Skip to contentSkip to conversation

initialize omap SRAM later on with __arm_ioremap_exec()

PATCH In review Tony Lindgren 4 participants 37 messages Oct 5, 2011 – Oct 7, 2011

Subsystems (4)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover initialize omap SRAM later on with __arm_ioremap_exec()

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 · 1 line
Signature
author maintainer
#1 lore raw

PATCH 1/4 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     |   22 ++++++++++++++++++++++
 2 files changed, 23 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 +22 -0
index ab50627..a813658 100644
@@ -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);
#2 lore raw

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

Quoted 7 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.

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

Quoted 57 lines
---
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   22 ++++++++++++++++++++++
 2 files changed, 23 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 +22 -0
index ab50627..a813658 100644
@@ -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

author maintainer
#3 lore raw

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

Quoted 8 lines · Nicolas Pitre
Quoted 6 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.

Quoted 5 lines
Quoted 1 line

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

Here's this one updated to drop the export.

Tony

From: Tony Lindgren <[email protected]>
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.

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
#4 lore raw

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

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 +3 -13
index eb36b25..8987b3f 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]> */
 	.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
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 23cc9e4..5a9a54d 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]> */
 	.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
arch/arm/mach-omap1/board-h2.c +3 -13
index 6c70c28..c8e1d4f 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]> */
 	.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
arch/arm/mach-omap1/board-h3.c +3 -13
index 8e2b64a..c88e131 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. */
 	.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
arch/arm/mach-omap1/board-htcherald.c +3 -9
index e81ead1..e8eedd7 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 */
 	.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
arch/arm/mach-omap1/board-innovator.c +16 -20
index 8b03459..88cf8ba 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. */
 	.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
arch/arm/mach-omap1/board-nokia770.c +12 -22
index 8b22be7..6969f2f 100644
@@ -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
arch/arm/mach-omap1/board-osk.c +3 -13
index 44b8e93..3e12a69 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]> */
 	.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
arch/arm/mach-omap1/board-palmte.c +3 -13
index 3d8cd90..4aa2d0e 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")
 	.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
arch/arm/mach-omap1/board-palmtt.c +3 -13
index d0eefe8..32254bd 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")
 	.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
arch/arm/mach-omap1/board-palmz71.c +3 -15
index 98e79bc..d41478d 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")
 	.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
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 602b55c..bdf3b85 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")
 	.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
arch/arm/mach-omap1/board-voiceblue.c +3 -13
index 8016515..42e5151 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]> */
 	.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
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);
#5 lore raw

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

In reply to Tony Lindgren
Quoted 60 lines · Tony Lindgren
Quoted 8 lines · Nicolas Pitre
Quoted 6 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.

Quoted 5 lines
Quoted 1 line

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

Here's this one updated to drop the export.

Tony

From: Tony Lindgren <[email protected]>
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.

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 +7 -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.
+ */

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

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

author maintainer
#6 lore raw

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

Quoted 14 lines · Santosh Shilimkar

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

Quoted 12 lines · Tony Lindgren
Quoted 1 line · Nicolas Pitre

On Tue, 4 Oct 2011, Tony Lindgren wrote:

arch/arm/mm/ioremap.c +10 -0
+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.

Quoted 3 lines

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..

Quoted 2 lines

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

#7 lore raw

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

Quoted 16 lines · Tony Lindgren
Quoted 14 lines · Santosh Shilimkar

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

Quoted 12 lines · Tony Lindgren
Quoted 1 line · Nicolas Pitre

On Tue, 4 Oct 2011, Tony Lindgren wrote:

arch/arm/mm/ioremap.c +10 -0
+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 ?

Quoted 2 lines

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

ok.

Quoted 6 lines
Quoted 3 lines

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..

Quoted 9 lines
Quoted 2 lines

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

author maintainer
#8 lore raw

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

Quoted 6 lines · Santosh Shilimkar
Quoted 5 lines · Tony Lindgren

..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.

Quoted 6 lines
Quoted 2 lines

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.

Quoted 4 lines

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:

arch/arm/mach-omap2/io.c +8 -0
@@ -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
 
