Skip to contentSkip to conversation

davinci: ioremap SRAM instead of iotables

PATCH Superseded Ben Gardiner 3 participants 10 messages May 31, 2011 – Jun 1, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover davinci: ioremap SRAM instead of iotables

The davinci platforms are mapping their io regions using iotables. This patch series converts them to mapping using ioremap.

This version of the series is based on-top-of '[RFC PATCH v4] Consolidate SRAM support' from Russell King and Jean-Christophe PLAGNIOL-VILLARD.

The davinci sram init is first changed to ioremap the regions specified by each of the soc_infos; then the iotables are each removed; then the SRAM_VIRT definition is removed. Finally, the da850's sram region is changed from the ARM local RAM region to the Shared RAM region. This change is needed to support mcasp ping-pong buffers on da850. Suspend was tested with rtcwake and was found to work.

Ben Gardiner (2):
[v2] davinci: sram: ioremap the davinci_soc_info specified sram
regions
[v2] davinci: da850-dm646x: remove the SRAM_VIRT iotable entry

Subhasish Ghosh (1):
[v2] davinci: da850: changed SRAM allocator to shared ram.

 arch/arm/mach-davinci/da850.c               |   10 ++--------
 arch/arm/mach-davinci/dm355.c               |    6 ------
 arch/arm/mach-davinci/dm365.c               |    6 ------
 arch/arm/mach-davinci/dm644x.c              |    6 ------
 arch/arm/mach-davinci/dm646x.c              |    6 ------
 arch/arm/mach-davinci/include/mach/common.h |    2 --
 arch/arm/mach-davinci/include/mach/da8xx.h  |    1 +
 arch/arm/mach-davinci/sram.c                |   10 ++++++++--
 8 files changed, 11 insertions(+), 36 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH v2 1/3 davinci: sram: ioremap the davinci_soc_info specified sram regions

The current davinci init sets up SRAM in iotables. There has been an observed failure to boot a da850 with 128K specified in the iotable.

Make the davinci sram allocator -- now based on RMK's consolidated SRAM support -- do an ioremap of the region specified by the entries in davinci_soc_info before registering with pv_pool_create().

This commit breaks runtime of davinci boards since the regions that the sram init is now trying to ioremap have been iomapped by their iotable entries. The iotable entries will be removed in the patches to come.

---
Changes since v1:
* return -ENOMEM if ioremap fails (Sekhar Nori)

---
 arch/arm/mach-davinci/sram.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/sram.c +8 -2
index 2c53db2..68b05d5 100644
@@ -8,6 +8,7 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/init.h>
 
@@ -25,6 +26,7 @@ EXPORT_SYMBOL_GPL(davinci_gen_pool);
  */
 static int __init sram_init(void)
 {
+	void *addr;
 	unsigned len = davinci_soc_info.sram_len;
 
 	if (!len)
@@ -36,8 +38,12 @@ static int __init sram_init(void)
 	if (!davinci_gen_pool)
 		return -ENOMEM;
 
-	WARN_ON(gen_pool_add_virt(davinci_gen_pool, SRAM_VIRT,
-				  davinci_soc_info.sram_phys, len, -1));
+	addr = ioremap(davinci_soc_info.sram_phys, len);
+	if (!addr)
+		return -ENOMEM;
+	if (WARN_ON(gen_pool_add_virt(davinci_gen_pool, addr,
+				  davinci_soc_info.sram_phys, len, -1)))
+		iounmap(addr);
 
 	return 0;
 }
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH v2 2/3 davinci: da850-dm646x: remove the SRAM_VIRT iotable entry

In reply to Ben Gardiner

The sram regions defined for da850-dm646x in their iotable entries are also defined in their davinci_soc_info's.

Remove this duplicate information which is now uneccessary since sram init will ioremap the regions defined by their davinci_soc_info's.

Since this removal completely removes all uses of SRAM_VIRT, also remove the SRAM_VIRT definition.

