All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
@ 2011-10-05  0:45 ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

Hi all,

Related to the omap static mapping, here's a first take on moving the
SRAM init to happen later so we can do generic map_io.

Still working on a similar patch for omap1, will send it a bit later.

Regards,

Tony

---

Tony Lindgren (4):
      ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
      ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
      ARM: OMAP: Remove calls to SRAM allocations for framebuffer
      ARM: OMAP: Map SRAM later on with ioremap_exec()


 arch/arm/include/asm/io.h                |    1 
 arch/arm/mach-omap2/board-omap3beagle.c  |    7 --
 arch/arm/mach-omap2/io.c                 |  108 ++++++++++++++----------------
 arch/arm/mm/ioremap.c                    |   22 ++++++
 arch/arm/plat-omap/include/plat/common.h |    1 
 arch/arm/plat-omap/sram.c                |   85 ++++++------------------
 6 files changed, 94 insertions(+), 130 deletions(-)

-- 
Signature

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
@ 2011-10-05  0:45 ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Related to the omap static mapping, here's a first take on moving the
SRAM init to happen later so we can do generic map_io.

Still working on a similar patch for omap1, will send it a bit later.

Regards,

Tony

---

Tony Lindgren (4):
      ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
      ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
      ARM: OMAP: Remove calls to SRAM allocations for framebuffer
      ARM: OMAP: Map SRAM later on with ioremap_exec()


 arch/arm/include/asm/io.h                |    1 
 arch/arm/mach-omap2/board-omap3beagle.c  |    7 --
 arch/arm/mach-omap2/io.c                 |  108 ++++++++++++++----------------
 arch/arm/mm/ioremap.c                    |   22 ++++++
 arch/arm/plat-omap/include/plat/common.h |    1 
 arch/arm/plat-omap/sram.c                |   85 ++++++------------------
 6 files changed, 94 insertions(+), 130 deletions(-)

-- 
Signature

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-05  0:45 ` Tony Lindgren
@ 2011-10-05  0:45   ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

This allows mapping external memory such as SRAM for use.

This is needed for some small chunks of code, such as reprogramming
SDRAM memory source clocks that can't be executed in SDRAM. Other
use cases include some PM related code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605d..4ff152e 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
 
 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
+extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
 extern void __iounmap(volatile void __iomem *addr);
 
 /*
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab50627..a813658 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -289,6 +289,28 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 }
 EXPORT_SYMBOL(__arm_ioremap);
 
+/*
+ * Remap an arbitrary physical address space into the kernel virtual
+ * address space as memory. Needed when the kernel wants to execute
+ * code in external memory. This is needed for reprogramming source
+ * clocks that would affect normal memory for example. Please see
+ * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
+ */
+void __iomem *
+__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
+{
+	unsigned int mtype;
+
+	if (cached)
+		mtype = MT_MEMORY;
+	else
+		mtype = MT_MEMORY_NONCACHED;
+
+	return __arm_ioremap_caller(phys_addr, size, mtype,
+			__builtin_return_address(0));
+}
+EXPORT_SYMBOL(__arm_ioremap_exec);
+
 void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);


^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-05  0:45   ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

This allows mapping external memory such as SRAM for use.

This is needed for some small chunks of code, such as reprogramming
SDRAM memory source clocks that can't be executed in SDRAM. Other
use cases include some PM related code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605d..4ff152e 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
 
 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
+extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
 extern void __iounmap(volatile void __iomem *addr);
 
 /*
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab50627..a813658 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -289,6 +289,28 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 }
 EXPORT_SYMBOL(__arm_ioremap);
 
+/*
+ * Remap an arbitrary physical address space into the kernel virtual
+ * address space as memory. Needed when the kernel wants to execute
+ * code in external memory. This is needed for reprogramming source
+ * clocks that would affect normal memory for example. Please see
+ * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
+ */
+void __iomem *
+__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
+{
+	unsigned int mtype;
+
+	if (cached)
+		mtype = MT_MEMORY;
+	else
+		mtype = MT_MEMORY_NONCACHED;
+
+	return __arm_ioremap_caller(phys_addr, size, mtype,
+			__builtin_return_address(0));
+}
+EXPORT_SYMBOL(__arm_ioremap_exec);
+
 void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 2/4] ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
  2011-10-05  0:45 ` Tony Lindgren
@ 2011-10-05  0:45   ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

This way we don't need to initialize SoC detection early
and can start using generic map_io.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c  |    7 --
 arch/arm/mach-omap2/io.c                 |   91 ++++++++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h |    1 
 3 files changed, 50 insertions(+), 49 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index e085371..4e5605d 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -444,11 +444,6 @@ static struct platform_device keys_gpio = {
 	},
 };
 
-static void __init omap3_beagle_init_early(void)
-{
-	omap2_init_common_infrastructure();
-}
-
 static struct platform_device *omap3_beagle_devices[] __initdata = {
 	&leds_gpio,
 	&keys_gpio,
@@ -555,7 +550,7 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
 	.boot_params	= 0x80000100,
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
-	.init_early	= omap3_beagle_init_early,
+	.init_early	= omap3_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3_beagle_init,
 	.timer		= &omap3_secure_timer,
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 1a13b79..82230e1 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -247,9 +247,6 @@ static void __init _omap2_map_common_io(void)
 	 */
 	local_flush_tlb_all();
 	flush_cache_all();
-
-	omap2_check_revision();
-	omap_sram_init();
 }
 
 #ifdef CONFIG_SOC_OMAP2420
@@ -336,29 +333,15 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
 /* See irq.c, omap4-common.c and entry-macro.S */
 void __iomem *omap_irq_base;
 
-void __init omap2_init_common_infrastructure(void)
+static void __init omap_common_init_early(void)
 {
-	u8 postsetup_state;
+	omap2_check_revision();
+	omap_sram_init();
+}
 
-	if (cpu_is_omap242x()) {
-		omap242x_powerdomains_init();
-		omap242x_clockdomains_init();
-		omap2420_hwmod_init();
-	} else if (cpu_is_omap243x()) {
-		omap243x_powerdomains_init();
-		omap243x_clockdomains_init();
-		omap2430_hwmod_init();
-	} else if (cpu_is_omap34xx()) {
-		omap3xxx_powerdomains_init();
-		omap3xxx_clockdomains_init();
-		omap3xxx_hwmod_init();
-	} else if (cpu_is_omap44xx()) {
-		omap44xx_powerdomains_init();
-		omap44xx_clockdomains_init();
-		omap44xx_hwmod_init();
-	} else {
-		pr_err("Could not init hwmod data - unknown SoC\n");
-        }
+static void __init omap_hwmod_init_postsetup(void)
+{
+	u8 postsetup_state;
 
 	/* Set the default postsetup state for all hwmods */
 #ifdef CONFIG_PM_RUNTIME
@@ -387,57 +370,79 @@ void __init omap2_init_common_infrastructure(void)
 				     &postsetup_state);
 
 	omap_pm_if_early_init();
-
-	if (cpu_is_omap2420())
-		omap2420_clk_init();
-	else if (cpu_is_omap2430())
-		omap2430_clk_init();
-	else if (cpu_is_omap34xx())
-		omap3xxx_clk_init();
-	else if (cpu_is_omap44xx())
-		omap4xxx_clk_init();
-	else
-		pr_err("Could not init clock framework - unknown SoC\n");
 }
 
 void __init omap2420_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap2xxx_voltagedomains_init();
+	omap242x_powerdomains_init();
+	omap242x_clockdomains_init();
+	omap2420_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap2420_clk_init();
 }
 
 void __init omap2430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap2xxx_voltagedomains_init();
+	omap243x_powerdomains_init();
+	omap243x_clockdomains_init();
+	omap2430_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap2430_clk_init();
+}
+
+/*
+ * Currently only board-omap3beagle.c should call this because of the
+ * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
+ */
+void __init omap3_init_early(void)
+{
+	omap_common_init_early();
+	omap3xxx_voltagedomains_init();
+	omap3xxx_powerdomains_init();
+	omap3xxx_clockdomains_init();
+	omap3xxx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap3xxx_clk_init();
 }
 
 void __init omap3430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap35xx_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap3630_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init am35xx_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init ti816x_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap4430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap44xx_voltagedomains_init();
+	omap44xx_powerdomains_init();
+	omap44xx_clockdomains_init();
+	omap44xx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap4xxx_clk_init();
 }
 
 void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index abda2c7..5eac355 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -50,6 +50,7 @@ void omap2430_init_early(void);
 void omap3430_init_early(void);
 void omap35xx_init_early(void);
 void omap3630_init_early(void);
+void omap3_init_early(void);	/* Do not use this one */
 void am35xx_init_early(void);
 void ti816x_init_early(void);
 void omap4430_init_early(void);


^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 2/4] ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
@ 2011-10-05  0:45   ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

This way we don't need to initialize SoC detection early
and can start using generic map_io.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c  |    7 --
 arch/arm/mach-omap2/io.c                 |   91 ++++++++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h |    1 
 3 files changed, 50 insertions(+), 49 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index e085371..4e5605d 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -444,11 +444,6 @@ static struct platform_device keys_gpio = {
 	},
 };
 
-static void __init omap3_beagle_init_early(void)
-{
-	omap2_init_common_infrastructure();
-}
-
 static struct platform_device *omap3_beagle_devices[] __initdata = {
 	&leds_gpio,
 	&keys_gpio,
@@ -555,7 +550,7 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
 	.boot_params	= 0x80000100,
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
-	.init_early	= omap3_beagle_init_early,
+	.init_early	= omap3_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3_beagle_init,
 	.timer		= &omap3_secure_timer,
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 1a13b79..82230e1 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -247,9 +247,6 @@ static void __init _omap2_map_common_io(void)
 	 */
 	local_flush_tlb_all();
 	flush_cache_all();
-
-	omap2_check_revision();
-	omap_sram_init();
 }
 
 #ifdef CONFIG_SOC_OMAP2420
@@ -336,29 +333,15 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
 /* See irq.c, omap4-common.c and entry-macro.S */
 void __iomem *omap_irq_base;
 
-void __init omap2_init_common_infrastructure(void)
+static void __init omap_common_init_early(void)
 {
-	u8 postsetup_state;
+	omap2_check_revision();
+	omap_sram_init();
+}
 
-	if (cpu_is_omap242x()) {
-		omap242x_powerdomains_init();
-		omap242x_clockdomains_init();
-		omap2420_hwmod_init();
-	} else if (cpu_is_omap243x()) {
-		omap243x_powerdomains_init();
-		omap243x_clockdomains_init();
-		omap2430_hwmod_init();
-	} else if (cpu_is_omap34xx()) {
-		omap3xxx_powerdomains_init();
-		omap3xxx_clockdomains_init();
-		omap3xxx_hwmod_init();
-	} else if (cpu_is_omap44xx()) {
-		omap44xx_powerdomains_init();
-		omap44xx_clockdomains_init();
-		omap44xx_hwmod_init();
-	} else {
-		pr_err("Could not init hwmod data - unknown SoC\n");
-        }
+static void __init omap_hwmod_init_postsetup(void)
+{
+	u8 postsetup_state;
 
 	/* Set the default postsetup state for all hwmods */
 #ifdef CONFIG_PM_RUNTIME
@@ -387,57 +370,79 @@ void __init omap2_init_common_infrastructure(void)
 				     &postsetup_state);
 
 	omap_pm_if_early_init();
-
-	if (cpu_is_omap2420())
-		omap2420_clk_init();
-	else if (cpu_is_omap2430())
-		omap2430_clk_init();
-	else if (cpu_is_omap34xx())
-		omap3xxx_clk_init();
-	else if (cpu_is_omap44xx())
-		omap4xxx_clk_init();
-	else
-		pr_err("Could not init clock framework - unknown SoC\n");
 }
 
 void __init omap2420_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap2xxx_voltagedomains_init();
+	omap242x_powerdomains_init();
+	omap242x_clockdomains_init();
+	omap2420_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap2420_clk_init();
 }
 
 void __init omap2430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap2xxx_voltagedomains_init();
+	omap243x_powerdomains_init();
+	omap243x_clockdomains_init();
+	omap2430_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap2430_clk_init();
+}
+
+/*
+ * Currently only board-omap3beagle.c should call this because of the
+ * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
+ */
+void __init omap3_init_early(void)
+{
+	omap_common_init_early();
+	omap3xxx_voltagedomains_init();
+	omap3xxx_powerdomains_init();
+	omap3xxx_clockdomains_init();
+	omap3xxx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap3xxx_clk_init();
 }
 
 void __init omap3430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap35xx_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap3630_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init am35xx_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init ti816x_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap4430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap44xx_voltagedomains_init();
+	omap44xx_powerdomains_init();
+	omap44xx_clockdomains_init();
+	omap44xx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap4xxx_clk_init();
 }
 
 void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index abda2c7..5eac355 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -50,6 +50,7 @@ void omap2430_init_early(void);
 void omap3430_init_early(void);
 void omap35xx_init_early(void);
 void omap3630_init_early(void);
+void omap3_init_early(void);	/* Do not use this one */
 void am35xx_init_early(void);
 void ti816x_init_early(void);
 void omap4430_init_early(void);

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
  2011-10-05  0:45 ` Tony Lindgren
@ 2011-10-05  0:45   ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Tomi Valkeinen, linux-omap

This assumes fixed mappings which will not work once we move
to use ioremap_exec(). It seems that these are currently
not in use, or in use for some out of tree corner cases.

If SRAM support for framebuffer is wanted, it should be done
with ioremap in the driver.

Note that further removal of the code can now be done,
but that can be done seprately by the driver maintainers.

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/sram.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 363c91e..3c8aa44 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -19,7 +19,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/omapfb.h>
 
 #include <asm/tlb.h>
 #include <asm/cacheflush.h>
@@ -29,10 +28,8 @@
 #include <plat/sram.h>
 #include <plat/board.h>
 #include <plat/cpu.h>
-#include <plat/vram.h>
 
 #include "sram.h"
-#include "fb.h"
 
 /* XXX These "sideways" includes are a sign that something is wrong */
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
@@ -112,8 +109,6 @@ static int is_sram_locked(void)
  */
 static void __init omap_detect_sram(void)
 {
-	unsigned long reserved;
-
 	if (cpu_class_is_omap2()) {
 		if (is_sram_locked()) {
 			if (cpu_is_omap34xx()) {
@@ -170,17 +165,6 @@ static void __init omap_detect_sram(void)
 			omap_sram_size = 0x4000;
 		}
 	}
-	reserved = omapfb_reserve_sram(omap_sram_start, omap_sram_base,
-				       omap_sram_size,
-				       omap_sram_start + SRAM_BOOTLOADER_SZ,
-				       omap_sram_size - SRAM_BOOTLOADER_SZ);
-	omap_sram_size -= reserved;
-
-	reserved = omap_vram_reserve_sram(omap_sram_start, omap_sram_base,
-			omap_sram_size,
-			omap_sram_start + SRAM_BOOTLOADER_SZ,
-			omap_sram_size - SRAM_BOOTLOADER_SZ);
-	omap_sram_size -= reserved;
 
 	omap_sram_ceil = omap_sram_base + omap_sram_size;
 }


^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
@ 2011-10-05  0:45   ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

This assumes fixed mappings which will not work once we move
to use ioremap_exec(). It seems that these are currently
not in use, or in use for some out of tree corner cases.

If SRAM support for framebuffer is wanted, it should be done
with ioremap in the driver.

Note that further removal of the code can now be done,
but that can be done seprately by the driver maintainers.

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/sram.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 363c91e..3c8aa44 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -19,7 +19,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/omapfb.h>
 
 #include <asm/tlb.h>
 #include <asm/cacheflush.h>
@@ -29,10 +28,8 @@
 #include <plat/sram.h>
 #include <plat/board.h>
 #include <plat/cpu.h>
-#include <plat/vram.h>
 
 #include "sram.h"
-#include "fb.h"
 
 /* XXX These "sideways" includes are a sign that something is wrong */
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
@@ -112,8 +109,6 @@ static int is_sram_locked(void)
  */
 static void __init omap_detect_sram(void)
 {
-	unsigned long reserved;
-
 	if (cpu_class_is_omap2()) {
 		if (is_sram_locked()) {
 			if (cpu_is_omap34xx()) {
@@ -170,17 +165,6 @@ static void __init omap_detect_sram(void)
 			omap_sram_size = 0x4000;
 		}
 	}
-	reserved = omapfb_reserve_sram(omap_sram_start, omap_sram_base,
-				       omap_sram_size,
-				       omap_sram_start + SRAM_BOOTLOADER_SZ,
-				       omap_sram_size - SRAM_BOOTLOADER_SZ);
-	omap_sram_size -= reserved;
-
-	reserved = omap_vram_reserve_sram(omap_sram_start, omap_sram_base,
-			omap_sram_size,
-			omap_sram_start + SRAM_BOOTLOADER_SZ,
-			omap_sram_size - SRAM_BOOTLOADER_SZ);
-	omap_sram_size -= reserved;
 
 	omap_sram_ceil = omap_sram_base + omap_sram_size;
 }

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
  2011-10-05  0:45 ` Tony Lindgren
@ 2011-10-05  0:45   ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

This allows us to remove omap hacks for map_io.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/io.c  |   19 +-----------
 arch/arm/plat-omap/sram.c |   69 +++++++++++++--------------------------------
 2 files changed, 22 insertions(+), 66 deletions(-)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 82230e1..8069ca8 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -239,22 +239,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
 };
 #endif
 
-static void __init _omap2_map_common_io(void)
-{
-	/* 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();
-}
-
 #ifdef CONFIG_SOC_OMAP2420
 void __init omap242x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -263,7 +252,6 @@ void __init omap243x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -271,7 +259,6 @@ void __init omap243x_map_common_io(void)
 void __init omap34xx_map_common_io(void)
 {
 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -279,7 +266,6 @@ void __init omap34xx_map_common_io(void)
 void __init omapti816x_map_common_io(void)
 {
 	iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -287,7 +273,6 @@ void __init omapti816x_map_common_io(void)
 void __init omap44xx_map_common_io(void)
 {
 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -336,7 +321,6 @@ void __iomem *omap_irq_base;
 static void __init omap_common_init_early(void)
 {
 	omap2_check_revision();
-	omap_sram_init();
 }
 
 static void __init omap_hwmod_init_postsetup(void)
@@ -448,11 +432,12 @@ void __init omap4430_init_early(void)
 void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
 				      struct omap_sdrc_params *sdrc_cs1)
 {
+	omap_sram_init();
+
 	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
 		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 		_omap2_init_reprogram_sdrc();
 	}
-
 }
 
 /*
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 3c8aa44..8b28664 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -38,16 +38,9 @@
 #endif
 
 #define OMAP1_SRAM_PA		0x20000000
-#define OMAP1_SRAM_VA		VMALLOC_END
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
-#define OMAP2_SRAM_VA		0xfe400000
-#define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
-#define OMAP3_SRAM_VA           0xfe400000
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
-#define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
-#define OMAP4_SRAM_VA		0xfe400000
 #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
-#define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
 
 #if defined(CONFIG_ARCH_OMAP2PLUS)
 #define SRAM_BOOTLOADER_SZ	0x00
@@ -70,9 +63,9 @@
 #define ROUND_DOWN(value,boundary)	((value) & (~((boundary)-1)))
 
 static unsigned long omap_sram_start;
-static unsigned long omap_sram_base;
+static void __iomem *omap_sram_base;
 static unsigned long omap_sram_size;
-static unsigned long omap_sram_ceil;
+static void __iomem *omap_sram_ceil;
 
 /*
  * Depending on the target RAMFS firewall setup, the public usable amount of
@@ -112,7 +105,6 @@ static void __init omap_detect_sram(void)
 	if (cpu_class_is_omap2()) {
 		if (is_sram_locked()) {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_PUB_VA;
 				omap_sram_start = OMAP3_SRAM_PUB_PA;
 				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
 				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
@@ -121,25 +113,20 @@ static void __init omap_detect_sram(void)
 					omap_sram_size = 0x8000; /* 32K */
 				}
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_PUB_VA;
 				omap_sram_start = OMAP4_SRAM_PUB_PA;
 				omap_sram_size = 0xa000; /* 40K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_PUB_VA;
 				omap_sram_start = OMAP2_SRAM_PUB_PA;
 				omap_sram_size = 0x800; /* 2K */
 			}
 		} else {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_VA;
 				omap_sram_start = OMAP3_SRAM_PA;
 				omap_sram_size = 0x10000; /* 64K */
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_VA;
 				omap_sram_start = OMAP4_SRAM_PA;
 				omap_sram_size = 0xe000; /* 56K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_VA;
 				omap_sram_start = OMAP2_SRAM_PA;
 				if (cpu_is_omap242x())
 					omap_sram_size = 0xa0000; /* 640K */
@@ -148,7 +135,6 @@ static void __init omap_detect_sram(void)
 			}
 		}
 	} else {
-		omap_sram_base = OMAP1_SRAM_VA;
 		omap_sram_start = OMAP1_SRAM_PA;
 
 		if (cpu_is_omap7xx())
@@ -165,24 +151,14 @@ static void __init omap_detect_sram(void)
 			omap_sram_size = 0x4000;
 		}
 	}
-
-	omap_sram_ceil = omap_sram_base + omap_sram_size;
 }
 
-static struct map_desc omap_sram_io_desc[] __initdata = {
-	{	/* .length gets filled in at runtime */
-		.virtual	= OMAP1_SRAM_VA,
-		.pfn		= __phys_to_pfn(OMAP1_SRAM_PA),
-		.type		= MT_MEMORY
-	}
-};
-
 /*
  * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
  */
 static void __init omap_map_sram(void)
 {
-	unsigned long base;
+	int cached = 1;
 
 	if (omap_sram_size == 0)
 		return;
@@ -195,28 +171,18 @@ static void __init omap_map_sram(void)
 		 * the ARM may attempt to write cache lines back to SDRAM
 		 * which will cause the system to hang.
 		 */
-		omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED;
+		cached = 0;
 	}
 
-	omap_sram_io_desc[0].virtual = omap_sram_base;
-	base = omap_sram_start;
-	base = ROUND_DOWN(base, PAGE_SIZE);
-	omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
-	omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE);
-	iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
-
-	pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
-		(long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
-		omap_sram_io_desc[0].virtual,
-		omap_sram_io_desc[0].length);
+	omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
+	omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
+						cached);
+	if (!omap_sram_base) {
+		pr_err("SRAM: Could not map\n");
+		return;
+	}
 
-	/*
-	 * 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();
+	omap_sram_ceil = omap_sram_base + omap_sram_size;
 
 	/*
 	 * Looks like we need to preserve some bootloader code at the
@@ -235,13 +201,18 @@ static void __init omap_map_sram(void)
  */
 void *omap_sram_push_address(unsigned long size)
 {
-	if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
+	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
+
+	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
+
+	if (size > available) {
 		pr_err("Not enough space in SRAM\n");
 		return NULL;
 	}
 
-	omap_sram_ceil -= size;
-	omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
+	new_ceil -= size;
+	new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
+	omap_sram_ceil = IOMEM(new_ceil);
 
 	return (void *)omap_sram_ceil;
 }


^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
@ 2011-10-05  0:45   ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

This allows us to remove omap hacks for map_io.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/io.c  |   19 +-----------
 arch/arm/plat-omap/sram.c |   69 +++++++++++++--------------------------------
 2 files changed, 22 insertions(+), 66 deletions(-)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 82230e1..8069ca8 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -239,22 +239,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
 };
 #endif
 
