From 69717607f028d7d4f4b355afb86556f3dd9363fc Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 6 Aug 2010 14:13:13 +0200 Subject: microblaze: Report if only one timer is used Kernel needs two timers because of clocksource and clockevent. It is better to show warning message directly on early console if available. If it isn't available kernel log buffer contains it. Signed-off-by: Michal Simek --- arch/microblaze/kernel/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/microblaze/kernel/timer.c') diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index b1380ae93ae1..ec7df67006ba 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -278,7 +278,7 @@ void __init time_init(void) 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"); + eprintk(KERN_EMERG "Please enable two timers in HW\n"); BUG(); } -- cgit v1.2.1 From 92ee8bd468b43938319d6ff51afb071b6e9ef758 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 13 Sep 2010 21:23:49 -0700 Subject: microblaze: Use static const char * const where possible Signed-off-by: Joe Perches Signed-off-by: Michal Simek --- arch/microblaze/kernel/timer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'arch/microblaze/kernel/timer.c') diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index ec7df67006ba..da9d1e56108b 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -258,12 +258,12 @@ void __init time_init(void) 0 }; #endif - char *timer_list[] = { - "xlnx,xps-timer-1.00.a", - "xlnx,opb-timer-1.00.b", - "xlnx,opb-timer-1.00.a", - NULL - }; + const char * const 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]); -- cgit v1.2.1 From e65f1e2843d31d9ed74c7cce273adc0d97b5140f Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 14 Sep 2010 08:09:37 +0200 Subject: microblaze: Remove additional compatible properties Device-tree BSP generates longer compatible properties that's why we can remove extra/old one. Signed-off-by: Michal Simek --- arch/microblaze/kernel/timer.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/microblaze/kernel/timer.c') diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index da9d1e56108b..64ca14dbac6e 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -260,8 +260,6 @@ void __init time_init(void) #endif const char * const timer_list[] = { "xlnx,xps-timer-1.00.a", - "xlnx,opb-timer-1.00.b", - "xlnx,opb-timer-1.00.a", NULL }; -- cgit v1.2.1 From 02b08045a0306c38131c6d7155c4034a775d40b1 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 28 Sep 2010 16:04:14 +1000 Subject: microblaze: Add support for little-endian Microblaze Microblaze little-endian toolchain exports __MICROBLAZEEL__ which is used in the kernel to identify little/big endian. The most of the changes are in loading values from DTB which is always big endian. Little endian platforms are based on new AXI bus which has impact to early uartlite initialization. Signed-off-by: Michal Simek --- arch/microblaze/kernel/timer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/microblaze/kernel/timer.c') diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index 64ca14dbac6e..fcb97e86003d 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -270,11 +270,11 @@ void __init time_init(void) } BUG_ON(!timer); - timer_baseaddr = *(int *) of_get_property(timer, "reg", NULL); + timer_baseaddr = be32_to_cpup(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); + irq = be32_to_cpup(of_get_property(timer, "interrupts", NULL)); + timer_num = be32_to_cpup(of_get_property(timer, + "xlnx,one-timer-only", NULL)); if (timer_num) { eprintk(KERN_EMERG "Please enable two timers in HW\n"); BUG(); -- cgit v1.2.1 From ccea0e6e49e4db8ee7968c183ecddb3e399c5f54 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 7 Oct 2010 17:39:21 +1000 Subject: microblaze: Support timer on AXI lite New microblaze systems uses two buses. One for memories and flashes and the second for low-speed peripherals which can run on different CLK. This is the reason why the kernel is trying to read clock-frequency directly from node. If there is then the kernel will work with it. If not then cpu CLK is used. Signed-off-by: Michal Simek --- arch/microblaze/kernel/timer.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'arch/microblaze/kernel/timer.c') diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index fcb97e86003d..a5aa33db1df3 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c @@ -38,6 +38,9 @@ static unsigned int timer_baseaddr; #define TIMER_BASE timer_baseaddr #endif +unsigned int freq_div_hz; +unsigned int timer_clock_freq; + #define TCSR0 (0x00) #define TLR0 (0x04) #define TCR0 (0x08) @@ -115,7 +118,7 @@ static void microblaze_timer_set_mode(enum clock_event_mode mode, switch (mode) { case CLOCK_EVT_MODE_PERIODIC: printk(KERN_INFO "%s: periodic\n", __func__); - microblaze_timer0_start_periodic(cpuinfo.freq_div_hz); + microblaze_timer0_start_periodic(freq_div_hz); break; case CLOCK_EVT_MODE_ONESHOT: printk(KERN_INFO "%s: oneshot\n", __func__); @@ -168,7 +171,7 @@ static struct irqaction timer_irqaction = { static __init void microblaze_clockevent_init(void) { clockevent_microblaze_timer.mult = - div_sc(cpuinfo.cpu_clock_freq, NSEC_PER_SEC, + div_sc(timer_clock_freq, NSEC_PER_SEC, clockevent_microblaze_timer.shift); clockevent_microblaze_timer.max_delta_ns = clockevent_delta2ns((u32)~0, &clockevent_microblaze_timer); @@ -201,7 +204,7 @@ static struct cyclecounter microblaze_cc = { int __init init_microblaze_timecounter(void) { - microblaze_cc.mult = div_sc(cpuinfo.cpu_clock_freq, NSEC_PER_SEC, + microblaze_cc.mult = div_sc(timer_clock_freq, NSEC_PER_SEC, microblaze_cc.shift); timecounter_init(µblaze_tc, µblaze_cc, sched_clock()); @@ -221,7 +224,7 @@ static struct clocksource clocksource_microblaze = { static int __init microblaze_clocksource_init(void) { clocksource_microblaze.mult = - clocksource_hz2mult(cpuinfo.cpu_clock_freq, + clocksource_hz2mult(timer_clock_freq, clocksource_microblaze.shift); if (clocksource_register(&clocksource_microblaze)) panic("failed to register clocksource"); @@ -247,6 +250,7 @@ void __init time_init(void) u32 irq, i = 0; u32 timer_num = 1; struct device_node *timer = NULL; + const void *prop; #ifdef CONFIG_SELFMOD_TIMER unsigned int timer_baseaddr = 0; int arr_func[] = { @@ -286,7 +290,14 @@ void __init time_init(void) 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; + /* If there is clock-frequency property than use it */ + prop = of_get_property(timer, "clock-frequency", NULL); + if (prop) + timer_clock_freq = be32_to_cpup(prop); + else + timer_clock_freq = cpuinfo.cpu_clock_freq; + + freq_div_hz = timer_clock_freq / HZ; setup_irq(irq, &timer_irqaction); #ifdef CONFIG_HEART_BEAT -- cgit v1.2.1