]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: Clean-up omap1 low-level io init and ensure cache & tlb flushing
authorTony Lindgren <tony@atomide.com>
Thu, 5 Jan 2006 01:03:07 +0000 (17:03 -0800)
committerTony Lindgren <tony@atomide.com>
Thu, 5 Jan 2006 01:03:07 +0000 (17:03 -0800)
Caches and tlb must be flushed after map_io as pointed out by RMK on
linux-arm-kernel mailing list.

This patch adds does following:

- Move hw init from omap_map_common_io() to new function omap1_init_common_hw()

- Ensure cache and tlb flushing is done in omap_map_common_io() because of
  cpu detection

- Ensure cache and tlb flushing is done after mapping sram

- Remove old unused init check code

arch/arm/mach-omap1/board-generic.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-palmte.c
arch/arm/mach-omap1/board-perseus2.c
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap1/io.c
arch/arm/plat-omap/sram.c
include/asm-arm/arch-omap/io.h

index 4b292e93fbe23563e2a6d8297cad7a3d68427581..15552ffcd1a3b481b38d829d1eb0cb6c5401cbc1 100644 (file)
@@ -30,6 +30,7 @@
 
 static void __init omap_generic_init_irq(void)
 {
+       omap1_init_common_hw();
        omap_init_irq();
 }
 
@@ -104,7 +105,7 @@ static void __init omap_generic_init(void)
 
 static void __init omap_generic_map_io(void)
 {
-       omap_map_common_io();
+       omap1_map_common_io();
 }
 
 MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
