Skip to contentSkip to conversation

Repost of omap SRAM map_io changes

PATCH New Tony Lindgren 3 participants 12 messages Oct 7, 2011 – Oct 11, 2011

Subsystems (4)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Repost of omap SRAM map_io changes

Hi all,

Here's a repost of the original patches with minimal changes to fix some compile warnings and with the acks added.

There's also one new patch to warn about trying to use the omap_ioremap too early that's good to have for some sanity checks.

These patches are against the dt branch in linux-omap tree because of dependencies to earlier cleanup.

Regards,

Tony

---

Tony Lindgren (7):
ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
ARM: OMAP1: Use generic map_io, init_early and init_irq
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()
ARM: OMAP: Move set_globals initialization to happen in init_early
ARM: OMAP: Warn if omap_ioremap is called before SoC detection

 arch/arm/include/asm/io.h                |    1 
 arch/arm/mach-omap1/board-ams-delta.c    |   16 +---
 arch/arm/mach-omap1/board-fsample.c      |   76 +++++++++---------
 arch/arm/mach-omap1/board-generic.c      |   16 +---
 arch/arm/mach-omap1/board-h2.c           |   16 +---
 arch/arm/mach-omap1/board-h3.c           |   16 +---
 arch/arm/mach-omap1/board-htcherald.c    |   12 +--
 arch/arm/mach-omap1/board-innovator.c    |   36 ++++-----
 arch/arm/mach-omap1/board-nokia770.c     |   34 +++-----
 arch/arm/mach-omap1/board-osk.c          |   16 +---
 arch/arm/mach-omap1/board-palmte.c       |   16 +---
 arch/arm/mach-omap1/board-palmtt.c       |   16 +---
 arch/arm/mach-omap1/board-palmz71.c      |   18 +---
 arch/arm/mach-omap1/board-perseus2.c     |   75 +++++++++---------
 arch/arm/mach-omap1/board-sx1.c          |   17 +---
 arch/arm/mach-omap1/board-voiceblue.c    |   16 +---
 arch/arm/mach-omap1/devices.c            |    3 +
 arch/arm/mach-omap1/io.c                 |   57 ++++++-------
 arch/arm/mach-omap2/board-omap3beagle.c  |    7 --
 arch/arm/mach-omap2/board-ti8168evm.c    |    1 
 arch/arm/mach-omap2/common.c             |   50 +++++-------
 arch/arm/mach-omap2/control.c            |   14 +--
 arch/arm/mach-omap2/io.c                 |  127 +++++++++++++++---------------
 arch/arm/mach-omap2/io.h                 |    7 --
 arch/arm/mach-omap2/omap-smp.c           |    7 +-
 arch/arm/mach-omap2/prcm.c               |   19 +---
 arch/arm/mach-omap2/sdrc.c               |   13 +--
 arch/arm/mm/ioremap.c                    |   21 +++++
 arch/arm/plat-omap/include/plat/common.h |   17 ++--
 arch/arm/plat-omap/include/plat/io.h     |   29 ++++++-
 arch/arm/plat-omap/io.c                  |   10 ++
 arch/arm/plat-omap/sram.c                |   85 +++++---------------
 32 files changed, 356 insertions(+), 508 deletions(-)
Signature · 1 line
Signature
author maintainer
#1 lore raw

PATCH 1/7 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.