---
Changes since v1:
* squashed patches 3-8 in v1 series into this patch (Sergei Shtylyov)

---
 arch/arm/mach-davinci/da850.c               |    6 ------
 arch/arm/mach-davinci/dm355.c               |    6 ------
 arch/arm/mach-davinci/dm365.c               |    6 ------
 arch/arm/mach-davinci/dm644x.c              |    6 ------
 arch/arm/mach-davinci/dm646x.c              |    6 ------
 arch/arm/mach-davinci/include/mach/common.h |    2 --
 6 files changed, 0 insertions(+), 32 deletions(-)
arch/arm/mach-davinci/da850.c +0 -6
index 5c2bf3b..904ede9 100644
@@ -725,12 +725,6 @@ static struct map_desc da850_io_desc[] = {
 		.length		= DA8XX_CP_INTC_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(DA8XX_ARM_RAM_BASE),
-		.length		= SZ_8K,
-		.type		= MT_DEVICE
-	},
 };
 
 static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
arch/arm/mach-davinci/dm355.c +0 -6
index 9bda687..94f44d3 100644
@@ -757,12 +757,6 @@ static struct map_desc dm355_io_desc[] = {
 		.length		= IO_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(0x00010000),
-		.length		= SZ_32K,
-		.type		= MT_MEMORY_NONCACHED,
-	},
 };
 
 /* Contents of JTAG ID register used to identify exact cpu type */
arch/arm/mach-davinci/dm365.c +0 -6
index d306034..58f5b0a 100644
@@ -970,12 +970,6 @@ static struct map_desc dm365_io_desc[] = {
 		.length		= IO_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(0x00010000),
-		.length		= SZ_32K,
-		.type		= MT_MEMORY_NONCACHED,
-	},
 };
 
 static struct resource dm365_ks_resources[] = {
arch/arm/mach-davinci/dm644x.c +0 -6
index 3949ed7..11e6481 100644
@@ -663,12 +663,6 @@ static struct map_desc dm644x_io_desc[] = {
 		.length		= IO_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(0x00008000),
-		.length		= SZ_16K,
-		.type		= MT_MEMORY_NONCACHED,
-	},
 };
 
 /* Contents of JTAG ID register used to identify exact cpu type */
arch/arm/mach-davinci/dm646x.c +0 -6
index a4365f7..57d697e 100644
@@ -747,12 +747,6 @@ static struct map_desc dm646x_io_desc[] = {
 		.length		= IO_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(0x00010000),
-		.length		= SZ_32K,
-		.type		= MT_MEMORY_NONCACHED,
-	},
 };
 
 /* Contents of JTAG ID register used to identify exact cpu type */
arch/arm/mach-davinci/include/mach/common.h +0 -2
index 665d049..16b5ec5 100644
@@ -86,8 +86,6 @@ extern struct davinci_soc_info davinci_soc_info;
 extern void davinci_common_init(struct davinci_soc_info *soc_info);
 extern void davinci_init_ide(void);
 
-/* standard place to map on-chip SRAMs; they *may* support DMA */
-#define SRAM_VIRT	0xfffe0000
 #define SRAM_SIZE	SZ_128K
 
 #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
Signature · 1 line
1.7.4.1
#9 lore raw

PATCH v2 3/3 davinci: da850: changed SRAM allocator to shared ram.

In reply to Ben Gardiner

From: Subhasish Ghosh <[email protected]>

This patch modifies the sram allocator to allocate memory from the DA8XX shared RAM.

[rebased onto consolidated SRAM patches]

---
Changes since v1:
* re-sorted the new DA8XX_SHARED_RAM_BASE definition in da8xx.h to between DA8XX_AEMIF_CTL_BASE and DA8XX_ARM_RAM_BASE (Sergei Shtylyov).

---
 arch/arm/mach-davinci/da850.c              |    4 ++--
 arch/arm/mach-davinci/include/mach/da8xx.h |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/da850.c +2 -2
