diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-08-28 23:55:51 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@cam.org> | 2008-09-25 16:26:44 -0400 |
commit | ebe35aff883496c07248df82c8576c3b6e84bbbe (patch) | |
tree | 89120d403604b79e894c0e5683c9fb335d2c3460 /arch/arm/mach-orion5x | |
parent | 1f8081f539a80c3d36a17ecd094d104eae60c01c (diff) |
[ARM] Orion: prepare for runtime-determined timer tick rate
Currently, orion5x uses a hardcoded timer tick rate of 166 MHz, but
the actual timer tick rate varies between different members of the SoC
family (and can vary based on strap pin settings).
This patch prepares for runtime determination of the timer tick rate.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r-- | arch/arm/mach-orion5x/common.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/include/mach/timex.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/kurobox_pro-setup.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/tsx09-common.c | 3 |
5 files changed, 20 insertions, 9 deletions
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 83367265bcf6..8a8b089b8b74 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -146,7 +146,6 @@ void __init orion5x_ehci1_init(void) | |||
146 | ****************************************************************************/ | 146 | ****************************************************************************/ |
147 | struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = { | 147 | struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = { |
148 | .dram = &orion5x_mbus_dram_info, | 148 | .dram = &orion5x_mbus_dram_info, |
149 | .t_clk = ORION5X_TCLK, | ||
150 | }; | 149 | }; |
151 | 150 | ||
152 | static struct resource orion5x_eth_shared_resources[] = { | 151 | static struct resource orion5x_eth_shared_resources[] = { |
@@ -282,7 +281,7 @@ static struct plat_serial8250_port orion5x_uart0_data[] = { | |||
282 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | 281 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, |
283 | .iotype = UPIO_MEM, | 282 | .iotype = UPIO_MEM, |
284 | .regshift = 2, | 283 | .regshift = 2, |
285 | .uartclk = ORION5X_TCLK, | 284 | .uartclk = 0, |
286 | }, { | 285 | }, { |
287 | }, | 286 | }, |
288 | }; | 287 | }; |
@@ -326,7 +325,7 @@ static struct plat_serial8250_port orion5x_uart1_data[] = { | |||
326 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | 325 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, |
327 | .iotype = UPIO_MEM, | 326 | .iotype = UPIO_MEM, |
328 | .regshift = 2, | 327 | .regshift = 2, |
329 | .uartclk = ORION5X_TCLK, | 328 | .uartclk = 0, |
330 | }, { | 329 | }, { |
331 | }, | 330 | }, |
332 | }; | 331 | }; |
@@ -459,9 +458,17 @@ void __init orion5x_xor_init(void) | |||
459 | /***************************************************************************** | 458 | /***************************************************************************** |
460 | * Time handling | 459 | * Time handling |
461 | ****************************************************************************/ | 460 | ****************************************************************************/ |
461 | int orion5x_tclk; | ||
462 | |||
463 | int __init orion5x_find_tclk(void) | ||
464 | { | ||
465 | return 166666667; | ||
466 | } | ||
467 | |||
462 | static void orion5x_timer_init(void) | 468 | static void orion5x_timer_init(void) |
463 | { | 469 | { |
464 | orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK); | 470 | orion5x_tclk = orion5x_find_tclk(); |
471 | orion_time_init(IRQ_ORION5X_BRIDGE, orion5x_tclk); | ||
465 | } | 472 | } |
466 | 473 | ||
467 | struct sys_timer orion5x_timer = { | 474 | struct sys_timer orion5x_timer = { |
@@ -514,7 +521,11 @@ void __init orion5x_init(void) | |||
514 | u32 dev, rev; | 521 | u32 dev, rev; |
515 | 522 | ||
516 | orion5x_id(&dev, &rev, &dev_name); | 523 | orion5x_id(&dev, &rev, &dev_name); |
517 | printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, ORION5X_TCLK); | 524 | printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk); |
525 | |||
526 | orion5x_eth_shared_data.t_clk = orion5x_tclk; | ||
527 | orion5x_uart0_data[0].uartclk = orion5x_tclk; | ||
528 | orion5x_uart1_data[0].uartclk = orion5x_tclk; | ||
518 | 529 | ||
519 | /* | 530 | /* |
520 | * Setup Orion address map | 531 | * Setup Orion address map |
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index e75bd7004b94..c8598cc7cd58 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h | |||
@@ -10,6 +10,7 @@ struct mv_sata_platform_data; | |||
10 | void orion5x_map_io(void); | 10 | void orion5x_map_io(void); |
11 | void orion5x_init_irq(void); | 11 | void orion5x_init_irq(void); |
12 | void orion5x_init(void); | 12 | void orion5x_init(void); |
13 | extern int orion5x_tclk; | ||
13 | extern struct sys_timer orion5x_timer; | 14 | extern struct sys_timer orion5x_timer; |
14 | 15 | ||
15 | /* | 16 | /* |
diff --git a/arch/arm/mach-orion5x/include/mach/timex.h b/arch/arm/mach-orion5x/include/mach/timex.h index e82e44db7629..4c69820e0810 100644 --- a/arch/arm/mach-orion5x/include/mach/timex.h +++ b/arch/arm/mach-orion5x/include/mach/timex.h | |||
@@ -9,5 +9,3 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define CLOCK_TICK_RATE (100 * HZ) | 11 | #define CLOCK_TICK_RATE (100 * HZ) |
12 | |||
13 | #define ORION5X_TCLK 166666667 | ||
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c index cb72f1bb9cb7..171ffaf98ddf 100644 --- a/arch/arm/mach-orion5x/kurobox_pro-setup.c +++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c | |||
@@ -291,7 +291,7 @@ static void kurobox_pro_power_off(void) | |||
291 | const unsigned char shutdownwait[] = {0x00, 0x0c}; | 291 | const unsigned char shutdownwait[] = {0x00, 0x0c}; |
292 | const unsigned char poweroff[] = {0x00, 0x06}; | 292 | const unsigned char poweroff[] = {0x00, 0x06}; |
293 | /* 38400 baud divisor */ | 293 | /* 38400 baud divisor */ |
294 | const unsigned divisor = ((ORION5X_TCLK + (8 * 38400)) / (16 * 38400)); | 294 | const unsigned divisor = ((orion5x_tclk + (8 * 38400)) / (16 * 38400)); |
295 | 295 | ||
296 | pr_info("%s: triggering power-off...\n", __func__); | 296 | pr_info("%s: triggering power-off...\n", __func__); |
297 | 297 | ||
diff --git a/arch/arm/mach-orion5x/tsx09-common.c b/arch/arm/mach-orion5x/tsx09-common.c index 83feac3147a6..5128da1101bf 100644 --- a/arch/arm/mach-orion5x/tsx09-common.c +++ b/arch/arm/mach-orion5x/tsx09-common.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/timex.h> | 16 | #include <linux/timex.h> |
17 | #include <linux/serial_reg.h> | 17 | #include <linux/serial_reg.h> |
18 | #include "tsx09-common.h" | 18 | #include "tsx09-common.h" |
19 | #include "common.h" | ||
19 | 20 | ||
20 | /***************************************************************************** | 21 | /***************************************************************************** |
21 | * QNAP TS-x09 specific power off method via UART1-attached PIC | 22 | * QNAP TS-x09 specific power off method via UART1-attached PIC |
@@ -26,7 +27,7 @@ | |||
26 | void qnap_tsx09_power_off(void) | 27 | void qnap_tsx09_power_off(void) |
27 | { | 28 | { |
28 | /* 19200 baud divisor */ | 29 | /* 19200 baud divisor */ |
29 | const unsigned divisor = ((ORION5X_TCLK + (8 * 19200)) / (16 * 19200)); | 30 | const unsigned divisor = ((orion5x_tclk + (8 * 19200)) / (16 * 19200)); |
30 | 31 | ||
31 | pr_info("%s: triggering power-off...\n", __func__); | 32 | pr_info("%s: triggering power-off...\n", __func__); |
32 | 33 | ||