Beispiel #1
0
static int pn544_remove(struct i2c_client *client)
{
	printk("pn544_remove start\n");
	pmu_disable();
	pn544_dev = i2c_get_clientdata(client);
	pn544_disable_irq(pn544_dev);
	free_irq(client->irq, pn544_dev);
	misc_deregister(&pn544_dev->pn544_device);
	mutex_destroy(&pn544_dev->read_mutex);
//	wake_lock_destroy(&pn544_dev->wl);//FIXED Screen off transcation proformance issue
	gpio_free(pn544_dev->irq_gpio);
	gpio_free(pn544_dev->ven_gpio);
	gpio_free(pn544_dev->firm_gpio);
	kfree(pn544_dev);
	pn544_dev = NULL;
	printk("pn544_remove end\n");

	return 0;
}
/* manage the clock gates via PMU */
static void clkdev_add_pmu(const char *dev, const char *con, bool deactivate,
			   unsigned int module, unsigned int bits)
{
	struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);

	clk->cl.dev_id = dev;
	clk->cl.con_id = con;
	clk->cl.clk = clk;
	clk->enable = pmu_enable;
	clk->disable = pmu_disable;
	clk->module = module;
	clk->bits = bits;
	if (deactivate) {
		/*
		 * Disable it during the initialization. Module should enable
		 * when used
		 */
		pmu_disable(clk);
	}
	clkdev_add(&clk->cl);
}
Beispiel #3
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;
}