---
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
arch/arm/include/asm/io.h +1 -0
index d66605d..4ff152e 100644
@@ -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);
 
 /*
arch/arm/mm/ioremap.c +21 -0
index ab50627..a2d94ac 100644
@@ -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);
author maintainer
#2 lore raw

PATCH 1/7 ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY

Quoted 8 lines · Tony Lindgren

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.

FYI this I've sent to Russell's patch system:

http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7126/1

Regards,

Tony

Quoted 54 lines
---
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
arch/arm/include/asm/io.h +1 -0
index d66605d..4ff152e 100644
@@ -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);
 
 /*
arch/arm/mm/ioremap.c +21 -1
index ab50627..a2d94ac 100644
@@ -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);
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

PATCH 1/7 ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY

In reply to Tony Lindgren
Quoted 5 lines · On Fri, 07 Oct 2011 12:45:43 -0700 Tony Lindgren <[email protected]> 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.

Looks good to me, thanks for doing this. I only have one very minor quibble below, which could be addressed in a later patch..

Quoted 27 lines
---
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
arch/arm/include/asm/io.h +0 -0
index d66605d..4ff152e 100644
@@ -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);
/*

arch/arm/mm/ioremap.c +0 -0
index ab50627..a2d94ac 100644
@@ -289,6 +289,27 @@ __arm_ioremap(unsigned long phys_addr, size_t
 size, unsigned int mtype) }
 EXPORT_SYMBOL(__arm_ioremap);

arch/arm/mm/ioremap.c __arm_ioremap(unsigned long phys_addr, size_t · line 300

Quoted 10 lines
arch/arm/mm/ioremap.c +9 -0
 
+/*
+ * 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)

I'd rather see this as 'bool cached', so it's clear we're talking about a simple boolean (rather than bits).

Quoted 21 lines
arch/arm/mm/ioremap.c +12 -1
+{
+	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);
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#4 lore raw

PATCH 1/7 ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY

Quoted 12 lines · Andres Salomon
Quoted 5 lines · On Fri, 07 Oct 2011 12:45:43 -0700 Tony Lindgren <[email protected]> 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.

Quoted 8 lines

Looks good to me, thanks for doing this. I only have one very minor quibble below, which could be addressed in a later patch..

arch/arm/mm/ioremap.c __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) · line 300

Quoted 2 lines
arch/arm/mm/ioremap.c +2 -0
+void __iomem *
+__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)

I'd rather see this as 'bool cached', so it's clear we're talking about a simple boolean (rather than bits).

Sure, thanks, updated version below. Will also update the patch in Russell's patch system.

Tony
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ioremap-exec.patch
Type: text/x-diff
Size: 1937 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20111011/a970586f/attachment-0001.bin>

author maintainer
#5 lore raw

PATCH 2/7 ARM: OMAP1: Use generic map_io, init_early and init_irq

In reply to Tony Lindgren

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.

---
 arch/arm/mach-omap1/board-ams-delta.c |   16 +------
 arch/arm/mach-omap1/board-fsample.c   |   76 ++++++++++++++++-----------------
 arch/arm/mach-omap1/board-generic.c   |   16 +------
 arch/arm/mach-omap1/board-h2.c        |   16 +------
 arch/arm/mach-omap1/board-h3.c        |   16 +------
 arch/arm/mach-omap1/board-htcherald.c |   12 +----
 arch/arm/mach-omap1/board-innovator.c |   36 +++++++---------
 arch/arm/mach-omap1/board-nokia770.c  |   34 +++++----------
 arch/arm/mach-omap1/board-osk.c       |   16 +------
 arch/arm/mach-omap1/board-palmte.c    |   16 +------
 arch/arm/mach-omap1/board-palmtt.c    |   16 +------
 arch/arm/mach-omap1/board-palmz71.c   |   18 +-------
 arch/arm/mach-omap1/board-perseus2.c  |   75 ++++++++++++++++-----------------
 arch/arm/mach-omap1/board-sx1.c       |   17 +------
 arch/arm/mach-omap1/board-voiceblue.c |   16 +------
 arch/arm/mach-omap1/io.c              |   56 +++++++++++-------------
 arch/arm/plat-omap/include/plat/io.h  |   27 +++++++++++-
 17 files changed, 183 insertions(+), 296 deletions(-)
arch/arm/mach-omap1/board-ams-delta.c +3 -13
index 312ea6b..4427737 100644
@@ -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 <[email protected]> */
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-fsample.c +36 -40

103 lines not on this page · raw message

arch/arm/mach-omap1/board-generic.c +3 -13
index 04fc356..cc0cca7 100644
@@ -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 <[email protected]> */
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-h2.c +3 -13
index cb7fb1a..248a5b8 100644
@@ -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 <[email protected]> */
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-h3.c +3 -13
index 31f3487..f28f05f 100644
@@ -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. */
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-htcherald.c +3 -9
index 36e06ea..67798df 100644
@@ -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 <[email protected]> */
 	/* Maintainer: wing-linux.sourceforge.net */
 	.boot_params    = 0x10000100,
 	.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