-static void __init _omap2_map_common_io(void)
-{
-	/* 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();
-}
-
 #ifdef CONFIG_SOC_OMAP2420
 void __init omap242x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -263,7 +252,6 @@ void __init omap243x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -271,7 +259,6 @@ void __init omap243x_map_common_io(void)
 void __init omap34xx_map_common_io(void)
 {
 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -279,7 +266,6 @@ void __init omap34xx_map_common_io(void)
 void __init omapti816x_map_common_io(void)
 {
 	iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -287,7 +273,6 @@ void __init omapti816x_map_common_io(void)
 void __init omap44xx_map_common_io(void)
 {
 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -336,7 +321,6 @@ void __iomem *omap_irq_base;
 static void __init omap_common_init_early(void)
 {
 	omap2_check_revision();
-	omap_sram_init();
 }
 
 static void __init omap_hwmod_init_postsetup(void)
@@ -448,11 +432,12 @@ void __init omap4430_init_early(void)
 void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
 				      struct omap_sdrc_params *sdrc_cs1)
 {
+	omap_sram_init();
+
 	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
 		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 		_omap2_init_reprogram_sdrc();
 	}
-
 }
 
 /*
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 3c8aa44..8b28664 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -38,16 +38,9 @@
 #endif
 
 #define OMAP1_SRAM_PA		0x20000000
-#define OMAP1_SRAM_VA		VMALLOC_END
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
-#define OMAP2_SRAM_VA		0xfe400000
-#define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
-#define OMAP3_SRAM_VA           0xfe400000
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
-#define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
-#define OMAP4_SRAM_VA		0xfe400000
 #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
-#define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
 
 #if defined(CONFIG_ARCH_OMAP2PLUS)
 #define SRAM_BOOTLOADER_SZ	0x00
@@ -70,9 +63,9 @@
 #define ROUND_DOWN(value,boundary)	((value) & (~((boundary)-1)))
 
 static unsigned long omap_sram_start;
-static unsigned long omap_sram_base;
+static void __iomem *omap_sram_base;
 static unsigned long omap_sram_size;
-static unsigned long omap_sram_ceil;
+static void __iomem *omap_sram_ceil;
 
 /*
  * Depending on the target RAMFS firewall setup, the public usable amount of
@@ -112,7 +105,6 @@ static void __init omap_detect_sram(void)
 	if (cpu_class_is_omap2()) {
 		if (is_sram_locked()) {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_PUB_VA;
 				omap_sram_start = OMAP3_SRAM_PUB_PA;
 				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
 				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
@@ -121,25 +113,20 @@ static void __init omap_detect_sram(void)
 					omap_sram_size = 0x8000; /* 32K */
 				}
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_PUB_VA;
 				omap_sram_start = OMAP4_SRAM_PUB_PA;
 				omap_sram_size = 0xa000; /* 40K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_PUB_VA;
 				omap_sram_start = OMAP2_SRAM_PUB_PA;
 				omap_sram_size = 0x800; /* 2K */
 			}
 		} else {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_VA;
 				omap_sram_start = OMAP3_SRAM_PA;
 				omap_sram_size = 0x10000; /* 64K */
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_VA;
 				omap_sram_start = OMAP4_SRAM_PA;
 				omap_sram_size = 0xe000; /* 56K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_VA;
 				omap_sram_start = OMAP2_SRAM_PA;
 				if (cpu_is_omap242x())
 					omap_sram_size = 0xa0000; /* 640K */
@@ -148,7 +135,6 @@ static void __init omap_detect_sram(void)
 			}
 		}
 	} else {
-		omap_sram_base = OMAP1_SRAM_VA;
 		omap_sram_start = OMAP1_SRAM_PA;
 
 		if (cpu_is_omap7xx())
@@ -165,24 +151,14 @@ static void __init omap_detect_sram(void)
 			omap_sram_size = 0x4000;
 		}
 	}
-
-	omap_sram_ceil = omap_sram_base + omap_sram_size;
 }
 
-static struct map_desc omap_sram_io_desc[] __initdata = {
-	{	/* .length gets filled in at runtime */
-		.virtual	= OMAP1_SRAM_VA,
-		.pfn		= __phys_to_pfn(OMAP1_SRAM_PA),
-		.type		= MT_MEMORY
-	}
-};
-
 /*
  * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
  */
 static void __init omap_map_sram(void)
 {
-	unsigned long base;
+	int cached = 1;
 
 	if (omap_sram_size == 0)
 		return;
@@ -195,28 +171,18 @@ static void __init omap_map_sram(void)
 		 * the ARM may attempt to write cache lines back to SDRAM
 		 * which will cause the system to hang.
 		 */
-		omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED;
+		cached = 0;
 	}
 
-	omap_sram_io_desc[0].virtual = omap_sram_base;
-	base = omap_sram_start;
-	base = ROUND_DOWN(base, PAGE_SIZE);
-	omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
-	omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE);
-	iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
-
-	pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
-		(long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
-		omap_sram_io_desc[0].virtual,
-		omap_sram_io_desc[0].length);
+	omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
+	omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
+						cached);
+	if (!omap_sram_base) {
+		pr_err("SRAM: Could not map\n");
+		return;
+	}
 
-	/*
-	 * 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();
+	omap_sram_ceil = omap_sram_base + omap_sram_size;
 
 	/*
 	 * Looks like we need to preserve some bootloader code at the
@@ -235,13 +201,18 @@ static void __init omap_map_sram(void)
  */
 void *omap_sram_push_address(unsigned long size)
 {
-	if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
+	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
+
+	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
+
+	if (size > available) {
 		pr_err("Not enough space in SRAM\n");
 		return NULL;
 	}
 
-	omap_sram_ceil -= size;
-	omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
+	new_ceil -= size;
+	new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
+	omap_sram_ceil = IOMEM(new_ceil);
 
 	return (void *)omap_sram_ceil;
 }

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-05  0:45   ` Tony Lindgren
@ 2011-10-05  1:00     ` Nicolas Pitre
  -1 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-05  1:00 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> This allows mapping external memory such as SRAM for use.
> 
> This is needed for some small chunks of code, such as reprogramming
> SDRAM memory source clocks that can't be executed in SDRAM. Other
> use cases include some PM related code.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

As mentioned, you might consider dropping the export until needed.


> ---
>  arch/arm/include/asm/io.h |    1 +
>  arch/arm/mm/ioremap.c     |   22 ++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
> index d66605d..4ff152e 100644
> --- a/arch/arm/include/asm/io.h
> +++ b/arch/arm/include/asm/io.h
> @@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
>  
>  extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
>  extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
> +extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
>  extern void __iounmap(volatile void __iomem *addr);
>  
>  /*
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index ab50627..a813658 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -289,6 +289,28 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
>  }
>  EXPORT_SYMBOL(__arm_ioremap);
>  
> +/*
> + * Remap an arbitrary physical address space into the kernel virtual
> + * address space as memory. Needed when the kernel wants to execute
> + * code in external memory. This is needed for reprogramming source
> + * clocks that would affect normal memory for example. Please see
> + * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
> + */
> +void __iomem *
> +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
> +{
> +	unsigned int mtype;
> +
> +	if (cached)
> +		mtype = MT_MEMORY;
> +	else
> +		mtype = MT_MEMORY_NONCACHED;
> +
> +	return __arm_ioremap_caller(phys_addr, size, mtype,
> +			__builtin_return_address(0));
> +}
> +EXPORT_SYMBOL(__arm_ioremap_exec);
> +
>  void __iounmap(volatile void __iomem *io_addr)
>  {
>  	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-05  1:00     ` Nicolas Pitre
  0 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-05  1:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> This allows mapping external memory such as SRAM for use.
> 
> This is needed for some small chunks of code, such as reprogramming
> SDRAM memory source clocks that can't be executed in SDRAM. Other
> use cases include some PM related code.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

As mentioned, you might consider dropping the export until needed.


> ---
>  arch/arm/include/asm/io.h |    1 +
>  arch/arm/mm/ioremap.c     |   22 ++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
> index d66605d..4ff152e 100644
> --- a/arch/arm/include/asm/io.h
> +++ b/arch/arm/include/asm/io.h
> @@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
>  
>  extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
>  extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
> +extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
>  extern void __iounmap(volatile void __iomem *addr);
>  
>  /*
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index ab50627..a813658 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -289,6 +289,28 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
>  }
>  EXPORT_SYMBOL(__arm_ioremap);
>  
> +/*
> + * Remap an arbitrary physical address space into the kernel virtual
> + * address space as memory. Needed when the kernel wants to execute
> + * code in external memory. This is needed for reprogramming source
> + * clocks that would affect normal memory for example. Please see
> + * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
> + */
> +void __iomem *
> +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
> +{
> +	unsigned int mtype;
> +
> +	if (cached)
> +		mtype = MT_MEMORY;
> +	else
> +		mtype = MT_MEMORY_NONCACHED;
> +
> +	return __arm_ioremap_caller(phys_addr, size, mtype,
> +			__builtin_return_address(0));
> +}
> +EXPORT_SYMBOL(__arm_ioremap_exec);
> +
>  void __iounmap(volatile void __iomem *io_addr)
>  {
>  	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
  2011-10-05  0:45   ` Tony Lindgren
@ 2011-10-05  1:07     ` Nicolas Pitre
  -1 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-05  1:07 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> This allows us to remove omap hacks for map_io.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Nice cleanup.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>


> ---
>  arch/arm/mach-omap2/io.c  |   19 +-----------
>  arch/arm/plat-omap/sram.c |   69 +++++++++++++--------------------------------
>  2 files changed, 22 insertions(+), 66 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
> index 82230e1..8069ca8 100644
> --- a/arch/arm/mach-omap2/io.c
> +++ b/arch/arm/mach-omap2/io.c
> @@ -239,22 +239,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
>  };
>  #endif
>  
> -static void __init _omap2_map_common_io(void)
> -{
> -	/* 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();
> -}
> -
>  #ifdef CONFIG_SOC_OMAP2420
>  void __init omap242x_map_common_io(void)
>  {
>  	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
>  	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -263,7 +252,6 @@ void __init omap243x_map_common_io(void)
>  {
>  	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
>  	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -271,7 +259,6 @@ void __init omap243x_map_common_io(void)
>  void __init omap34xx_map_common_io(void)
>  {
>  	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -279,7 +266,6 @@ void __init omap34xx_map_common_io(void)
>  void __init omapti816x_map_common_io(void)
>  {
>  	iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -287,7 +273,6 @@ void __init omapti816x_map_common_io(void)
>  void __init omap44xx_map_common_io(void)
>  {
>  	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -336,7 +321,6 @@ void __iomem *omap_irq_base;
>  static void __init omap_common_init_early(void)
>  {
>  	omap2_check_revision();
> -	omap_sram_init();
>  }
>  
>  static void __init omap_hwmod_init_postsetup(void)
> @@ -448,11 +432,12 @@ void __init omap4430_init_early(void)
>  void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
>  				      struct omap_sdrc_params *sdrc_cs1)
>  {
> +	omap_sram_init();
> +
>  	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
>  		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
>  		_omap2_init_reprogram_sdrc();
>  	}
> -
>  }
>  
>  /*
> diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
> index 3c8aa44..8b28664 100644
> --- a/arch/arm/plat-omap/sram.c
> +++ b/arch/arm/plat-omap/sram.c
> @@ -38,16 +38,9 @@
>  #endif
>  
>  #define OMAP1_SRAM_PA		0x20000000
> -#define OMAP1_SRAM_VA		VMALLOC_END
>  #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
> -#define OMAP2_SRAM_VA		0xfe400000
> -#define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
> -#define OMAP3_SRAM_VA           0xfe400000
>  #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
> -#define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
> -#define OMAP4_SRAM_VA		0xfe400000
>  #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
> -#define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
>  
>  #if defined(CONFIG_ARCH_OMAP2PLUS)
>  #define SRAM_BOOTLOADER_SZ	0x00
> @@ -70,9 +63,9 @@
>  #define ROUND_DOWN(value,boundary)	((value) & (~((boundary)-1)))
>  
>  static unsigned long omap_sram_start;
> -static unsigned long omap_sram_base;
> +static void __iomem *omap_sram_base;
>  static unsigned long omap_sram_size;
> -static unsigned long omap_sram_ceil;
> +static void __iomem *omap_sram_ceil;
>  
>  /*
>   * Depending on the target RAMFS firewall setup, the public usable amount of
> @@ -112,7 +105,6 @@ static void __init omap_detect_sram(void)
>  	if (cpu_class_is_omap2()) {
>  		if (is_sram_locked()) {
>  			if (cpu_is_omap34xx()) {
> -				omap_sram_base = OMAP3_SRAM_PUB_VA;
>  				omap_sram_start = OMAP3_SRAM_PUB_PA;
>  				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
>  				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
> @@ -121,25 +113,20 @@ static void __init omap_detect_sram(void)
>  					omap_sram_size = 0x8000; /* 32K */
>  				}
>  			} else if (cpu_is_omap44xx()) {
> -				omap_sram_base = OMAP4_SRAM_PUB_VA;
>  				omap_sram_start = OMAP4_SRAM_PUB_PA;
>  				omap_sram_size = 0xa000; /* 40K */
>  			} else {
> -				omap_sram_base = OMAP2_SRAM_PUB_VA;
>  				omap_sram_start = OMAP2_SRAM_PUB_PA;
>  				omap_sram_size = 0x800; /* 2K */
>  			}
>  		} else {
>  			if (cpu_is_omap34xx()) {
> -				omap_sram_base = OMAP3_SRAM_VA;
>  				omap_sram_start = OMAP3_SRAM_PA;
>  				omap_sram_size = 0x10000; /* 64K */
>  			} else if (cpu_is_omap44xx()) {
> -				omap_sram_base = OMAP4_SRAM_VA;
>  				omap_sram_start = OMAP4_SRAM_PA;
>  				omap_sram_size = 0xe000; /* 56K */
>  			} else {
> -				omap_sram_base = OMAP2_SRAM_VA;
>  				omap_sram_start = OMAP2_SRAM_PA;
>  				if (cpu_is_omap242x())
>  					omap_sram_size = 0xa0000; /* 640K */
> @@ -148,7 +135,6 @@ static void __init omap_detect_sram(void)
>  			}
>  		}
>  	} else {
> -		omap_sram_base = OMAP1_SRAM_VA;
>  		omap_sram_start = OMAP1_SRAM_PA;
>  
>  		if (cpu_is_omap7xx())
> @@ -165,24 +151,14 @@ static void __init omap_detect_sram(void)
>  			omap_sram_size = 0x4000;
>  		}
>  	}
> -
> -	omap_sram_ceil = omap_sram_base + omap_sram_size;
>  }
>  
> -static struct map_desc omap_sram_io_desc[] __initdata = {
> -	{	/* .length gets filled in at runtime */
> -		.virtual	= OMAP1_SRAM_VA,
> -		.pfn		= __phys_to_pfn(OMAP1_SRAM_PA),
> -		.type		= MT_MEMORY
> -	}
> -};
> -
>  /*
>   * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
>   */
>  static void __init omap_map_sram(void)
>  {
> -	unsigned long base;
> +	int cached = 1;
>  
>  	if (omap_sram_size == 0)
>  		return;
> @@ -195,28 +171,18 @@ static void __init omap_map_sram(void)
>  		 * the ARM may attempt to write cache lines back to SDRAM
>  		 * which will cause the system to hang.
>  		 */
> -		omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED;
> +		cached = 0;
>  	}
>  
> -	omap_sram_io_desc[0].virtual = omap_sram_base;
> -	base = omap_sram_start;
> -	base = ROUND_DOWN(base, PAGE_SIZE);
> -	omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
> -	omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE);
> -	iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
> -
> -	pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
> -		(long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
> -		omap_sram_io_desc[0].virtual,
> -		omap_sram_io_desc[0].length);
> +	omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
> +	omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
> +						cached);
> +	if (!omap_sram_base) {
> +		pr_err("SRAM: Could not map\n");
> +		return;
> +	}
>  
> -	/*
> -	 * 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();
> +	omap_sram_ceil = omap_sram_base + omap_sram_size;
>  
>  	/*
>  	 * Looks like we need to preserve some bootloader code at the
> @@ -235,13 +201,18 @@ static void __init omap_map_sram(void)
>   */
>  void *omap_sram_push_address(unsigned long size)
>  {
> -	if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
> +	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
> +
> +	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
> +
> +	if (size > available) {
>  		pr_err("Not enough space in SRAM\n");
>  		return NULL;
>  	}
>  
> -	omap_sram_ceil -= size;
> -	omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
> +	new_ceil -= size;
> +	new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
> +	omap_sram_ceil = IOMEM(new_ceil);
>  
>  	return (void *)omap_sram_ceil;
>  }
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
@ 2011-10-05  1:07     ` Nicolas Pitre
  0 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-05  1:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> This allows us to remove omap hacks for map_io.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Nice cleanup.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>


> ---
>  arch/arm/mach-omap2/io.c  |   19 +-----------
>  arch/arm/plat-omap/sram.c |   69 +++++++++++++--------------------------------
>  2 files changed, 22 insertions(+), 66 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
> index 82230e1..8069ca8 100644
> --- a/arch/arm/mach-omap2/io.c
> +++ b/arch/arm/mach-omap2/io.c
> @@ -239,22 +239,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
>  };
>  #endif
>  
> -static void __init _omap2_map_common_io(void)
> -{
> -	/* 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();
> -}
> -
>  #ifdef CONFIG_SOC_OMAP2420
>  void __init omap242x_map_common_io(void)
>  {
>  	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
>  	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -263,7 +252,6 @@ void __init omap243x_map_common_io(void)
>  {
>  	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
>  	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -271,7 +259,6 @@ void __init omap243x_map_common_io(void)
>  void __init omap34xx_map_common_io(void)
>  {
>  	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -279,7 +266,6 @@ void __init omap34xx_map_common_io(void)
>  void __init omapti816x_map_common_io(void)
>  {
>  	iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -287,7 +273,6 @@ void __init omapti816x_map_common_io(void)
>  void __init omap44xx_map_common_io(void)
>  {
>  	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -336,7 +321,6 @@ void __iomem *omap_irq_base;
>  static void __init omap_common_init_early(void)
>  {
>  	omap2_check_revision();
> -	omap_sram_init();
>  }
>  
>  static void __init omap_hwmod_init_postsetup(void)
> @@ -448,11 +432,12 @@ void __init omap4430_init_early(void)
>  void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
>  				      struct omap_sdrc_params *sdrc_cs1)
>  {
> +	omap_sram_init();
> +
>  	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
>  		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
>  		_omap2_init_reprogram_sdrc();
>  	}
> -
>  }
>  
>  /*
> diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
> index 3c8aa44..8b28664 100644
> --- a/arch/arm/plat-omap/sram.c
> +++ b/arch/arm/plat-omap/sram.c
> @@ -38,16 +38,9 @@
>  #endif
>  
>  #define OMAP1_SRAM_PA		0x20000000
> -#define OMAP1_SRAM_VA		VMALLOC_END
>  #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
> -#define OMAP2_SRAM_VA		0xfe400000
> -#define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
> -#define OMAP3_SRAM_VA           0xfe400000
>  #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
> -#define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
> -#define OMAP4_SRAM_VA		0xfe400000
>  #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
> -#define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
>  
>  #if defined(CONFIG_ARCH_OMAP2PLUS)
>  #define SRAM_BOOTLOADER_SZ	0x00
> @@ -70,9 +63,9 @@
>  #define ROUND_DOWN(value,boundary)	((value) & (~((boundary)-1)))
>  
>  static unsigned long omap_sram_start;
> -static unsigned long omap_sram_base;
> +static void __iomem *omap_sram_base;
>  static unsigned long omap_sram_size;
> -static unsigned long omap_sram_ceil;
> +static void __iomem *omap_sram_ceil;
>  
>  /*
>   * Depending on the target RAMFS firewall setup, the public usable amount of
> @@ -112,7 +105,6 @@ static void __init omap_detect_sram(void)
>  	if (cpu_class_is_omap2()) {
>  		if (is_sram_locked()) {
>  			if (cpu_is_omap34xx()) {
> -				omap_sram_base = OMAP3_SRAM_PUB_VA;
>  				omap_sram_start = OMAP3_SRAM_PUB_PA;
>  				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
>  				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
> @@ -121,25 +113,20 @@ static void __init omap_detect_sram(void)
>  					omap_sram_size = 0x8000; /* 32K */
>  				}
>  			} else if (cpu_is_omap44xx()) {
> -				omap_sram_base = OMAP4_SRAM_PUB_VA;
>  				omap_sram_start = OMAP4_SRAM_PUB_PA;
>  				omap_sram_size = 0xa000; /* 40K */
>  			} else {
> -				omap_sram_base = OMAP2_SRAM_PUB_VA;
>  				omap_sram_start = OMAP2_SRAM_PUB_PA;
>  				omap_sram_size = 0x800; /* 2K */
>  			}
>  		} else {
>  			if (cpu_is_omap34xx()) {
> -				omap_sram_base = OMAP3_SRAM_VA;
>  				omap_sram_start = OMAP3_SRAM_PA;
>  				omap_sram_size = 0x10000; /* 64K */
>  			} else if (cpu_is_omap44xx()) {
> -				omap_sram_base = OMAP4_SRAM_VA;
>  				omap_sram_start = OMAP4_SRAM_PA;
>  				omap_sram_size = 0xe000; /* 56K */
>  			} else {
> -				omap_sram_base = OMAP2_SRAM_VA;
>  				omap_sram_start = OMAP2_SRAM_PA;
>  				if (cpu_is_omap242x())
>  					omap_sram_size = 0xa0000; /* 640K */
> @@ -148,7 +135,6 @@ static void __init omap_detect_sram(void)
>  			}
>  		}
>  	} else {
> -		omap_sram_base = OMAP1_SRAM_VA;
>  		omap_sram_start = OMAP1_SRAM_PA;
>  
>  		if (cpu_is_omap7xx())
> @@ -165,24 +151,14 @@ static void __init omap_detect_sram(void)
>  			omap_sram_size = 0x4000;
>  		}
>  	}
> -
> -	omap_sram_ceil = omap_sram_base + omap_sram_size;
>  }
>  
> -static struct map_desc omap_sram_io_desc[] __initdata = {
> -	{	/* .length gets filled in at runtime */
> -		.virtual	= OMAP1_SRAM_VA,
> -		.pfn		= __phys_to_pfn(OMAP1_SRAM_PA),
> -		.type		= MT_MEMORY
> -	}
> -};
> -
>  /*
>   * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
>   */
>  static void __init omap_map_sram(void)
>  {
> -	unsigned long base;
> +	int cached = 1;
>  
>  	if (omap_sram_size == 0)
>  		return;
> @@ -195,28 +171,18 @@ static void __init omap_map_sram(void)
>  		 * the ARM may attempt to write cache lines back to SDRAM
>  		 * which will cause the system to hang.
>  		 */
> -		omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED;
> +		cached = 0;
>  	}
>  
> -	omap_sram_io_desc[0].virtual = omap_sram_base;
> -	base = omap_sram_start;
> -	base = ROUND_DOWN(base, PAGE_SIZE);
> -	omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
> -	omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE);
> -	iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
> -
> -	pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
> -		(long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
> -		omap_sram_io_desc[0].virtual,
> -		omap_sram_io_desc[0].length);
> +	omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
> +	omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
> +						cached);
> +	if (!omap_sram_base) {
> +		pr_err("SRAM: Could not map\n");
> +		return;
> +	}
>  
> -	/*
> -	 * 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();
> +	omap_sram_ceil = omap_sram_base + omap_sram_size;
>  
>  	/*
>  	 * Looks like we need to preserve some bootloader code at the
> @@ -235,13 +201,18 @@ static void __init omap_map_sram(void)
>   */
>  void *omap_sram_push_address(unsigned long size)
>  {
> -	if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
> +	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
> +
> +	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
> +
> +	if (size > available) {
>  		pr_err("Not enough space in SRAM\n");
>  		return NULL;
>  	}
>  
> -	omap_sram_ceil -= size;
> -	omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
> +	new_ceil -= size;
> +	new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
> +	omap_sram_ceil = IOMEM(new_ceil);
>  
>  	return (void *)omap_sram_ceil;
>  }
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
  2011-10-05  0:45 ` Tony Lindgren
@ 2011-10-05  1:40   ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  1:40 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap

Otherwise we can't do generic map_io as we currently rely on
static mappings that work only because of arch_ioremap.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index e26c79c..e6ee884 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -37,7 +37,6 @@ static void __init ti8168_evm_init(void)
 
 static void __init ti8168_evm_map_io(void)
 {
-	omap2_set_globals_ti816x();
 	omapti816x_map_common_io();
 }
 
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index de61f15..f19a332 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -59,7 +59,6 @@ void __init omap2_set_globals_242x(void)
 
 void __init omap242x_map_io(void)
 {
-	omap2_set_globals_242x();
 	omap242x_map_common_io();
 }
 #endif
@@ -83,7 +82,6 @@ void __init omap2_set_globals_243x(void)
 
 void __init omap243x_map_io(void)
 {
-	omap2_set_globals_243x();
 	omap243x_map_common_io();
 }
 #endif
@@ -107,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
 
 void __init omap3_map_io(void)
 {
-	omap2_set_globals_3xxx();
 	omap34xx_map_common_io();
 }
 
@@ -153,7 +150,6 @@ void __init omap2_set_globals_443x(void)
 
 void __init omap4_map_io(void)
 {
-	omap2_set_globals_443x();
 	omap44xx_map_common_io();
 }
 #endif
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4957554..527abdd 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -44,6 +44,7 @@
 #include "clockdomain.h"
 #include <plat/omap_hwmod.h>
 #include <plat/multi.h>
+#include <plat/common.h>
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -363,6 +364,7 @@ static void __init omap_hwmod_init_postsetup(void)
 
 void __init omap2420_init_early(void)
 {
+	omap2_set_globals_242x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap242x_powerdomains_init();
@@ -374,6 +376,7 @@ void __init omap2420_init_early(void)
 
 void __init omap2430_init_early(void)
 {
+	omap2_set_globals_243x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap243x_powerdomains_init();
@@ -389,6 +392,7 @@ void __init omap2430_init_early(void)
  */
 void __init omap3_init_early(void)
 {
+	omap2_set_globals_3xxx();
 	omap_common_init_early();
 	omap3xxx_voltagedomains_init();
 	omap3xxx_powerdomains_init();
@@ -420,11 +424,19 @@ void __init am35xx_init_early(void)
 
 void __init ti816x_init_early(void)
 {
-	omap3_init_early();
+	omap2_set_globals_ti816x();
+	omap_common_init_early();
+	omap3xxx_voltagedomains_init();
+	omap3xxx_powerdomains_init();
+	omap3xxx_clockdomains_init();
+	omap3xxx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap3xxx_clk_init();
 }
 
 void __init omap4430_init_early(void)
 {
+	omap2_set_globals_443x();
 	omap_common_init_early();
 	omap44xx_voltagedomains_init();
 	omap44xx_powerdomains_init();

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
@ 2011-10-05  1:40   ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05  1:40 UTC (permalink / raw)
  To: linux-arm-kernel

Otherwise we can't do generic map_io as we currently rely on
static mappings that work only because of arch_ioremap.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index e26c79c..e6ee884 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -37,7 +37,6 @@ static void __init ti8168_evm_init(void)
 
 static void __init ti8168_evm_map_io(void)
 {
-	omap2_set_globals_ti816x();
 	omapti816x_map_common_io();
 }
 
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index de61f15..f19a332 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -59,7 +59,6 @@ void __init omap2_set_globals_242x(void)
 
 void __init omap242x_map_io(void)
 {
-	omap2_set_globals_242x();
 	omap242x_map_common_io();
 }
 #endif
@@ -83,7 +82,6 @@ void __init omap2_set_globals_243x(void)
 
 void __init omap243x_map_io(void)
 {
-	omap2_set_globals_243x();
 	omap243x_map_common_io();
 }
 #endif
@@ -107,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
 
 void __init omap3_map_io(void)
 {
-	omap2_set_globals_3xxx();
 	omap34xx_map_common_io();
 }
 
@@ -153,7 +150,6 @@ void __init omap2_set_globals_443x(void)
 
 void __init omap4_map_io(void)
 {
-	omap2_set_globals_443x();
 	omap44xx_map_common_io();
 }
 #endif
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4957554..527abdd 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -44,6 +44,7 @@
 #include "clockdomain.h"
 #include <plat/omap_hwmod.h>
 #include <plat/multi.h>
+#include <plat/common.h>
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -363,6 +364,7 @@ static void __init omap_hwmod_init_postsetup(void)
 
 void __init omap2420_init_early(void)
 {
+	omap2_set_globals_242x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap242x_powerdomains_init();
@@ -374,6 +376,7 @@ void __init omap2420_init_early(void)
 
 void __init omap2430_init_early(void)
 {
+	omap2_set_globals_243x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap243x_powerdomains_init();
@@ -389,6 +392,7 @@ void __init omap2430_init_early(void)
  */
 void __init omap3_init_early(void)
 {
+	omap2_set_globals_3xxx();
 	omap_common_init_early();
 	omap3xxx_voltagedomains_init();
 	omap3xxx_powerdomains_init();
@@ -420,11 +424,19 @@ void __init am35xx_init_early(void)
 
 void __init ti816x_init_early(void)
 {
-	omap3_init_early();
+	omap2_set_globals_ti816x();
+	omap_common_init_early();
+	omap3xxx_voltagedomains_init();
+	omap3xxx_powerdomains_init();
+	omap3xxx_clockdomains_init();
+	omap3xxx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap3xxx_clk_init();
 }
 
 void __init omap4430_init_early(void)
 {
+	omap2_set_globals_443x();
 	omap_common_init_early();
 	omap44xx_voltagedomains_init();
 	omap44xx_powerdomains_init();

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* Re: [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
  2011-10-05  1:40   ` Tony Lindgren
