static void setup(void) { rcc_clock_setup_hse_3v3(&MY_CLOCK); setup_systick(MY_CLOCK.ahb_frequency); setup_heartbeat(); my_ILI.begin(); }
void __init time_init(void) { u32 irq, i = 0; u32 timer_num = 1; struct device_node *timer = NULL; #ifdef CONFIG_SELFMOD_TIMER unsigned int timer_baseaddr = 0; int arr_func[] = { (int)µblaze_read, (int)&timer_interrupt, (int)µblaze_clocksource_init, (int)µblaze_timer_set_mode, (int)µblaze_timer_set_next_event, 0 }; #endif char *timer_list[] = { "xlnx,xps-timer-1.00.a", "xlnx,opb-timer-1.00.b", "xlnx,opb-timer-1.00.a", NULL }; for (i = 0; timer_list[i] != NULL; i++) { timer = of_find_compatible_node(NULL, NULL, timer_list[i]); if (timer) break; } BUG_ON(!timer); timer_baseaddr = *(int *) of_get_property(timer, "reg", NULL); timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE); irq = *(int *) of_get_property(timer, "interrupts", NULL); timer_num = *(int *) of_get_property(timer, "xlnx,one-timer-only", NULL); if (timer_num) { printk(KERN_EMERG "Please enable two timers in HW\n"); BUG(); } #ifdef CONFIG_SELFMOD_TIMER selfmod_function((int *) arr_func, timer_baseaddr); #endif printk(KERN_INFO "%s #0 at 0x%08x, irq=%d\n", timer_list[i], timer_baseaddr, irq); cpuinfo.freq_div_hz = cpuinfo.cpu_clock_freq / HZ; setup_irq(irq, &timer_irqaction); #ifdef CONFIG_HEART_BEAT setup_heartbeat(); #endif microblaze_clocksource_init(); microblaze_clockevent_init(); }
static void __init xilinx_timer_init(struct device_node *timer) { u32 irq; u32 timer_num = 1; int ret; timer_baseaddr = of_iomap(timer, 0); if (!timer_baseaddr) { pr_err("ERROR: invalid timer base address\n"); BUG(); } irq = irq_of_parse_and_map(timer, 0); of_property_read_u32(timer, "xlnx,one-timer-only", &timer_num); if (timer_num) { pr_emerg("Please enable two timers in HW\n"); BUG(); } pr_info("%s: irq=%d\n", timer->full_name, irq); /* If there is clock-frequency property than use it */ ret = of_property_read_u32(timer, "clock-frequency", &timer_clock_freq); if (ret < 0) timer_clock_freq = cpuinfo.cpu_clock_freq; freq_div_hz = timer_clock_freq / HZ; setup_irq(irq, &timer_irqaction); #ifdef CONFIG_HEART_BEAT setup_heartbeat(); #endif xilinx_clocksource_init(); xilinx_clockevent_init(); timer_initialized = 1; }