ARM: Remove dependency of plat-orion time code on mach directory includes.
authorLennert Buytenhek <buytenh@wantstofly.org>
Fri, 15 Oct 2010 14:50:26 +0000 (16:50 +0200)
committerNicolas Pitre <nico@fluxnic.net>
Thu, 3 Mar 2011 21:27:01 +0000 (16:27 -0500)
This patch makes the various mach dirs that use the plat-orion time
code pass in timer and bridge addresses explicitly, instead of having
plat-orion get those values by including a mach dir include file --
the latter mechanism is problematic if you want to support multiple
ARM platforms in the same kernel image.

Signed-off-by: Lennert Buytenhek <buytenh@secretlab.ca>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
58 files changed:
arch/arm/mach-dove/cm-a510.c
arch/arm/mach-dove/common.c
arch/arm/mach-dove/common.h
arch/arm/mach-dove/dove-db-setup.c
arch/arm/mach-dove/include/mach/bridge-regs.h
arch/arm/mach-kirkwood/common.c
arch/arm/mach-kirkwood/common.h
arch/arm/mach-kirkwood/d2net_v2-setup.c
arch/arm/mach-kirkwood/db88f6281-bp-setup.c
arch/arm/mach-kirkwood/dockstar-setup.c
arch/arm/mach-kirkwood/guruplug-setup.c
arch/arm/mach-kirkwood/include/mach/bridge-regs.h
arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c
arch/arm/mach-kirkwood/netspace_v2-setup.c
arch/arm/mach-kirkwood/netxbig_v2-setup.c
arch/arm/mach-kirkwood/openrd-setup.c
arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
arch/arm/mach-kirkwood/rd88f6281-setup.c
arch/arm/mach-kirkwood/sheevaplug-setup.c
arch/arm/mach-kirkwood/t5325-setup.c
arch/arm/mach-kirkwood/ts219-setup.c
arch/arm/mach-kirkwood/ts41x-setup.c
arch/arm/mach-loki/common.c
arch/arm/mach-loki/common.h
arch/arm/mach-loki/include/mach/bridge-regs.h
arch/arm/mach-loki/lb88rc8480-setup.c
arch/arm/mach-mv78xx0/buffalo-wxl-setup.c
arch/arm/mach-mv78xx0/common.c
arch/arm/mach-mv78xx0/common.h
arch/arm/mach-mv78xx0/db78x00-bp-setup.c
arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c
arch/arm/mach-orion5x/common.c
arch/arm/mach-orion5x/common.h
arch/arm/mach-orion5x/d2net-setup.c
arch/arm/mach-orion5x/db88f5281-setup.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/edmini_v2-setup.c
arch/arm/mach-orion5x/include/mach/bridge-regs.h
arch/arm/mach-orion5x/kurobox_pro-setup.c
arch/arm/mach-orion5x/ls-chl-setup.c
arch/arm/mach-orion5x/ls_hgl-setup.c
arch/arm/mach-orion5x/lsmini-setup.c
arch/arm/mach-orion5x/mss2-setup.c
arch/arm/mach-orion5x/mv2120-setup.c
arch/arm/mach-orion5x/net2big-setup.c
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
arch/arm/mach-orion5x/rd88f5182-setup.c
arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
arch/arm/mach-orion5x/terastation_pro2-setup.c
arch/arm/mach-orion5x/ts209-setup.c
arch/arm/mach-orion5x/ts409-setup.c
arch/arm/mach-orion5x/ts78xx-setup.c
arch/arm/mach-orion5x/wnr854t-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/plat-orion/include/plat/time.h
arch/arm/plat-orion/time.c

index 96e0e94..03e11f9 100644 (file)
@@ -90,6 +90,7 @@ MACHINE_START(CM_A510, "Compulab CM-A510 Board")
        .boot_params    = 0x00000100,
        .init_machine   = cm_a510_init,
        .map_io         = dove_map_io,
+       .init_early     = dove_init_early,
        .init_irq       = dove_init_irq,
        .timer          = &dove_timer,
 MACHINE_END
index fe627ab..e06a88f 100644 (file)
@@ -532,6 +532,11 @@ void __init dove_i2c_init(void)
 /*****************************************************************************
  * Time handling
  ****************************************************************************/