@ 2011-10-05  1:51     ` Nicolas Pitre
  -1 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-05  1:51 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> Otherwise we can't do generic map_io as we currently rely on
> static mappings that work only because of arch_ioremap.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

That's great.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

> diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
> index e26c79c..e6ee884 100644
> --- a/arch/arm/mach-omap2/board-ti8168evm.c
> +++ b/arch/arm/mach-omap2/board-ti8168evm.c
> @@ -37,7 +37,6 @@ static void __init ti8168_evm_init(void)
>  
>  static void __init ti8168_evm_map_io(void)
>  {
> -	omap2_set_globals_ti816x();
>  	omapti816x_map_common_io();
>  }
>  
> diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
> index de61f15..f19a332 100644
> --- a/arch/arm/mach-omap2/common.c
> +++ b/arch/arm/mach-omap2/common.c
> @@ -59,7 +59,6 @@ void __init omap2_set_globals_242x(void)
>  
>  void __init omap242x_map_io(void)
>  {
> -	omap2_set_globals_242x();
>  	omap242x_map_common_io();
>  }
>  #endif
> @@ -83,7 +82,6 @@ void __init omap2_set_globals_243x(void)
>  
>  void __init omap243x_map_io(void)
>  {
> -	omap2_set_globals_243x();
>  	omap243x_map_common_io();
>  }
>  #endif
> @@ -107,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
>  
>  void __init omap3_map_io(void)
>  {
> -	omap2_set_globals_3xxx();
>  	omap34xx_map_common_io();
>  }
>  
> @@ -153,7 +150,6 @@ void __init omap2_set_globals_443x(void)
>  
>  void __init omap4_map_io(void)
>  {
> -	omap2_set_globals_443x();
>  	omap44xx_map_common_io();
>  }
>  #endif
> diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
> index 4957554..527abdd 100644
> --- a/arch/arm/mach-omap2/io.c
> +++ b/arch/arm/mach-omap2/io.c
> @@ -44,6 +44,7 @@
>  #include "clockdomain.h"
>  #include <plat/omap_hwmod.h>
>  #include <plat/multi.h>
> +#include <plat/common.h>
>  
>  /*
>   * The machine specific code may provide the extra mapping besides the
> @@ -363,6 +364,7 @@ static void __init omap_hwmod_init_postsetup(void)
>  
>  void __init omap2420_init_early(void)
>  {
> +	omap2_set_globals_242x();
>  	omap_common_init_early();
>  	omap2xxx_voltagedomains_init();
>  	omap242x_powerdomains_init();
> @@ -374,6 +376,7 @@ void __init omap2420_init_early(void)
>  
>  void __init omap2430_init_early(void)
>  {
> +	omap2_set_globals_243x();
>  	omap_common_init_early();
>  	omap2xxx_voltagedomains_init();
>  	omap243x_powerdomains_init();
> @@ -389,6 +392,7 @@ void __init omap2430_init_early(void)
>   */
>  void __init omap3_init_early(void)
>  {
> +	omap2_set_globals_3xxx();
>  	omap_common_init_early();
>  	omap3xxx_voltagedomains_init();
>  	omap3xxx_powerdomains_init();
> @@ -420,11 +424,19 @@ void __init am35xx_init_early(void)
>  
>  void __init ti816x_init_early(void)
>  {
> -	omap3_init_early();
> +	omap2_set_globals_ti816x();
> +	omap_common_init_early();
> +	omap3xxx_voltagedomains_init();
> +	omap3xxx_powerdomains_init();
> +	omap3xxx_clockdomains_init();
> +	omap3xxx_hwmod_init();
> +	omap_hwmod_init_postsetup();
> +	omap3xxx_clk_init();
>  }
>  
>  void __init omap4430_init_early(void)
>  {
> +	omap2_set_globals_443x();
>  	omap_common_init_early();
>  	omap44xx_voltagedomains_init();
>  	omap44xx_powerdomains_init();
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
@ 2011-10-05  1:51     ` Nicolas Pitre
  0 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-05  1:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> Otherwise we can't do generic map_io as we currently rely on
> static mappings that work only because of arch_ioremap.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

That's great.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

> diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
> index e26c79c..e6ee884 100644
> --- a/arch/arm/mach-omap2/board-ti8168evm.c
> +++ b/arch/arm/mach-omap2/board-ti8168evm.c
> @@ -37,7 +37,6 @@ static void __init ti8168_evm_init(void)
>  
>  static void __init ti8168_evm_map_io(void)
>  {
> -	omap2_set_globals_ti816x();
>  	omapti816x_map_common_io();
>  }
>  
> diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
> index de61f15..f19a332 100644
> --- a/arch/arm/mach-omap2/common.c
> +++ b/arch/arm/mach-omap2/common.c
> @@ -59,7 +59,6 @@ void __init omap2_set_globals_242x(void)
>  
>  void __init omap242x_map_io(void)
>  {
> -	omap2_set_globals_242x();
>  	omap242x_map_common_io();
>  }
>  #endif
> @@ -83,7 +82,6 @@ void __init omap2_set_globals_243x(void)
>  
>  void __init omap243x_map_io(void)
>  {
> -	omap2_set_globals_243x();
>  	omap243x_map_common_io();
>  }
>  #endif
> @@ -107,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
>  
>  void __init omap3_map_io(void)
>  {
> -	omap2_set_globals_3xxx();
>  	omap34xx_map_common_io();
>  }
>  
> @@ -153,7 +150,6 @@ void __init omap2_set_globals_443x(void)
>  
>  void __init omap4_map_io(void)
>  {
> -	omap2_set_globals_443x();
>  	omap44xx_map_common_io();
>  }
>  #endif
> diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
> index 4957554..527abdd 100644
> --- a/arch/arm/mach-omap2/io.c
> +++ b/arch/arm/mach-omap2/io.c
> @@ -44,6 +44,7 @@
>  #include "clockdomain.h"
>  #include <plat/omap_hwmod.h>
>  #include <plat/multi.h>
> +#include <plat/common.h>
>  
>  /*
>   * The machine specific code may provide the extra mapping besides the
> @@ -363,6 +364,7 @@ static void __init omap_hwmod_init_postsetup(void)
>  
>  void __init omap2420_init_early(void)
>  {
> +	omap2_set_globals_242x();
>  	omap_common_init_early();
>  	omap2xxx_voltagedomains_init();
>  	omap242x_powerdomains_init();
> @@ -374,6 +376,7 @@ void __init omap2420_init_early(void)
>  
>  void __init omap2430_init_early(void)
>  {
> +	omap2_set_globals_243x();
>  	omap_common_init_early();
>  	omap2xxx_voltagedomains_init();
>  	omap243x_powerdomains_init();
> @@ -389,6 +392,7 @@ void __init omap2430_init_early(void)
>   */
>  void __init omap3_init_early(void)
>  {
> +	omap2_set_globals_3xxx();
>  	omap_common_init_early();
>  	omap3xxx_voltagedomains_init();
>  	omap3xxx_powerdomains_init();
> @@ -420,11 +424,19 @@ void __init am35xx_init_early(void)
>  
>  void __init ti816x_init_early(void)
>  {
> -	omap3_init_early();
> +	omap2_set_globals_ti816x();
> +	omap_common_init_early();
> +	omap3xxx_voltagedomains_init();
> +	omap3xxx_powerdomains_init();
> +	omap3xxx_clockdomains_init();
> +	omap3xxx_hwmod_init();
> +	omap_hwmod_init_postsetup();
> +	omap3xxx_clk_init();
>  }
>  
>  void __init omap4430_init_early(void)
>  {
> +	omap2_set_globals_443x();
>  	omap_common_init_early();
>  	omap44xx_voltagedomains_init();
>  	omap44xx_powerdomains_init();
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
  2011-10-05  0:45   ` Tony Lindgren
@ 2011-10-05  6:45     ` Tomi Valkeinen
  -1 siblings, 0 replies; 74+ messages in thread
From: Tomi Valkeinen @ 2011-10-05  6:45 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

On Tue, 2011-10-04 at 17:45 -0700, Tony Lindgren wrote:
> This assumes fixed mappings which will not work once we move
> to use ioremap_exec(). It seems that these are currently
> not in use, or in use for some out of tree corner cases.
> 
> If SRAM support for framebuffer is wanted, it should be done
> with ioremap in the driver.
> 
> Note that further removal of the code can now be done,
> but that can be done seprately by the driver maintainers.
> 
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Looks good to me. I have similar changes in my working branch for omapfb
cleanup.

Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

 Tomi



^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
@ 2011-10-05  6:45     ` Tomi Valkeinen
  0 siblings, 0 replies; 74+ messages in thread
From: Tomi Valkeinen @ 2011-10-05  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2011-10-04 at 17:45 -0700, Tony Lindgren wrote:
> This assumes fixed mappings which will not work once we move
> to use ioremap_exec(). It seems that these are currently
> not in use, or in use for some out of tree corner cases.
> 
> If SRAM support for framebuffer is wanted, it should be done
> with ioremap in the driver.
> 
> Note that further removal of the code can now be done,
> but that can be done seprately by the driver maintainers.
> 
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Looks good to me. I have similar changes in my working branch for omapfb
cleanup.

Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

 Tomi

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
  2011-10-05  0:45 ` Tony Lindgren
@ 2011-10-05  7:03   ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-05  7:03 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

Tony,

On Wednesday 05 October 2011 06:15 AM, Tony Lindgren wrote:
> Hi all,
> 
> Related to the omap static mapping, here's a first take on moving the
> SRAM init to happen later so we can do generic map_io.
> 
> Still working on a similar patch for omap1, will send it a bit later.
> 
> Regards,
> 
> Tony
> 
> ---
> 
> Tony Lindgren (4):
>       ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
>       ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
>       ARM: OMAP: Remove calls to SRAM allocations for framebuffer
>       ARM: OMAP: Map SRAM later on with ioremap_exec()
> 
>
Nice work.

With quick scan, looks like the series will work since
you have already taken care of SRAM is being ready before
SDRC has been initialised which was the only corner case
I was worried.

Will look at this series in next couple of days and do some testing.
Looks like you wanted to inlcude below patch also part of this
series though [PATCH 5/4] numbering is bit confusing.
[PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in
init_early

Regards
Santosh



^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
@ 2011-10-05  7:03   ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-05  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

Tony,

On Wednesday 05 October 2011 06:15 AM, Tony Lindgren wrote:
> Hi all,
> 
> Related to the omap static mapping, here's a first take on moving the
> SRAM init to happen later so we can do generic map_io.
> 
> Still working on a similar patch for omap1, will send it a bit later.
> 
> Regards,
> 
> Tony
> 
> ---
> 
> Tony Lindgren (4):
>       ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
>       ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
>       ARM: OMAP: Remove calls to SRAM allocations for framebuffer
>       ARM: OMAP: Map SRAM later on with ioremap_exec()
> 
>
Nice work.

With quick scan, looks like the series will work since
you have already taken care of SRAM is being ready before
SDRC has been initialised which was the only corner case
I was worried.

Will look at this series in next couple of days and do some testing.
Looks like you wanted to inlcude below patch also part of this
series though [PATCH 5/4] numbering is bit confusing.
[PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in
init_early

Regards
Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-05  1:00     ` Nicolas Pitre
@ 2011-10-05 22:06       ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05 22:06 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: linux-arm-kernel, linux-omap

* Nicolas Pitre <nico@fluxnic.net> [111004 17:26]:
> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> 
> > This allows mapping external memory such as SRAM for use.
> > 
> > This is needed for some small chunks of code, such as reprogramming
> > SDRAM memory source clocks that can't be executed in SDRAM. Other
> > use cases include some PM related code.
> > 
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> As mentioned, you might consider dropping the export until needed.

Here's this one updated to drop the export.

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Tue, 4 Oct 2011 18:26:27 -0700
Subject: [PATCH] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY

This allows mapping external memory such as SRAM for use.

This is needed for some small chunks of code, such as reprogramming
SDRAM memory source clocks that can't be executed in SDRAM. Other
use cases include some PM related code.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605d..4ff152e 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
 
 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
+extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
 extern void __iounmap(volatile void __iomem *addr);
 
 /*
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab50627..a2d94ac 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -289,6 +289,27 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 }
 EXPORT_SYMBOL(__arm_ioremap);
 
+/*
+ * Remap an arbitrary physical address space into the kernel virtual
+ * address space as memory. Needed when the kernel wants to execute
+ * code in external memory. This is needed for reprogramming source
+ * clocks that would affect normal memory for example. Please see
+ * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
+ */
+void __iomem *
+__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
+{
+	unsigned int mtype;
+
+	if (cached)
+		mtype = MT_MEMORY;
+	else
+		mtype = MT_MEMORY_NONCACHED;
+
+	return __arm_ioremap_caller(phys_addr, size, mtype,
+			__builtin_return_address(0));
+}
+
 void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-05 22:06       ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05 22:06 UTC (permalink / raw)
  To: linux-arm-kernel

* Nicolas Pitre <nico@fluxnic.net> [111004 17:26]:
> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> 
> > This allows mapping external memory such as SRAM for use.
> > 
> > This is needed for some small chunks of code, such as reprogramming
> > SDRAM memory source clocks that can't be executed in SDRAM. Other
> > use cases include some PM related code.
> > 
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> As mentioned, you might consider dropping the export until needed.

Here's this one updated to drop the export.

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Tue, 4 Oct 2011 18:26:27 -0700
Subject: [PATCH] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY

This allows mapping external memory such as SRAM for use.

This is needed for some small chunks of code, such as reprogramming
SDRAM memory source clocks that can't be executed in SDRAM. Other
use cases include some PM related code.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605d..4ff152e 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
 
 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
+extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
 extern void __iounmap(volatile void __iomem *addr);
 
 /*
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab50627..a2d94ac 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -289,6 +289,27 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 }
 EXPORT_SYMBOL(__arm_ioremap);
 
+/*
+ * Remap an arbitrary physical address space into the kernel virtual
+ * address space as memory. Needed when the kernel wants to execute
+ * code in external memory. This is needed for reprogramming source
+ * clocks that would affect normal memory for example. Please see
+ * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
+ */
+void __iomem *
+__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
+{
+	unsigned int mtype;
+
+	if (cached)
+		mtype = MT_MEMORY;
+	else
+		mtype = MT_MEMORY_NONCACHED;
+
+	return __arm_ioremap_caller(phys_addr, size, mtype,
+			__builtin_return_address(0));
+}
+
 void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 1.5/4] ARM: OMAP1: Use generic map_io, init_early and init_irq
  2011-10-05 22:06       ` Tony Lindgren
@ 2011-10-05 22:08         ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05 22:08 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: linux-arm-kernel, linux-omap

This allows removing omap hacks for map_io allowing generic
map_io.

Note that in the future we can't do cpu_is_omapxxxx detection
until in init_early. This means that board-innovator.c now
assumes 15xx only, and board-generic.c assumes 16xx only.
This is best fixed later on by passing the SoC type from
device tree.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index eb36b25..8987b3f 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -135,12 +135,6 @@ void ams_delta_latch2_write(u16 mask, u16 value)
 	*(volatile __u16 *) AMS_DELTA_LATCH2_VIRT = ams_delta_latch2_reg;
 }
 
-static void __init ams_delta_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static struct map_desc ams_delta_io_desc[] __initdata = {
 	/* AMS_DELTA_LATCH1 */
 	{
@@ -379,17 +373,13 @@ static int __init ams_delta_modem_init(void)
 }
 arch_initcall(ams_delta_modem_init);
 
-static void __init ams_delta_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
 	/* Maintainer: Jonathan McDowell <noodles@earth.li> */
 	.atag_offset	= 0x100,
-	.map_io		= ams_delta_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= ams_delta_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= ams_delta_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 999789c..c92fd16 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -297,6 +297,39 @@ static struct omap_board_config_kernel fsample_config[] __initdata = {
 
 static void __init omap_fsample_init(void)
 {
+	/* Early, board-dependent init */
+
+	/*
+	 * Hold GSM Reset until needed
+	 */
+	omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
+
+	/*
+	 * UARTs -> done automagically by 8250 driver
+	 */
+
+	/*
+	 * CSx timings, GPIO Mux ... setup
+	 */
+
+	/* Flash: CS0 timings setup */
+	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
+	omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
+
+	/*
+	 * Ethernet support through the debug board
+	 * CS1 timings setup
+	 */
+	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
+	omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
+
+	/*
+	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
+	 * It is used as the Ethernet controller interrupt
+	 */
+	omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF,
+			OMAP7XX_IO_CONF_9);
+
 	fsample_init_smc91x();
 
 	if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
@@ -326,12 +359,6 @@ static void __init omap_fsample_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_fsample_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
 static struct map_desc omap_fsample_io_desc[] __initdata = {
 	{
@@ -350,49 +377,18 @@ static struct map_desc omap_fsample_io_desc[] __initdata = {
 
 static void __init omap_fsample_map_io(void)
 {
-	omap1_map_common_io();
+	omap15xx_map_io();
 	iotable_init(omap_fsample_io_desc,
 		     ARRAY_SIZE(omap_fsample_io_desc));
-
-	/* Early, board-dependent init */
-
-	/*
-	 * Hold GSM Reset until needed
-	 */
-	omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
-
-	/*
-	 * UARTs -> done automagically by 8250 driver
-	 */
-
-	/*
-	 * CSx timings, GPIO Mux ... setup
-	 */
-
-	/* Flash: CS0 timings setup */
-	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
-	omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
-
-	/*
-	 * Ethernet support through the debug board
-	 * CS1 timings setup
-	 */
-	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
-	omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
-
-	/*
-	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
-	 * It is used as the Ethernet controller interrupt
-	 */
-	omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
 }
 
 MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
 /* Maintainer: Brian Swetland <swetland@google.com> */
 	.atag_offset	= 0x100,
 	.map_io		= omap_fsample_map_io,
+	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_fsample_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_fsample_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 23cc9e4..5a9a54d 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -28,12 +28,6 @@
 #include <plat/board.h>
 #include <plat/common.h>
 
-static void __init omap_generic_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 /* assume no Mini-AB port */
 
 #ifdef CONFIG_ARCH_OMAP15XX
@@ -87,17 +81,13 @@ static void __init omap_generic_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_generic_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
 	/* Maintainer: Tony Lindgren <tony@atomide.com> */
 	.atag_offset	= 0x100,
-	.map_io		= omap_generic_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_generic_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_generic_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 6c70c28..c8e1d4f 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -373,12 +373,6 @@ static struct i2c_board_info __initdata h2_i2c_board_info[] = {
 	},
 };
 
-static void __init h2_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static struct omap_usb_config h2_usb_config __initdata = {
 	/* usb1 has a Mini-AB port and external isp1301 transceiver */
 	.otg		= 2,
@@ -454,17 +448,13 @@ static void __init h2_init(void)
 	h2_mmc_init();
 }
 
-static void __init h2_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_H2, "TI-H2")
 	/* Maintainer: Imre Deak <imre.deak@nokia.com> */
 	.atag_offset	= 0x100,
-	.map_io		= h2_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= h2_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= h2_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 8e2b64a..c88e131 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -436,23 +436,13 @@ static void __init h3_init(void)
 	h3_mmc_init();
 }
 
-static void __init h3_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
-static void __init h3_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
 	/* Maintainer: Texas Instruments, Inc. */
 	.atag_offset	= 0x100,
-	.map_io		= h3_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= h3_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= h3_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index e81ead1..e8eedd7 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -500,7 +500,7 @@ static void __init htcherald_lcd_init(void)
 
 static void __init htcherald_map_io(void)
 {
-	omap1_map_common_io();
+	omap7xx_map_io();
 
 	/*
 	 * The LCD panel must be disabled and DMA turned off here, as doing
@@ -601,20 +601,14 @@ static void __init htcherald_init(void)
 #endif
 }
 
-static void __init htcherald_init_irq(void)
-{
-	printk(KERN_INFO "htcherald_init_irq.\n");
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 MACHINE_START(HERALD, "HTC Herald")
 	/* Maintainer: Cory Maccarrone <darkstar6262@gmail.com> */
 	/* Maintainer: wing-linux.sourceforge.net */
 	.atag_offset    = 0x100,
 	.map_io         = htcherald_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq       = htcherald_init_irq,
+	.init_irq       = omap1_init_irq,
 	.init_machine   = htcherald_init,
 	.timer          = &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 8b03459..88cf8ba 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -289,12 +289,6 @@ static void __init innovator_init_smc91x(void)
 	}
 }
 
-static void __init innovator_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 #ifdef CONFIG_ARCH_OMAP15XX
 static struct omap_usb_config innovator1510_usb_config __initdata = {
 	/* for bundled non-standard host and peripheral cables */
@@ -439,30 +433,32 @@ static void __init innovator_init(void)
 	innovator_mmc_init();
 }
 
+/*
+ * REVISIT: Assume 15xx for now, we don't want to do revision check
+ * until later on. The right way to fix this is to set up a different
+ * machine_id for 16xx Innovator, or use device tree.
+ */
 static void __init innovator_map_io(void)
 {
-	omap1_map_common_io();
+	omap15xx_map_io();
 
-#ifdef CONFIG_ARCH_OMAP15XX
-	if (cpu_is_omap1510()) {
-		iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
-		udelay(10);	/* Delay needed for FPGA */
-
-		/* Dump the Innovator FPGA rev early - useful info for support. */
-		printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
-		       fpga_read(OMAP1510_FPGA_REV_HIGH),
-		       fpga_read(OMAP1510_FPGA_REV_LOW),
-		       fpga_read(OMAP1510_FPGA_BOARD_REV));
-	}
-#endif
+	iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
+	udelay(10);	/* Delay needed for FPGA */
+
+	/* Dump the Innovator FPGA rev early - useful info for support. */
+	pr_debug("Innovator FPGA Rev %d.%d Board Rev %d\n",
+			fpga_read(OMAP1510_FPGA_REV_HIGH),
+			fpga_read(OMAP1510_FPGA_REV_LOW),
+			fpga_read(OMAP1510_FPGA_BOARD_REV));
 }
 
 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
 	/* Maintainer: MontaVista Software, Inc. */
 	.atag_offset	= 0x100,
 	.map_io		= innovator_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= innovator_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= innovator_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 8b22be7..6969f2f 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -41,21 +41,6 @@
 
 #define ADS7846_PENDOWN_GPIO	15
 
-static void __init omap_nokia770_init_irq(void)
-{
-	/* On Nokia 770, the SleepX signal is masked with an
-	 * MPUIO line by default.  It has to be unmasked for it
-	 * to become functional */
-
-	/* SleepX mask direction */
-	omap_writew((omap_readw(0xfffb5008) & ~2), 0xfffb5008);
-	/* Unmask SleepX signal */
-	omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
-
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static const unsigned int nokia770_keymap[] = {
 	KEY(1, 0, GROUP_0 | KEY_UP),
 	KEY(2, 0, GROUP_1 | KEY_F5),
@@ -164,6 +149,15 @@ static void __init nokia770_cbus_init(void)
 {
 	int		ret;
 
+	/* On Nokia 770, the SleepX signal is masked with an
+	 * MPUIO line by default.  It has to be unmasked for it
+	 * to become functional */
+
+	/* SleepX mask direction */
+	omap_writew((omap_readw(0xfffb5008) & ~2), 0xfffb5008);
+	/* Unmask SleepX signal */
+	omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
+
 	platform_device_register(&nokia770_cbus_device);
 
 	ret = gpio_request(62, "RETU irq");
@@ -370,16 +364,12 @@ static void __init omap_nokia770_init(void)
 	nokia770_mmc_init();
 }
 
-static void __init omap_nokia770_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(NOKIA770, "Nokia 770")
 	.atag_offset	= 0x100,
-	.map_io		= omap_nokia770_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_nokia770_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_nokia770_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 44b8e93..3e12a69 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -279,12 +279,6 @@ static void __init osk_init_cf(void)
 	irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);
 }
 
-static void __init osk_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static struct omap_usb_config osk_usb_config __initdata = {
 	/* has usb host connector (A) ... for development it can also
 	 * be used, with a NONSTANDARD gender-bending cable/dongle, as
@@ -576,17 +570,13 @@ static void __init osk_init(void)
 	osk_mistral_init();
 }
 
-static void __init osk_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_OSK, "TI-OSK")
 	/* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
 	.atag_offset	= 0x100,
-	.map_io		= osk_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= osk_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= osk_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 3d8cd90..4aa2d0e 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -59,12 +59,6 @@
 #define PALMTE_MMC2_GPIO	OMAP_MPUIO(7)
 #define PALMTE_MMC3_GPIO	OMAP_MPUIO(11)
 
-static void __init omap_palmte_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static const unsigned int palmte_keymap[] = {
 	KEY(0, 0, KEY_F1),		/* Calendar */
 	KEY(1, 0, KEY_F2),		/* Contacts */
@@ -269,16 +263,12 @@ static void __init omap_palmte_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_palmte_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
 	.atag_offset	= 0x100,
-	.map_io		= omap_palmte_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_palmte_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_palmte_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index d0eefe8..32254bd 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -263,12 +263,6 @@ static struct spi_board_info __initdata palmtt_boardinfo[] = {
 	}
 };
 
-static void __init omap_palmtt_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static struct omap_usb_config palmtt_usb_config __initdata = {
 	.register_dev	= 1,
 	.hmc_mode	= 0,
@@ -315,16 +309,12 @@ static void __init omap_palmtt_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_palmtt_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
 	.atag_offset	= 0x100,
-	.map_io		= omap_palmtt_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_palmtt_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_palmtt_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 98e79bc..d41478d 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -57,13 +57,6 @@
 #define PALMZ71_SLIDER_GPIO	OMAP_MPUIO(3)
 #define PALMZ71_MMC_IN_GPIO	OMAP_MPUIO(4)
 
-static void __init
-omap_palmz71_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static const unsigned int palmz71_keymap[] = {
 	KEY(0, 0, KEY_F1),
 	KEY(1, 0, KEY_F2),
@@ -334,17 +327,12 @@ omap_palmz71_init(void)
 	palmz71_gpio_setup(0);
 }
 
-static void __init
-omap_palmz71_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
 	.atag_offset	= 0x100,
-	.map_io		= omap_palmz71_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_palmz71_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_palmz71_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index ad3a156..7506f34 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -265,6 +265,39 @@ static void __init perseus2_init_smc91x(void)
 
 static void __init omap_perseus2_init(void)
 {
+	/* Early, board-dependent init */
+
+	/*
+	 * Hold GSM Reset until needed
+	 */
+	omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
+
+	/*
+	 * UARTs -> done automagically by 8250 driver
+	 */
+
+	/*
+	 * CSx timings, GPIO Mux ... setup
+	 */
+
+	/* Flash: CS0 timings setup */
+	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
+	omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
+
+	/*
+	 * Ethernet support through the debug board
+	 * CS1 timings setup
+	 */
+	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
+	omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
+
+	/*
+	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
+	 * It is used as the Ethernet controller interrupt
+	 */
+	omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF,
+				OMAP7XX_IO_CONF_9);
+
 	perseus2_init_smc91x();
 
 	if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
@@ -294,11 +327,6 @@ static void __init omap_perseus2_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_perseus2_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
 static struct map_desc omap_perseus2_io_desc[] __initdata = {
 	{
@@ -311,49 +339,18 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
 
 static void __init omap_perseus2_map_io(void)
 {
-	omap1_map_common_io();
+	omap7xx_map_io();
 	iotable_init(omap_perseus2_io_desc,
 		     ARRAY_SIZE(omap_perseus2_io_desc));
-
-	/* Early, board-dependent init */
-
-	/*
-	 * Hold GSM Reset until needed
-	 */
-	omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
-
-	/*
-	 * UARTs -> done automagically by 8250 driver
-	 */
-
-	/*
-	 * CSx timings, GPIO Mux ... setup
-	 */
-
-	/* Flash: CS0 timings setup */
-	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
-	omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
-
-	/*
-	 * Ethernet support through the debug board
-	 * CS1 timings setup
-	 */
-	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
-	omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
-
-	/*
-	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
-	 * It is used as the Ethernet controller interrupt
-	 */
-	omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
 }
 
 MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
 	/* Maintainer: Kevin Hilman <kjh@hilman.org> */
 	.atag_offset	= 0x100,
 	.map_io		= omap_perseus2_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_perseus2_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_perseus2_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 602b55c..bdf3b85 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -407,24 +407,13 @@ static void __init omap_sx1_init(void)
 	gpio_direction_output(11, 0);	/*A_SWITCH = 0 */
 	gpio_direction_output(15, 0);	/*A_USB_ON = 0 */
 }
-/*----------------------------------------*/
-static void __init omap_sx1_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-/*----------------------------------------*/
-
-static void __init omap_sx1_map_io(void)
-{
-	omap1_map_common_io();
-}
 
 MACHINE_START(SX1, "OMAP310 based Siemens SX1")
 	.atag_offset	= 0x100,
-	.map_io		= omap_sx1_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_sx1_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_sx1_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 8016515..42e5151 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -159,17 +159,6 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
 static struct omap_board_config_kernel voiceblue_config[] = {
 };
 
-static void __init voiceblue_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
-static void __init voiceblue_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 #define MACHINE_PANICED		1
 #define MACHINE_REBOOTING	2
 #define MACHINE_REBOOT		4
@@ -302,9 +291,10 @@ static void __init voiceblue_init(void)
 MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
 	/* Maintainer: Ladislav Michl <michl@2n.cz> */
 	.atag_offset	= 0x100,
-	.map_io		= voiceblue_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= voiceblue_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= voiceblue_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 870886a..a16aab7 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -85,50 +85,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();
+}
 
 #if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
-	if (cpu_is_omap7xx()) {
-		iotable_init(omap7xx_io_desc, ARRAY_SIZE(omap7xx_io_desc));
-	}
+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();
+#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".
 	 */
@@ -138,8 +132,8 @@ void __init omap1_init_common_hw(void)
 	/* Must init clocks early to assure that timer interrupt works
 	 */
 	omap1_clk_init();
-
 	omap1_mux_init();
+	omap_sram_init();
 }
 
 /*
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h
index 6591875..c0c7850 100644
--- a/arch/arm/plat-omap/include/plat/io.h
+++ b/arch/arm/plat-omap/include/plat/io.h
@@ -256,8 +256,31 @@ extern void omap_writel(u32 v, u32 pa);
 
 struct omap_sdrc_params;
 
-extern void omap1_map_common_io(void);
-extern void omap1_init_common_hw(void);
+#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
+void omap7xx_map_io(void);
+#else
+static inline void omap_map_io(void)
+{
+}
+#endif
+
+#ifdef CONFIG_ARCH_OMAP15XX
+void omap15xx_map_io(void);
+#else
+static inline void omap15xx_map_io(void)
+{
+}
+#endif
+
+#ifdef CONFIG_ARCH_OMAP16XX
+void omap16xx_map_io(void);
+#else
+static inline void omap16xx_map_io(void)
+{
+}
+#endif
+
+void omap1_init_early(void);
 
 #ifdef CONFIG_SOC_OMAP2420
 extern void omap242x_map_common_io(void);

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 1.5/4] ARM: OMAP1: Use generic map_io, init_early and init_irq
@ 2011-10-05 22:08         ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05 22:08 UTC (permalink / raw)
  To: linux-arm-kernel

This allows removing omap hacks for map_io allowing generic
map_io.

Note that in the future we can't do cpu_is_omapxxxx detection
until in init_early. This means that board-innovator.c now
assumes 15xx only, and board-generic.c assumes 16xx only.
This is best fixed later on by passing the SoC type from
device tree.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index eb36b25..8987b3f 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -135,12 +135,6 @@ void ams_delta_latch2_write(u16 mask, u16 value)
 	*(volatile __u16 *) AMS_DELTA_LATCH2_VIRT = ams_delta_latch2_reg;
 }
 
-static void __init ams_delta_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static struct map_desc ams_delta_io_desc[] __initdata = {
 	/* AMS_DELTA_LATCH1 */
 	{
@@ -379,17 +373,13 @@ static int __init ams_delta_modem_init(void)
 }
 arch_initcall(ams_delta_modem_init);
 
-static void __init ams_delta_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
 	/* Maintainer: Jonathan McDowell <noodles@earth.li> */
 	.atag_offset	= 0x100,
-	.map_io		= ams_delta_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= ams_delta_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= ams_delta_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 999789c..c92fd16 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -297,6 +297,39 @@ static struct omap_board_config_kernel fsample_config[] __initdata = {
 
 static void __init omap_fsample_init(void)
 {
+	/* Early, board-dependent init */
+
+	/*
+	 * Hold GSM Reset until needed
+	 */
+	omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
+
+	/*
+	 * UARTs -> done automagically by 8250 driver
+	 */
+
+	/*
+	 * CSx timings, GPIO Mux ... setup
+	 */
+
+	/* Flash: CS0 timings setup */
+	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
+	omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
+
+	/*
+	 * Ethernet support through the debug board
+	 * CS1 timings setup
+	 */
+	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
+	omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
+
+	/*
+	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
+	 * It is used as the Ethernet controller interrupt
+	 */
+	omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF,
+			OMAP7XX_IO_CONF_9);
+
 	fsample_init_smc91x();
 
 	if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
@@ -326,12 +359,6 @@ static void __init omap_fsample_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_fsample_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
 static struct map_desc omap_fsample_io_desc[] __initdata = {
 	{
@@ -350,49 +377,18 @@ static struct map_desc omap_fsample_io_desc[] __initdata = {
 
 static void __init omap_fsample_map_io(void)
 {
-	omap1_map_common_io();
+	omap15xx_map_io();
 	iotable_init(omap_fsample_io_desc,
 		     ARRAY_SIZE(omap_fsample_io_desc));
-
-	/* Early, board-dependent init */
-
-	/*
-	 * Hold GSM Reset until needed
-	 */
-	omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
-
-	/*
-	 * UARTs -> done automagically by 8250 driver
-	 */
-
-	/*
-	 * CSx timings, GPIO Mux ... setup
-	 */
-
-	/* Flash: CS0 timings setup */
-	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
-	omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
-
-	/*
-	 * Ethernet support through the debug board
-	 * CS1 timings setup
-	 */
-	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
-	omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
-
-	/*
-	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
-	 * It is used as the Ethernet controller interrupt
-	 */
-	omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
 }
 
 MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
 /* Maintainer: Brian Swetland <swetland@google.com> */
 	.atag_offset	= 0x100,
 	.map_io		= omap_fsample_map_io,
+	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_fsample_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_fsample_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 23cc9e4..5a9a54d 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -28,12 +28,6 @@
 #include <plat/board.h>
 #include <plat/common.h>
 
-static void __init omap_generic_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 /* assume no Mini-AB port */
 
 #ifdef CONFIG_ARCH_OMAP15XX
@@ -87,17 +81,13 @@ static void __init omap_generic_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_generic_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
 	/* Maintainer: Tony Lindgren <tony@atomide.com> */
 	.atag_offset	= 0x100,
-	.map_io		= omap_generic_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_generic_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_generic_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 6c70c28..c8e1d4f 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -373,12 +373,6 @@ static struct i2c_board_info __initdata h2_i2c_board_info[] = {
 	},
 };
 
-static void __init h2_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static struct omap_usb_config h2_usb_config __initdata = {
 	/* usb1 has a Mini-AB port and external isp1301 transceiver */
 	.otg		= 2,
@@ -454,17 +448,13 @@ static void __init h2_init(void)
 	h2_mmc_init();
 }
 
-static void __init h2_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_H2, "TI-H2")
 	/* Maintainer: Imre Deak <imre.deak@nokia.com> */
 	.atag_offset	= 0x100,
-	.map_io		= h2_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= h2_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= h2_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 8e2b64a..c88e131 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -436,23 +436,13 @@ static void __init h3_init(void)
 	h3_mmc_init();
 }
 
-static void __init h3_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
-static void __init h3_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
 	/* Maintainer: Texas Instruments, Inc. */
 	.atag_offset	= 0x100,
-	.map_io		= h3_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= h3_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= h3_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index e81ead1..e8eedd7 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -500,7 +500,7 @@ static void __init htcherald_lcd_init(void)
 
 static void __init htcherald_map_io(void)
 {
-	omap1_map_common_io();
+	omap7xx_map_io();
 
 	/*
 	 * The LCD panel must be disabled and DMA turned off here, as doing
@@ -601,20 +601,14 @@ static void __init htcherald_init(void)
 #endif
 }
 
-static void __init htcherald_init_irq(void)
-{
-	printk(KERN_INFO "htcherald_init_irq.\n");
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 MACHINE_START(HERALD, "HTC Herald")
 	/* Maintainer: Cory Maccarrone <darkstar6262@gmail.com> */
 	/* Maintainer: wing-linux.sourceforge.net */
 	.atag_offset    = 0x100,
 	.map_io         = htcherald_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq       = htcherald_init_irq,
+	.init_irq       = omap1_init_irq,
 	.init_machine   = htcherald_init,
 	.timer          = &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 8b03459..88cf8ba 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -289,12 +289,6 @@ static void __init innovator_init_smc91x(void)
 	}
 }
 
-static void __init innovator_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 #ifdef CONFIG_ARCH_OMAP15XX
 static struct omap_usb_config innovator1510_usb_config __initdata = {
 	/* for bundled non-standard host and peripheral cables */
@@ -439,30 +433,32 @@ static void __init innovator_init(void)
 	innovator_mmc_init();
 }
 
+/*
+ * REVISIT: Assume 15xx for now, we don't want to do revision check
+ * until later on. The right way to fix this is to set up a different
+ * machine_id for 16xx Innovator, or use device tree.
+ */
 static void __init innovator_map_io(void)
 {
-	omap1_map_common_io();
+	omap15xx_map_io();
 
-#ifdef CONFIG_ARCH_OMAP15XX
-	if (cpu_is_omap1510()) {
-		iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
-		udelay(10);	/* Delay needed for FPGA */
-
-		/* Dump the Innovator FPGA rev early - useful info for support. */
-		printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
-		       fpga_read(OMAP1510_FPGA_REV_HIGH),
-		       fpga_read(OMAP1510_FPGA_REV_LOW),
-		       fpga_read(OMAP1510_FPGA_BOARD_REV));
-	}
-#endif
+	iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
+	udelay(10);	/* Delay needed for FPGA */
+
+	/* Dump the Innovator FPGA rev early - useful info for support. */
+	pr_debug("Innovator FPGA Rev %d.%d Board Rev %d\n",
+			fpga_read(OMAP1510_FPGA_REV_HIGH),
+			fpga_read(OMAP1510_FPGA_REV_LOW),
+			fpga_read(OMAP1510_FPGA_BOARD_REV));
 }
 
 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
 	/* Maintainer: MontaVista Software, Inc. */
 	.atag_offset	= 0x100,
 	.map_io		= innovator_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= innovator_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= innovator_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 8b22be7..6969f2f 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -41,21 +41,6 @@
 
 #define ADS7846_PENDOWN_GPIO	15
 
-static void __init omap_nokia770_init_irq(void)
-{
-	/* On Nokia 770, the SleepX signal is masked with an
-	 * MPUIO line by default.  It has to be unmasked for it
-	 * to become functional */
-
-	/* SleepX mask direction */
-	omap_writew((omap_readw(0xfffb5008) & ~2), 0xfffb5008);
-	/* Unmask SleepX signal */
-	omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
-
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static const unsigned int nokia770_keymap[] = {
 	KEY(1, 0, GROUP_0 | KEY_UP),
 	KEY(2, 0, GROUP_1 | KEY_F5),
@@ -164,6 +149,15 @@ static void __init nokia770_cbus_init(void)
 {
 	int		ret;
 
+	/* On Nokia 770, the SleepX signal is masked with an
+	 * MPUIO line by default.  It has to be unmasked for it
+	 * to become functional */
+
+	/* SleepX mask direction */
+	omap_writew((omap_readw(0xfffb5008) & ~2), 0xfffb5008);
+	/* Unmask SleepX signal */
+	omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
+
 	platform_device_register(&nokia770_cbus_device);
 
 	ret = gpio_request(62, "RETU irq");
@@ -370,16 +364,12 @@ static void __init omap_nokia770_init(void)
 	nokia770_mmc_init();
 }
 
-static void __init omap_nokia770_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(NOKIA770, "Nokia 770")
 	.atag_offset	= 0x100,
-	.map_io		= omap_nokia770_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_nokia770_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_nokia770_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 44b8e93..3e12a69 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -279,12 +279,6 @@ static void __init osk_init_cf(void)
 	irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);
 }
 
-static void __init osk_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static struct omap_usb_config osk_usb_config __initdata = {
 	/* has usb host connector (A) ... for development it can also
 	 * be used, with a NONSTANDARD gender-bending cable/dongle, as
@@ -576,17 +570,13 @@ static void __init osk_init(void)
 	osk_mistral_init();
 }
 
-static void __init osk_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_OSK, "TI-OSK")
 	/* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
 	.atag_offset	= 0x100,
-	.map_io		= osk_map_io,
+	.map_io		= omap16xx_map_io,
+	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= osk_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= osk_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 3d8cd90..4aa2d0e 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -59,12 +59,6 @@
 #define PALMTE_MMC2_GPIO	OMAP_MPUIO(7)
 #define PALMTE_MMC3_GPIO	OMAP_MPUIO(11)
 
-static void __init omap_palmte_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static const unsigned int palmte_keymap[] = {
 	KEY(0, 0, KEY_F1),		/* Calendar */
 	KEY(1, 0, KEY_F2),		/* Contacts */
@@ -269,16 +263,12 @@ static void __init omap_palmte_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_palmte_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
 	.atag_offset	= 0x100,
-	.map_io		= omap_palmte_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_palmte_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_palmte_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index d0eefe8..32254bd 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -263,12 +263,6 @@ static struct spi_board_info __initdata palmtt_boardinfo[] = {
 	}
 };
 
-static void __init omap_palmtt_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static struct omap_usb_config palmtt_usb_config __initdata = {
 	.register_dev	= 1,
 	.hmc_mode	= 0,
@@ -315,16 +309,12 @@ static void __init omap_palmtt_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_palmtt_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
 	.atag_offset	= 0x100,
-	.map_io		= omap_palmtt_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_palmtt_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_palmtt_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 98e79bc..d41478d 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -57,13 +57,6 @@
 #define PALMZ71_SLIDER_GPIO	OMAP_MPUIO(3)
 #define PALMZ71_MMC_IN_GPIO	OMAP_MPUIO(4)
 
-static void __init
-omap_palmz71_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
 static const unsigned int palmz71_keymap[] = {
 	KEY(0, 0, KEY_F1),
 	KEY(1, 0, KEY_F2),
@@ -334,17 +327,12 @@ omap_palmz71_init(void)
 	palmz71_gpio_setup(0);
 }
 
-static void __init
-omap_palmz71_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
 	.atag_offset	= 0x100,
-	.map_io		= omap_palmz71_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_palmz71_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_palmz71_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index ad3a156..7506f34 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -265,6 +265,39 @@ static void __init perseus2_init_smc91x(void)
 
 static void __init omap_perseus2_init(void)
 {
+	/* Early, board-dependent init */
+
+	/*
+	 * Hold GSM Reset until needed
+	 */
+	omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
+
+	/*
+	 * UARTs -> done automagically by 8250 driver
+	 */
+
+	/*
+	 * CSx timings, GPIO Mux ... setup
+	 */
+
+	/* Flash: CS0 timings setup */
+	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
+	omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
+
+	/*
+	 * Ethernet support through the debug board
+	 * CS1 timings setup
+	 */
+	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
+	omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
+
+	/*
+	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
+	 * It is used as the Ethernet controller interrupt
+	 */
+	omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF,
+				OMAP7XX_IO_CONF_9);
+
 	perseus2_init_smc91x();
 
 	if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
@@ -294,11 +327,6 @@ static void __init omap_perseus2_init(void)
 	omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
-static void __init omap_perseus2_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
 static struct map_desc omap_perseus2_io_desc[] __initdata = {
 	{
@@ -311,49 +339,18 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
 
 static void __init omap_perseus2_map_io(void)
 {
-	omap1_map_common_io();
+	omap7xx_map_io();
 	iotable_init(omap_perseus2_io_desc,
 		     ARRAY_SIZE(omap_perseus2_io_desc));
-
-	/* Early, board-dependent init */
-
-	/*
-	 * Hold GSM Reset until needed
-	 */
-	omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
-
-	/*
-	 * UARTs -> done automagically by 8250 driver
-	 */
-
-	/*
-	 * CSx timings, GPIO Mux ... setup
-	 */
-
-	/* Flash: CS0 timings setup */
-	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
-	omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
-
-	/*
-	 * Ethernet support through the debug board
-	 * CS1 timings setup
-	 */
-	omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
-	omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
-
-	/*
-	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
-	 * It is used as the Ethernet controller interrupt
-	 */
-	omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
 }
 
 MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
 	/* Maintainer: Kevin Hilman <kjh@hilman.org> */
 	.atag_offset	= 0x100,
 	.map_io		= omap_perseus2_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_perseus2_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_perseus2_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 602b55c..bdf3b85 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -407,24 +407,13 @@ static void __init omap_sx1_init(void)
 	gpio_direction_output(11, 0);	/*A_SWITCH = 0 */
 	gpio_direction_output(15, 0);	/*A_USB_ON = 0 */
 }
-/*----------------------------------------*/
-static void __init omap_sx1_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-/*----------------------------------------*/
-
-static void __init omap_sx1_map_io(void)
-{
-	omap1_map_common_io();
-}
 
 MACHINE_START(SX1, "OMAP310 based Siemens SX1")
 	.atag_offset	= 0x100,
-	.map_io		= omap_sx1_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= omap_sx1_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= omap_sx1_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 8016515..42e5151 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -159,17 +159,6 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
 static struct omap_board_config_kernel voiceblue_config[] = {
 };
 
-static void __init voiceblue_init_irq(void)
-{
-	omap1_init_common_hw();
-	omap1_init_irq();
-}
-
-static void __init voiceblue_map_io(void)
-{
-	omap1_map_common_io();
-}
-
 #define MACHINE_PANICED		1
 #define MACHINE_REBOOTING	2
 #define MACHINE_REBOOT		4
@@ -302,9 +291,10 @@ static void __init voiceblue_init(void)
 MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
 	/* Maintainer: Ladislav Michl <michl@2n.cz> */
 	.atag_offset	= 0x100,
-	.map_io		= voiceblue_map_io,
+	.map_io		= omap15xx_map_io,
+	.init_early     = omap1_init_early,
 	.reserve	= omap_reserve,
-	.init_irq	= voiceblue_init_irq,
+	.init_irq	= omap1_init_irq,
 	.init_machine	= voiceblue_init,
 	.timer		= &omap1_timer,
 MACHINE_END
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 870886a..a16aab7 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -85,50 +85,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();
+}
 
 #if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
-	if (cpu_is_omap7xx()) {
-		iotable_init(omap7xx_io_desc, ARRAY_SIZE(omap7xx_io_desc));
-	}
+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();
+#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".
 	 */
@@ -138,8 +132,8 @@ void __init omap1_init_common_hw(void)
 	/* Must init clocks early to assure that timer interrupt works
 	 */
 	omap1_clk_init();
-
 	omap1_mux_init();
+	omap_sram_init();
 }
 
 /*
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h
index 6591875..c0c7850 100644
--- a/arch/arm/plat-omap/include/plat/io.h
+++ b/arch/arm/plat-omap/include/plat/io.h
@@ -256,8 +256,31 @@ extern void omap_writel(u32 v, u32 pa);
 
 struct omap_sdrc_params;
 
-extern void omap1_map_common_io(void);
-extern void omap1_init_common_hw(void);
+#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
+void omap7xx_map_io(void);
+#else
+static inline void omap_map_io(void)
+{
+}
+#endif
+
+#ifdef CONFIG_ARCH_OMAP15XX
+void omap15xx_map_io(void);
+#else
+static inline void omap15xx_map_io(void)
+{
+}
+#endif
+
+#ifdef CONFIG_ARCH_OMAP16XX
+void omap16xx_map_io(void);
+#else
+static inline void omap16xx_map_io(void)
+{
+}
+#endif
+
+void omap1_init_early(void);
 
 #ifdef CONFIG_SOC_OMAP2420
 extern void omap242x_map_common_io(void);

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* Re: [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
  2011-10-05  1:07     ` Nicolas Pitre
@ 2011-10-05 22:13       ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05 22:13 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: linux-arm-kernel, linux-omap

* Nicolas Pitre <nico@fluxnic.net> [111004 17:34]:
> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> 
> > This allows us to remove omap hacks for map_io.
> > 
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Nice cleanup.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

This one needed minor changes for the omap1 omap_sram_init
call. Updated patch below, still assuming I have your ack
for this one too.

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Tue, 4 Oct 2011 13:52:57 -0700
Subject: [PATCH] ARM: OMAP: Map SRAM later on with ioremap_exec()

This allows us to remove omap hacks for map_io.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 36f26c3..38e1142 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -21,6 +21,7 @@
 #include <mach/hardware.h>
 #include <asm/mach/map.h>
 
+#include <plat/common.h>
 #include <plat/tc.h>
 #include <plat/board.h>
 #include <plat/mux.h>
@@ -291,6 +292,8 @@ static int __init omap1_init_devices(void)
 	if (!cpu_class_is_omap1())
 		return -ENODEV;
 
+	omap_sram_init();
+
 	/* please keep these calls, and their implementations above,
 	 * in alphabetical order so they're easier to sort through.
 	 */
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index a16aab7..8140a4e 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -21,7 +21,6 @@
 #include "clock.h"
 
 extern void omap_check_revision(void);
-extern void omap_sram_init(void);
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -133,7 +132,6 @@ void omap1_init_early(void)
 	 */
 	omap1_clk_init();
 	omap1_mux_init();
-	omap_sram_init();
 }
 
 /*
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 31c5f4d..fec50d8 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -35,8 +35,8 @@
 #include "clock2xxx.h"
 #include "clock3xxx.h"
 #include "clock44xx.h"
-#include "io.h"
 
+#include <plat/common.h>
 #include <plat/omap-pm.h>
 #include "voltage.h"
 #include "powerdomain.h"
@@ -240,22 +240,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
 };
 #endif
 
-static void __init _omap2_map_common_io(void)
-{
-	/* 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();
-}
-
 #ifdef CONFIG_SOC_OMAP2420
 void __init omap242x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -264,7 +253,6 @@ void __init omap243x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -272,7 +260,6 @@ void __init omap243x_map_common_io(void)
 void __init omap34xx_map_common_io(void)
 {
 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -280,7 +267,6 @@ void __init omap34xx_map_common_io(void)
 void __init omapti816x_map_common_io(void)
 {
 	iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -288,7 +274,6 @@ void __init omapti816x_map_common_io(void)
 void __init omap44xx_map_common_io(void)
 {
 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -337,7 +322,6 @@ void __iomem *omap_irq_base;
 static void __init omap_common_init_early(void)
 {
 	omap2_check_revision();
-	omap_sram_init();
 		omap2xxx_voltagedomains_init();
 		omap2xxx_voltagedomains_init();
 		omap3xxx_voltagedomains_init();
@@ -453,11 +437,12 @@ void __init omap4430_init_early(void)
 void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
 				      struct omap_sdrc_params *sdrc_cs1)
 {
+	omap_sram_init();
+
 	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
 		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 		_omap2_init_reprogram_sdrc();
 	}
-
 }
 
 /*
diff --git a/arch/arm/mach-omap2/io.h b/arch/arm/mach-omap2/io.h
index fd230c6..e69de29 100644
--- a/arch/arm/mach-omap2/io.h
+++ b/arch/arm/mach-omap2/io.h
@@ -1,7 +0,0 @@
-
-#ifndef __MACH_OMAP2_IO_H__
-#define __MACH_OMAP2_IO_H__
-
-extern int __init omap_sram_init(void);
-
-#endif /*  __MACH_OMAP2_IO_H__ */
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 5eac355..ed85720 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -55,6 +55,8 @@ void am35xx_init_early(void);
 void ti816x_init_early(void);
 void omap4430_init_early(void);
 
+void omap_sram_init(void);
+
 /*
  * IO bases for various OMAP processors
  * Except the tap base, rest all the io bases
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 3c8aa44..8b28664 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -38,16 +38,9 @@
 #endif
 
 #define OMAP1_SRAM_PA		0x20000000
-#define OMAP1_SRAM_VA		VMALLOC_END
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
-#define OMAP2_SRAM_VA		0xfe400000
-#define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
-#define OMAP3_SRAM_VA           0xfe400000
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
-#define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
-#define OMAP4_SRAM_VA		0xfe400000
 #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
-#define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
 
 #if defined(CONFIG_ARCH_OMAP2PLUS)
 #define SRAM_BOOTLOADER_SZ	0x00
@@ -70,9 +63,9 @@
 #define ROUND_DOWN(value,boundary)	((value) & (~((boundary)-1)))
 
 static unsigned long omap_sram_start;
-static unsigned long omap_sram_base;
+static void __iomem *omap_sram_base;
 static unsigned long omap_sram_size;
-static unsigned long omap_sram_ceil;
+static void __iomem *omap_sram_ceil;
 
 /*
  * Depending on the target RAMFS firewall setup, the public usable amount of
@@ -112,7 +105,6 @@ static void __init omap_detect_sram(void)
 	if (cpu_class_is_omap2()) {
 		if (is_sram_locked()) {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_PUB_VA;
 				omap_sram_start = OMAP3_SRAM_PUB_PA;
 				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
 				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
@@ -121,25 +113,20 @@ static void __init omap_detect_sram(void)
 					omap_sram_size = 0x8000; /* 32K */
 				}
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_PUB_VA;
 				omap_sram_start = OMAP4_SRAM_PUB_PA;
 				omap_sram_size = 0xa000; /* 40K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_PUB_VA;
 				omap_sram_start = OMAP2_SRAM_PUB_PA;
 				omap_sram_size = 0x800; /* 2K */
 			}
 		} else {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_VA;
 				omap_sram_start = OMAP3_SRAM_PA;
 				omap_sram_size = 0x10000; /* 64K */
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_VA;
 				omap_sram_start = OMAP4_SRAM_PA;
 				omap_sram_size = 0xe000; /* 56K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_VA;
 				omap_sram_start = OMAP2_SRAM_PA;
 				if (cpu_is_omap242x())
 					omap_sram_size = 0xa0000; /* 640K */
@@ -148,7 +135,6 @@ static void __init omap_detect_sram(void)
 			}
 		}
 	} else {
-		omap_sram_base = OMAP1_SRAM_VA;
 		omap_sram_start = OMAP1_SRAM_PA;
 
 		if (cpu_is_omap7xx())
@@ -165,24 +151,14 @@ static void __init omap_detect_sram(void)
 			omap_sram_size = 0x4000;
 		}
 	}
-
-	omap_sram_ceil = omap_sram_base + omap_sram_size;
 }
 
-static struct map_desc omap_sram_io_desc[] __initdata = {
-	{	/* .length gets filled in at runtime */
-		.virtual	= OMAP1_SRAM_VA,
-		.pfn		= __phys_to_pfn(OMAP1_SRAM_PA),
-		.type		= MT_MEMORY
-	}
-};
-
 /*
  * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
  */
 static void __init omap_map_sram(void)
 {
-	unsigned long base;
+	int cached = 1;
 
 	if (omap_sram_size == 0)
 		return;
@@ -195,28 +171,18 @@ static void __init omap_map_sram(void)
 		 * the ARM may attempt to write cache lines back to SDRAM
 		 * which will cause the system to hang.
 		 */
-		omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED;
+		cached = 0;
 	}
 
-	omap_sram_io_desc[0].virtual = omap_sram_base;
-	base = omap_sram_start;
-	base = ROUND_DOWN(base, PAGE_SIZE);
-	omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
-	omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE);
-	iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
-
-	pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
-		(long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
-		omap_sram_io_desc[0].virtual,
-		omap_sram_io_desc[0].length);
+	omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
+	omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
+						cached);
+	if (!omap_sram_base) {
+		pr_err("SRAM: Could not map\n");
+		return;
+	}
 
-	/*
-	 * 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();
+	omap_sram_ceil = omap_sram_base + omap_sram_size;
 
 	/*
 	 * Looks like we need to preserve some bootloader code at the
@@ -235,13 +201,18 @@ static void __init omap_map_sram(void)
  */
 void *omap_sram_push_address(unsigned long size)
 {
-	if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
+	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
+
+	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
+
+	if (size > available) {
 		pr_err("Not enough space in SRAM\n");
 		return NULL;
 	}
 
-	omap_sram_ceil -= size;
-	omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
+	new_ceil -= size;
+	new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
+	omap_sram_ceil = IOMEM(new_ceil);
 
 	return (void *)omap_sram_ceil;
 }

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
@ 2011-10-05 22:13       ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05 22:13 UTC (permalink / raw)
  To: linux-arm-kernel

* Nicolas Pitre <nico@fluxnic.net> [111004 17:34]:
> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> 
> > This allows us to remove omap hacks for map_io.
> > 
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Nice cleanup.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

This one needed minor changes for the omap1 omap_sram_init
call. Updated patch below, still assuming I have your ack
for this one too.

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Tue, 4 Oct 2011 13:52:57 -0700
Subject: [PATCH] ARM: OMAP: Map SRAM later on with ioremap_exec()

This allows us to remove omap hacks for map_io.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 36f26c3..38e1142 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -21,6 +21,7 @@
 #include <mach/hardware.h>
 #include <asm/mach/map.h>
 
+#include <plat/common.h>
 #include <plat/tc.h>
 #include <plat/board.h>
 #include <plat/mux.h>
@@ -291,6 +292,8 @@ static int __init omap1_init_devices(void)
 	if (!cpu_class_is_omap1())
 		return -ENODEV;
 
+	omap_sram_init();
+
 	/* please keep these calls, and their implementations above,
 	 * in alphabetical order so they're easier to sort through.
 	 */
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index a16aab7..8140a4e 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -21,7 +21,6 @@
 #include "clock.h"
 
 extern void omap_check_revision(void);
-extern void omap_sram_init(void);
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -133,7 +132,6 @@ void omap1_init_early(void)
 	 */
 	omap1_clk_init();
 	omap1_mux_init();
-	omap_sram_init();
 }
 
 /*
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 31c5f4d..fec50d8 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -35,8 +35,8 @@
 #include "clock2xxx.h"
 #include "clock3xxx.h"
 #include "clock44xx.h"
-#include "io.h"
 
+#include <plat/common.h>
 #include <plat/omap-pm.h>
 #include "voltage.h"
 #include "powerdomain.h"
@@ -240,22 +240,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
 };
 #endif
 
-static void __init _omap2_map_common_io(void)
-{
-	/* 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();
-}
-
 #ifdef CONFIG_SOC_OMAP2420
 void __init omap242x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -264,7 +253,6 @@ void __init omap243x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -272,7 +260,6 @@ void __init omap243x_map_common_io(void)
 void __init omap34xx_map_common_io(void)
 {
 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -280,7 +267,6 @@ void __init omap34xx_map_common_io(void)
 void __init omapti816x_map_common_io(void)
 {
 	iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -288,7 +274,6 @@ void __init omapti816x_map_common_io(void)
 void __init omap44xx_map_common_io(void)
 {
 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -337,7 +322,6 @@ void __iomem *omap_irq_base;
 static void __init omap_common_init_early(void)
 {
 	omap2_check_revision();
-	omap_sram_init();
 		omap2xxx_voltagedomains_init();
 		omap2xxx_voltagedomains_init();
 		omap3xxx_voltagedomains_init();
@@ -453,11 +437,12 @@ void __init omap4430_init_early(void)
 void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
 				      struct omap_sdrc_params *sdrc_cs1)
 {
+	omap_sram_init();
+
 	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
 		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 		_omap2_init_reprogram_sdrc();
 	}
-
 }
 
 /*
diff --git a/arch/arm/mach-omap2/io.h b/arch/arm/mach-omap2/io.h
index fd230c6..e69de29 100644
--- a/arch/arm/mach-omap2/io.h
+++ b/arch/arm/mach-omap2/io.h
@@ -1,7 +0,0 @@
-
-#ifndef __MACH_OMAP2_IO_H__
-#define __MACH_OMAP2_IO_H__
-
-extern int __init omap_sram_init(void);
-
-#endif /*  __MACH_OMAP2_IO_H__ */
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 5eac355..ed85720 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -55,6 +55,8 @@ void am35xx_init_early(void);
 void ti816x_init_early(void);
 void omap4430_init_early(void);
 
+void omap_sram_init(void);
+
 /*
  * IO bases for various OMAP processors
  * Except the tap base, rest all the io bases
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 3c8aa44..8b28664 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -38,16 +38,9 @@
 #endif
 
 #define OMAP1_SRAM_PA		0x20000000
-#define OMAP1_SRAM_VA		VMALLOC_END
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
-#define OMAP2_SRAM_VA		0xfe400000
-#define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
-#define OMAP3_SRAM_VA           0xfe400000
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
-#define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
-#define OMAP4_SRAM_VA		0xfe400000
 #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
-#define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
 
 #if defined(CONFIG_ARCH_OMAP2PLUS)
 #define SRAM_BOOTLOADER_SZ	0x00
@@ -70,9 +63,9 @@
 #define ROUND_DOWN(value,boundary)	((value) & (~((boundary)-1)))
 
 static unsigned long omap_sram_start;
-static unsigned long omap_sram_base;
+static void __iomem *omap_sram_base;
 static unsigned long omap_sram_size;
-static unsigned long omap_sram_ceil;
+static void __iomem *omap_sram_ceil;
 
 /*
  * Depending on the target RAMFS firewall setup, the public usable amount of
@@ -112,7 +105,6 @@ static void __init omap_detect_sram(void)
 	if (cpu_class_is_omap2()) {
 		if (is_sram_locked()) {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_PUB_VA;
 				omap_sram_start = OMAP3_SRAM_PUB_PA;
 				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
 				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
@@ -121,25 +113,20 @@ static void __init omap_detect_sram(void)
 					omap_sram_size = 0x8000; /* 32K */
 				}
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_PUB_VA;
 				omap_sram_start = OMAP4_SRAM_PUB_PA;
 				omap_sram_size = 0xa000; /* 40K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_PUB_VA;
 				omap_sram_start = OMAP2_SRAM_PUB_PA;
 				omap_sram_size = 0x800; /* 2K */
 			}
 		} else {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_VA;
 				omap_sram_start = OMAP3_SRAM_PA;
 				omap_sram_size = 0x10000; /* 64K */
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_VA;
 				omap_sram_start = OMAP4_SRAM_PA;
 				omap_sram_size = 0xe000; /* 56K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_VA;
 				omap_sram_start = OMAP2_SRAM_PA;
 				if (cpu_is_omap242x())
 					omap_sram_size = 0xa0000; /* 640K */
@@ -148,7 +135,6 @@ static void __init omap_detect_sram(void)
 			}
 		}
 	} else {
-		omap_sram_base = OMAP1_SRAM_VA;
 		omap_sram_start = OMAP1_SRAM_PA;
 
 		if (cpu_is_omap7xx())
@@ -165,24 +151,14 @@ static void __init omap_detect_sram(void)
 			omap_sram_size = 0x4000;
 		}
 	}
-
-	omap_sram_ceil = omap_sram_base + omap_sram_size;
 }
 
-static struct map_desc omap_sram_io_desc[] __initdata = {
-	{	/* .length gets filled in at runtime */
-		.virtual	= OMAP1_SRAM_VA,
-		.pfn		= __phys_to_pfn(OMAP1_SRAM_PA),
-		.type		= MT_MEMORY
-	}
-};
-
 /*
  * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
  */
 static void __init omap_map_sram(void)
 {
-	unsigned long base;
+	int cached = 1;
 
 	if (omap_sram_size == 0)
 		return;
@@ -195,28 +171,18 @@ static void __init omap_map_sram(void)
 		 * the ARM may attempt to write cache lines back to SDRAM
 		 * which will cause the system to hang.
 		 */
-		omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED;
+		cached = 0;
 	}
 
-	omap_sram_io_desc[0].virtual = omap_sram_base;
-	base = omap_sram_start;
-	base = ROUND_DOWN(base, PAGE_SIZE);
-	omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
-	omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE);
-	iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
-
-	pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
-		(long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
-		omap_sram_io_desc[0].virtual,
-		omap_sram_io_desc[0].length);
+	omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
+	omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
+						cached);
+	if (!omap_sram_base) {
+		pr_err("SRAM: Could not map\n");
+		return;
+	}
 