arch/arm/mach-omap1/board-innovator.c +16 -20
index 0b1ba46..3e349d0 100644
@@ -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. */
 	.boot_params	= 0x10000100,
 	.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
arch/arm/mach-omap1/board-nokia770.c +12 -22
index 5469ce2..9b348b6 100644
@@ -39,21 +39,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),
@@ -246,6 +231,15 @@ static inline void nokia770_mmc_init(void)
 
 static void __init omap_nokia770_init(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);
+
 	platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
 	spi_register_board_info(nokia770_spi_board_info,
 				ARRAY_SIZE(nokia770_spi_board_info));
@@ -258,16 +252,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")
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-osk.c +3 -13
index b08a213..562986e 100644
@@ -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 <[email protected]> */
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-palmte.c +3 -13
index 459cb6b..fc9edd8 100644
@@ -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")
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-palmtt.c +3 -13
index b214f45..5ff3def 100644
@@ -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")
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-palmz71.c +3 -15
index 9b0ea48..8e08873 100644
@@ -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")
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-perseus2.c +36 -39

102 lines not on this page · raw message

arch/arm/mach-omap1/board-sx1.c +3 -14
index 9c3b7c5..23326e0 100644
@@ -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")
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/board-voiceblue.c +3 -13
index 036edc0..1444ce8 100644
@@ -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 <[email protected]> */
 	.boot_params	= 0x10000100,
-	.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
arch/arm/mach-omap1/io.c +25 -31

83 lines not on this page · raw message

arch/arm/plat-omap/include/plat/io.h +25 -2
index 6591875..c0c7850 100644
@@ -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);
author maintainer
#6 lore raw

PATCH 3/7 ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done

In reply to Tony Lindgren

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

---
 arch/arm/mach-omap2/board-omap3beagle.c  |    7 --
 arch/arm/mach-omap2/io.c                 |   95 +++++++++++++++---------------
 arch/arm/plat-omap/include/plat/common.h |    1 
 3 files changed, 50 insertions(+), 53 deletions(-)
arch/arm/mach-omap2/board-omap3beagle.c +1 -6
index 4a5d75f..4c25742 100644
@@ -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,
arch/arm/mach-omap2/io.c +48 -47

147 lines not on this page · raw message

arch/arm/plat-omap/include/plat/common.h +1 -0
index abda2c7..5eac355 100644
@@ -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);
author maintainer
#7 lore raw

PATCH 4/7 ARM: OMAP: Remove calls to SRAM allocations for framebuffer

In reply to Tony Lindgren

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.

---
 arch/arm/plat-omap/sram.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)
arch/arm/plat-omap/sram.c +0 -16
index 363c91e..3c8aa44 100644
@@ -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;
 }
author maintainer
#8 lore raw

PATCH 5/7 ARM: OMAP: Map SRAM later on with ioremap_exec()

In reply to Tony Lindgren

This allows us to remove omap hacks for map_io.

---
 arch/arm/mach-omap1/devices.c            |    3 +
 arch/arm/mach-omap1/io.c                 |    2 -
 arch/arm/mach-omap2/io.c                 |   21 +--------
 arch/arm/mach-omap2/io.h                 |    7 ---
 arch/arm/plat-omap/include/plat/common.h |    2 +
 arch/arm/plat-omap/sram.c                |   69 +++++++++---------------------
 6 files changed, 28 insertions(+), 76 deletions(-)
arch/arm/mach-omap1/devices.c +3 -0
index 36f26c3..38e1142 100644
@@ -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.
 	 */
arch/arm/mach-omap1/io.c +0 -2
index a16aab7..8140a4e 100644
@@ -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();
 }
 
 /*
arch/arm/mach-omap2/io.c +3 -18
index e8123d0..b42bbb8 100644
@@ -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();
 }
 
 static void __init omap_hwmod_init_postsetup(void)
@@ -449,11 +433,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();
 	}
-
 }
 
 /*
arch/arm/mach-omap2/io.h +0 -7
index fd230c6..e69de29 100644
@@ -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__ */
arch/arm/plat-omap/include/plat/common.h +2 -0
index 5eac355..ed85720 100644
@@ -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
arch/arm/plat-omap/sram.c +20 -49

149 lines not on this page · raw message

author maintainer
#9 lore raw