index 904ede9..4781230 100644
@@ -1093,8 +1093,8 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
 	.gpio_irq		= IRQ_DA8XX_GPIO0,
 	.serial_dev		= &da8xx_serial_device,
 	.emac_pdata		= &da8xx_emac_pdata,
-	.sram_phys		= DA8XX_ARM_RAM_BASE,
-	.sram_len		= SZ_8K,
+	.sram_phys		= DA8XX_SHARED_RAM_BASE,
+	.sram_len		= SZ_128K,
 	.reset_device		= &da8xx_wdt_device,
 };
 
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
index ad64da7..b67499f 100644
@@ -67,6 +67,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_AEMIF_CS2_BASE	0x60000000
 #define DA8XX_AEMIF_CS3_BASE	0x62000000
 #define DA8XX_AEMIF_CTL_BASE	0x68000000
+#define DA8XX_SHARED_RAM_BASE	0x80000000
 #define DA8XX_ARM_RAM_BASE	0xffff0000
 
 void __init da830_init(void);
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH v2 1/3 davinci: sram: ioremap the davinci_soc_info specified sram regions

In reply to Ben Gardiner
Quoted 6 lines · Ben Gardiner

The current davinci init sets up SRAM in iotables. There has been an observed failure to boot a da850 with 128K specified in the iotable.

Make the davinci sram allocator -- now based on RMK's consolidated SRAM support -- do an ioremap of the region specified by the entries in davinci_soc_info before registering with pv_pool_create().

you should update the commit message

Quoted 6 lines

This commit breaks runtime of davinci boards since the regions that the sram init is now trying to ioremap have been iomapped by their iotable entries. The iotable entries will be removed in the patches to come.

Quoted 6 lines

---
Changes since v1:
* return -ENOMEM if ioremap fails (Sekhar Nori)

you need to put your sob

otherwise

for the whole series

Best Regards,
J.

#3 lore raw

v3 cover davinci: ioremap SRAM instead of iotables

The davinci platforms are mapping their io regions using iotables. This patch series converts them to mapping using ioremap.

This version of the series is based on-top-of '[RFC PATCH v4] Consolidate SRAM support' from Russell King and Jean-Christophe PLAGNIOL-VILLARD. V3 has a fix to the commit message of 1/3 as requested by Jean-Christophe PLAGNIOL- VILLARD and also his Acks added to the series.

The davinci sram init is first changed to ioremap the regions specified by each of the soc_infos; then the iotables are each removed; then the SRAM_VIRT definition is removed. Finally, the da850's sram region is changed from the ARM local RAM region to the Shared RAM region. This change is needed to support mcasp ping-pong buffers on da850. Suspend was tested with rtcwake and was found to work.

Ben Gardiner (2):
[v3] davinci: sram: ioremap the davinci_soc_info specified sram
regions
[v3] davinci: da850-dm646x: remove the SRAM_VIRT iotable entry

Subhasish Ghosh (1):
[v3] davinci: da850: changed SRAM allocator to shared ram.

 arch/arm/mach-davinci/da850.c               |   10 ++--------
 arch/arm/mach-davinci/dm355.c               |    6 ------
 arch/arm/mach-davinci/dm365.c               |    6 ------
 arch/arm/mach-davinci/dm644x.c              |    6 ------
 arch/arm/mach-davinci/dm646x.c              |    6 ------
 arch/arm/mach-davinci/include/mach/common.h |    2 --
 arch/arm/mach-davinci/include/mach/da8xx.h  |    1 +
 arch/arm/mach-davinci/sram.c                |   10 ++++++++--
 8 files changed, 11 insertions(+), 36 deletions(-)
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH v3 1/3 davinci: sram: ioremap the davinci_soc_info specified sram regions

The current davinci init sets up SRAM in iotables. There has been an observed failure to boot a da850 with 128K specified in the iotable.