-	/*
-	 * 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();
+	omap_sram_ceil = omap_sram_base + omap_sram_size;
 
 	/*
 	 * Looks like we need to preserve some bootloader code at the
@@ -235,13 +201,18 @@ static void __init omap_map_sram(void)
  */
 void *omap_sram_push_address(unsigned long size)
 {
-	if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
+	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
+
+	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
+
+	if (size > available) {
 		pr_err("Not enough space in SRAM\n");
 		return NULL;
 	}
 
-	omap_sram_ceil -= size;
-	omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
+	new_ceil -= size;
+	new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
+	omap_sram_ceil = IOMEM(new_ceil);
 
 	return (void *)omap_sram_ceil;
 }

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* Re: [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
  2011-10-05  6:45     ` Tomi Valkeinen
@ 2011-10-05 22:41       ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05 22:41 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-arm-kernel, linux-omap

* Tomi Valkeinen <tomi.valkeinen@ti.com> [111004 23:11]:
> On Tue, 2011-10-04 at 17:45 -0700, Tony Lindgren wrote:
> > This assumes fixed mappings which will not work once we move
> > to use ioremap_exec(). It seems that these are currently
> > not in use, or in use for some out of tree corner cases.
> > 
> > If SRAM support for framebuffer is wanted, it should be done
> > with ioremap in the driver.
> > 
> > Note that further removal of the code can now be done,
> > but that can be done seprately by the driver maintainers.
> > 
> > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Looks good to me. I have similar changes in my working branch for omapfb
> cleanup.
> 
> Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Thanks. FYI, looks like there's a warning in display.c:

arch/arm/mach-omap2/display.c: In function 'omap_display_init':
arch/arm/mach-omap2/display.c:93: warning: assignment from incompatible pointer type

Do you have a patch for that already?

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
@ 2011-10-05 22:41       ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-05 22:41 UTC (permalink / raw)
  To: linux-arm-kernel

* Tomi Valkeinen <tomi.valkeinen@ti.com> [111004 23:11]:
> On Tue, 2011-10-04 at 17:45 -0700, Tony Lindgren wrote:
> > This assumes fixed mappings which will not work once we move
> > to use ioremap_exec(). It seems that these are currently
> > not in use, or in use for some out of tree corner cases.
> > 
> > If SRAM support for framebuffer is wanted, it should be done
> > with ioremap in the driver.
> > 
> > Note that further removal of the code can now be done,
> > but that can be done seprately by the driver maintainers.
> > 
> > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Looks good to me. I have similar changes in my working branch for omapfb
> cleanup.
> 
> Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

Thanks. FYI, looks like there's a warning in display.c:

arch/arm/mach-omap2/display.c: In function 'omap_display_init':
arch/arm/mach-omap2/display.c:93: warning: assignment from incompatible pointer type

Do you have a patch for that already?

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
  2011-10-05 22:13       ` Tony Lindgren
@ 2011-10-05 23:01         ` Nicolas Pitre
  -1 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-05 23:01 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

On Wed, 5 Oct 2011, Tony Lindgren wrote:

> * Nicolas Pitre <nico@fluxnic.net> [111004 17:34]:
> > On Tue, 4 Oct 2011, Tony Lindgren wrote:
> > 
> > > This allows us to remove omap hacks for map_io.
> > > 
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > Nice cleanup.
> > 
> > Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> This one needed minor changes for the omap1 omap_sram_init
> call. Updated patch below, still assuming I have your ack
> for this one too.

Sure.


Nicolas

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
@ 2011-10-05 23:01         ` Nicolas Pitre
  0 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-05 23:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 5 Oct 2011, Tony Lindgren wrote:

> * Nicolas Pitre <nico@fluxnic.net> [111004 17:34]:
> > On Tue, 4 Oct 2011, Tony Lindgren wrote:
> > 
> > > This allows us to remove omap hacks for map_io.
> > > 
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > Nice cleanup.
> > 
> > Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> This one needed minor changes for the omap1 omap_sram_init
> call. Updated patch below, still assuming I have your ack
> for this one too.

Sure.


Nicolas

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
  2011-10-05  1:51     ` Nicolas Pitre
@ 2011-10-06  1:36       ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-06  1:36 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: linux-arm-kernel, linux-omap

* Nicolas Pitre <nico@fluxnic.net> [111004 18:17]:
> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> 
> > Otherwise we can't do generic map_io as we currently rely on
> > static mappings that work only because of arch_ioremap.
> > 
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> That's great.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

Here's an updated version with all the early ioremap
access converted to use L3/L4_IO_ADDRESS macros. Some
of this may not be needed after generic map_io, but until
then we can't use ioremap until in init_early after the
SoC detection is done.

Regards,

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Tue, 4 Oct 2011 18:17:41 -0700
Subject: [PATCH] ARM: OMAP: Move set_globals initialization to happen in init_early

Otherwise we can't do generic map_io as we currently rely on
static mappings that work only because of arch_ioremap.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index 981ca00..b0a16d2 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -37,7 +37,6 @@ static void __init ti8168_evm_init(void)
 
 static void __init ti8168_evm_map_io(void)
 {
-	omap2_set_globals_ti816x();
 	omapti816x_map_common_io();
 }
 
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index de61f15..110e5b9 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -45,11 +45,11 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 static struct omap_globals omap242x_globals = {
 	.class	= OMAP242X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x48014000),
-	.sdrc	= OMAP2420_SDRC_BASE,
-	.sms	= OMAP2420_SMS_BASE,
-	.ctrl	= OMAP242X_CTRL_BASE,
-	.prm	= OMAP2420_PRM_BASE,
-	.cm	= OMAP2420_CM_BASE,
+	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
+	.sms	= OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
+	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
+	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
+	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
 };
 
 void __init omap2_set_globals_242x(void)
@@ -59,7 +59,6 @@ void __init omap2_set_globals_242x(void)
 
 void __init omap242x_map_io(void)
 {
-	omap2_set_globals_242x();
 	omap242x_map_common_io();
 }
 #endif
@@ -69,11 +68,11 @@ void __init omap242x_map_io(void)
 static struct omap_globals omap243x_globals = {
 	.class	= OMAP243X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x4900a000),
-	.sdrc	= OMAP243X_SDRC_BASE,
-	.sms	= OMAP243X_SMS_BASE,
-	.ctrl	= OMAP243X_CTRL_BASE,
-	.prm	= OMAP2430_PRM_BASE,
-	.cm	= OMAP2430_CM_BASE,
+	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
+	.sms	= OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
+	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
+	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
+	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
 };
 
 void __init omap2_set_globals_243x(void)
@@ -83,7 +82,6 @@ void __init omap2_set_globals_243x(void)
 
 void __init omap243x_map_io(void)
 {
-	omap2_set_globals_243x();
 	omap243x_map_common_io();
 }
 #endif
@@ -93,11 +91,11 @@ void __init omap243x_map_io(void)
 static struct omap_globals omap3_globals = {
 	.class	= OMAP343X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x4830A000),
-	.sdrc	= OMAP343X_SDRC_BASE,
-	.sms	= OMAP343X_SMS_BASE,
-	.ctrl	= OMAP343X_CTRL_BASE,
-	.prm	= OMAP3430_PRM_BASE,
-	.cm	= OMAP3430_CM_BASE,
+	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
+	.sms	= OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
+	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
+	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
+	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
 };
 
 void __init omap2_set_globals_3xxx(void)
@@ -107,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
 
 void __init omap3_map_io(void)
 {
-	omap2_set_globals_3xxx();
 	omap34xx_map_common_io();
 }
 
@@ -122,9 +119,9 @@ void __init omap3_map_io(void)
 static struct omap_globals ti816x_globals = {
 	.class  = OMAP343X_CLASS,
 	.tap    = OMAP2_L4_IO_ADDRESS(TI816X_TAP_BASE),
-	.ctrl   = TI816X_CTRL_BASE,
-	.prm    = TI816X_PRCM_BASE,
-	.cm     = TI816X_PRCM_BASE,
+	.ctrl   = OMAP2_L4_IO_ADDRESS(TI816X_CTRL_BASE),
+	.prm    = OMAP2_L4_IO_ADDRESS(TI816X_PRCM_BASE),
+	.cm     = OMAP2_L4_IO_ADDRESS(TI816X_PRCM_BASE),
 };
 
 void __init omap2_set_globals_ti816x(void)
@@ -137,11 +134,11 @@ void __init omap2_set_globals_ti816x(void)
 static struct omap_globals omap4_globals = {
 	.class	= OMAP443X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-	.ctrl	= OMAP443X_SCM_BASE,
-	.ctrl_pad	= OMAP443X_CTRL_BASE,
-	.prm	= OMAP4430_PRM_BASE,
-	.cm	= OMAP4430_CM_BASE,
-	.cm2	= OMAP4430_CM2_BASE,
+	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
+	.ctrl_pad	= OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
+	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
+	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
+	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
 };
 
 void __init omap2_set_globals_443x(void)
@@ -153,7 +150,6 @@ void __init omap2_set_globals_443x(void)
 
 void __init omap4_map_io(void)
 {
-	omap2_set_globals_443x();
 	omap44xx_map_common_io();
 }
 #endif
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index aab884f..e34d27f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -149,17 +149,11 @@ static struct omap3_control_regs control_context;
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
 {
-	/* Static mapping, never released */
-	if (omap2_globals->ctrl) {
-		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
-		WARN_ON(!omap2_ctrl_base);
-	}
+	if (omap2_globals->ctrl)
+		omap2_ctrl_base = omap2_globals->ctrl;
 
-	/* Static mapping, never released */
-	if (omap2_globals->ctrl_pad) {
-		omap4_ctrl_pad_base = ioremap(omap2_globals->ctrl_pad, SZ_4K);
-		WARN_ON(!omap4_ctrl_pad_base);
-	}
+	if (omap2_globals->ctrl_pad)
+		omap4_ctrl_pad_base = omap2_globals->ctrl_pad;
 }
 
 void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index b42bbb8..d5caac3 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -44,6 +44,7 @@
 #include "clockdomain.h"
 #include <plat/omap_hwmod.h>
 #include <plat/multi.h>
+#include <plat/common.h>
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -359,6 +360,7 @@ static void __init omap_hwmod_init_postsetup(void)
 
 void __init omap2420_init_early(void)
 {
+	omap2_set_globals_242x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap242x_powerdomains_init();
@@ -370,6 +372,7 @@ void __init omap2420_init_early(void)
 
 void __init omap2430_init_early(void)
 {
+	omap2_set_globals_243x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap243x_powerdomains_init();
@@ -385,6 +388,7 @@ void __init omap2430_init_early(void)
  */
 void __init omap3_init_early(void)
 {
+	omap2_set_globals_3xxx();
 	omap_common_init_early();
 	omap3xxx_voltagedomains_init();
 	omap3xxx_powerdomains_init();
@@ -416,11 +420,19 @@ void __init am35xx_init_early(void)
 
 void __init ti816x_init_early(void)
 {
-	omap3_init_early();
+	omap2_set_globals_ti816x();
+	omap_common_init_early();
+	omap3xxx_voltagedomains_init();
+	omap3xxx_powerdomains_init();
+	omap3xxx_clockdomains_init();
+	omap3xxx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap3xxx_clk_init();
 }
 
 void __init omap4430_init_early(void)
 {
+	omap2_set_globals_443x();
 	omap_common_init_early();
 	omap44xx_voltagedomains_init();
 	omap44xx_powerdomains_init();
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index ce65e93..11e25a4 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -102,8 +102,11 @@ void __init smp_init_cpus(void)
 {
 	unsigned int i, ncores;
 
-	/* Never released */
-	scu_base = ioremap(OMAP44XX_SCU_BASE, SZ_256);
+	/*
+	 * Currently we can't call ioremap here because
+	 * SoC detection won't work until after init_early.
+	 */
+	scu_base =  OMAP2_L4_IO_ADDRESS(OMAP44XX_SCU_BASE);
 	BUG_ON(!scu_base);
 
 	ncores = scu_get_core_count(scu_base);
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 2e40a5c..8db5f03 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -151,17 +151,10 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
 
 void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
 {
-	/* Static mapping, never released */
-	if (omap2_globals->prm) {
-		prm_base = ioremap(omap2_globals->prm, SZ_8K);
-		WARN_ON(!prm_base);
-	}
-	if (omap2_globals->cm) {
-		cm_base = ioremap(omap2_globals->cm, SZ_8K);
-		WARN_ON(!cm_base);
-	}
-	if (omap2_globals->cm2) {
-		cm2_base = ioremap(omap2_globals->cm2, SZ_8K);
-		WARN_ON(!cm2_base);
-	}
+	if (omap2_globals->prm)
+		prm_base = omap2_globals->prm;
+	if (omap2_globals->cm)
+		cm_base = omap2_globals->cm;
+	if (omap2_globals->cm2)
+		cm2_base = omap2_globals->cm2;
 }
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index da6f3a6..8f27828 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -117,15 +117,10 @@ int omap2_sdrc_get_params(unsigned long r,
 
 void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
 {
-	/* Static mapping, never released */
-	if (omap2_globals->sdrc) {
-		omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K);
-		WARN_ON(!omap2_sdrc_base);
-	}
-	if (omap2_globals->sms) {
-		omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K);
-		WARN_ON(!omap2_sms_base);
-	}
+	if (omap2_globals->sdrc)
+		omap2_sdrc_base = omap2_globals->sdrc;
+	if (omap2_globals->sms)
+		omap2_sms_base = omap2_globals->sms;
 }
 
 /**

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
@ 2011-10-06  1:36       ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-06  1:36 UTC (permalink / raw)
  To: linux-arm-kernel

* Nicolas Pitre <nico@fluxnic.net> [111004 18:17]:
> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> 
> > Otherwise we can't do generic map_io as we currently rely on
> > static mappings that work only because of arch_ioremap.
> > 
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> That's great.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

Here's an updated version with all the early ioremap
access converted to use L3/L4_IO_ADDRESS macros. Some
of this may not be needed after generic map_io, but until
then we can't use ioremap until in init_early after the
SoC detection is done.

Regards,

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Tue, 4 Oct 2011 18:17:41 -0700
Subject: [PATCH] ARM: OMAP: Move set_globals initialization to happen in init_early

Otherwise we can't do generic map_io as we currently rely on
static mappings that work only because of arch_ioremap.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index 981ca00..b0a16d2 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -37,7 +37,6 @@ static void __init ti8168_evm_init(void)
 
 static void __init ti8168_evm_map_io(void)
 {
-	omap2_set_globals_ti816x();
 	omapti816x_map_common_io();
 }
 
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index de61f15..110e5b9 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -45,11 +45,11 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 static struct omap_globals omap242x_globals = {
 	.class	= OMAP242X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x48014000),
-	.sdrc	= OMAP2420_SDRC_BASE,
-	.sms	= OMAP2420_SMS_BASE,
-	.ctrl	= OMAP242X_CTRL_BASE,
-	.prm	= OMAP2420_PRM_BASE,
-	.cm	= OMAP2420_CM_BASE,
+	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
+	.sms	= OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
+	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
+	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
+	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
 };
 
 void __init omap2_set_globals_242x(void)
@@ -59,7 +59,6 @@ void __init omap2_set_globals_242x(void)
 
 void __init omap242x_map_io(void)
 {
-	omap2_set_globals_242x();
 	omap242x_map_common_io();
 }
 #endif
@@ -69,11 +68,11 @@ void __init omap242x_map_io(void)
 static struct omap_globals omap243x_globals = {
 	.class	= OMAP243X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x4900a000),
-	.sdrc	= OMAP243X_SDRC_BASE,
-	.sms	= OMAP243X_SMS_BASE,
-	.ctrl	= OMAP243X_CTRL_BASE,
-	.prm	= OMAP2430_PRM_BASE,
-	.cm	= OMAP2430_CM_BASE,
+	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
+	.sms	= OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
+	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
+	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
+	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
 };
 
 void __init omap2_set_globals_243x(void)
@@ -83,7 +82,6 @@ void __init omap2_set_globals_243x(void)
 
 void __init omap243x_map_io(void)
 {
-	omap2_set_globals_243x();
 	omap243x_map_common_io();
 }
 #endif
@@ -93,11 +91,11 @@ void __init omap243x_map_io(void)
 static struct omap_globals omap3_globals = {
 	.class	= OMAP343X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(0x4830A000),
-	.sdrc	= OMAP343X_SDRC_BASE,
-	.sms	= OMAP343X_SMS_BASE,
-	.ctrl	= OMAP343X_CTRL_BASE,
-	.prm	= OMAP3430_PRM_BASE,
-	.cm	= OMAP3430_CM_BASE,
+	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
+	.sms	= OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
+	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
+	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
+	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
 };
 
 void __init omap2_set_globals_3xxx(void)
@@ -107,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
 
 void __init omap3_map_io(void)
 {
-	omap2_set_globals_3xxx();
 	omap34xx_map_common_io();
 }
 
@@ -122,9 +119,9 @@ void __init omap3_map_io(void)
 static struct omap_globals ti816x_globals = {
 	.class  = OMAP343X_CLASS,
 	.tap    = OMAP2_L4_IO_ADDRESS(TI816X_TAP_BASE),
-	.ctrl   = TI816X_CTRL_BASE,
-	.prm    = TI816X_PRCM_BASE,
-	.cm     = TI816X_PRCM_BASE,
+	.ctrl   = OMAP2_L4_IO_ADDRESS(TI816X_CTRL_BASE),
+	.prm    = OMAP2_L4_IO_ADDRESS(TI816X_PRCM_BASE),
+	.cm     = OMAP2_L4_IO_ADDRESS(TI816X_PRCM_BASE),
 };
 
 void __init omap2_set_globals_ti816x(void)
@@ -137,11 +134,11 @@ void __init omap2_set_globals_ti816x(void)
 static struct omap_globals omap4_globals = {
 	.class	= OMAP443X_CLASS,
 	.tap	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
-	.ctrl	= OMAP443X_SCM_BASE,
-	.ctrl_pad	= OMAP443X_CTRL_BASE,
-	.prm	= OMAP4430_PRM_BASE,
-	.cm	= OMAP4430_CM_BASE,
-	.cm2	= OMAP4430_CM2_BASE,
+	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
+	.ctrl_pad	= OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
+	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
+	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
+	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
 };
 
 void __init omap2_set_globals_443x(void)
@@ -153,7 +150,6 @@ void __init omap2_set_globals_443x(void)
 
 void __init omap4_map_io(void)
 {
-	omap2_set_globals_443x();
 	omap44xx_map_common_io();
 }
 #endif
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index aab884f..e34d27f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -149,17 +149,11 @@ static struct omap3_control_regs control_context;
 
 void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
 {
-	/* Static mapping, never released */
-	if (omap2_globals->ctrl) {
-		omap2_ctrl_base = ioremap(omap2_globals->ctrl, SZ_4K);
-		WARN_ON(!omap2_ctrl_base);
-	}
+	if (omap2_globals->ctrl)
+		omap2_ctrl_base = omap2_globals->ctrl;
 
-	/* Static mapping, never released */
-	if (omap2_globals->ctrl_pad) {
-		omap4_ctrl_pad_base = ioremap(omap2_globals->ctrl_pad, SZ_4K);
-		WARN_ON(!omap4_ctrl_pad_base);
-	}
+	if (omap2_globals->ctrl_pad)
+		omap4_ctrl_pad_base = omap2_globals->ctrl_pad;
 }
 
 void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index b42bbb8..d5caac3 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -44,6 +44,7 @@
 #include "clockdomain.h"
 #include <plat/omap_hwmod.h>
 #include <plat/multi.h>
+#include <plat/common.h>
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -359,6 +360,7 @@ static void __init omap_hwmod_init_postsetup(void)
 
 void __init omap2420_init_early(void)
 {
+	omap2_set_globals_242x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap242x_powerdomains_init();
@@ -370,6 +372,7 @@ void __init omap2420_init_early(void)
 
 void __init omap2430_init_early(void)
 {
+	omap2_set_globals_243x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap243x_powerdomains_init();
@@ -385,6 +388,7 @@ void __init omap2430_init_early(void)
  */
 void __init omap3_init_early(void)
 {
+	omap2_set_globals_3xxx();
 	omap_common_init_early();
 	omap3xxx_voltagedomains_init();
 	omap3xxx_powerdomains_init();
@@ -416,11 +420,19 @@ void __init am35xx_init_early(void)
 
 void __init ti816x_init_early(void)
 {
-	omap3_init_early();
+	omap2_set_globals_ti816x();
+	omap_common_init_early();
+	omap3xxx_voltagedomains_init();
+	omap3xxx_powerdomains_init();
+	omap3xxx_clockdomains_init();
+	omap3xxx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap3xxx_clk_init();
 }
 
 void __init omap4430_init_early(void)
 {
+	omap2_set_globals_443x();
 	omap_common_init_early();
 	omap44xx_voltagedomains_init();
 	omap44xx_powerdomains_init();
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index ce65e93..11e25a4 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -102,8 +102,11 @@ void __init smp_init_cpus(void)
 {
 	unsigned int i, ncores;
 
-	/* Never released */
-	scu_base = ioremap(OMAP44XX_SCU_BASE, SZ_256);
+	/*
+	 * Currently we can't call ioremap here because
+	 * SoC detection won't work until after init_early.
+	 */
+	scu_base =  OMAP2_L4_IO_ADDRESS(OMAP44XX_SCU_BASE);
 	BUG_ON(!scu_base);
 
 	ncores = scu_get_core_count(scu_base);
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 2e40a5c..8db5f03 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -151,17 +151,10 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
 
 void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
 {
-	/* Static mapping, never released */
-	if (omap2_globals->prm) {
-		prm_base = ioremap(omap2_globals->prm, SZ_8K);
-		WARN_ON(!prm_base);
-	}
-	if (omap2_globals->cm) {
-		cm_base = ioremap(omap2_globals->cm, SZ_8K);
-		WARN_ON(!cm_base);
-	}
-	if (omap2_globals->cm2) {
-		cm2_base = ioremap(omap2_globals->cm2, SZ_8K);
-		WARN_ON(!cm2_base);
-	}
+	if (omap2_globals->prm)
+		prm_base = omap2_globals->prm;
+	if (omap2_globals->cm)
+		cm_base = omap2_globals->cm;
+	if (omap2_globals->cm2)
+		cm2_base = omap2_globals->cm2;
 }
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index da6f3a6..8f27828 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -117,15 +117,10 @@ int omap2_sdrc_get_params(unsigned long r,
 
 void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
 {
-	/* Static mapping, never released */
-	if (omap2_globals->sdrc) {
-		omap2_sdrc_base = ioremap(omap2_globals->sdrc, SZ_64K);
-		WARN_ON(!omap2_sdrc_base);
-	}
-	if (omap2_globals->sms) {
-		omap2_sms_base = ioremap(omap2_globals->sms, SZ_64K);
-		WARN_ON(!omap2_sms_base);
-	}
+	if (omap2_globals->sdrc)
+		omap2_sdrc_base = omap2_globals->sdrc;
+	if (omap2_globals->sms)
+		omap2_sms_base = omap2_globals->sms;
 }
 
 /**

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* Re: [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
  2011-10-05  7:03   ` Santosh Shilimkar
@ 2011-10-06  1:42     ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-06  1:42 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: linux-arm-kernel, linux-omap

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111004 23:29]:
> 
> Will look at this series in next couple of days and do some testing.

Thanks, turns out there were a few issues with early ioremap
that I fixed. Care to check the L4_IO_ADDRESS changes?

It's all pushed now into sram-map-io branch at:

https://github.com/tmlind/linux/tree/sram-map-io

It seems it's booting now on all omaps I've tried, so will merge
it into linux-omap master branch as well for testing.

> Looks like you wanted to inlcude below patch also part of this
> series though [PATCH 5/4] numbering is bit confusing.
> [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in
> init_early

Yeah sorry the patches overflowed from the initial four..

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
@ 2011-10-06  1:42     ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-06  1:42 UTC (permalink / raw)
  To: linux-arm-kernel

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111004 23:29]:
> 
> Will look at this series in next couple of days and do some testing.

Thanks, turns out there were a few issues with early ioremap
that I fixed. Care to check the L4_IO_ADDRESS changes?

It's all pushed now into sram-map-io branch at:

https://github.com/tmlind/linux/tree/sram-map-io

It seems it's booting now on all omaps I've tried, so will merge
it into linux-omap master branch as well for testing.

