aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/sram.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2006-12-07 16:58:10 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-05-08 15:36:31 -0400
commitc40fae9525e6c29c87a4f4361ff0a8d67a36e448 (patch)
tree00c3e0008b3e963c5a622245b951f1135e456c24 /arch/arm/plat-omap/sram.c
parentf4e4c324a5f81f18156499d1ade3732ba1f5b523 (diff)
ARM: OMAP: Sync core code with linux-omap
This patch syncs omap specific core code with linux-omap. Most of the changes are needed to fix bitrot caused by driver updates in linux-omap tree. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-omap/sram.c')
-rw-r--r--arch/arm/plat-omap/sram.c77
1 files changed, 46 insertions, 31 deletions
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 19014b2ff4c6..7e5f8877e051 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -46,12 +46,13 @@
46 46
47#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) 47#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
48 48
49static unsigned long omap_sram_start;
49static unsigned long omap_sram_base; 50static unsigned long omap_sram_base;
50static unsigned long omap_sram_size; 51static unsigned long omap_sram_size;
51static unsigned long omap_sram_ceil; 52static unsigned long omap_sram_ceil;
52 53
53unsigned long omap_fb_sram_start; 54int omap_fb_sram_plane = -1;
54unsigned long omap_fb_sram_size; 55int omap_fb_sram_valid;
55 56
56/* Depending on the target RAMFS firewall setup, the public usable amount of 57/* Depending on the target RAMFS firewall setup, the public usable amount of
57 * SRAM varies. The default accessable size for all device types is 2k. A GP 58 * SRAM varies. The default accessable size for all device types is 2k. A GP
@@ -77,30 +78,43 @@ static int is_sram_locked(void)
77 return 1; /* assume locked with no PPA or security driver */ 78 return 1; /* assume locked with no PPA or security driver */
78} 79}
79 80
80void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail, 81static int get_fb_sram_conf(unsigned long start_avail, unsigned size_avail,
81 unsigned long *start, unsigned long *size) 82 unsigned long *start, int *plane_idx)
82{ 83{
83 const struct omap_fbmem_config *fbmem_conf; 84 const struct omap_fbmem_config *fbmem_conf;
84 85 unsigned long size = 0;
85 fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config); 86 int i;
86 if (fbmem_conf != NULL) { 87
87 *start = fbmem_conf->fb_sram_start; 88 i = 0;
88 *size = fbmem_conf->fb_sram_size; 89 *start = 0;
89 } else { 90 *plane_idx = -1;
90 *size = 0; 91 while ((fbmem_conf = omap_get_nr_config(OMAP_TAG_FBMEM,
91 *start = 0; 92 struct omap_fbmem_config, i)) != NULL) {
93 u32 paddr, end;
94
95 paddr = fbmem_conf->start;
96 end = fbmem_conf->start + fbmem_conf->size;
97 if (paddr > omap_sram_start &&
98 paddr < omap_sram_start + omap_sram_size) {
99 if (*plane_idx != -1 || paddr < start_avail ||
100 paddr == end ||
101 end > start_avail + size_avail) {
102 printk(KERN_ERR "invalid FB SRAM configuration");
103 *start = 0;
104 return -1;
105 }
106 *plane_idx = i;
107 *start = fbmem_conf->start;
108 size = fbmem_conf->size;
109 }
110 i++;
92 } 111 }
93 112
94 if (*size && ( 113 if (*plane_idx >= 0)
95 *start < start_avail || 114 pr_info("Reserving %lu bytes SRAM frame buffer "
96 *start + *size > start_avail + size_avail)) { 115 "for plane %d\n", size, *plane_idx);
97 printk(KERN_ERR "invalid FB SRAM configuration\n");
98 *start = start_avail;
99 *size = size_avail;
100 }
101 116
102 if (*size) 117 return 0;
103 pr_info("Reserving %lu bytes SRAM for frame buffer\n", *size);
104} 118}
105 119
106/* 120/*
@@ -111,16 +125,16 @@ void get_fb_sram_conf(unsigned long start_avail, unsigned size_avail,
111 */ 125 */
112void __init omap_detect_sram(void) 126void __init omap_detect_sram(void)
113{ 127{
114 unsigned long sram_start; 128 unsigned long fb_sram_start;
115 129
116 if (cpu_is_omap24xx()) { 130 if (cpu_is_omap24xx()) {
117 if (is_sram_locked()) { 131 if (is_sram_locked()) {
118 omap_sram_base = OMAP2_SRAM_PUB_VA; 132 omap_sram_base = OMAP2_SRAM_PUB_VA;
119 sram_start = OMAP2_SRAM_PUB_PA; 133 omap_sram_start = OMAP2_SRAM_PUB_PA;
120 omap_sram_size = 0x800; /* 2K */ 134 omap_sram_size = 0x800; /* 2K */
121 } else { 135 } else {
122 omap_sram_base = OMAP2_SRAM_VA; 136 omap_sram_base = OMAP2_SRAM_VA;
123 sram_start = OMAP2_SRAM_PA; 137 omap_sram_start = OMAP2_SRAM_PA;
124 if (cpu_is_omap242x()) 138 if (cpu_is_omap242x())
125 omap_sram_size = 0xa0000; /* 640K */ 139 omap_sram_size = 0xa0000; /* 640K */
126 else if (cpu_is_omap243x()) 140 else if (cpu_is_omap243x())
@@ -128,7 +142,7 @@ void __init omap_detect_sram(void)
128 } 142 }
129 } else { 143 } else {
130 omap_sram_base = OMAP1_SRAM_VA; 144 omap_sram_base = OMAP1_SRAM_VA;
131 sram_start = OMAP1_SRAM_PA; 145 omap_sram_start = OMAP1_SRAM_PA;
132 146
133 if (cpu_is_omap730()) 147 if (cpu_is_omap730())
134 omap_sram_size = 0x32000; /* 200K */ 148 omap_sram_size = 0x32000; /* 200K */
@@ -144,12 +158,13 @@ void __init omap_detect_sram(void)
144 omap_sram_size = 0x4000; 158 omap_sram_size = 0x4000;
145 } 159 }
146 } 160 }
147 get_fb_sram_conf(sram_start + SRAM_BOOTLOADER_SZ, 161 if (get_fb_sram_conf(omap_sram_start + SRAM_BOOTLOADER_SZ,
148 omap_sram_size - SRAM_BOOTLOADER_SZ, 162 omap_sram_size - SRAM_BOOTLOADER_SZ,
149 &omap_fb_sram_start, &omap_fb_sram_size); 163 &fb_sram_start, &omap_fb_sram_plane) == 0)
150 if (omap_fb_sram_size) 164 omap_fb_sram_valid = 1;
151 omap_sram_size -= sram_start + omap_sram_size - 165 if (omap_fb_sram_valid && omap_fb_sram_plane >= 0)
152 omap_fb_sram_start; 166 omap_sram_size -= omap_sram_start + omap_sram_size -
167 fb_sram_start;
153 omap_sram_ceil = omap_sram_base + omap_sram_size; 168 omap_sram_ceil = omap_sram_base + omap_sram_size;
154} 169}
155 170