index 0fc2e0f36e7c916e014d62e48314d612663a38b6..7335ad26e29b90a4d3af1ed93354ae29a278b608 100644 (file)
@@ -187,6 +187,7 @@ static void __init h2_init_smc91x(void)
 
 static void __init h2_init_irq(void)
 {
+       omap1_init_common_hw();
        omap_init_irq();
        omap_gpio_init();
        h2_init_smc91x();
@@ -274,7 +275,7 @@ static void __init h2_init(void)
 
 static void __init h2_map_io(void)
 {
-       omap_map_common_io();
+       omap1_map_common_io();
 }
 
 MACHINE_START(OMAP_H2, "TI-H2")
index 2953d38aedb0eb369048a97ec9473045f70ec50b..2e7527a0ae8b4555731b71855fdcb4377d599833 100644 (file)
@@ -284,6 +284,7 @@ static void __init h3_init_smc91x(void)
 
 void h3_init_irq(void)
 {
+       omap1_init_common_hw();
        omap_init_irq();
        omap_gpio_init();
        h3_init_smc91x();
@@ -291,7 +292,7 @@ void h3_init_irq(void)
 
 static void __init h3_map_io(void)
 {
-       omap_map_common_io();
+       omap1_map_common_io();
 }
 
 MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
index 95f1ff36cdcbc0b3e81ee5a2f7f298bcf35c7d05..26039039dc26dcf520b3ca5e44c7d6cc2633fd90 100644 (file)
@@ -181,6 +181,7 @@ static void __init innovator_init_smc91x(void)
 
 void innovator_init_irq(void)
 {
+       omap1_init_common_hw();
        omap_init_irq();
        omap_gpio_init();
 #ifdef CONFIG_ARCH_OMAP15XX
@@ -285,7 +286,7 @@ static void __init innovator_init(void)
 
 static void __init innovator_map_io(void)
 {
-       omap_map_common_io();
+       omap1_map_common_io();
 
 #ifdef CONFIG_ARCH_OMAP15XX
        if (cpu_is_omap1510()) {
index 83f68ed389f08f782b27db0d2fbb66af937380a8..f5ae193d476147330f52414e9b10ba1beb620008 100644 (file)
@@ -169,6 +169,7 @@ static void __init osk_init_cf(void)
 
 static void __init osk_init_irq(void)
 {
+       omap1_init_common_hw();
        omap_init_irq();
        omap_gpio_init();
        osk_init_smc91x();
@@ -279,7 +280,7 @@ static void __init osk_init(void)
 
 static void __init osk_map_io(void)
 {
-       omap_map_common_io();
+       omap1_map_common_io();
 }
 
 MACHINE_START(OMAP_OSK, "TI-OSK")
index 540b20d78cca6838c8e1122d935d019b3bc7a45b..a3d093efae58186745bcd69b605552ac0a220699 100644 (file)
@@ -34,6 +34,7 @@
 
 static void __init omap_generic_init_irq(void)
 {
+       omap1_init_common_hw();
        omap_init_irq();
 }
 
@@ -72,7 +73,7 @@ static void __init omap_generic_init(void)
 
 static void __init omap_generic_map_io(void)
 {
-       omap_map_common_io();
+       omap1_map_common_io();
 }
 
 MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
index dd8069a4a4c6df15fba54b58dbd9c6c7c4456b80..41a72da4b33e7db2279ffc93359539f4777bed06 100644 (file)
@@ -179,6 +179,7 @@ static void __init perseus2_init_smc91x(void)
 
 void omap_perseus2_init_irq(void)
 {
+       omap1_init_common_hw();
        omap_init_irq();
        omap_gpio_init();
        perseus2_init_smc91x();
@@ -195,7 +196,7 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
 
 static void __init omap_perseus2_map_io(void)
 {
-       omap_map_common_io();
+       omap1_map_common_io();
        iotable_init(omap_perseus2_io_desc,
                     ARRAY_SIZE(omap_perseus2_io_desc));
 
index 5a2e1d1647c5f5b032f5f0683427c2ab965b0e0a..ad309356d3348f2a4010dd7408ca6a8943dea00f 100644 (file)
@@ -162,6 +162,7 @@ static struct omap_board_config_kernel voiceblue_config[] = {
 
 static void __init voiceblue_init_irq(void)
 {
+       omap1_init_common_hw();
        omap_init_irq();
        omap_gpio_init();
 }
@@ -206,7 +207,7 @@ static void __init voiceblue_init(void)
 
 static void __init voiceblue_map_io(void)
 {
-       omap_map_common_io();
+       omap1_map_common_io();
 }
 
 #define MACHINE_PANICED                1
index a7a19f75b9e1ad119434cb001c96d5c4a79b28f2..82d556be79c51d24418c7da9198f91ccba5986d6 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 
+#include <asm/tlb.h>
 #include <asm/mach/map.h>
 #include <asm/io.h>
 #include <asm/arch/mux.h>
@@ -83,15 +84,24 @@ static struct map_desc omap16xx_io_desc[] __initdata = {
 };
 #endif
 
-static int initialized = 0;
-
-static void __init _omap_map_io(void)
+/*
+ * Maps common IO regions for omap1. This should only get called from
+ * board specific init.
+ */
+void __init omap1_map_common_io(void)
 {
-       initialized = 1;
-
-       /* We have to initialize the IO space mapping before we can run
-        * cpu_is_omapxxx() macros. */
        iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
+
+       /* Normally devicemaps_init() would flush caches and tlb after
+        * mdesc->map_io(), but we must also do it here because of the CPU
+        * revision check below.
+        */
+       local_flush_tlb_all();
+       flush_cache_all();
+
+       /* We want to check CPU revision early for cpu_is_omapxxxx() macros.
+        * IO space mapping must be initialized before we can do that.
+        */
        omap_check_revision();
 
 #ifdef CONFIG_ARCH_OMAP730
@@ -111,7 +121,14 @@ static void __init _omap_map_io(void)
 #endif
 
        omap_sram_init();
+}
 
+/*
+ * Common low-level hardware init for omap1. This should only get called from
+ * board specific init.
+ */
+void __init omap1_init_common_hw()
+{
        /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
         * on a Posted Write in the TIPB Bridge".
         */
@@ -121,16 +138,7 @@ static void __init _omap_map_io(void)
        /* Must init clocks early to assure that timer interrupt works
         */
        omap1_clk_init();
-}
 
-/*
- * This should only get called from board specific init
- */
-void __init omap_map_common_io(void)
-{
-       if (!initialized) {
-               _omap_map_io();
-               omap1_mux_init();
-       }
+       omap1_mux_init();
 }
 
index 3c615668ee82b07c06c7808e0746623009925ddd..26db74b6683cfe347250580fc3f89d6653a5e965 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 
-#include <asm/mach/map.h>
+#include <asm/tlb.h>
 #include <asm/io.h>
 #include <asm/cacheflush.h>
 
+#include <asm/mach/map.h>
+
 #include <asm/arch/sram.h>
 
 #define OMAP1_SRAM_PA          0x20000000
@@ -150,6 +152,14 @@ void __init omap_map_sram(void)
               omap_sram_io_desc[0].pfn, omap_sram_io_desc[0].virtual,
               omap_sram_io_desc[0].length);
 
+       /*
+        * Normally devicemaps_init() would flush caches and tlb after
+        * mdesc->map_io(), but since we're called from map_io(), we
+        * must do it here.
+        */
+       local_flush_tlb_all();
+       flush_cache_all();
+
        /*
         * Looks like we need to preserve some bootloader code at the
         * beginning of SRAM for jumping to flash for reboot to work...
index f5bcc9a1aed645b9a1703cafc5308bc2d8e668ec..929efab5879c8278995c5e88a08033e57255c071 100644 (file)
@@ -116,7 +116,8 @@ typedef struct { volatile u32 offset[4096]; } __regbase32;
                                        ->offset[((vaddr)&4095)>>2]
 #define __REG32(paddr)         __REGV32(io_p2v(paddr))
 
-extern void omap_map_common_io(void);
+extern void omap1_map_common_io(void);
+extern void omap1_init_common_hw(void);
 
 #else