PATCH 6/7 ARM: OMAP: Move set_globals initialization to happen in init_early

In reply to Tony Lindgren

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

---
 arch/arm/mach-omap2/board-ti8168evm.c    |    1 -
 arch/arm/mach-omap2/common.c             |   50 ++++++++++++++----------------
 arch/arm/mach-omap2/control.c            |   14 ++------
 arch/arm/mach-omap2/io.c                 |   14 ++++++++
 arch/arm/mach-omap2/omap-smp.c           |    7 +++-
 arch/arm/mach-omap2/prcm.c               |   19 ++++-------
 arch/arm/mach-omap2/sdrc.c               |   13 ++------
 arch/arm/plat-omap/include/plat/common.h |   14 ++++----
 8 files changed, 62 insertions(+), 70 deletions(-)
arch/arm/mach-omap2/board-ti8168evm.c +0 -1
index 981ca00..b0a16d2 100644
@@ -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();
 }
 
arch/arm/mach-omap2/common.c +23 -27

104 lines not on this page · raw message

arch/arm/mach-omap2/control.c +4 -10
index aab884f..e34d27f 100644
@@ -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)
arch/arm/mach-omap2/io.c +13 -1
index b42bbb8..d5caac3 100644
@@ -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();
arch/arm/mach-omap2/omap-smp.c +5 -2
index ce65e93..11e25a4 100644
@@ -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);
arch/arm/mach-omap2/prcm.c +6 -13
index 2e40a5c..8db5f03 100644
@@ -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;
 }
arch/arm/mach-omap2/sdrc.c +4 -9
index da6f3a6..8f27828 100644
@@ -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;
 }
 
 /**
arch/arm/plat-omap/include/plat/common.h +7 -7
index ed85720..c50df48 100644
@@ -65,13 +65,13 @@ void omap_sram_init(void);
 struct omap_globals {
 	u32		class;		/* OMAP class to detect */
 	void __iomem	*tap;		/* Control module ID code */
-	unsigned long   sdrc;           /* SDRAM Controller */
-	unsigned long   sms;            /* SDRAM Memory Scheduler */
-	unsigned long   ctrl;           /* System Control Module */
-	unsigned long   ctrl_pad;	/* PAD Control Module */
-	unsigned long   prm;            /* Power and Reset Management */
-	unsigned long   cm;             /* Clock Management */
-	unsigned long   cm2;
+	void __iomem	*sdrc;           /* SDRAM Controller */
+	void __iomem	*sms;            /* SDRAM Memory Scheduler */
+	void __iomem	*ctrl;           /* System Control Module */
+	void __iomem	*ctrl_pad;	/* PAD Control Module */
+	void __iomem	*prm;            /* Power and Reset Management */
+	void __iomem	*cm;             /* Clock Management */
+	void __iomem	*cm2;
 };
 
 void omap2_set_globals_242x(void);
author maintainer
#10 lore raw

PATCH 7/7 ARM: OMAP: Warn if omap_ioremap is called before SoC detection

In reply to Tony Lindgren

We don't have cpu_is_omapxxxx SoC detection initialized until SoC detection is initialized from init_early.

Note that with the common map_io we should no longer need cpu_is_omapxxxx for ioremap.

---
 arch/arm/mach-omap1/io.c             |    1 +
 arch/arm/mach-omap2/io.c             |    1 +
 arch/arm/plat-omap/include/plat/io.h |    2 ++
 arch/arm/plat-omap/io.c              |   10 ++++++++++
 4 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-omap1/io.c +1 -0