arch/arm/plat-omap/sram.c +3 -0
@@ -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

#9 lore raw

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

Quoted 30 lines · Tony Lindgren
Quoted 6 lines · Santosh Shilimkar
Quoted 5 lines · Tony Lindgren

..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.

Quoted 6 lines
Quoted 2 lines

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.

Quoted 4 lines

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:

arch/arm/mach-omap2/io.c +0 -0
@@ -238,6 +238,14 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
 		.length		= L4_EMU_44XX_SIZE,
 		.type		= MT_DEVICE,

arch/arm/mach-omap2/io.c static struct map_desc omap44xx_io_desc[] __initdata = { · line 249

Quoted 10 lines
arch/arm/mach-omap2/io.c +8 -0
 	},
+#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.

(quoted diff) +0 -0

b/arch/arm/plat-omap/include/plat/sram.h
index f500fc3..111b1a8 100644

arch/arm/plat-omap/include/plat/sram.h +5 -0
@@ -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
arch/arm/plat-omap/sram.c +10 -1
index 363c91e..cdd303f 100644
@@ -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

author maintainer
#10 lore raw

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

Quoted 7 lines · Santosh Shilimkar

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.

Quoted 2 lines

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

Quoted 51 lines
arch/arm/plat-omap/include/plat/sram.h +5 -0
index f500fc3..111b1a8 100644
@@ -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
arch/arm/plat-omap/sram.c +10 -1
index 363c91e..cdd303f 100644
@@ -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

#11 lore raw

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

Quoted 9 lines · Tony Lindgren
Quoted 7 lines · Santosh Shilimkar

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.

Quoted 9 lines

Oh yeah, the beginning is different too, I forgot that.

Quoted 2 lines

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.

Quoted 4 lines

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

author maintainer
#12 lore raw

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

Quoted 11 lines · Santosh Shilimkar
Quoted 4 lines · Tony Lindgren

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

author maintainer
#13 lore raw

PATCH 2/4 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                 |   91 ++++++++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h |    1 
 3 files changed, 50 insertions(+), 49 deletions(-)
arch/arm/mach-omap2/board-omap3beagle.c +1 -6
index e085371..4e5605d 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 -43

143 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
#15 lore raw

PATCH 3/4 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;
 }
#16 lore raw

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

Quoted 4 lines · 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.

Quoted 8 lines

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.

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

Tomi

author maintainer
#17 lore raw

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

Quoted 11 lines · Tomi Valkeinen
Quoted 10 lines · 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.

Quoted 7 lines
Quoted 2 lines

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

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

#18 lore raw

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

Quoted 18 lines · Tony Lindgren
Quoted 17 lines · Tomi Valkeinen
Quoted 4 lines · 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.

Quoted 8 lines

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.

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

Quoted 8 lines
Quoted 1 line

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

author maintainer
#19 lore raw

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

Quoted 26 lines · Tomi Valkeinen
Quoted 25 lines · Tony Lindgren
Quoted 11 lines · Tomi Valkeinen
Quoted 10 lines · 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.

Quoted 7 lines
Quoted 2 lines

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

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

Quoted 6 lines
Quoted 1 line

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

author maintainer
#20 lore raw

PATCH 4/4 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-omap2/io.c  |   19 +-----------
 arch/arm/plat-omap/sram.c |   69 +++++++++++++--------------------------------
 2 files changed, 22 insertions(+), 66 deletions(-)
arch/arm/mach-omap2/io.c +2 -17
index 82230e1..8069ca8 100644
@@ -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();
 	}
