Merge branch 'vmalloc' of git://git.linaro.org/people/nico/linux into devel-stable
[linux-2.6.git] / arch / arm / mach-omap1 / io.c
index 4c3e582..8e55b6f 100644 (file)
 
 #include <asm/tlb.h>
 #include <asm/mach/map.h>
-#include <mach/mux.h>
-#include <mach/tc.h>
+#include <plat/mux.h>
+#include <plat/tc.h>
+
+#include "clock.h"
 
-extern int omap1_clk_init(void);
 extern void omap_check_revision(void);
-extern void omap_sram_init(void);
-extern void omapfb_reserve_sdram(void);
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -29,24 +28,24 @@ extern void omapfb_reserve_sdram(void);
  */
 static struct map_desc omap_io_desc[] __initdata = {
        {
-               .virtual        = IO_VIRT,
-               .pfn            = __phys_to_pfn(IO_PHYS),
-               .length         = IO_SIZE,
+               .virtual        = OMAP1_IO_VIRT,
+               .pfn            = __phys_to_pfn(OMAP1_IO_PHYS),
+               .length         = OMAP1_IO_SIZE,
                .type           = MT_DEVICE
        }
 };
 
-#ifdef CONFIG_ARCH_OMAP730
-static struct map_desc omap730_io_desc[] __initdata = {
+#if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
+static struct map_desc omap7xx_io_desc[] __initdata = {
        {
-               .virtual        = OMAP730_DSP_BASE,
-               .pfn            = __phys_to_pfn(OMAP730_DSP_START),
-               .length         = OMAP730_DSP_SIZE,
+               .virtual        = OMAP7XX_DSP_BASE,
+               .pfn            = __phys_to_pfn(OMAP7XX_DSP_START),
+               .length         = OMAP7XX_DSP_SIZE,
                .type           = MT_DEVICE
        }, {
-               .virtual        = OMAP730_DSPREG_BASE,
-               .pfn            = __phys_to_pfn(OMAP730_DSPREG_START),
-               .length         = OMAP730_DSPREG_SIZE,
+               .virtual        = OMAP7XX_DSPREG_BASE,
+               .pfn            = __phys_to_pfn(OMAP7XX_DSPREG_START),
+               .length         = OMAP7XX_DSPREG_SIZE,
                .type           = MT_DEVICE
        }
 };
@@ -85,51 +84,44 @@ static struct map_desc omap16xx_io_desc[] __initdata = {
 #endif
 
 /*
- * Maps common IO regions for omap1. This should only get called from
- * board specific init.
+ * Maps common IO regions for omap1
  */
-void __init omap1_map_common_io(void)
+static void __init omap1_map_common_io(void)
 {
        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
-       if (cpu_is_omap730()) {
-               iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
-       }
+#if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
+void __init omap7xx_map_io(void)
+{
+       omap1_map_common_io();
+       iotable_init(omap7xx_io_desc, ARRAY_SIZE(omap7xx_io_desc));
+}
 #endif
+
 #ifdef CONFIG_ARCH_OMAP15XX
-       if (cpu_is_omap15xx()) {
-               iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
-       }
-#endif
-#if defined(CONFIG_ARCH_OMAP16XX)
-       if (cpu_is_omap16xx()) {
-               iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
-       }
+void __init omap15xx_map_io(void)
+{
+       omap1_map_common_io();
+       iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
+}
 #endif
 
-       omap_sram_init();
-       omapfb_reserve_sdram();
+#if defined(CONFIG_ARCH_OMAP16XX)
+void __init omap16xx_map_io(void)
+{
+       omap1_map_common_io();
+       iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
 }
+#endif
 
 /*
- * Common low-level hardware init for omap1. This should only get called from
- * board specific init.
+ * Common low-level hardware init for omap1.
  */
-void __init omap1_init_common_hw(void)
+void omap1_init_early(void)
 {
+       omap_check_revision();
+
        /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
         * on a Posted Write in the TIPB Bridge".
         */
@@ -139,7 +131,46 @@ void __init omap1_init_common_hw(void)
        /* Must init clocks early to assure that timer interrupt works
         */
        omap1_clk_init();
-
        omap1_mux_init();
+       omap_init_consistent_dma_size();
 }
 
+/*
+ * NOTE: Please use ioremap + __raw_read/write where possible instead of these
+ */
+
+u8 omap_readb(u32 pa)
+{
+       return __raw_readb(OMAP1_IO_ADDRESS(pa));
+}
+EXPORT_SYMBOL(omap_readb);
+
+u16 omap_readw(u32 pa)
+{
+       return __raw_readw(OMAP1_IO_ADDRESS(pa));
+}
+EXPORT_SYMBOL(omap_readw);
+
+u32 omap_readl(u32 pa)
+{
+       return __raw_readl(OMAP1_IO_ADDRESS(pa));
+}
+EXPORT_SYMBOL(omap_readl);
+
+void omap_writeb(u8 v, u32 pa)
+{
+       __raw_writeb(v, OMAP1_IO_ADDRESS(pa));
+}
+EXPORT_SYMBOL(omap_writeb);
+
+void omap_writew(u16 v, u32 pa)
+{
+       __raw_writew(v, OMAP1_IO_ADDRESS(pa));
+}
+EXPORT_SYMBOL(omap_writew);
+
+void omap_writel(u32 v, u32 pa)
+{
+       __raw_writel(v, OMAP1_IO_ADDRESS(pa));
+}
+EXPORT_SYMBOL(omap_writel);