aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBen Gardiner <bengardiner@nanometrics.ca>2012-10-05 13:04:41 -0400
committerSekhar Nori <nsekhar@ti.com>2012-10-27 06:58:33 -0400
commit626863a3f32f0baaf55a1d18b8d4fbb937700dda (patch)
tree97e76d5e443ec8b0d3357f3819d7139bb3e0d8a7 /arch
parent2eb2478d471e45e1d0c8bb3defbf82bf7204e13d (diff)
ARM: davinci: sram: switch from iotable to ioremapped 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 do an ioremap of the region specified by the entries in davinci_soc_info before registering with gen_pool_add_virt(). Remove all iotable SRAM mappings and SRAM_VIRT. Regression tested suspend/resume on AM180x EVM. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Signed-off-by: Matt Porter <mporter@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-davinci/da850.c6
-rw-r--r--arch/arm/mach-davinci/dm355.c6
-rw-r--r--arch/arm/mach-davinci/dm365.c6
-rw-r--r--arch/arm/mach-davinci/dm644x.c6
-rw-r--r--arch/arm/mach-davinci/dm646x.c6
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h2
-rw-r--r--arch/arm/mach-davinci/sram.c18
7 files changed, 15 insertions, 35 deletions
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index b90c172d5541..ffc84f5e1aa2 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -781,12 +781,6 @@ static struct map_desc da850_io_desc[] = {
781 .length = DA8XX_CP_INTC_SIZE, 781 .length = DA8XX_CP_INTC_SIZE,
782 .type = MT_DEVICE 782 .type = MT_DEVICE
783 }, 783 },
784 {
785 .virtual = SRAM_VIRT,
786 .pfn = __phys_to_pfn(DA8XX_ARM_RAM_BASE),
787 .length = SZ_8K,
788 .type = MT_DEVICE
789 },
790}; 784};
791 785
792static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE }; 786static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE };
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index a255434908db..b49c3b77d55e 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -758,12 +758,6 @@ static struct map_desc dm355_io_desc[] = {
758 .length = IO_SIZE, 758 .length = IO_SIZE,
759 .type = MT_DEVICE 759 .type = MT_DEVICE
760 }, 760 },
761 {
762 .virtual = SRAM_VIRT,
763 .pfn = __phys_to_pfn(0x00010000),
764 .length = SZ_32K,
765 .type = MT_MEMORY_NONCACHED,
766 },
767}; 761};
768 762
769/* Contents of JTAG ID register used to identify exact cpu type */ 763/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index b680c832e0ba..6c3980540be0 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -985,12 +985,6 @@ static struct map_desc dm365_io_desc[] = {
985 .length = IO_SIZE, 985 .length = IO_SIZE,
986 .type = MT_DEVICE 986 .type = MT_DEVICE
987 }, 987 },
988 {
989 .virtual = SRAM_VIRT,
990 .pfn = __phys_to_pfn(0x00010000),
991 .length = SZ_32K,
992 .type = MT_MEMORY_NONCACHED,
993 },
994}; 988};
995 989
996static struct resource dm365_ks_resources[] = { 990static struct resource dm365_ks_resources[] = {
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index cd0c8b1e1ecf..9ab1f105cf00 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -786,12 +786,6 @@ static struct map_desc dm644x_io_desc[] = {
786 .length = IO_SIZE, 786 .length = IO_SIZE,
787 .type = MT_DEVICE 787 .type = MT_DEVICE
788 }, 788 },
789 {
790 .virtual = SRAM_VIRT,
791 .pfn = __phys_to_pfn(0x00008000),
792 .length = SZ_16K,
793 .type = MT_MEMORY_NONCACHED,
794 },
795}; 789};
796 790
797/* Contents of JTAG ID register used to identify exact cpu type */ 791/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 97c0f8e555bd..ac7b431c4c8e 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -756,12 +756,6 @@ static struct map_desc dm646x_io_desc[] = {
756 .length = IO_SIZE, 756 .length = IO_SIZE,
757 .type = MT_DEVICE 757 .type = MT_DEVICE
758 }, 758 },
759 {
760 .virtual = SRAM_VIRT,
761 .pfn = __phys_to_pfn(0x00010000),
762 .length = SZ_32K,
763 .type = MT_MEMORY_NONCACHED,
764 },
765}; 759};
766 760
767/* Contents of JTAG ID register used to identify exact cpu type */ 761/* Contents of JTAG ID register used to identify exact cpu type */
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index bdc4aa8e672a..046c7238a3d6 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -104,8 +104,6 @@ int davinci_pm_init(void);
104static inline int davinci_pm_init(void) { return 0; } 104static inline int davinci_pm_init(void) { return 0; }
105#endif 105#endif
106 106
107/* standard place to map on-chip SRAMs; they *may* support DMA */
108#define SRAM_VIRT 0xfffe0000
109#define SRAM_SIZE SZ_128K 107#define SRAM_SIZE SZ_128K
110 108
111#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */ 109#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
index db0f7787faf1..fa56374912d4 100644
--- a/arch/arm/mach-davinci/sram.c
+++ b/arch/arm/mach-davinci/sram.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/io.h>
13#include <linux/genalloc.h> 14#include <linux/genalloc.h>
14 15
15#include <mach/common.h> 16#include <mach/common.h>
@@ -32,7 +33,7 @@ void *sram_alloc(size_t len, dma_addr_t *dma)
32 return NULL; 33 return NULL;
33 34
34 if (dma) 35 if (dma)
35 *dma = dma_base + (vaddr - SRAM_VIRT); 36 *dma = gen_pool_virt_to_phys(sram_pool, vaddr);
36 return (void *)vaddr; 37 return (void *)vaddr;
37 38
38} 39}
@@ -53,8 +54,10 @@ EXPORT_SYMBOL(sram_free);
53 */ 54 */
54static int __init sram_init(void) 55static int __init sram_init(void)
55{ 56{
57 phys_addr_t phys = davinci_soc_info.sram_dma;
56 unsigned len = davinci_soc_info.sram_len; 58 unsigned len = davinci_soc_info.sram_len;
57 int status = 0; 59 int status = 0;
60 void *addr;
58 61
59 if (len) { 62 if (len) {
60 len = min_t(unsigned, len, SRAM_SIZE); 63 len = min_t(unsigned, len, SRAM_SIZE);
@@ -62,8 +65,17 @@ static int __init sram_init(void)
62 if (!sram_pool) 65 if (!sram_pool)
63 status = -ENOMEM; 66 status = -ENOMEM;
64 } 67 }
65 if (sram_pool) 68
66 status = gen_pool_add(sram_pool, SRAM_VIRT, len, -1); 69 if (sram_pool) {
70 addr = ioremap(phys, len);
71 if (!addr)
72 return -ENOMEM;
73 status = gen_pool_add_virt(sram_pool, (unsigned)addr,
74 phys, len, -1);
75 if (status < 0)
76 iounmap(addr);
77 }
78
67 WARN_ON(status < 0); 79 WARN_ON(status < 0);
68 return status; 80 return status;
69} 81}