void cpu_profiler_reset(void) { pmu_enable(); pmu_user_enable(); pmn_reset(); ccnt_reset(); ccnt_divider(0); }
/* the pci enable helper */ static int pci_enable(struct clk *clk) { unsigned int val = ltq_cgu_r32(ifccr); /* set bus clock speed */ if (of_machine_is_compatible("lantiq,ar9")) { val &= ~0x1f00000; if (clk->rate == CLOCK_33M) val |= 0xe00000; else val |= 0x700000; /* 62.5M */ } else { val &= ~0xf00000; if (clk->rate == CLOCK_33M) val |= 0x800000; else val |= 0x400000; /* 62.5M */ } ltq_cgu_w32(val, ifccr); pmu_enable(clk); return 0; }
/* the pci enable helper */ static int pci_enable(struct clk *clk) { unsigned int ifccr = ltq_cgu_r32(CGU_IFCCR); /* set bus clock speed */ if (of_machine_is_compatible("lantiq,ar9")) { ifccr &= ~0x1f00000; if (clk->rate == CLOCK_33M) ifccr |= 0xe00000; else ifccr |= 0x700000; /* 62.5M */ } else { ifccr &= ~0xf00000; if (clk->rate == CLOCK_33M) ifccr |= 0x800000; else ifccr |= 0x400000; /* 62.5M */ } ltq_cgu_w32(ifccr, CGU_IFCCR); pmu_enable(clk); return 0; }
int main(void) { struct task *next; /* Set the CPU speed */ uint32_t skuid = read32(DEVICEID_BASE + DEVICEID_SKUID_OFFSET); uint32_t cpuspeed_id = skuid & DEVICEID_SKUID_CPUSPEED_MASK; uint32_t clksel_val = (1<<19) | 12; if(cpuspeed_id == DEVICEID_SKUID_CPUSPEED_720) clksel_val |= (720 << 8); else if(cpuspeed_id == DEVICEID_SKUID_CPUSPEED_600) clksel_val |= (600 << 8); else panic("Unsupported CPU!"); write32(CM_MPU_BASE + PRM_CLKSEL1_PLL_MPU_OFFSET, clksel_val); /* Basic hardware initialization */ init_cpumodes(); // set up CPU modes for interrupt handling intc_init(); // initialize interrupt controller gpio_init(); // initialize gpio interrupt system /* Start up hardware */ timers_init(); // must come first, since it initializes the watchdog eth_init(); uart_init(); /* For some reason, turning on the caches causes the kernel to hang after finishing the third invocation. Maybe we have to clear the caches here, or enable the MMU. */ printk("mmu init\n"); prep_pagetable(); init_mmu(); printk("cache init\n"); init_cache(); /* Initialize other interrupts */ init_interrupts(); /* Initialize task queues */ init_tasks(); /* Initialize idle task */ syscall_spawn(NULL, 7, idle_task, NULL, 0, SPAWN_DAEMON); pmu_enable(); trace_init(); printk("userspace init\n"); /* Initialize first user program */ syscall_spawn(NULL, 6, init_task, NULL, 0, 0); while (nondaemon_count > 0) { next = schedule(); task_activate(next); check_stack(next); } pmu_disable(); intc_reset(); eth_deinit(); deinit_mmu(); return 0; }
static int pn544_probe(struct i2c_client *client, const struct i2c_device_id *id) { int ret; struct device_node *of_node = NULL; static struct clk *bb_clk2; /*added bb_clk2 for nfc , start */ printk("pn544_probe(): start\n"); if (pn544_dev != NULL) { printk("pn544_probe: multiple devices NOT supported\n"); ret = -ENODEV; goto err_single_device; } if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { pr_err("%s : need I2C_FUNC_I2C\n", __func__); return -ENODEV; } pn544_dev = kzalloc(sizeof(*pn544_dev), GFP_KERNEL); if (pn544_dev == NULL) { dev_err(&client->dev, "failed to allocate memory for module data\n"); ret = -ENOMEM; goto err_exit; } pn544_dev->client = client; if (client->dev.of_node) { of_node = client->dev.of_node; ret = of_get_named_gpio(of_node, "nfc,irq_gpio", 0); if (ret>0) { pn544_dev->irq_gpio=ret; } else{ printk("pn544_probe: of_property_read(irq_gpio) fail:%d\n",ret); goto err_device_create_failed; } ret = of_get_named_gpio(of_node, "nfc,firm_gpio", 0); if (ret>0) { pn544_dev->firm_gpio=ret; } else{ printk("pn544_probe: of_property_read(firm_gpio) fail:%d\n",ret); goto err_device_create_failed; } ret = of_get_named_gpio(of_node, "nfc,ven_gpio", 0); //8974 mpp7 if (ret>0) { pn544_dev->ven_gpio=ret; } else{ printk("pn544_probe: of_property_read(ven_gpio) fail:%d\n",ret); goto err_device_create_failed; } pmu_enable(); /* init mutex and queues */ init_waitqueue_head(&pn544_dev->read_wq); mutex_init(&pn544_dev->read_mutex); spin_lock_init(&pn544_dev->irq_enabled_lock); /*Initialise wake lock*/ // wake_lock_init(&pn544_dev->wl,WAKE_LOCK_SUSPEND,"nfc_locker");//FIXED Screen off transcation proformance issue pn544_dev->pn544_device.minor = MISC_DYNAMIC_MINOR; pn544_dev->pn544_device.name = "pn544"; pn544_dev->pn544_device.fops = &pn544_dev_fops; ret = misc_register(&pn544_dev->pn544_device); if (ret) { pr_err("%s : misc_register failed\n", __FILE__); goto err_misc_register; } /* request irq. the irq is set whenever the chip has data available * for reading. it is cleared when all data has been read. */ ret =nxp_pn544_reset(); printk("pn544 reset\n"); if (ret < 0) { printk( "can't reset device\n"); goto err_device_create_file_failed; } bb_clk2 = clk_get(&client->dev, "ref_clk"); if (IS_ERR(bb_clk2)) { printk(KERN_ERR "%s: Error getting bb_clk2\n", __func__); bb_clk2 = NULL; //return -ENOENT; } else{ printk("%s: start prepare bb_clk2\n", __func__); ret = clk_prepare_enable(bb_clk2); if(ret){ printk(KERN_ERR "%s: prepare bb_clk2 failed ret:%d\n", __func__, ret); } } pr_info("%s : requesting IRQ %d\n", __func__, client->irq); pn544_dev->irq_enabled = true; ret = request_irq(client->irq, pn544_dev_irq_handler, IRQF_TRIGGER_HIGH, client->name, pn544_dev); if (ret) { printk("request_irq failed\n"); goto err_request_irq_failed; } pn544_disable_irq(pn544_dev); i2c_set_clientdata(client, pn544_dev); printk("nfc probe is ok\n"); return 0; } err_request_irq_failed: misc_deregister(&pn544_dev->pn544_device); err_misc_register: mutex_destroy(&pn544_dev->read_mutex); kfree(pn544_dev); err_device_create_failed: kfree(pn544_dev); pn544_dev = NULL; err_device_create_file_failed: //device_destroy(pn544_dev_class, MKDEV(pn544_major, pn544_minor)); err_exit: //gpio_free(platform_data->firm_gpio); err_single_device: return ret; }