index 8140a4e..fd9eb09 100644
@@ -121,6 +121,7 @@ void __init omap16xx_map_io(void)
 void omap1_init_early(void)
 {
 	omap_check_revision();
+	omap_ioremap_init();
 
 	/* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
 	 * on a Posted Write in the TIPB Bridge".
arch/arm/mach-omap2/io.c +1 -0
index d5caac3..aa96538 100644
@@ -323,6 +323,7 @@ void __iomem *omap_irq_base;
 static void __init omap_common_init_early(void)
 {
 	omap2_check_revision();
+	omap_ioremap_init();
 }
 
 static void __init omap_hwmod_init_postsetup(void)
arch/arm/plat-omap/include/plat/io.h +2 -0
index c0c7850..5ffbea6 100644
@@ -247,6 +247,8 @@
  * NOTE: Please use ioremap + __raw_read/write where possible instead of these
  */
 
+void omap_ioremap_init(void);
+
 extern u8 omap_readb(u32 pa);
 extern u16 omap_readw(u32 pa);
 extern u32 omap_readl(u32 pa);
arch/arm/plat-omap/io.c +10 -0
index f1ecfa9..1bbcbde 100644
@@ -23,11 +23,16 @@
 #define BETWEEN(p,st,sz)	((p) >= (st) && (p) < ((st) + (sz)))
 #define XLATE(p,pst,vst)	((void __iomem *)((p) - (pst) + (vst)))
 
+static int initialized;
+
 /*
  * Intercept ioremap() requests for addresses in our fixed mapping regions.
  */
 void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
 {
+
+	WARN(!initialized, "Do not use ioremap before init_early\n");
+
 #ifdef CONFIG_ARCH_OMAP1
 	if (cpu_class_is_omap1()) {
 		if (BETWEEN(p, OMAP1_IO_PHYS, OMAP1_IO_SIZE))
@@ -139,3 +144,8 @@ void omap_iounmap(volatile void __iomem *addr)
 		__iounmap(addr);
 }
 EXPORT_SYMBOL(omap_iounmap);
+
+void __init omap_ioremap_init(void)
+{
+	initialized++;
+}
#11 lore raw

PATCH 7/7 ARM: OMAP: Warn if omap_ioremap is called before SoC detection

Quoted 7 lines · Tony Lindgren

We don't have cpu_is_omapxxxx SoC detection initialized until SoC detection is initialized from init_early.

Note that with the common map_io we should no longer need cpu_is_omapxxxx for ioremap.

Quoted 81 lines
---
 arch/arm/mach-omap1/io.c             |    1 +
 arch/arm/mach-omap2/io.c             |    1 +
 arch/arm/plat-omap/include/plat/io.h |    2 ++
 arch/arm/plat-omap/io.c              |   10 ++++++++++
 4 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-omap1/io.c +1 -0
index 8140a4e..fd9eb09 100644
@@ -121,6 +121,7 @@ void __init omap16xx_map_io(void)
 void omap1_init_early(void)
 {
 	omap_check_revision();
+	omap_ioremap_init();
 
 	/* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
 	 * on a Posted Write in the TIPB Bridge".
arch/arm/mach-omap2/io.c +1 -0
index d5caac3..aa96538 100644
@@ -323,6 +323,7 @@ void __iomem *omap_irq_base;
 static void __init omap_common_init_early(void)
 {
 	omap2_check_revision();
+	omap_ioremap_init();
 }
 
 static void __init omap_hwmod_init_postsetup(void)
arch/arm/plat-omap/include/plat/io.h +2 -0
index c0c7850..5ffbea6 100644
@@ -247,6 +247,8 @@
  * NOTE: Please use ioremap + __raw_read/write where possible instead of these
  */
 
+void omap_ioremap_init(void);
+
 extern u8 omap_readb(u32 pa);
 extern u16 omap_readw(u32 pa);
 extern u32 omap_readl(u32 pa);
arch/arm/plat-omap/io.c +10 -0
index f1ecfa9..1bbcbde 100644
@@ -23,11 +23,16 @@
 #define BETWEEN(p,st,sz)	((p) >= (st) && (p) < ((st) + (sz)))
 #define XLATE(p,pst,vst)	((void __iomem *)((p) - (pst) + (vst)))
 
+static int initialized;
+
 /*
  * Intercept ioremap() requests for addresses in our fixed mapping regions.
  */
 void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
 {
+
+	WARN(!initialized, "Do not use ioremap before init_early\n");
+
 #ifdef CONFIG_ARCH_OMAP1
 	if (cpu_class_is_omap1()) {
 		if (BETWEEN(p, OMAP1_IO_PHYS, OMAP1_IO_SIZE))
@@ -139,3 +144,8 @@ void omap_iounmap(volatile void __iomem *addr)
 		__iounmap(addr);
 }
 EXPORT_SYMBOL(omap_iounmap);
+
+void __init omap_ioremap_init(void)
+{
+	initialized++;
+}

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel