]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] Orion: prepare for runtime-determined timer tick rate
authorLennert Buytenhek <buytenh@wantstofly.org>
Fri, 29 Aug 2008 03:55:51 +0000 (05:55 +0200)
committerNicolas Pitre <nico@cam.org>
Thu, 25 Sep 2008 20:26:44 +0000 (16:26 -0400)
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>
arch/arm/mach-orion5x/common.c
arch/arm/mach-orion5x/common.h
arch/arm/mach-orion5x/include/mach/timex.h
arch/arm/mach-orion5x/kurobox_pro-setup.c
arch/arm/mach-orion5x/tsx09-common.c

index 83367265bcf60af85b2ce63b1bc8defb252b6340..8a8b089b8b74334d5293594884997c50c3ab6eb1 100644 (file)
@@ -146,7 +146,6 @@ void __init orion5x_ehci1_init(void)
  ****************************************************************************/
 struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = {
        .dram           = &orion5x_mbus_dram_info,
-       .t_clk          = ORION5X_TCLK,
 };
 
 static struct resource orion5x_eth_shared_resources[] = {
@@ -282,7 +281,7 @@ static struct plat_serial8250_port orion5x_uart0_data[] = {
                .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
                .iotype         = UPIO_MEM,
                .regshift       = 2,
-               .uartclk        = ORION5X_TCLK,
+               .uartclk        = 0,
        }, {
        },
 };
@@ -326,7 +325,7 @@ static struct plat_serial8250_port orion5x_uart1_data[] = {
                .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
                .iotype         = UPIO_MEM,
                .regshift       = 2,
-               .uartclk        = ORION5X_TCLK,
+               .uartclk        = 0,
        }, {
        },
 };
@@ -459,9 +458,17 @@ void __init orion5x_xor_init(void)
 /*****************************************************************************
  * Time handling
  ****************************************************************************/
+int orion5x_tclk;
+
+int __init orion5x_find_tclk(void)
+{
+       return 166666667;
+}
+
 static void orion5x_timer_init(void)
 {
-       orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK);
+       orion5x_tclk = orion5x_find_tclk();
+       orion_time_init(IRQ_ORION5X_BRIDGE, orion5x_tclk);
 }
 
 struct sys_timer orion5x_timer = {
@@ -514,7 +521,11 @@ void __init orion5x_init(void)
        u32 dev, rev;
 
        orion5x_id(&dev, &rev, &dev_name);
-       printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, ORION5X_TCLK);
+       printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
+
+       orion5x_eth_shared_data.t_clk = orion5x_tclk;
+       orion5x_uart0_data[0].uartclk = orion5x_tclk;
+       orion5x_uart1_data[0].uartclk = orion5x_tclk;
 
        /*
         * Setup Orion address map
index e75bd7004b94c2011f01b9f132c6eef3940f28cc..c8598cc7cd588a44e9a079f6860c7ec0b052b424 100644 (file)
@@ -10,6 +10,7 @@ struct mv_sata_platform_data;
 void orion5x_map_io(void);
 void orion5x_init_irq(void);
 void orion5x_init(void);
+extern int orion5x_tclk;
 extern struct sys_timer orion5x_timer;
 
 /*
index e82e44db7629fa2d523ae72d1192b19b326f632f..4c69820e0810f228737229a869e42f5ddea10545 100644 (file)
@@ -9,5 +9,3 @@
  */
 
 #define CLOCK_TICK_RATE                (100 * HZ)
-
-#define ORION5X_TCLK           166666667
index cb72f1bb9cb772a2b18692b255ed2e467d4fc0a7..171ffaf98ddfe8111d16fca7e089d05660b0dc94 100644 (file)
@@ -291,7 +291,7 @@ static void kurobox_pro_power_off(void)
        const unsigned char shutdownwait[]      = {0x00, 0x0c};
        const unsigned char poweroff[]          = {0x00, 0x06};
        /* 38400 baud divisor */
-       const unsigned divisor = ((ORION5X_TCLK + (8 * 38400)) / (16 * 38400));
+       const unsigned divisor = ((orion5x_tclk + (8 * 38400)) / (16 * 38400));
 
        pr_info("%s: triggering power-off...\n", __func__);
 
index 83feac3147a60d257da59957e2b40d67d632c3dc..5128da1101bfe60a7805bcc28a5b02648636ca4d 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/timex.h>
 #include <linux/serial_reg.h>
 #include "tsx09-common.h"
+#include "common.h"
 
 /*****************************************************************************
  * QNAP TS-x09 specific power off method via UART1-attached PIC
@@ -26,7 +27,7 @@
 void qnap_tsx09_power_off(void)
 {
        /* 19200 baud divisor */
-       const unsigned divisor = ((ORION5X_TCLK + (8 * 19200)) / (16 * 19200));
+       const unsigned divisor = ((orion5x_tclk + (8 * 19200)) / (16 * 19200));
 
        pr_info("%s: triggering power-off...\n", __func__);