Make the davinci sram allocator -- now based on RMK's consolidated SRAM support -- do an ioremap of the region specified by the entries in davinci_soc_info before registering with gen_pool_add_virt().

This commit breaks runtime of davinci boards since the regions that the sram init is now trying to ioremap have been iomapped by their iotable entries. The iotable entries will be removed in the patches to come.

---
Changes since v2:
* Added Jean-Christophe PLAGNIOL-VILLARD's Ack
Changes since v1:
* return -ENOMEM if ioremap fails (Sekhar Nori)

---
 arch/arm/mach-davinci/sram.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/sram.c +8 -2
index 2c53db2..68b05d5 100644
@@ -8,6 +8,7 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/init.h>
 
@@ -25,6 +26,7 @@ EXPORT_SYMBOL_GPL(davinci_gen_pool);
  */
 static int __init sram_init(void)
 {
+	void *addr;
 	unsigned len = davinci_soc_info.sram_len;
 
 	if (!len)
@@ -36,8 +38,12 @@ static int __init sram_init(void)
 	if (!davinci_gen_pool)
 		return -ENOMEM;
 
-	WARN_ON(gen_pool_add_virt(davinci_gen_pool, SRAM_VIRT,
-				  davinci_soc_info.sram_phys, len, -1));
+	addr = ioremap(davinci_soc_info.sram_phys, len);
+	if (!addr)
+		return -ENOMEM;
+	if(WARN_ON(gen_pool_add_virt(davinci_gen_pool, addr,
+				  davinci_soc_info.sram_phys, len, -1)))
+		iounmap(addr);
 
 	return 0;
 }
Signature · 1 line
1.7.4.1
#5 lore raw

PATCH v3 2/3 davinci: da850-dm646x: remove the SRAM_VIRT iotable entry

In reply to Ben Gardiner

The sram regions defined for da850-dm646x in their iotable entries are also defined in their davinci_soc_info's.

Remove this duplicate information which is now uneccessary since sram init will ioremap the regions defined by their davinci_soc_info's.

Since this removal completely removes all uses of SRAM_VIRT, also remove the SRAM_VIRT definition.

---
Changes since v2:
* Added Jean-Christophe PLAGNIOL-VILLARD's Ack
Changes since v1:
* squashed patches 3-8 in v1 series into this patch (Sergei Shtylyov)

---
 arch/arm/mach-davinci/da850.c               |    6 ------
 arch/arm/mach-davinci/dm355.c               |    6 ------
 arch/arm/mach-davinci/dm365.c               |    6 ------
 arch/arm/mach-davinci/dm644x.c              |    6 ------
 arch/arm/mach-davinci/dm646x.c              |    6 ------
 arch/arm/mach-davinci/include/mach/common.h |    2 --
 6 files changed, 0 insertions(+), 32 deletions(-)
arch/arm/mach-davinci/da850.c +0 -6
index 5c2bf3b..904ede9 100644
@@ -725,12 +725,6 @@ static struct map_desc da850_io_desc[] = {
 		.length		= DA8XX_CP_INTC_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(DA8XX_ARM_RAM_BASE),
-		.length		= SZ_8K,
-		.type		= MT_DEVICE
-	},
 };
 
 static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
arch/arm/mach-davinci/dm355.c +0 -6
index 9bda687..94f44d3 100644
@@ -757,12 +757,6 @@ static struct map_desc dm355_io_desc[] = {
 		.length		= IO_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(0x00010000),
-		.length		= SZ_32K,
-		.type		= MT_MEMORY_NONCACHED,
-	},
 };
 
 /* Contents of JTAG ID register used to identify exact cpu type */