> Looks like you wanted to inlcude below patch also part of this
> series though [PATCH 5/4] numbering is bit confusing.
> [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in
> init_early

Yeah sorry the patches overflowed from the initial four..

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
  2011-10-05 22:41       ` Tony Lindgren
@ 2011-10-06  8:38         ` Tomi Valkeinen
  -1 siblings, 0 replies; 74+ messages in thread
From: Tomi Valkeinen @ 2011-10-06  8:38 UTC (permalink / raw)
  To: Tony Lindgren, Paul Walmsley; +Cc: linux-arm-kernel, linux-omap

On Wed, 2011-10-05 at 15:41 -0700, Tony Lindgren wrote:
> * Tomi Valkeinen <tomi.valkeinen@ti.com> [111004 23:11]:
> > On Tue, 2011-10-04 at 17:45 -0700, Tony Lindgren wrote:
> > > This assumes fixed mappings which will not work once we move
> > > to use ioremap_exec(). It seems that these are currently
> > > not in use, or in use for some out of tree corner cases.
> > > 
> > > If SRAM support for framebuffer is wanted, it should be done
> > > with ioremap in the driver.
> > > 
> > > Note that further removal of the code can now be done,
> > > but that can be done seprately by the driver maintainers.
> > > 
> > > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > Looks good to me. I have similar changes in my working branch for omapfb
> > cleanup.
> > 
> > Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> Thanks. FYI, looks like there's a warning in display.c:
> 
> arch/arm/mach-omap2/display.c: In function 'omap_display_init':
> arch/arm/mach-omap2/display.c:93: warning: assignment from incompatible pointer type
> 
> Do you have a patch for that already?

Paul should have a patch for that in queue ("OMAP: change
get_context_loss_count ret value to int"). DSS is already using the new
style function pointer, which uses int for return value (versus the
current function which returns u32).

 Tomi



^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
@ 2011-10-06  8:38         ` Tomi Valkeinen
  0 siblings, 0 replies; 74+ messages in thread
From: Tomi Valkeinen @ 2011-10-06  8:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2011-10-05 at 15:41 -0700, Tony Lindgren wrote:
> * Tomi Valkeinen <tomi.valkeinen@ti.com> [111004 23:11]:
> > On Tue, 2011-10-04 at 17:45 -0700, Tony Lindgren wrote:
> > > This assumes fixed mappings which will not work once we move
> > > to use ioremap_exec(). It seems that these are currently
> > > not in use, or in use for some out of tree corner cases.
> > > 
> > > If SRAM support for framebuffer is wanted, it should be done
> > > with ioremap in the driver.
> > > 
> > > Note that further removal of the code can now be done,
> > > but that can be done seprately by the driver maintainers.
> > > 
> > > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > Looks good to me. I have similar changes in my working branch for omapfb
> > cleanup.
> > 
> > Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> Thanks. FYI, looks like there's a warning in display.c:
> 
> arch/arm/mach-omap2/display.c: In function 'omap_display_init':
> arch/arm/mach-omap2/display.c:93: warning: assignment from incompatible pointer type
> 
> Do you have a patch for that already?

Paul should have a patch for that in queue ("OMAP: change
get_context_loss_count ret value to int"). DSS is already using the new
style function pointer, which uses int for return value (versus the
current function which returns u32).

 Tomi

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
  2011-10-06  8:38         ` Tomi Valkeinen
@ 2011-10-06 16:22           ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-06 16:22 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: Paul Walmsley, linux-arm-kernel, linux-omap

* Tomi Valkeinen <tomi.valkeinen@ti.com> [111006 01:04]:
> On Wed, 2011-10-05 at 15:41 -0700, Tony Lindgren wrote:
> > * Tomi Valkeinen <tomi.valkeinen@ti.com> [111004 23:11]:
> > > On Tue, 2011-10-04 at 17:45 -0700, Tony Lindgren wrote:
> > > > This assumes fixed mappings which will not work once we move
> > > > to use ioremap_exec(). It seems that these are currently
> > > > not in use, or in use for some out of tree corner cases.
> > > > 
> > > > If SRAM support for framebuffer is wanted, it should be done
> > > > with ioremap in the driver.
> > > > 
> > > > Note that further removal of the code can now be done,
> > > > but that can be done seprately by the driver maintainers.
> > > > 
> > > > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > > 
> > > Looks good to me. I have similar changes in my working branch for omapfb
> > > cleanup.
> > > 
> > > Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > 
> > Thanks. FYI, looks like there's a warning in display.c:
> > 
> > arch/arm/mach-omap2/display.c: In function 'omap_display_init':
> > arch/arm/mach-omap2/display.c:93: warning: assignment from incompatible pointer type
> > 
> > Do you have a patch for that already?
> 
> Paul should have a patch for that in queue ("OMAP: change
> get_context_loss_count ret value to int"). DSS is already using the new
> style function pointer, which uses int for return value (versus the
> current function which returns u32).

OK thanks.

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
@ 2011-10-06 16:22           ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-06 16:22 UTC (permalink / raw)
  To: linux-arm-kernel

* Tomi Valkeinen <tomi.valkeinen@ti.com> [111006 01:04]:
> On Wed, 2011-10-05 at 15:41 -0700, Tony Lindgren wrote:
> > * Tomi Valkeinen <tomi.valkeinen@ti.com> [111004 23:11]:
> > > On Tue, 2011-10-04 at 17:45 -0700, Tony Lindgren wrote:
> > > > This assumes fixed mappings which will not work once we move
> > > > to use ioremap_exec(). It seems that these are currently
> > > > not in use, or in use for some out of tree corner cases.
> > > > 
> > > > If SRAM support for framebuffer is wanted, it should be done
> > > > with ioremap in the driver.
> > > > 
> > > > Note that further removal of the code can now be done,
> > > > but that can be done seprately by the driver maintainers.
> > > > 
> > > > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > > 
> > > Looks good to me. I have similar changes in my working branch for omapfb
> > > cleanup.
> > > 
> > > Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > 
> > Thanks. FYI, looks like there's a warning in display.c:
> > 
> > arch/arm/mach-omap2/display.c: In function 'omap_display_init':
> > arch/arm/mach-omap2/display.c:93: warning: assignment from incompatible pointer type
> > 
> > Do you have a patch for that already?
> 
> Paul should have a patch for that in queue ("OMAP: change
> get_context_loss_count ret value to int"). DSS is already using the new
> style function pointer, which uses int for return value (versus the
> current function which returns u32).

OK thanks.

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-05 22:06       ` Tony Lindgren
@ 2011-10-07  6:40         ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:40 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

On Thursday 06 October 2011 03:36 AM, Tony Lindgren wrote:
> * Nicolas Pitre <nico@fluxnic.net> [111004 17:26]:
>> On Tue, 4 Oct 2011, Tony Lindgren wrote:
>>
>>> This allows mapping external memory such as SRAM for use.
>>>
>>> This is needed for some small chunks of code, such as reprogramming
>>> SDRAM memory source clocks that can't be executed in SDRAM. Other
>>> use cases include some PM related code.
>>>
>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>
>> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
>>
>> As mentioned, you might consider dropping the export until needed.
> 
> Here's this one updated to drop the export.
> 
> Tony
> 
> 
> From: Tony Lindgren <tony@atomide.com>
> Date: Tue, 4 Oct 2011 18:26:27 -0700
> Subject: [PATCH] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
> 
> This allows mapping external memory such as SRAM for use.
> 
> This is needed for some small chunks of code, such as reprogramming
> SDRAM memory source clocks that can't be executed in SDRAM. Other
> use cases include some PM related code.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
> index d66605d..4ff152e 100644
> --- a/arch/arm/include/asm/io.h
> +++ b/arch/arm/include/asm/io.h
> @@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
>  
>  extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
>  extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
> +extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
>  extern void __iounmap(volatile void __iomem *addr);
>  
>  /*
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index ab50627..a2d94ac 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -289,6 +289,27 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
>  }
>  EXPORT_SYMBOL(__arm_ioremap);
>  
> +/*
> + * Remap an arbitrary physical address space into the kernel virtual
> + * address space as memory. Needed when the kernel wants to execute
> + * code in external memory. This is needed for reprogramming source
> + * clocks that would affect normal memory for example. Please see
> + * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
> + */
> +void __iomem *
> +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
> +{
> +	unsigned int mtype;
> +
> +	if (cached)
> +		mtype = MT_MEMORY;
> +	else
> +		mtype = MT_MEMORY_NONCACHED;
> +
Why don't we allow user to pass the mtype here ?
We do have a need also to map a page of DDR and SRAM as
strongly ordered for errata fix and this interface can be
used for that.
Ofcourse, SO memory type is not executable memories, so the
API name might be miss-leading.

Regards
Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-07  6:40         ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 06 October 2011 03:36 AM, Tony Lindgren wrote:
> * Nicolas Pitre <nico@fluxnic.net> [111004 17:26]:
>> On Tue, 4 Oct 2011, Tony Lindgren wrote:
>>
>>> This allows mapping external memory such as SRAM for use.
>>>
>>> This is needed for some small chunks of code, such as reprogramming
>>> SDRAM memory source clocks that can't be executed in SDRAM. Other
>>> use cases include some PM related code.
>>>
>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>
>> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
>>
>> As mentioned, you might consider dropping the export until needed.
> 
> Here's this one updated to drop the export.
> 
> Tony
> 
> 
> From: Tony Lindgren <tony@atomide.com>
> Date: Tue, 4 Oct 2011 18:26:27 -0700
> Subject: [PATCH] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
> 
> This allows mapping external memory such as SRAM for use.
> 
> This is needed for some small chunks of code, such as reprogramming
> SDRAM memory source clocks that can't be executed in SDRAM. Other
> use cases include some PM related code.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
> index d66605d..4ff152e 100644
> --- a/arch/arm/include/asm/io.h
> +++ b/arch/arm/include/asm/io.h
> @@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
>  
>  extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
>  extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
> +extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
>  extern void __iounmap(volatile void __iomem *addr);
>  
>  /*
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index ab50627..a2d94ac 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -289,6 +289,27 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
>  }
>  EXPORT_SYMBOL(__arm_ioremap);
>  
> +/*
> + * Remap an arbitrary physical address space into the kernel virtual
> + * address space as memory. Needed when the kernel wants to execute
> + * code in external memory. This is needed for reprogramming source
> + * clocks that would affect normal memory for example. Please see
> + * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
> + */
> +void __iomem *
> +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
> +{
> +	unsigned int mtype;
> +
> +	if (cached)
> +		mtype = MT_MEMORY;
> +	else
> +		mtype = MT_MEMORY_NONCACHED;
> +
Why don't we allow user to pass the mtype here ?
We do have a need also to map a page of DDR and SRAM as
strongly ordered for errata fix and this interface can be
used for that.
Ofcourse, SO memory type is not executable memories, so the
API name might be miss-leading.

Regards
Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 2/4] ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
  2011-10-05  0:45   ` Tony Lindgren
@ 2011-10-07  6:47     ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:47 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

On Wednesday 05 October 2011 06:15 AM, Tony Lindgren wrote:
> This way we don't need to initialize SoC detection early
> and can start using generic map_io.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>	

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 2/4] ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
@ 2011-10-07  6:47     ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 05 October 2011 06:15 AM, Tony Lindgren wrote:
> This way we don't need to initialize SoC detection early
> and can start using generic map_io.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>	

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
  2011-10-05 22:13       ` Tony Lindgren
@ 2011-10-07  6:52         ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:52 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

On Thursday 06 October 2011 03:43 AM, Tony Lindgren wrote:
> * Nicolas Pitre <nico@fluxnic.net> [111004 17:34]:
>> On Tue, 4 Oct 2011, Tony Lindgren wrote:
>>
>>> This allows us to remove omap hacks for map_io.
>>>
>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>
>> Nice cleanup.
>>
>> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> This one needed minor changes for the omap1 omap_sram_init
> call. Updated patch below, still assuming I have your ack
> for this one too.
> 
> Tony
> 
> 
> From: Tony Lindgren <tony@atomide.com>
> Date: Tue, 4 Oct 2011 13:52:57 -0700
> Subject: [PATCH] ARM: OMAP: Map SRAM later on with ioremap_exec()
> 
> This allows us to remove omap hacks for map_io.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 

Are you considering this change for 3.2?
OMAP4 errata WA would have a conflict with the
change is sram code and hence the question ?

O.w patch looks fine to me.

Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>	

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
@ 2011-10-07  6:52         ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 06 October 2011 03:43 AM, Tony Lindgren wrote:
> * Nicolas Pitre <nico@fluxnic.net> [111004 17:34]:
>> On Tue, 4 Oct 2011, Tony Lindgren wrote:
>>
>>> This allows us to remove omap hacks for map_io.
>>>
>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>
>> Nice cleanup.
>>
>> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> This one needed minor changes for the omap1 omap_sram_init
> call. Updated patch below, still assuming I have your ack
> for this one too.
> 
> Tony
> 
> 
> From: Tony Lindgren <tony@atomide.com>
> Date: Tue, 4 Oct 2011 13:52:57 -0700
> Subject: [PATCH] ARM: OMAP: Map SRAM later on with ioremap_exec()
> 
> This allows us to remove omap hacks for map_io.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 

Are you considering this change for 3.2?
OMAP4 errata WA would have a conflict with the
change is sram code and hence the question ?

O.w patch looks fine to me.

Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>	

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
  2011-10-06  1:36       ` Tony Lindgren
@ 2011-10-07  6:56         ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:56 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

On Thursday 06 October 2011 07:06 AM, Tony Lindgren wrote:
> * Nicolas Pitre <nico@fluxnic.net> [111004 18:17]:
>> On Tue, 4 Oct 2011, Tony Lindgren wrote:
>>
>>> Otherwise we can't do generic map_io as we currently rely on
>>> static mappings that work only because of arch_ioremap.
>>>
>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>
>> That's great.
>>
>> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> Here's an updated version with all the early ioremap
> access converted to use L3/L4_IO_ADDRESS macros. Some
> of this may not be needed after generic map_io, but until
> then we can't use ioremap until in init_early after the
> SoC detection is done.
> 
> Regards,
> 
> Tony
> 
> 
> From: Tony Lindgren <tony@atomide.com>
> Date: Tue, 4 Oct 2011 18:17:41 -0700
> Subject: [PATCH] ARM: OMAP: Move set_globals initialization to happen in init_early
> 
> Otherwise we can't do generic map_io as we currently rely on
> static mappings that work only because of arch_ioremap.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
The changes looks fine to me. Though the ugly hard-coding
is back with it, it's a step towards generic_io, so hopefully
it won't have to stay for long time.

Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>	


considering it's commin

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
@ 2011-10-07  6:56         ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 06 October 2011 07:06 AM, Tony Lindgren wrote:
> * Nicolas Pitre <nico@fluxnic.net> [111004 18:17]:
>> On Tue, 4 Oct 2011, Tony Lindgren wrote:
>>
>>> Otherwise we can't do generic map_io as we currently rely on
>>> static mappings that work only because of arch_ioremap.
>>>
>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>
>> That's great.
>>
>> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> Here's an updated version with all the early ioremap
> access converted to use L3/L4_IO_ADDRESS macros. Some
> of this may not be needed after generic map_io, but until
> then we can't use ioremap until in init_early after the
> SoC detection is done.
> 
> Regards,
> 
> Tony
> 
> 
> From: Tony Lindgren <tony@atomide.com>
> Date: Tue, 4 Oct 2011 18:17:41 -0700
> Subject: [PATCH] ARM: OMAP: Move set_globals initialization to happen in init_early
> 
> Otherwise we can't do generic map_io as we currently rely on
> static mappings that work only because of arch_ioremap.
> 
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
The changes looks fine to me. Though the ugly hard-coding
is back with it, it's a step towards generic_io, so hopefully
it won't have to stay for long time.

Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>	


considering it's commin

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
  2011-10-06  1:42     ` Tony Lindgren
@ 2011-10-07  6:59       ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:59 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-omap

On Thursday 06 October 2011 07:12 AM, Tony Lindgren wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111004 23:29]:
>>
>> Will look at this series in next couple of days and do some testing.
> 
> Thanks, turns out there were a few issues with early ioremap
> that I fixed. Care to check the L4_IO_ADDRESS changes?
>
They look ok to me.

> It's all pushed now into sram-map-io branch at:
> 
> https://github.com/tmlind/linux/tree/sram-map-io
> 
> It seems it's booting now on all omaps I've tried, so will merge
> it into linux-omap master branch as well for testing.
> 
I have reviewed and tested this series. No problems seen.
As asked on other thread, if you are targeting this one for
3.2, then sram changes would have a small conflict with
OMAP4 errata patch. If it is for 3.3, we should be able to
sort out that conflict easily.

Regards
Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
@ 2011-10-07  6:59       ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07  6:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 06 October 2011 07:12 AM, Tony Lindgren wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111004 23:29]:
>>
>> Will look at this series in next couple of days and do some testing.
> 
> Thanks, turns out there were a few issues with early ioremap
> that I fixed. Care to check the L4_IO_ADDRESS changes?
>
They look ok to me.

> It's all pushed now into sram-map-io branch at:
> 
> https://github.com/tmlind/linux/tree/sram-map-io
> 
> It seems it's booting now on all omaps I've tried, so will merge
> it into linux-omap master branch as well for testing.
> 
I have reviewed and tested this series. No problems seen.
As asked on other thread, if you are targeting this one for
3.2, then sram changes would have a small conflict with
OMAP4 errata patch. If it is for 3.3, we should be able to
sort out that conflict easily.

Regards
Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-07  6:40         ` Santosh Shilimkar
@ 2011-10-07 14:43           ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 14:43 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:06]:
> On Thursday 06 October 2011 03:36 AM, Tony Lindgren wrote:
> > * Nicolas Pitre <nico@fluxnic.net> [111004 17:26]:
> >> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> > +void __iomem *
> > +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
> > +{
> > +	unsigned int mtype;
> > +
> > +	if (cached)
> > +		mtype = MT_MEMORY;
> > +	else
> > +		mtype = MT_MEMORY_NONCACHED;
> > +
> Why don't we allow user to pass the mtype here ?

Well we want to keep the MT_MEMORY types out of asm/io.h.

> We do have a need also to map a page of DDR and SRAM as
> strongly ordered for errata fix and this interface can be
> used for that.

Yeah..

> Ofcourse, SO memory type is not executable memories, so the
> API name might be miss-leading.

..so I think we should just have a separate static mapping for
the omap4 errata fix SO page, and just limit the memory available
for SRAM code to ioremap.

How does that sounds to you?

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-07 14:43           ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:06]:
> On Thursday 06 October 2011 03:36 AM, Tony Lindgren wrote:
> > * Nicolas Pitre <nico@fluxnic.net> [111004 17:26]:
> >> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> > +void __iomem *
> > +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
> > +{
> > +	unsigned int mtype;
> > +
> > +	if (cached)
> > +		mtype = MT_MEMORY;
> > +	else
> > +		mtype = MT_MEMORY_NONCACHED;
> > +
> Why don't we allow user to pass the mtype here ?

Well we want to keep the MT_MEMORY types out of asm/io.h.

> We do have a need also to map a page of DDR and SRAM as
> strongly ordered for errata fix and this interface can be
> used for that.

Yeah..

> Ofcourse, SO memory type is not executable memories, so the
> API name might be miss-leading.

..so I think we should just have a separate static mapping for
the omap4 errata fix SO page, and just limit the memory available
for SRAM code to ioremap.

How does that sounds to you?

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
  2011-10-07  6:59       ` Santosh Shilimkar
@ 2011-10-07 14:45         ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 14:45 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: linux-arm-kernel, linux-omap

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:25]:
> On Thursday 06 October 2011 07:12 AM, Tony Lindgren wrote:
> > * Santosh Shilimkar <santosh.shilimkar@ti.com> [111004 23:29]:
> >>
> >> Will look at this series in next couple of days and do some testing.
> > 
> > Thanks, turns out there were a few issues with early ioremap
> > that I fixed. Care to check the L4_IO_ADDRESS changes?
> >
> They look ok to me.

Thanks for testing.
 
> > It's all pushed now into sram-map-io branch at:
> > 
> > https://github.com/tmlind/linux/tree/sram-map-io
> > 
> > It seems it's booting now on all omaps I've tried, so will merge
> > it into linux-omap master branch as well for testing.
> > 
> I have reviewed and tested this series. No problems seen.
> As asked on other thread, if you are targeting this one for
> 3.2, then sram changes would have a small conflict with
> OMAP4 errata patch. If it is for 3.3, we should be able to
> sort out that conflict easily.

Yeah let's if we can map the errata fix page separately.

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
@ 2011-10-07 14:45         ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 14:45 UTC (permalink / raw)
  To: linux-arm-kernel

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:25]:
> On Thursday 06 October 2011 07:12 AM, Tony Lindgren wrote:
> > * Santosh Shilimkar <santosh.shilimkar@ti.com> [111004 23:29]:
> >>
> >> Will look at this series in next couple of days and do some testing.
> > 
> > Thanks, turns out there were a few issues with early ioremap
> > that I fixed. Care to check the L4_IO_ADDRESS changes?
> >
> They look ok to me.

Thanks for testing.
 
> > It's all pushed now into sram-map-io branch at:
> > 
> > https://github.com/tmlind/linux/tree/sram-map-io
> > 
> > It seems it's booting now on all omaps I've tried, so will merge
> > it into linux-omap master branch as well for testing.
> > 
> I have reviewed and tested this series. No problems seen.
> As asked on other thread, if you are targeting this one for
> 3.2, then sram changes would have a small conflict with
> OMAP4 errata patch. If it is for 3.3, we should be able to
> sort out that conflict easily.

Yeah let's if we can map the errata fix page separately.

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
  2011-10-07  6:56         ` Santosh Shilimkar
@ 2011-10-07 14:54           ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 14:54 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:22]:
> The changes looks fine to me. Though the ugly hard-coding
> is back with it, it's a step towards generic_io, so hopefully
> it won't have to stay for long time.

Nico please correct me if I'm wrong, but I think that with
generic map_io we have static mappings in place after map_io,
and then ioremap should work for the static mappings right
after map_io except without the need for __arch_ioremap.

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
@ 2011-10-07 14:54           ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 14:54 UTC (permalink / raw)
  To: linux-arm-kernel

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:22]:
> The changes looks fine to me. Though the ugly hard-coding
> is back with it, it's a step towards generic_io, so hopefully
> it won't have to stay for long time.

Nico please correct me if I'm wrong, but I think that with
generic map_io we have static mappings in place after map_io,
and then ioremap should work for the static mappings right
after map_io except without the need for __arch_ioremap.

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
  2011-10-07  6:52         ` Santosh Shilimkar
@ 2011-10-07 14:55           ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 14:55 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:18]:
> 
> Are you considering this change for 3.2?

I think we should as this is blocking development for
generic map_io and genalloc changes for SRAM code.

> OMAP4 errata WA would have a conflict with the
> change is sram code and hence the question ?

Right, let's see if we can fix that with a static mapping.

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
@ 2011-10-07 14:55           ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 14:55 UTC (permalink / raw)
  To: linux-arm-kernel

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:18]:
> 
> Are you considering this change for 3.2?

I think we should as this is blocking development for
generic map_io and genalloc changes for SRAM code.

> OMAP4 errata WA would have a conflict with the
> change is sram code and hence the question ?

Right, let's see if we can fix that with a static mapping.

Regards,

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-07 14:43           ` Tony Lindgren
@ 2011-10-07 15:03             ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07 15:03 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

On Friday 07 October 2011 08:13 PM, Tony Lindgren wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:06]:
>> On Thursday 06 October 2011 03:36 AM, Tony Lindgren wrote:
>>> * Nicolas Pitre <nico@fluxnic.net> [111004 17:26]:
>>>> On Tue, 4 Oct 2011, Tony Lindgren wrote:
>>> +void __iomem *
>>> +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
>>> +{
>>> +	unsigned int mtype;
>>> +
>>> +	if (cached)
>>> +		mtype = MT_MEMORY;
>>> +	else
>>> +		mtype = MT_MEMORY_NONCACHED;
>>> +
>> Why don't we allow user to pass the mtype here ?
> 
> Well we want to keep the MT_MEMORY types out of asm/io.h.
> 
ok.

>> We do have a need also to map a page of DDR and SRAM as
>> strongly ordered for errata fix and this interface can be
>> used for that.
> 
> Yeah..
> 
>> Ofcourse, SO memory type is not executable memories, so the
>> API name might be miss-leading.
> 
> ..so I think we should just have a separate static mapping for
> the omap4 errata fix SO page, and just limit the memory available
> for SRAM code to ioremap.
> 
> How does that sounds to you?
> 
That's more or less what the patch is already doing.
Instead of static mapping, I was dynamically stealing one
page ( SZ_4K) and mapping it as MT_MEMORY_SO and rest
of the memory as MT_MEMORY for OMAP4.

It should be doable with your updates as well,
I guess with or without static mapping since the only
requisite is to keep one page of SRAM free on OMAP4 and
them map them using  iotable_init() with MT_MEMORY_SO.

Regards
Santosh




^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-07 15:03             ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 07 October 2011 08:13 PM, Tony Lindgren wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:06]:
>> On Thursday 06 October 2011 03:36 AM, Tony Lindgren wrote:
>>> * Nicolas Pitre <nico@fluxnic.net> [111004 17:26]:
>>>> On Tue, 4 Oct 2011, Tony Lindgren wrote:
>>> +void __iomem *
>>> +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
>>> +{
>>> +	unsigned int mtype;
>>> +
>>> +	if (cached)
>>> +		mtype = MT_MEMORY;
>>> +	else
>>> +		mtype = MT_MEMORY_NONCACHED;
>>> +
>> Why don't we allow user to pass the mtype here ?
> 
> Well we want to keep the MT_MEMORY types out of asm/io.h.
> 
ok.

>> We do have a need also to map a page of DDR and SRAM as
>> strongly ordered for errata fix and this interface can be
>> used for that.
> 
> Yeah..
> 
>> Ofcourse, SO memory type is not executable memories, so the
>> API name might be miss-leading.
> 
> ..so I think we should just have a separate static mapping for
> the omap4 errata fix SO page, and just limit the memory available
> for SRAM code to ioremap.
> 
> How does that sounds to you?
> 
That's more or less what the patch is already doing.
Instead of static mapping, I was dynamically stealing one
page ( SZ_4K) and mapping it as MT_MEMORY_SO and rest
of the memory as MT_MEMORY for OMAP4.

It should be doable with your updates as well,
I guess with or without static mapping since the only
requisite is to keep one page of SRAM free on OMAP4 and
them map them using  iotable_init() with MT_MEMORY_SO.

Regards
Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-07 15:03             ` Santosh Shilimkar
@ 2011-10-07 15:11               ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 15:11 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 07:29]:
> On Friday 07 October 2011 08:13 PM, Tony Lindgren wrote:
> > 
> > ..so I think we should just have a separate static mapping for
> > the omap4 errata fix SO page, and just limit the memory available
> > for SRAM code to ioremap.
> > 
> > How does that sounds to you?
> > 
> That's more or less what the patch is already doing.
> Instead of static mapping, I was dynamically stealing one
> page ( SZ_4K) and mapping it as MT_MEMORY_SO and rest
> of the memory as MT_MEMORY for OMAP4.

Yeah cool.
 
> It should be doable with your updates as well,
> I guess with or without static mapping since the only
> requisite is to keep one page of SRAM free on OMAP4 and
> them map them using  iotable_init() with MT_MEMORY_SO.

How about something like the following, this won't compile
without at least moving the defines around a bit, but shows
what I had in mind:

--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -238,6 +238,14 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
 		.length		= L4_EMU_44XX_SIZE,
 		.type		= MT_DEVICE,
 	},
+#ifdef CONFIG_OMAP4_ERRATA_I688
+	{
+		.virtual	= OMAP4_SRAM_VA,
+		.pfn		= __phys_to_pfn(OMAP4_SRAM_PA),
+		.length		= PAGE_SIZE,
+		.type		= MT_MEMORY_SO,
+	},
+#endif
 };
 #endif
 
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -125,6 +125,9 @@ static void __init omap_detect_sram(void)
 				omap_sram_size = 0x10000; /* 64K */
 			} else if (cpu_is_omap44xx()) {
 				omap_sram_start = OMAP4_SRAM_PA;
+#ifdef CONFIG_OMAP4_ERRATA_I688
+				omap_sram_start += PAGE_SIZE;
+#endif
 				omap_sram_size = 0xe000; /* 56K */
 			} else {
 				omap_sram_start = OMAP2_SRAM_PA;

Eventually the SRAM code will be a generic driver, so let's try
to keep the errata fix out of the SRAM code.

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-07 15:11               ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 15:11 UTC (permalink / raw)
  To: linux-arm-kernel

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 07:29]:
> On Friday 07 October 2011 08:13 PM, Tony Lindgren wrote:
> > 
> > ..so I think we should just have a separate static mapping for
> > the omap4 errata fix SO page, and just limit the memory available
> > for SRAM code to ioremap.
> > 
> > How does that sounds to you?
> > 
> That's more or less what the patch is already doing.
> Instead of static mapping, I was dynamically stealing one
> page ( SZ_4K) and mapping it as MT_MEMORY_SO and rest
> of the memory as MT_MEMORY for OMAP4.

Yeah cool.
 
> It should be doable with your updates as well,
> I guess with or without static mapping since the only
> requisite is to keep one page of SRAM free on OMAP4 and
> them map them using  iotable_init() with MT_MEMORY_SO.

How about something like the following, this won't compile
without at least moving the defines around a bit, but shows
what I had in mind:

--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -238,6 +238,14 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
 		.length		= L4_EMU_44XX_SIZE,
 		.type		= MT_DEVICE,
 	},
+#ifdef CONFIG_OMAP4_ERRATA_I688
+	{
+		.virtual	= OMAP4_SRAM_VA,
+		.pfn		= __phys_to_pfn(OMAP4_SRAM_PA),
+		.length		= PAGE_SIZE,
+		.type		= MT_MEMORY_SO,
+	},
+#endif
 };
 #endif
 
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -125,6 +125,9 @@ static void __init omap_detect_sram(void)
 				omap_sram_size = 0x10000; /* 64K */
 			} else if (cpu_is_omap44xx()) {
 				omap_sram_start = OMAP4_SRAM_PA;
+#ifdef CONFIG_OMAP4_ERRATA_I688
+				omap_sram_start += PAGE_SIZE;
+#endif
 				omap_sram_size = 0xe000; /* 56K */
 			} else {
 				omap_sram_start = OMAP2_SRAM_PA;

Eventually the SRAM code will be a generic driver, so let's try
to keep the errata fix out of the SRAM code.

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-07 15:11               ` Tony Lindgren
@ 2011-10-07 17:39                 ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07 17:39 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

On Friday 07 October 2011 08:41 PM, Tony Lindgren wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 07:29]:
>> On Friday 07 October 2011 08:13 PM, Tony Lindgren wrote:
>>>
>>> ..so I think we should just have a separate static mapping for
>>> the omap4 errata fix SO page, and just limit the memory available
>>> for SRAM code to ioremap.
>>>
>>> How does that sounds to you?
>>>
>> That's more or less what the patch is already doing.
>> Instead of static mapping, I was dynamically stealing one
>> page ( SZ_4K) and mapping it as MT_MEMORY_SO and rest
>> of the memory as MT_MEMORY for OMAP4.
> 
> Yeah cool.
>  
>> It should be doable with your updates as well,
>> I guess with or without static mapping since the only
>> requisite is to keep one page of SRAM free on OMAP4 and
>> them map them using  iotable_init() with MT_MEMORY_SO.
> 
> How about something like the following, this won't compile
> without at least moving the defines around a bit, but shows
> what I had in mind:
> 
> --- a/arch/arm/mach-omap2/io.c
> +++ b/arch/arm/mach-omap2/io.c
> @@ -238,6 +238,14 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
>  		.length		= L4_EMU_44XX_SIZE,
>  		.type		= MT_DEVICE,
>  	},
> +#ifdef CONFIG_OMAP4_ERRATA_I688
> +	{
> +		.virtual	= OMAP4_SRAM_VA,
> +		.pfn		= __phys_to_pfn(OMAP4_SRAM_PA),
> +		.length		= PAGE_SIZE,
> +		.type		= MT_MEMORY_SO,
> +	},
> +#endif
>  };

