diff mbox

[1/3,v2] davinci: sram: ioremap the davinci_soc_info specified sram regions

Message ID 3406118d1598e5e279108dd94c63ced1fa8d02bc.1306877621.git.bengardiner@nanometrics.ca (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Gardiner May 31, 2011, 9:46 p.m. UTC
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.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Sekhar Nori <nsekhar@ti.com>

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

---
 arch/arm/mach-davinci/sram.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

Comments

Jean-Christophe PLAGNIOL-VILLARD June 1, 2011, 5:17 a.m. UTC | #1
On 17:46 Tue 31 May     , Ben Gardiner wrote:
> 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
> 
> 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.
> 
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Sekhar Nori <nsekhar@ti.com>
> 
> ---
> Changes since v1:
>  * return -ENOMEM if ioremap fails (Sekhar Nori)
you need to put your sob

otherwise 

Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

for the whole series

Best Regards,
J.
Ben Gardiner June 1, 2011, 3:03 p.m. UTC | #2
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(-)
Sekhar Nori June 1, 2011, 4:56 p.m. UTC | #3
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
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
index 2c53db2..68b05d5 100644
--- a/arch/arm/mach-davinci/sram.c
+++ b/arch/arm/mach-davinci/sram.c
@@ -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;
 }