arch/arm/mach-davinci/dm365.c +0 -6
index d306034..58f5b0a 100644
@@ -970,12 +970,6 @@ static struct map_desc dm365_io_desc[] = {
 		.length		= IO_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(0x00010000),
-		.length		= SZ_32K,
-		.type		= MT_MEMORY_NONCACHED,
-	},
 };
 
 static struct resource dm365_ks_resources[] = {
arch/arm/mach-davinci/dm644x.c +0 -6
index 3949ed7..11e6481 100644
@@ -663,12 +663,6 @@ static struct map_desc dm644x_io_desc[] = {
 		.length		= IO_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(0x00008000),
-		.length		= SZ_16K,
-		.type		= MT_MEMORY_NONCACHED,
-	},
 };
 
 /* Contents of JTAG ID register used to identify exact cpu type */
arch/arm/mach-davinci/dm646x.c +0 -6
index a4365f7..57d697e 100644
@@ -747,12 +747,6 @@ static struct map_desc dm646x_io_desc[] = {
 		.length		= IO_SIZE,
 		.type		= MT_DEVICE
 	},
-	{
-		.virtual	= SRAM_VIRT,
-		.pfn		= __phys_to_pfn(0x00010000),
-		.length		= SZ_32K,
-		.type		= MT_MEMORY_NONCACHED,
-	},
 };
 
 /* Contents of JTAG ID register used to identify exact cpu type */
arch/arm/mach-davinci/include/mach/common.h +0 -2
index 665d049..16b5ec5 100644
@@ -86,8 +86,6 @@ extern struct davinci_soc_info davinci_soc_info;
 extern void davinci_common_init(struct davinci_soc_info *soc_info);
 extern void davinci_init_ide(void);
 
-/* standard place to map on-chip SRAMs; they *may* support DMA */
-#define SRAM_VIRT	0xfffe0000
 #define SRAM_SIZE	SZ_128K
 
 #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
Signature · 1 line
1.7.4.1
#6 lore raw

PATCH v3 3/3 davinci: da850: changed SRAM allocator to shared ram.

In reply to Ben Gardiner

From: Subhasish Ghosh <[email protected]>

This patch modifies the sram allocator to allocate memory from the DA8XX shared RAM.

---
Changes since v2:
* Added Jean-Christophe PLAGNIOL-VILLARD's Ack
Changes since v1:
* re-sorted the new DA8XX_SHARED_RAM_BASE definition in da8xx.h to between DA8XX_AEMIF_CTL_BASE and DA8XX_DDR2_CTL_BASE (Sergei Shtylyov).

---
 arch/arm/mach-davinci/da850.c              |    4 ++--
 arch/arm/mach-davinci/include/mach/da8xx.h |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/da850.c +2 -2
index 904ede9..4781230 100644
@@ -1093,8 +1093,8 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
 	.gpio_irq		= IRQ_DA8XX_GPIO0,
 	.serial_dev		= &da8xx_serial_device,
 	.emac_pdata		= &da8xx_emac_pdata,
-	.sram_phys		= DA8XX_ARM_RAM_BASE,
-	.sram_len		= SZ_8K,
+	.sram_phys		= DA8XX_SHARED_RAM_BASE,
+	.sram_len		= SZ_128K,
 	.reset_device		= &da8xx_wdt_device,
 };
 
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
index ad64da7..b67499f 100644
@@ -67,6 +67,7 @@ extern unsigned int da850_max_speed;
 #define DA8XX_AEMIF_CS2_BASE	0x60000000
 #define DA8XX_AEMIF_CS3_BASE	0x62000000
 #define DA8XX_AEMIF_CTL_BASE	0x68000000
+#define DA8XX_SHARED_RAM_BASE	0x80000000
 #define DA8XX_ARM_RAM_BASE	0xffff0000
 
 void __init da830_init(void);
Signature · 1 line
1.7.4.1
#7 lore raw

v3 cover davinci: ioremap SRAM instead of iotables

In reply to Ben Gardiner

Hi Ben,

No need to send out a new revision just to add an ack. The maintainer would take care of collecting the acks when committing the patch.

Thanks,
Sekhar