I initially tried some thing similar but the issue was GP and
HS devices. SRAM_PA isn't same on GP and EMU device and hence
did that dynamically. One way is I can make GP and HS
device SRAM_PA same for OMAP4 (Will loose 16 KB of
SRAM on OMAP4 GP). It's ok to loose that 16 KB SRAM
for OMAP4 with errata enabled.

Below change works on both GP and HS device
If you are OK with it, I can update errata patch accordingly.

diff --git a/arch/arm/plat-omap/include/plat/sram.h
b/arch/arm/plat-omap/include/plat/sram.h
index f500fc3..111b1a8 100644
--- a/arch/arm/plat-omap/include/plat/sram.h
+++ b/arch/arm/plat-omap/include/plat/sram.h
@@ -95,6 +95,11 @@ static inline void omap_push_sram_idle(void) {}
  */
 #define OMAP2_SRAM_PA		0x40200000
 #define OMAP3_SRAM_PA           0x40200000
+#ifdef CONFIG_OMAP4_ERRATA_I688
+#define OMAP4_SRAM_PA		0x40304000
+#else
 #define OMAP4_SRAM_PA		0x40300000
+#endif
+#define OMAP4_SRAM_VA		0xfe404000

 #endif
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 363c91e..cdd303f 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -48,9 +48,13 @@
 #define OMAP3_SRAM_VA           0xfe400000
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
 #define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
-#define OMAP4_SRAM_VA		0xfe400000
+#ifdef CONFIG_OMAP4_ERRATA_I688
+#define OMAP4_SRAM_PUB_PA	OMAP4_SRAM_PA
+#define OMAP4_SRAM_PUB_VA	OMAP4_SRAM_VA
+#else
 #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
 #define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
+#endif

 #if defined(CONFIG_ARCH_OMAP2PLUS)
 #define SRAM_BOOTLOADER_SZ	0x00
@@ -203,6 +207,11 @@ static void __init omap_map_sram(void)
 	if (omap_sram_size == 0)
 		return;

+#ifdef CONFIG_OMAP4_ERRATA_I688
+		omap_sram_base += PAGE_SIZE;
+		omap_sram_start += PAGE_SIZE;
+		omap_sram_size -= SZ_16K;
+#endif
 	if (cpu_is_omap34xx()) {
 		/*
 		 * SRAM must be marked as non-cached on OMAP3 since the

Regards
Santosh

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-07 17:39                 ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07 17:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 07 October 2011 08:41 PM, Tony Lindgren wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 07:29]:
>> On Friday 07 October 2011 08:13 PM, Tony Lindgren wrote:
>>>
>>> ..so I think we should just have a separate static mapping for
>>> the omap4 errata fix SO page, and just limit the memory available
>>> for SRAM code to ioremap.
>>>
>>> How does that sounds to you?
>>>
>> That's more or less what the patch is already doing.
>> Instead of static mapping, I was dynamically stealing one
>> page ( SZ_4K) and mapping it as MT_MEMORY_SO and rest
>> of the memory as MT_MEMORY for OMAP4.
> 
> Yeah cool.
>  
>> It should be doable with your updates as well,
>> I guess with or without static mapping since the only
>> requisite is to keep one page of SRAM free on OMAP4 and
>> them map them using  iotable_init() with MT_MEMORY_SO.
> 
> How about something like the following, this won't compile
> without at least moving the defines around a bit, but shows
> what I had in mind:
> 
> --- a/arch/arm/mach-omap2/io.c
> +++ b/arch/arm/mach-omap2/io.c
> @@ -238,6 +238,14 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
>  		.length		= L4_EMU_44XX_SIZE,
>  		.type		= MT_DEVICE,
>  	},
> +#ifdef CONFIG_OMAP4_ERRATA_I688
> +	{
> +		.virtual	= OMAP4_SRAM_VA,
> +		.pfn		= __phys_to_pfn(OMAP4_SRAM_PA),
> +		.length		= PAGE_SIZE,
> +		.type		= MT_MEMORY_SO,
> +	},
> +#endif
>  };

I initially tried some thing similar but the issue was GP and
HS devices. SRAM_PA isn't same on GP and EMU device and hence
did that dynamically. One way is I can make GP and HS
device SRAM_PA same for OMAP4 (Will loose 16 KB of
SRAM on OMAP4 GP). It's ok to loose that 16 KB SRAM
for OMAP4 with errata enabled.

Below change works on both GP and HS device
If you are OK with it, I can update errata patch accordingly.

diff --git a/arch/arm/plat-omap/include/plat/sram.h
b/arch/arm/plat-omap/include/plat/sram.h
index f500fc3..111b1a8 100644
--- a/arch/arm/plat-omap/include/plat/sram.h
+++ b/arch/arm/plat-omap/include/plat/sram.h
@@ -95,6 +95,11 @@ static inline void omap_push_sram_idle(void) {}
  */
 #define OMAP2_SRAM_PA		0x40200000
 #define OMAP3_SRAM_PA           0x40200000
+#ifdef CONFIG_OMAP4_ERRATA_I688
+#define OMAP4_SRAM_PA		0x40304000
+#else
 #define OMAP4_SRAM_PA		0x40300000
+#endif
+#define OMAP4_SRAM_VA		0xfe404000

 #endif
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 363c91e..cdd303f 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -48,9 +48,13 @@
 #define OMAP3_SRAM_VA           0xfe400000
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
 #define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
-#define OMAP4_SRAM_VA		0xfe400000
+#ifdef CONFIG_OMAP4_ERRATA_I688
+#define OMAP4_SRAM_PUB_PA	OMAP4_SRAM_PA
+#define OMAP4_SRAM_PUB_VA	OMAP4_SRAM_VA
+#else
 #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
 #define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
+#endif

 #if defined(CONFIG_ARCH_OMAP2PLUS)
 #define SRAM_BOOTLOADER_SZ	0x00
@@ -203,6 +207,11 @@ static void __init omap_map_sram(void)
 	if (omap_sram_size == 0)
 		return;

+#ifdef CONFIG_OMAP4_ERRATA_I688
+		omap_sram_base += PAGE_SIZE;
+		omap_sram_start += PAGE_SIZE;
+		omap_sram_size -= SZ_16K;
+#endif
 	if (cpu_is_omap34xx()) {
 		/*
 		 * SRAM must be marked as non-cached on OMAP3 since the

Regards
Santosh

^ permalink raw reply related	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-07 17:39                 ` Santosh Shilimkar
@ 2011-10-07 18:16                   ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 18:16 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 10:05]:
> 
> I initially tried some thing similar but the issue was GP and
> HS devices. SRAM_PA isn't same on GP and EMU device and hence
> did that dynamically. One way is I can make GP and HS
> device SRAM_PA same for OMAP4 (Will loose 16 KB of
> SRAM on OMAP4 GP). It's ok to loose that 16 KB SRAM
> for OMAP4 with errata enabled.

Oh yeah, the beginning is different too, I forgot that.
 
> Below change works on both GP and HS device
> If you are OK with it, I can update errata patch accordingly.

OK to me to loose 16KB when the errata is enabled. That can
be fixed later on for example by passing the SRAM area from
device tree.

I assume now you can add the mapping to io.c instead? If so,
then it's easier to apply the patches whatever way makes more
sense.

Regards,

Tony
 
> diff --git a/arch/arm/plat-omap/include/plat/sram.h
> b/arch/arm/plat-omap/include/plat/sram.h
> index f500fc3..111b1a8 100644
> --- a/arch/arm/plat-omap/include/plat/sram.h
> +++ b/arch/arm/plat-omap/include/plat/sram.h
> @@ -95,6 +95,11 @@ static inline void omap_push_sram_idle(void) {}
>   */
>  #define OMAP2_SRAM_PA		0x40200000
>  #define OMAP3_SRAM_PA           0x40200000
> +#ifdef CONFIG_OMAP4_ERRATA_I688
> +#define OMAP4_SRAM_PA		0x40304000
> +#else
>  #define OMAP4_SRAM_PA		0x40300000
> +#endif
> +#define OMAP4_SRAM_VA		0xfe404000
> 
>  #endif
> diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
> index 363c91e..cdd303f 100644
> --- a/arch/arm/plat-omap/sram.c
> +++ b/arch/arm/plat-omap/sram.c
> @@ -48,9 +48,13 @@
>  #define OMAP3_SRAM_VA           0xfe400000
>  #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
>  #define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
> -#define OMAP4_SRAM_VA		0xfe400000
> +#ifdef CONFIG_OMAP4_ERRATA_I688
> +#define OMAP4_SRAM_PUB_PA	OMAP4_SRAM_PA
> +#define OMAP4_SRAM_PUB_VA	OMAP4_SRAM_VA
> +#else
>  #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
>  #define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
> +#endif
> 
>  #if defined(CONFIG_ARCH_OMAP2PLUS)
>  #define SRAM_BOOTLOADER_SZ	0x00
> @@ -203,6 +207,11 @@ static void __init omap_map_sram(void)
>  	if (omap_sram_size == 0)
>  		return;
> 
> +#ifdef CONFIG_OMAP4_ERRATA_I688
> +		omap_sram_base += PAGE_SIZE;
> +		omap_sram_start += PAGE_SIZE;
> +		omap_sram_size -= SZ_16K;
> +#endif
>  	if (cpu_is_omap34xx()) {
>  		/*
>  		 * SRAM must be marked as non-cached on OMAP3 since the
> 
> Regards
> Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-07 18:16                   ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 18:16 UTC (permalink / raw)
  To: linux-arm-kernel

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 10:05]:
> 
> I initially tried some thing similar but the issue was GP and
> HS devices. SRAM_PA isn't same on GP and EMU device and hence
> did that dynamically. One way is I can make GP and HS
> device SRAM_PA same for OMAP4 (Will loose 16 KB of
> SRAM on OMAP4 GP). It's ok to loose that 16 KB SRAM
> for OMAP4 with errata enabled.

Oh yeah, the beginning is different too, I forgot that.
 
> Below change works on both GP and HS device
> If you are OK with it, I can update errata patch accordingly.

OK to me to loose 16KB when the errata is enabled. That can
be fixed later on for example by passing the SRAM area from
device tree.

I assume now you can add the mapping to io.c instead? If so,
then it's easier to apply the patches whatever way makes more
sense.

Regards,

Tony
 
> diff --git a/arch/arm/plat-omap/include/plat/sram.h
> b/arch/arm/plat-omap/include/plat/sram.h
> index f500fc3..111b1a8 100644
> --- a/arch/arm/plat-omap/include/plat/sram.h
> +++ b/arch/arm/plat-omap/include/plat/sram.h
> @@ -95,6 +95,11 @@ static inline void omap_push_sram_idle(void) {}
>   */
>  #define OMAP2_SRAM_PA		0x40200000
>  #define OMAP3_SRAM_PA           0x40200000
> +#ifdef CONFIG_OMAP4_ERRATA_I688
> +#define OMAP4_SRAM_PA		0x40304000
> +#else
>  #define OMAP4_SRAM_PA		0x40300000
> +#endif
> +#define OMAP4_SRAM_VA		0xfe404000
> 
>  #endif
> diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
> index 363c91e..cdd303f 100644
> --- a/arch/arm/plat-omap/sram.c
> +++ b/arch/arm/plat-omap/sram.c
> @@ -48,9 +48,13 @@
>  #define OMAP3_SRAM_VA           0xfe400000
>  #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
>  #define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
> -#define OMAP4_SRAM_VA		0xfe400000
> +#ifdef CONFIG_OMAP4_ERRATA_I688
> +#define OMAP4_SRAM_PUB_PA	OMAP4_SRAM_PA
> +#define OMAP4_SRAM_PUB_VA	OMAP4_SRAM_VA
> +#else
>  #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
>  #define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
> +#endif
> 
>  #if defined(CONFIG_ARCH_OMAP2PLUS)
>  #define SRAM_BOOTLOADER_SZ	0x00
> @@ -203,6 +207,11 @@ static void __init omap_map_sram(void)
>  	if (omap_sram_size == 0)
>  		return;
> 
> +#ifdef CONFIG_OMAP4_ERRATA_I688
> +		omap_sram_base += PAGE_SIZE;
> +		omap_sram_start += PAGE_SIZE;
> +		omap_sram_size -= SZ_16K;
> +#endif
>  	if (cpu_is_omap34xx()) {
>  		/*
>  		 * SRAM must be marked as non-cached on OMAP3 since the
> 
> Regards
> Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-07 18:16                   ` Tony Lindgren
@ 2011-10-07 18:20                     ` Santosh Shilimkar
  -1 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07 18:20 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

On Friday 07 October 2011 11:46 PM, Tony Lindgren wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 10:05]:
>>
>> I initially tried some thing similar but the issue was GP and
>> HS devices. SRAM_PA isn't same on GP and EMU device and hence
>> did that dynamically. One way is I can make GP and HS
>> device SRAM_PA same for OMAP4 (Will loose 16 KB of
>> SRAM on OMAP4 GP). It's ok to loose that 16 KB SRAM
>> for OMAP4 with errata enabled.
> 
> Oh yeah, the beginning is different too, I forgot that.
>  
>> Below change works on both GP and HS device
>> If you are OK with it, I can update errata patch accordingly.
> 
> OK to me to loose 16KB when the errata is enabled. That can
> be fixed later on for example by passing the SRAM area from
> device tree.
>
Yep.

> I assume now you can add the mapping to io.c instead? If so,
> then it's easier to apply the patches whatever way makes more
> sense.
> 
io.c change I took as you suggested. The below change on top
of it. I just updated PM branch with this change.

Thanks for the tip. The errata code looks bit more clean
now. :)

Regards
Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-07 18:20                     ` Santosh Shilimkar
  0 siblings, 0 replies; 74+ messages in thread
From: Santosh Shilimkar @ 2011-10-07 18:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 07 October 2011 11:46 PM, Tony Lindgren wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 10:05]:
>>
>> I initially tried some thing similar but the issue was GP and
>> HS devices. SRAM_PA isn't same on GP and EMU device and hence
>> did that dynamically. One way is I can make GP and HS
>> device SRAM_PA same for OMAP4 (Will loose 16 KB of
>> SRAM on OMAP4 GP). It's ok to loose that 16 KB SRAM
>> for OMAP4 with errata enabled.
> 
> Oh yeah, the beginning is different too, I forgot that.
>  
>> Below change works on both GP and HS device
>> If you are OK with it, I can update errata patch accordingly.
> 
> OK to me to loose 16KB when the errata is enabled. That can
> be fixed later on for example by passing the SRAM area from
> device tree.
>
Yep.

> I assume now you can add the mapping to io.c instead? If so,
> then it's easier to apply the patches whatever way makes more
> sense.
> 
io.c change I took as you suggested. The below change on top
of it. I just updated PM branch with this change.

Thanks for the tip. The errata code looks bit more clean
now. :)

Regards
Santosh

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
  2011-10-07 18:20                     ` Santosh Shilimkar
@ 2011-10-07 18:27                       ` Tony Lindgren
  -1 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 18:27 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: Nicolas Pitre, linux-arm-kernel, linux-omap

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 10:46]:
> On Friday 07 October 2011 11:46 PM, Tony Lindgren wrote:
> 
> > I assume now you can add the mapping to io.c instead? If so,
> > then it's easier to apply the patches whatever way makes more
> > sense.
> > 
> io.c change I took as you suggested. The below change on top
> of it. I just updated PM branch with this change.
> 
> Thanks for the tip. The errata code looks bit more clean
> now. :)

OK thanks!

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
@ 2011-10-07 18:27                       ` Tony Lindgren
  0 siblings, 0 replies; 74+ messages in thread
From: Tony Lindgren @ 2011-10-07 18:27 UTC (permalink / raw)
  To: linux-arm-kernel

* Santosh Shilimkar <santosh.shilimkar@ti.com> [111007 10:46]:
> On Friday 07 October 2011 11:46 PM, Tony Lindgren wrote:
> 
> > I assume now you can add the mapping to io.c instead? If so,
> > then it's easier to apply the patches whatever way makes more
> > sense.
> > 
> io.c change I took as you suggested. The below change on top
> of it. I just updated PM branch with this change.
> 
> Thanks for the tip. The errata code looks bit more clean
> now. :)

OK thanks!

Tony

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
  2011-10-07  6:59       ` Santosh Shilimkar
@ 2011-10-07 20:23         ` Nicolas Pitre
  -1 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-07 20:23 UTC (permalink / raw)
  To: Santosh Shilimkar; +Cc: Tony Lindgren, linux-omap, linux-arm-kernel

On Fri, 7 Oct 2011, Santosh Shilimkar wrote:

> I have reviewed and tested this series. No problems seen.
> As asked on other thread, if you are targeting this one for
> 3.2, then sram changes would have a small conflict with
> OMAP4 errata patch. If it is for 3.3, we should be able to
> sort out that conflict easily.

3.2 please.  I've postponed one of my series to 3.3 because it breaks 
OMAP unless those changes are applied first.


Nicolas

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
@ 2011-10-07 20:23         ` Nicolas Pitre
  0 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-07 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 7 Oct 2011, Santosh Shilimkar wrote:

> I have reviewed and tested this series. No problems seen.
> As asked on other thread, if you are targeting this one for
> 3.2, then sram changes would have a small conflict with
> OMAP4 errata patch. If it is for 3.3, we should be able to
> sort out that conflict easily.

3.2 please.  I've postponed one of my series to 3.3 because it breaks 
OMAP unless those changes are applied first.


Nicolas

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
  2011-10-07 14:54           ` Tony Lindgren
@ 2011-10-07 23:26             ` Nicolas Pitre
  -1 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-07 23:26 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Santosh Shilimkar, linux-arm-kernel, linux-omap

On Fri, 7 Oct 2011, Tony Lindgren wrote:

> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:22]:
> > The changes looks fine to me. Though the ugly hard-coding
> > is back with it, it's a step towards generic_io, so hopefully
> > it won't have to stay for long time.
> 
> Nico please correct me if I'm wrong, but I think that with
> generic map_io we have static mappings in place after map_io,
> and then ioremap should work for the static mappings right
> after map_io except without the need for __arch_ioremap.

Yes, that _should_ work.


Nicolas

^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
@ 2011-10-07 23:26             ` Nicolas Pitre
  0 siblings, 0 replies; 74+ messages in thread
From: Nicolas Pitre @ 2011-10-07 23:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 7 Oct 2011, Tony Lindgren wrote:

> * Santosh Shilimkar <santosh.shilimkar@ti.com> [111006 23:22]:
> > The changes looks fine to me. Though the ugly hard-coding
> > is back with it, it's a step towards generic_io, so hopefully
> > it won't have to stay for long time.
> 
> Nico please correct me if I'm wrong, but I think that with
> generic map_io we have static mappings in place after map_io,
> and then ioremap should work for the static mappings right
> after map_io except without the need for __arch_ioremap.

Yes, that _should_ work.


Nicolas

^ permalink raw reply	[flat|nested] 74+ messages in thread

end of thread, other threads:[~2011-10-07 23:26 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-05  0:45 [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec() Tony Lindgren
2011-10-05  0:45 ` Tony Lindgren
2011-10-05  0:45 ` [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY Tony Lindgren
2011-10-05  0:45   ` Tony Lindgren
2011-10-05  1:00   ` Nicolas Pitre
2011-10-05  1:00     ` Nicolas Pitre
2011-10-05 22:06     ` Tony Lindgren
2011-10-05 22:06       ` Tony Lindgren
2011-10-05 22:08       ` [PATCH 1.5/4] ARM: OMAP1: Use generic map_io, init_early and init_irq Tony Lindgren
2011-10-05 22:08         ` Tony Lindgren
2011-10-07  6:40       ` [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY Santosh Shilimkar
2011-10-07  6:40         ` Santosh Shilimkar
2011-10-07 14:43         ` Tony Lindgren
2011-10-07 14:43           ` Tony Lindgren
2011-10-07 15:03           ` Santosh Shilimkar
2011-10-07 15:03             ` Santosh Shilimkar
2011-10-07 15:11             ` Tony Lindgren
2011-10-07 15:11               ` Tony Lindgren
2011-10-07 17:39               ` Santosh Shilimkar
2011-10-07 17:39                 ` Santosh Shilimkar
2011-10-07 18:16                 ` Tony Lindgren
2011-10-07 18:16                   ` Tony Lindgren
2011-10-07 18:20                   ` Santosh Shilimkar
2011-10-07 18:20                     ` Santosh Shilimkar
2011-10-07 18:27                     ` Tony Lindgren
2011-10-07 18:27                       ` Tony Lindgren
2011-10-05  0:45 ` [PATCH 2/4] ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done Tony Lindgren
2011-10-05  0:45   ` Tony Lindgren
2011-10-07  6:47   ` Santosh Shilimkar
2011-10-07  6:47     ` Santosh Shilimkar
2011-10-05  0:45 ` [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer Tony Lindgren
2011-10-05  0:45   ` Tony Lindgren
2011-10-05  6:45   ` Tomi Valkeinen
2011-10-05  6:45     ` Tomi Valkeinen
2011-10-05 22:41     ` Tony Lindgren
2011-10-05 22:41       ` Tony Lindgren
2011-10-06  8:38       ` Tomi Valkeinen
2011-10-06  8:38         ` Tomi Valkeinen
2011-10-06 16:22         ` Tony Lindgren
2011-10-06 16:22           ` Tony Lindgren
2011-10-05  0:45 ` [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec() Tony Lindgren
2011-10-05  0:45   ` Tony Lindgren
2011-10-05  1:07   ` Nicolas Pitre
2011-10-05  1:07     ` Nicolas Pitre
2011-10-05 22:13     ` Tony Lindgren
2011-10-05 22:13       ` Tony Lindgren
2011-10-05 23:01       ` Nicolas Pitre
2011-10-05 23:01         ` Nicolas Pitre
2011-10-07  6:52       ` Santosh Shilimkar
2011-10-07  6:52         ` Santosh Shilimkar
2011-10-07 14:55         ` Tony Lindgren
2011-10-07 14:55           ` Tony Lindgren
2011-10-05  1:40 ` [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early Tony Lindgren
2011-10-05  1:40   ` Tony Lindgren
2011-10-05  1:51   ` Nicolas Pitre
2011-10-05  1:51     ` Nicolas Pitre
2011-10-06  1:36     ` Tony Lindgren
2011-10-06  1:36       ` Tony Lindgren
2011-10-07  6:56       ` Santosh Shilimkar
2011-10-07  6:56         ` Santosh Shilimkar
2011-10-07 14:54         ` Tony Lindgren
2011-10-07 14:54           ` Tony Lindgren
2011-10-07 23:26           ` Nicolas Pitre
2011-10-07 23:26             ` Nicolas Pitre
2011-10-05  7:03 ` [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec() Santosh Shilimkar
2011-10-05  7:03   ` Santosh Shilimkar
2011-10-06  1:42   ` Tony Lindgren
2011-10-06  1:42     ` Tony Lindgren
2011-10-07  6:59     ` Santosh Shilimkar
2011-10-07  6:59       ` Santosh Shilimkar
2011-10-07 14:45       ` Tony Lindgren
2011-10-07 14:45         ` Tony Lindgren
2011-10-07 20:23       ` Nicolas Pitre
2011-10-07 20:23         ` Nicolas Pitre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.