+void __init dove_init_early(void)
+{
+       orion_time_set_base(TIMER_VIRT_BASE);
+}
+
 static int get_tclk(void)
 {
        /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
@@ -540,7 +545,8 @@ static int get_tclk(void)
 
 static void dove_timer_init(void)
 {
-       orion_time_init(IRQ_DOVE_BRIDGE, get_tclk());
+       orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
+                       IRQ_DOVE_BRIDGE, get_tclk());
 }
 
 struct sys_timer dove_timer = {
index a51517c..6a2046e 100644 (file)
@@ -22,6 +22,7 @@ extern struct mbus_dram_target_info dove_mbus_dram_info;
  */
 void dove_map_io(void);
 void dove_init(void);
+void dove_init_early(void);
 void dove_init_irq(void);
 void dove_setup_cpu_mbus(void);
 void dove_ge00_init(struct mv643xx_eth_platform_data *eth_data);
index 95925aa..2ac34ec 100644 (file)
@@ -97,6 +97,7 @@ MACHINE_START(DOVE_DB, "Marvell DB-MV88AP510-BP Development Board")
        .boot_params    = 0x00000100,
        .init_machine   = dove_db_init,
        .map_io         = dove_map_io,
+       .init_early     = dove_init_early,
        .init_irq       = dove_init_irq,
        .timer          = &dove_timer,
 MACHINE_END
index 214a4c3..226949d 100644 (file)
 #define SYSTEM_SOFT_RESET      (BRIDGE_VIRT_BASE | 0x010c)
 #define  SOFT_RESET            0x00000001
 
-#define BRIDGE_CAUSE           (BRIDGE_VIRT_BASE | 0x0110)
-#define BRIDGE_MASK            (BRIDGE_VIRT_BASE | 0x0114)
-#define  BRIDGE_INT_TIMER0     0x0002
-#define  BRIDGE_INT_TIMER1     0x0004
 #define  BRIDGE_INT_TIMER1_CLR (~0x0004)
 
 #define IRQ_VIRT_BASE          (BRIDGE_VIRT_BASE | 0x0200)
index 7ec14db..20e71df 100644 (file)
@@ -847,6 +847,11 @@ static void __init kirkwood_wdt_init(void)
 /*****************************************************************************
  * Time handling
  ****************************************************************************/
+void __init kirkwood_init_early(void)
+{
+       orion_time_set_base(TIMER_VIRT_BASE);
+}
+
 int kirkwood_tclk;
 
 static int __init kirkwood_find_tclk(void)
@@ -865,7 +870,9 @@ static int __init kirkwood_find_tclk(void)
 static void __init kirkwood_timer_init(void)
 {
        kirkwood_tclk = kirkwood_find_tclk();
-       orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
+
+       orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
+                       IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
 }
 
 struct sys_timer kirkwood_timer = {
index a35b862..b9b0f09 100644 (file)
@@ -27,6 +27,7 @@ struct kirkwood_asoc_platform_data;
  */
 void kirkwood_map_io(void);
 void kirkwood_init(void);
+void kirkwood_init_early(void);
 void kirkwood_init_irq(void);
 
 extern struct mbus_dram_target_info kirkwood_mbus_dram_info;
index a31c949..043cfd5 100644 (file)
@@ -224,6 +224,7 @@ MACHINE_START(D2NET_V2, "LaCie d2 Network v2")
        .boot_params    = 0x00000100,
        .init_machine   = d2net_v2_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 9ea7118..bff04e0 100644 (file)
@@ -100,6 +100,7 @@ MACHINE_START(DB88F6281_BP, "Marvell DB-88F6281-BP Development Board")
        .boot_params    = 0x00000100,
        .init_machine   = db88f6281_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 433ea36..f14dfb8 100644 (file)
@@ -105,6 +105,7 @@ MACHINE_START(DOCKSTAR, "Seagate FreeAgent DockStar")
        .boot_params    = 0x00000100,
        .init_machine   = dockstar_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 8f47dc0..41d1b40 100644 (file)
@@ -124,6 +124,7 @@ MACHINE_START(GURUPLUG, "Marvell GuruPlug Reference Board")
        .boot_params    = 0x00000100,
        .init_machine   = guruplug_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index aff0e13..957bd79 100644 (file)
@@ -29,9 +29,6 @@
 #define BRIDGE_CAUSE           (BRIDGE_VIRT_BASE | 0x0110)
 #define WDT_INT_REQ            0x0008
 
-#define BRIDGE_MASK            (BRIDGE_VIRT_BASE | 0x0114)
-#define BRIDGE_INT_TIMER0      0x0002
-#define BRIDGE_INT_TIMER1      0x0004
 #define BRIDGE_INT_TIMER1_CLR  (~0x0004)
 
 #define IRQ_VIRT_BASE          (BRIDGE_VIRT_BASE | 0x0200)
index 1e5266f..00cca22 100644 (file)
@@ -166,6 +166,7 @@ MACHINE_START(MV88F6281GTW_GE, "Marvell 88F6281 GTW GE Board")
        .boot_params    = 0x00000100,
        .init_machine   = mv88f6281gtw_ge_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 65ee21f..7cdab57 100644 (file)
@@ -261,6 +261,7 @@ MACHINE_START(NETSPACE_V2, "LaCie Network Space v2")
        .boot_params    = 0x00000100,
        .init_machine   = netspace_v2_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
@@ -271,6 +272,7 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2")
        .boot_params    = 0x00000100,
        .init_machine   = netspace_v2_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
@@ -281,6 +283,7 @@ MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2")
        .boot_params    = 0x00000100,
        .init_machine   = netspace_v2_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 93afd3c..6be627d 100644 (file)
@@ -402,6 +402,7 @@ MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2")
        .boot_params    = 0x00000100,
        .init_machine   = netxbig_v2_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
@@ -412,6 +413,7 @@ MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2")
        .boot_params    = 0x00000100,
        .init_machine   = netxbig_v2_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index cfcca41..f69beef 100644 (file)
@@ -217,6 +217,7 @@ MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board")
        .boot_params    = 0x00000100,
        .init_machine   = openrd_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
@@ -228,6 +229,7 @@ MACHINE_START(OPENRD_CLIENT, "Marvell OpenRD Client Board")
        .boot_params    = 0x00000100,
        .init_machine   = openrd_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
@@ -239,6 +241,7 @@ MACHINE_START(OPENRD_ULTIMATE, "Marvell OpenRD Ultimate Board")
        .boot_params    = 0x00000100,
        .init_machine   = openrd_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 0049614..75c6601 100644 (file)
@@ -82,6 +82,7 @@ MACHINE_START(RD88F6192_NAS, "Marvell RD-88F6192-NAS Development Board")
        .boot_params    = 0x00000100,
        .init_machine   = rd88f6192_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 0998a08..0f75494 100644 (file)
@@ -118,6 +118,7 @@ MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
        .boot_params    = 0x00000100,
        .init_machine   = rd88f6281_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index d2eec35..0a95063 100644 (file)
@@ -134,6 +134,7 @@ MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
        .boot_params    = 0x00000100,
        .init_machine   = sheevaplug_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
@@ -144,6 +145,7 @@ MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
        .boot_params    = 0x00000100,
        .init_machine   = sheevaplug_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index f38c282..e6b9b1b 100644 (file)
@@ -204,6 +204,7 @@ MACHINE_START(T5325, "HP t5325 Thin Client")
        .boot_params    = 0x00000100,
        .init_machine   = hp_t5325_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index dc999c4..68f32f2 100644 (file)
@@ -135,6 +135,7 @@ MACHINE_START(TS219, "QNAP TS-119/TS-219")
        .boot_params    = 0x00000100,
        .init_machine   = qnap_ts219_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 0f84e0a..d5d0099 100644 (file)
@@ -179,6 +179,7 @@ MACHINE_START(TS41X, "QNAP TS-41x")
        .boot_params    = 0x00000100,
        .init_machine   = qnap_ts41x_init,
        .map_io         = kirkwood_map_io,
+       .init_early     = kirkwood_init_early,
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
index 818f19d..e41e909 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/timex.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
+#include <mach/bridge-regs.h>
 #include <mach/loki.h>
 #include <plat/orion_nand.h>
 #include <plat/time.h>
@@ -290,9 +291,15 @@ void __init loki_uart1_init(void)
 /*****************************************************************************
  * Time handling
  ****************************************************************************/
+void __init loki_init_early(void)
+{
+       orion_time_set_base(TIMER_VIRT_BASE);
+}
+
 static void loki_timer_init(void)
 {
-       orion_time_init(IRQ_LOKI_BRIDGE, LOKI_TCLK);
+       orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
+                       IRQ_LOKI_BRIDGE, LOKI_TCLK);
 }
 
 struct sys_timer loki_timer = {
index 26054fd..a315dcf 100644 (file)
@@ -18,6 +18,7 @@ struct mv643xx_eth_platform_data;
  */
 void loki_map_io(void);
 void loki_init(void);
+void loki_init_early(void);
 void loki_init_irq(void);
 
 extern struct mbus_dram_target_info loki_mbus_dram_info;
index a3fabf7..fd87732 100644 (file)
 #define SYSTEM_SOFT_RESET      (BRIDGE_VIRT_BASE | 0x010c)
 #define SOFT_RESET             0x00000001
 
-#define BRIDGE_CAUSE           (BRIDGE_VIRT_BASE | 0x0110)
-
-#define BRIDGE_MASK            (BRIDGE_VIRT_BASE | 0x0114)
-#define BRIDGE_INT_TIMER0      0x0002
-#define BRIDGE_INT_TIMER1      0x0004
 #define BRIDGE_INT_TIMER1_CLR  0x0004
 
 #define IRQ_VIRT_BASE          (BRIDGE_VIRT_BASE | 0x0200)
index a1e75e7..35eae4e 100644 (file)
@@ -93,6 +93,7 @@ MACHINE_START(LB88RC8480, "Marvell LB88RC8480 Development Board")
        .boot_params    = 0x00000100,
        .init_machine   = lb88rc8480_init,
        .map_io         = loki_map_io,
+       .init_early     = loki_init_early,
        .init_irq       = loki_init_irq,
        .timer          = &loki_timer,
 MACHINE_END
index 29e390e..20f3f12 100644 (file)
@@ -148,6 +148,7 @@ MACHINE_START(TERASTATION_WXL, "Buffalo Nas WXL")
        .boot_params    = 0x00000100,
        .init_machine   = wxl_init,
        .map_io         = mv78xx0_map_io,
+       .init_early     = mv78xx0_init_early,
        .init_irq       = mv78xx0_init_irq,
        .timer          = &mv78xx0_timer,
 MACHINE_END
index 08465eb..44fb4e5 100644 (file)
@@ -818,9 +818,15 @@ void __init mv78xx0_uart3_init(void)
 /*****************************************************************************
  * Time handling
  ****************************************************************************/
+void __init mv78xx0_init_early(void)
+{
+       orion_time_set_base(TIMER_VIRT_BASE);
+}
+
 static void mv78xx0_timer_init(void)
 {
-       orion_time_init(IRQ_MV78XX0_TIMER_1, get_tclk());
+       orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
+                       IRQ_MV78XX0_TIMER_1, get_tclk());
 }
 
 struct sys_timer mv78xx0_timer = {
index befc224..632e63d 100644 (file)
@@ -20,6 +20,7 @@ struct mv_sata_platform_data;
 int mv78xx0_core_index(void);
 void mv78xx0_map_io(void);
 void mv78xx0_init(void);
+void mv78xx0_init_early(void);
 void mv78xx0_init_irq(void);
 
 extern struct mbus_dram_target_info mv78xx0_mbus_dram_info;
index 207c95e..df5aebe 100644 (file)
@@ -96,6 +96,7 @@ MACHINE_START(DB78X00_BP, "Marvell DB-78x00-BP Development Board")
        .boot_params    = 0x00000100,
        .init_machine   = db78x00_init,
        .map_io         = mv78xx0_map_io,
+       .init_early     = mv78xx0_init_early,
        .init_irq       = mv78xx0_init_irq,
        .timer          = &mv78xx0_timer,
 MACHINE_END
index 2d14c4f..c64dbb9 100644 (file)
 #define SYSTEM_SOFT_RESET      (BRIDGE_VIRT_BASE | 0x010c)
 #define SOFT_RESET             0x00000001
 
-#define BRIDGE_CAUSE           (BRIDGE_VIRT_BASE | 0x0110)
-#define BRIDGE_MASK            (BRIDGE_VIRT_BASE | 0x0114)
-#define BRIDGE_INT_TIMER0      0x0002
-#define BRIDGE_INT_TIMER1      0x0004
 #define BRIDGE_INT_TIMER1_CLR  (~0x0004)
 
 #define IRQ_VIRT_BASE          (BRIDGE_VIRT_BASE | 0x0200)
index 3511ad4..d927f14 100644 (file)
@@ -81,6 +81,7 @@ MACHINE_START(RD78X00_MASA, "Marvell RD-78x00-MASA Development Board")
        .boot_params    = 0x00000100,
        .init_machine   = rd78x00_masa_init,
        .map_io         = mv78xx0_map_io,
+       .init_early     = mv78xx0_init_early,
        .init_irq       = mv78xx0_init_irq,
        .timer          = &mv78xx0_timer,
 MACHINE_END
index 8dc2c76..986c3bf 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
+#include <mach/bridge-regs.h>
 #include <mach/hardware.h>
 #include <mach/orion5x.h>
 #include <plat/ehci-orion.h>
@@ -599,6 +600,11 @@ void __init orion5x_wdt_init(void)
 /*****************************************************************************
  * Time handling
  ****************************************************************************/
+void __init orion5x_init_early(void)
+{
+       orion_time_set_base(TIMER_VIRT_BASE);
+}
+
 int orion5x_tclk;
 
 int __init orion5x_find_tclk(void)
@@ -616,7 +622,9 @@ int __init orion5x_find_tclk(void)
 static void orion5x_timer_init(void)
 {
        orion5x_tclk = orion5x_find_tclk();
-       orion_time_init(IRQ_ORION5X_BRIDGE, orion5x_tclk);
+
+       orion_time_init(ORION5X_BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
+                       IRQ_ORION5X_BRIDGE, orion5x_tclk);
 }
 
 struct sys_timer orion5x_timer = {
index 8f00450..f2b2b35 100644 (file)
@@ -9,6 +9,7 @@ struct mv_sata_platform_data;
  * Basic Orion init functions used early by machine-setup.
  */
 void orion5x_map_io(void);
+void orion5x_init_early(void);
 void orion5x_init_irq(void);
 void orion5x_init(void);
 extern int orion5x_tclk;
index b1c451f..4258075 100644 (file)
@@ -339,6 +339,7 @@ MACHINE_START(D2NET, "LaCie d2 Network")
        .boot_params    = 0x00000100,
        .init_machine   = d2net_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
@@ -350,6 +351,7 @@ MACHINE_START(BIGDISK, "LaCie Big Disk Network")
        .boot_params    = 0x00000100,
        .init_machine   = d2net_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index df1083f..c10a117 100644 (file)
@@ -361,6 +361,7 @@ MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board")
        .boot_params    = 0x00000100,
        .init_machine   = db88f5281_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
 MACHINE_END
index 3a7bc0e..90ab022 100644 (file)
@@ -733,6 +733,7 @@ MACHINE_START(DNS323, "D-Link DNS-323")
        .boot_params    = 0x00000100,
        .init_machine   = dns323_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index ba98459..d037a90 100644 (file)
@@ -254,6 +254,7 @@ MACHINE_START(EDMINI_V2, "LaCie Ethernet Disk mini V2")
        .boot_params    = 0x00000100,
        .init_machine   = edmini_v2_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index 5c9744c..96484bc 100644 (file)
 
 #define CPU_SOFT_RESET         (ORION5X_BRIDGE_VIRT_BASE | 0x10c)
 
+#define BRIDGE_CAUSE           (ORION5X_BRIDGE_VIRT_BASE | 0x110)
+
 #define POWER_MNG_CTRL_REG     (ORION5X_BRIDGE_VIRT_BASE | 0x11C)
 
-#define BRIDGE_CAUSE           (ORION5X_BRIDGE_VIRT_BASE | 0x110)
 #define WDT_INT_REQ            0x0008
 
-#define BRIDGE_MASK            (ORION5X_BRIDGE_VIRT_BASE | 0x114)
-#define BRIDGE_INT_TIMER0      0x0002
-#define BRIDGE_INT_TIMER1      0x0004
 #define BRIDGE_INT_TIMER1_CLR  (~0x0004)
 
 #define MAIN_IRQ_CAUSE         (ORION5X_BRIDGE_VIRT_BASE | 0x200)
index 4be9aa0..47497c7 100644 (file)
@@ -382,6 +382,7 @@ MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro")
        .boot_params    = 0x00000100,
        .init_machine   = kurobox_pro_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
@@ -394,6 +395,7 @@ MACHINE_START(LINKSTATION_PRO, "Buffalo Linkstation Pro/Live")
        .boot_params    = 0x00000100,
        .init_machine   = kurobox_pro_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index 20a9b66..6ae12aa 100644 (file)
@@ -321,6 +321,7 @@ MACHINE_START(LINKSTATION_LSCHL, "Buffalo Linkstation LiveV3 (LS-CHL)")
        .boot_params    = 0x00000100,
        .init_machine   = lschl_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index 437364b..7adafd7 100644 (file)
@@ -268,6 +268,7 @@ MACHINE_START(LINKSTATION_LS_HGL, "Buffalo Linkstation LS-HGL")
        .boot_params    = 0x00000100,
        .init_machine   = ls_hgl_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index ab9b0cf..869958f 100644 (file)
@@ -270,6 +270,7 @@ MACHINE_START(LINKSTATION_MINI, "Buffalo Linkstation Mini")
        .boot_params    = 0x00000100,
        .init_machine   = lsmini_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index 2f0e16c..b43b208 100644 (file)
@@ -264,6 +264,7 @@ MACHINE_START(MSS2, "Maxtor Shared Storage II")
        .boot_params    = 0x00000100,
        .init_machine   = mss2_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32
index b3d90f2..c55d071 100644 (file)
@@ -232,6 +232,7 @@ MACHINE_START(MV2120, "HP Media Vault mv2120")
        .boot_params    = 0x00000100,
        .init_machine   = mv2120_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32
index d6665b3..429ecaf 100644 (file)
@@ -422,6 +422,7 @@ MACHINE_START(NET2BIG, "LaCie 2Big Network")
        .boot_params    = 0x00000100,
        .init_machine   = net2big_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index f4c26fd..34310ab 100644 (file)
@@ -172,6 +172,7 @@ MACHINE_START(RD88F5181L_FXO, "Marvell Orion-VoIP FXO Reference Design")
        .boot_params    = 0x00000100,
        .init_machine   = rd88f5181l_fxo_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index b594290..c1f79fa 100644 (file)
@@ -184,6 +184,7 @@ MACHINE_START(RD88F5181L_GE, "Marvell Orion-VoIP GE Reference Design")
        .boot_params    = 0x00000100,
        .init_machine   = rd88f5181l_ge_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index 165ed87..67ec695 100644 (file)
@@ -308,6 +308,7 @@ MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design")
        .boot_params    = 0x00000100,
        .init_machine   = rd88f5182_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
 MACHINE_END
index 02ff45f..b080c69 100644 (file)
@@ -126,6 +126,7 @@ MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design")
        .boot_params    = 0x00000100,
        .init_machine   = rd88f6183ap_ge_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index 4403fae..5653ee6 100644 (file)
@@ -361,6 +361,7 @@ MACHINE_START(TERASTATION_PRO2, "Buffalo Terastation Pro II/Live")
        .boot_params    = 0x00000100,
        .init_machine   = tsp2_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index 1e19612..8bbd27e 100644 (file)
@@ -325,6 +325,7 @@ MACHINE_START(TS209, "QNAP TS-109/TS-209")
        .boot_params    = 0x00000100,
        .init_machine   = qnap_ts209_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index 428af20..92f393f 100644 (file)
@@ -314,6 +314,7 @@ MACHINE_START(TS409, "QNAP TS-409")
        .boot_params    = 0x00000100,
        .init_machine   = qnap_ts409_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index a00c4f6..f4ff53c 100644 (file)
@@ -613,6 +613,7 @@ MACHINE_START(TS78XX, "Technologic Systems TS-78xx SBC")
        .boot_params    = 0x00000100,
        .init_machine   = ts78xx_init,
        .map_io         = ts78xx_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
 MACHINE_END
index 7994d6e..4e5216b 100644 (file)
@@ -175,6 +175,7 @@ MACHINE_START(WNR854T, "Netgear WNR854T")
        .boot_params    = 0x00000100,
        .init_machine   = wnr854t_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index a5989b7..fab79d0 100644 (file)
@@ -263,6 +263,7 @@ MACHINE_START(WRT350N_V2, "Linksys WRT350N v2")
        .boot_params    = 0x00000100,
        .init_machine   = wrt350n_v2_init,
        .map_io         = orion5x_map_io,
+       .init_early     = orion5x_init_early,
        .init_irq       = orion5x_init_irq,
        .timer          = &orion5x_timer,
        .fixup          = tag_fixup_mem32,
index c06ca35..4d5f1f6 100644 (file)
 #ifndef __PLAT_TIME_H
 #define __PLAT_TIME_H
 
-void orion_time_init(unsigned int irq, unsigned int tclk);
+void orion_time_set_base(u32 timer_base);
+
+void orion_time_init(u32 bridge_base, u32 bridge_timer1_clr_mask,
+                    unsigned int irq, unsigned int tclk);
 
 
 #endif
index c3da247..742b032 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <asm/sched_clock.h>
-#include <asm/mach/time.h>
-#include <mach/bridge-regs.h>
-#include <mach/hardware.h>
 
 /*
- * Number of timer ticks per jiffy.
+ * MBus bridge block registers.
  */
-static u32 ticks_per_jiffy;
+#define BRIDGE_CAUSE_OFF       0x0110
+#define BRIDGE_MASK_OFF                0x0114
+#define  BRIDGE_INT_TIMER0      0x0002
+#define  BRIDGE_INT_TIMER1      0x0004
 
 
 /*
  * Timer block registers.
  */
-#define TIMER_CTRL             (TIMER_VIRT_BASE + 0x0000)
-#define  TIMER0_EN             0x0001
-#define  TIMER0_RELOAD_EN      0x0002
-#define  TIMER1_EN             0x0004
-#define  TIMER1_RELOAD_EN      0x0008
-#define TIMER0_RELOAD          (TIMER_VIRT_BASE + 0x0010)
-#define TIMER0_VAL             (TIMER_VIRT_BASE + 0x0014)
-#define TIMER1_RELOAD          (TIMER_VIRT_BASE + 0x0018)
-#define TIMER1_VAL             (TIMER_VIRT_BASE + 0x001c)
+#define TIMER_CTRL_OFF         0x0000
+#define  TIMER0_EN              0x0001
+#define  TIMER0_RELOAD_EN       0x0002
+#define  TIMER1_EN              0x0004
+#define  TIMER1_RELOAD_EN       0x0008
+#define TIMER0_RELOAD_OFF      0x0010
+#define TIMER0_VAL_OFF         0x0014
+#define TIMER1_RELOAD_OFF      0x0018
+#define TIMER1_VAL_OFF         0x001c
+
+
+/*
+ * SoC-specific data.
+ */
+static void __iomem *bridge_base;
+static u32 bridge_timer1_clr_mask;
+static void __iomem *timer_base;
+
+
+/*
+ * Number of timer ticks per jiffy.
+ */
+static u32 ticks_per_jiffy;
 
 
 /*
@@ -50,14 +64,14 @@ static DEFINE_CLOCK_DATA(cd);
 
 unsigned long long notrace sched_clock(void)
 {
-       u32 cyc = 0xffffffff - readl(TIMER0_VAL);
+       u32 cyc = ~readl(timer_base + TIMER0_VAL_OFF);
        return cyc_to_sched_clock(&cd, cyc, (u32)~0);
 }
 
 
 static void notrace orion_update_sched_clock(void)
 {
-       u32 cyc = 0xffffffff - readl(TIMER0_VAL);
+       u32 cyc = ~readl(timer_base + TIMER0_VAL_OFF);
        update_sched_clock(&cd, cyc, (u32)~0);
 }
 
@@ -71,7 +85,7 @@ static void __init setup_sched_clock(unsigned long tclk)
  */
 static cycle_t orion_clksrc_read(struct clocksource *cs)
 {
-       return 0xffffffff - readl(TIMER0_VAL);
+       return 0xffffffff - readl(timer_base + TIMER0_VAL_OFF);
 }
 
 static struct clocksource orion_clksrc = {
@@ -101,23 +115,23 @@ orion_clkevt_next_event(unsigned long delta, struct clock_event_device *dev)
        /*
         * Clear and enable clockevent timer interrupt.
         */
-       writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
+       writel(bridge_timer1_clr_mask, bridge_base + BRIDGE_CAUSE_OFF);
 
-       u = readl(BRIDGE_MASK);
+       u = readl(bridge_base + BRIDGE_MASK_OFF);
        u |= BRIDGE_INT_TIMER1;
-       writel(u, BRIDGE_MASK);
+       writel(u, bridge_base + BRIDGE_MASK_OFF);
 
        /*
         * Setup new clockevent timer value.
         */
-       writel(delta, TIMER1_VAL);
+       writel(delta, timer_base + TIMER1_VAL_OFF);
 
        /*
         * Enable the timer.
         */
-       u = readl(TIMER_CTRL);
+       u = readl(timer_base + TIMER_CTRL_OFF);
        u = (u & ~TIMER1_RELOAD_EN) | TIMER1_EN;
-       writel(u, TIMER_CTRL);
+       writel(u, timer_base + TIMER_CTRL_OFF);
 
        local_irq_restore(flags);
 
@@ -135,37 +149,38 @@ orion_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
                /*
                 * Setup timer to fire at 1/HZ intervals.
                 */
-               writel(ticks_per_jiffy - 1, TIMER1_RELOAD);
-               writel(ticks_per_jiffy - 1, TIMER1_VAL);
+               writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD_OFF);
+               writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL_OFF);
 
                /*
                 * Enable timer interrupt.
                 */
-               u = readl(BRIDGE_MASK);
-               writel(u | BRIDGE_INT_TIMER1, BRIDGE_MASK);
+               u = readl(bridge_base + BRIDGE_MASK_OFF);
+               writel(u | BRIDGE_INT_TIMER1, bridge_base + BRIDGE_MASK_OFF);
 
                /*
                 * Enable timer.
                 */
-               u = readl(TIMER_CTRL);
-               writel(u | TIMER1_EN | TIMER1_RELOAD_EN, TIMER_CTRL);
+               u = readl(timer_base + TIMER_CTRL_OFF);
+               writel(u | TIMER1_EN | TIMER1_RELOAD_EN,
+                      timer_base + TIMER_CTRL_OFF);
        } else {
                /*
                 * Disable timer.
                 */
-               u = readl(TIMER_CTRL);
-               writel(u & ~TIMER1_EN, TIMER_CTRL);
+               u = readl(timer_base + TIMER_CTRL_OFF);
+               writel(u & ~TIMER1_EN, timer_base + TIMER_CTRL_OFF);
 
                /*
                 * Disable timer interrupt.
                 */
-               u = readl(BRIDGE_MASK);
-               writel(u & ~BRIDGE_INT_TIMER1, BRIDGE_MASK);
+               u = readl(bridge_base + BRIDGE_MASK_OFF);
+               writel(u & ~BRIDGE_INT_TIMER1, bridge_base + BRIDGE_MASK_OFF);
 
                /*
                 * ACK pending timer interrupt.
                 */
-               writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
+               writel(bridge_timer1_clr_mask, bridge_base + BRIDGE_CAUSE_OFF);
 
        }
        local_irq_restore(flags);
@@ -185,7 +200,7 @@ static irqreturn_t orion_timer_interrupt(int irq, void *dev_id)
        /*
         * ACK timer interrupt and call event handler.
         */
-       writel(BRIDGE_INT_TIMER1_CLR, BRIDGE_CAUSE);
+       writel(bridge_timer1_clr_mask, bridge_base + BRIDGE_CAUSE_OFF);
        orion_clkevt.event_handler(&orion_clkevt);
 
        return IRQ_HANDLED;
@@ -197,31 +212,45 @@ static struct irqaction orion_timer_irq = {
        .handler        = orion_timer_interrupt
 };
 
-void __init orion_time_init(unsigned int irq, unsigned int tclk)
+void __init
+orion_time_set_base(u32 _timer_base)
+{
+       timer_base = (void __iomem *)_timer_base;
+}
+
+void __init
+orion_time_init(u32 _bridge_base, u32 _bridge_timer1_clr_mask,
+               unsigned int irq, unsigned int tclk)
 {
        u32 u;
 
+       /*
+        * Set SoC-specific data.
+        */
+       bridge_base = (void __iomem *)_bridge_base;
+       bridge_timer1_clr_mask = _bridge_timer1_clr_mask;
+
        ticks_per_jiffy = (tclk + HZ/2) / HZ;
 
        /*
-        * Set scale and timer for sched_clock
+        * Set scale and timer for sched_clock.
         */
        setup_sched_clock(tclk);
 
        /*
         * Setup free-running clocksource timer (interrupts
-        * disabled.)
+        * disabled).
         */
-       writel(0xffffffff, TIMER0_VAL);
-       writel(0xffffffff, TIMER0_RELOAD);
-       u = readl(BRIDGE_MASK);
-       writel(u & ~BRIDGE_INT_TIMER0, BRIDGE_MASK);
-       u = readl(TIMER_CTRL);
-       writel(u | TIMER0_EN | TIMER0_RELOAD_EN, TIMER_CTRL);
+       writel(0xffffffff, timer_base + TIMER0_VAL_OFF);
+       writel(0xffffffff, timer_base + TIMER0_RELOAD_OFF);
+       u = readl(bridge_base + BRIDGE_MASK_OFF);
+       writel(u & ~BRIDGE_INT_TIMER0, bridge_base + BRIDGE_MASK_OFF);
+       u = readl(timer_base + TIMER_CTRL_OFF);
+       writel(u | TIMER0_EN | TIMER0_RELOAD_EN, timer_base + TIMER_CTRL_OFF);
        clocksource_register_hz(&orion_clksrc, tclk);
 
        /*
-        * Setup clockevent timer (interrupt-driven.)
+        * Setup clockevent timer (interrupt-driven).
         */
        setup_irq(irq, &orion_timer_irq);
        orion_clkevt.mult = div_sc(tclk, NSEC_PER_SEC, orion_clkevt.shift);