-
 }
 
 /*
arch/arm/plat-omap/sram.c +20 -49

149 lines not on this page · raw message

#21 lore raw

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

Quoted 3 lines · Tony Lindgren

This allows us to remove omap hacks for map_io.

Nice cleanup.

Quoted 254 lines
---
 arch/arm/mach-omap2/io.c  |   19 +-----------
 arch/arm/plat-omap/sram.c |   69 +++++++++++++--------------------------------
 2 files changed, 22 insertions(+), 66 deletions(-)
arch/arm/mach-omap2/io.c +2 -17
index 82230e1..8069ca8 100644
@@ -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();
 	}
-
 }
 
 /*
arch/arm/plat-omap/sram.c +20 -49
index 3c8aa44..8b28664 100644
@@ -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

author maintainer
#22 lore raw

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

Quoted 9 lines · Nicolas Pitre
Quoted 3 lines · Tony Lindgren

This allows us to remove omap hacks for map_io.

Nice cleanup.

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 <[email protected]>
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.

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 31c5f4d..fec50d8 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();
 		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();
 	}
-
 }
 
 /*
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

#23 lore raw

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

Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Nicolas Pitre
Quoted 3 lines · Tony Lindgren

This allows us to remove omap hacks for map_io.

Quoted 7 lines
Quoted 3 lines

Nice cleanup.

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

#24 lore raw

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

In reply to Tony Lindgren
Quoted 18 lines · Tony Lindgren
Quoted 9 lines · Nicolas Pitre
Quoted 3 lines · Tony Lindgren

This allows us to remove omap hacks for map_io.

Nice cleanup.

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

Quoted 9 lines

From: Tony Lindgren <[email protected]>
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.

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.

author maintainer
#25 lore raw

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

Quoted 2 lines · Santosh Shilimkar

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.

Quoted 2 lines

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

author maintainer
#26 lore raw

[PATCH 5/4] 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 +0 -1
index e26c79c..e6ee884 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 +0 -4
index de61f15..f19a332 100644
@@ -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
arch/arm/mach-omap2/io.c +13 -1
index 4957554..527abdd 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
@@ -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();
Acked-by
#27 lore raw

[PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early

Quoted 4 lines · Tony Lindgren

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

That's great.

Quoted 111 lines
arch/arm/mach-omap2/board-ti8168evm.c +0 -1
index e26c79c..e6ee884 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 +0 -4
index de61f15..f19a332 100644
@@ -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
arch/arm/mach-omap2/io.c +13 -1
index 4957554..527abdd 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
@@ -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

author maintainer
#28 lore raw

[PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early

Quoted 10 lines · Nicolas Pitre
Quoted 4 lines · Tony Lindgren

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

That's great.

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 <[email protected]>
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.

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;
 }
 
 /**
Reviewed-by Tested-by
#29 lore raw

[PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early

Quoted 27 lines · Tony Lindgren
Quoted 10 lines · Nicolas Pitre
Quoted 4 lines · Tony Lindgren

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

That's great.

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 <[email protected]>
Date: Tue, 4 Oct 2011 18:17:41 -0700
Subject: [PATCH] ARM: OMAP: Move set_globals initialization to happen in init_early

Quoted 6 lines

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

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.

considering it's commin

author maintainer
#30 lore raw

[PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early

Quoted 3 lines · Santosh Shilimkar

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

#31 lore raw

[PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early

Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Santosh Shilimkar

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

#32 lore raw

cover initialize omap SRAM later on with __arm_ioremap_exec()

In reply to Tony Lindgren

Tony,

Quoted 11 lines · Tony Lindgren

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

Quoted 9 lines

---

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

author maintainer
#33 lore raw

cover initialize omap SRAM later on with __arm_ioremap_exec()

Quoted 2 lines · Santosh Shilimkar

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.

Quoted 4 lines

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

#34 lore raw

cover initialize omap SRAM later on with __arm_ioremap_exec()

Quoted 7 lines · Tony Lindgren
Quoted 2 lines · Santosh Shilimkar

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.

Quoted 7 lines

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

author maintainer
#35 lore raw

cover initialize omap SRAM later on with __arm_ioremap_exec()

Quoted 9 lines · Santosh Shilimkar
Quoted 7 lines · Tony Lindgren
Quoted 2 lines · Santosh Shilimkar

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.

Quoted 4 lines
Quoted 4 lines

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

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

Quoted 8 lines
Quoted 3 lines

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

#36 lore raw

cover initialize omap SRAM later on with __arm_ioremap_exec()

In reply to Santosh Shilimkar
Quoted 5 lines · Santosh Shilimkar

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