aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-omap-pm/dss2/0136-DSS2-VRAM-separate-VRAM-setup-from-the-old-fb-vram.patch
blob: d9a87d12bf64c97506436b95f8454d76b6149ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
From 623b67b81b32b758915a58816bc75e092aa33bb8 Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Date: Thu, 2 Jul 2009 11:05:08 +0300
Subject: [PATCH 136/146] DSS2: VRAM: separate VRAM setup from the old fb vram setup

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
---
 arch/arm/mach-omap2/io.c               |    2 +
 arch/arm/plat-omap/fb.c                |   11 +++++-
 arch/arm/plat-omap/include/mach/vram.h |    6 +++
 arch/arm/plat-omap/sram.c              |   15 +++++---
 arch/arm/plat-omap/vram.c              |   60 ++++++++++++++++----------------
 include/linux/omapfb.h                 |    5 +++
 6 files changed, 62 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 5c91f36..221c60f 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -32,6 +32,7 @@
 #include <mach/sram.h>
 #include <mach/sdrc.h>
 #include <mach/gpmc.h>
+#include <mach/vram.h>
 
 #ifndef CONFIG_ARCH_OMAP4	/* FIXME: Remove this once clkdev is ready */
 #include "clock.h"
@@ -240,6 +241,7 @@ void __init omap2_map_common_io(void)
 	omap2_check_revision();
 	omap_sram_init();
 	omapfb_reserve_sdram();
+	omap_vram_reserve_sdram();
 }
 
 /*
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index 1dc3415..70fbeae 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -355,6 +355,16 @@ static inline int omap_init_fb(void)
 
 arch_initcall(omap_init_fb);
 
+void omapfb_reserve_sdram(void) {}
+unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
+				  unsigned long sram_vstart,
+				  unsigned long sram_size,
+				  unsigned long start_avail,
+				  unsigned long size_avail)
+{
+	return 0;
+}
+
 #else
 
 void omapfb_reserve_sdram(void) {}
@@ -367,5 +377,4 @@ unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
 	return 0;
 }
 
-
 #endif
diff --git a/arch/arm/plat-omap/include/mach/vram.h b/arch/arm/plat-omap/include/mach/vram.h
index 66b788e..8d26b05 100644
--- a/arch/arm/plat-omap/include/mach/vram.h
+++ b/arch/arm/plat-omap/include/mach/vram.h
@@ -37,4 +37,10 @@ extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram,
 extern void omap2_set_sdram_vram(u32 size, u32 start);
 extern void omap2_set_sram_vram(u32 size, u32 start);
 
+extern void omap_vram_reserve_sdram(void);
+extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
+					    unsigned long sram_vstart,
+					    unsigned long sram_size,
+					    unsigned long pstart_avail,
+					    unsigned long size_avail);
 #endif
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 4ea7380..26797e7 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/omapfb.h>
 
 #include <asm/tlb.h>
 #include <asm/cacheflush.h>
@@ -28,6 +29,7 @@
 #include <mach/sram.h>
 #include <mach/board.h>
 #include <mach/cpu.h>
+#include <mach/vram.h>
 
 #include <mach/control.h>
 
@@ -76,12 +78,6 @@ static unsigned long omap_sram_base;
 static unsigned long omap_sram_size;
 static unsigned long omap_sram_ceil;
 
-extern unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
-					 unsigned long sram_vstart,
-					 unsigned long sram_size,
-					 unsigned long pstart_avail,
-					 unsigned long size_avail);
-
 /*
  * Depending on the target RAMFS firewall setup, the public usable amount of
  * SRAM varies.  The default accessible size for all device types is 2k. A GP
@@ -185,6 +181,13 @@ void __init omap_detect_sram(void)
 				       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;
 }
 
diff --git a/arch/arm/plat-omap/vram.c b/arch/arm/plat-omap/vram.c
index 2954764..6c4bc18 100644
--- a/arch/arm/plat-omap/vram.c
+++ b/arch/arm/plat-omap/vram.c
@@ -39,7 +39,7 @@
 #include <mach/dma.h>
 
 #ifdef DEBUG
-#define DBG(format, ...) printk(KERN_DEBUG "VRAM: " format, ## __VA_ARGS__)
+#define DBG(format, ...) pr_debug("VRAM: " format, ## __VA_ARGS__)
 #else
 #define DBG(format, ...)
 #endif
@@ -239,7 +239,7 @@ static int _omap_vram_reserve(unsigned long paddr, unsigned pages)
 		if (!(start <= paddr && end >= paddr + size - 1))
 			continue;
 found:
-		DBG("FOUND area start %lx, end %lx\n", start, end);
+		DBG("found area start %lx, end %lx\n", start, end);
 
 		if (omap_vram_create_allocation(rm, paddr, pages) == NULL)
 			return -ENOMEM;
@@ -352,7 +352,7 @@ found:
 		if (end - start < pages << PAGE_SHIFT)
 			continue;
 
-		DBG("FOUND %lx, end %lx\n", start, end);
+		DBG("found %lx, end %lx\n", start, end);
 
 		alloc = omap_vram_create_allocation(rm, start, pages);
 		if (alloc == NULL)
@@ -504,30 +504,30 @@ arch_initcall(omap_vram_init);
 /* boottime vram alloc stuff */
 
 /* set from board file */
-static u32 omapfb_sram_vram_start __initdata;
-static u32 omapfb_sram_vram_size __initdata;
+static u32 omap_vram_sram_start __initdata;
+static u32 omap_vram_sram_size __initdata;
 
 /* set from board file */
-static u32 omapfb_sdram_vram_start __initdata;
-static u32 omapfb_sdram_vram_size __initdata;
+static u32 omap_vram_sdram_start __initdata;
+static u32 omap_vram_sdram_size __initdata;
 
 /* set from kernel cmdline */
-static u32 omapfb_def_sdram_vram_size __initdata;
-static u32 omapfb_def_sdram_vram_start __initdata;
+static u32 omap_vram_def_sdram_size __initdata;
+static u32 omap_vram_def_sdram_start __initdata;
 
-static void __init omapfb_early_vram(char **p)
+static void __init omap_vram_early_vram(char **p)
 {
-	omapfb_def_sdram_vram_size = memparse(*p, p);
+	omap_vram_def_sdram_size = memparse(*p, p);
 	if (**p == ',')
-		omapfb_def_sdram_vram_start = simple_strtoul((*p) + 1, p, 16);
+		omap_vram_def_sdram_start = simple_strtoul((*p) + 1, p, 16);
 }
-__early_param("vram=", omapfb_early_vram);
+__early_param("vram=", omap_vram_early_vram);
 
 /*
  * Called from map_io. We need to call to this early enough so that we
  * can reserve the fixed SDRAM regions before VM could get hold of them.
  */
-void __init omapfb_reserve_sdram(void)
+void __init omap_vram_reserve_sdram(void)
 {
 	struct bootmem_data	*bdata;
 	unsigned long		sdram_start, sdram_size;
@@ -535,14 +535,14 @@ void __init omapfb_reserve_sdram(void)
 	u32 size = 0;
 
 	/* cmdline arg overrides the board file definition */
-	if (omapfb_def_sdram_vram_size) {
-		size = omapfb_def_sdram_vram_size;
-		paddr = omapfb_def_sdram_vram_start;
+	if (omap_vram_def_sdram_size) {
+		size = omap_vram_def_sdram_size;
+		paddr = omap_vram_def_sdram_start;
 	}
 
 	if (!size) {
-		size = omapfb_sdram_vram_size;
-		paddr = omapfb_sdram_vram_start;
+		size = omap_vram_sdram_size;
+		paddr = omap_vram_sdram_start;
 	}
 
 #ifdef CONFIG_OMAP2_DSS_VRAM_SIZE
@@ -564,7 +564,7 @@ void __init omapfb_reserve_sdram(void)
 	if (paddr) {
 		if ((paddr & ~PAGE_MASK) || paddr < sdram_start ||
 				paddr + size > sdram_start + sdram_size) {
-			printk(KERN_ERR "Illegal SDRAM region for VRAM\n");
+			pr_err("Illegal SDRAM region for VRAM\n");
 			return;
 		}
 
@@ -574,7 +574,7 @@ void __init omapfb_reserve_sdram(void)
 		}
 	} else {
 		if (size > sdram_size) {
-			printk(KERN_ERR "Illegal SDRAM size for VRAM\n");
+			pr_err("Illegal SDRAM size for VRAM\n");
 			return;
 		}
 
@@ -597,7 +597,7 @@ void __init omapfb_reserve_sdram(void)
  * this point, since the driver built as a module would have problem with
  * freeing / reallocating the regions.
  */
-unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
+unsigned long __init omap_vram_reserve_sram(unsigned long sram_pstart,
 				  unsigned long sram_vstart,
 				  unsigned long sram_size,
 				  unsigned long pstart_avail,
@@ -608,8 +608,8 @@ unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
 	u32 paddr;
 	u32 size;
 
-	paddr = omapfb_sram_vram_start;
-	size = omapfb_sram_vram_size;
+	paddr = omap_vram_sram_start;
+	size = omap_vram_sram_size;
 
 	if (!size)
 		return 0;
@@ -620,7 +620,7 @@ unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
 	if (!paddr) {
 		/* Dynamic allocation */
 		if ((size_avail & PAGE_MASK) < size) {
-			printk(KERN_ERR "Not enough SRAM for VRAM\n");
+			pr_err("Not enough SRAM for VRAM\n");
 			return 0;
 		}
 		size_avail = (size_avail - size) & PAGE_MASK;
@@ -629,7 +629,7 @@ unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
 
 	if (paddr < sram_pstart ||
 			paddr + size > sram_pstart + sram_size) {
-		printk(KERN_ERR "Illegal SRAM region for VRAM\n");
+		pr_err("Illegal SRAM region for VRAM\n");
 		return 0;
 	}
 
@@ -648,14 +648,14 @@ unsigned long __init omapfb_reserve_sram(unsigned long sram_pstart,
 
 void __init omap2_set_sdram_vram(u32 size, u32 start)
 {
-	omapfb_sdram_vram_start = start;
-	omapfb_sdram_vram_size = size;
+	omap_vram_sdram_start = start;
+	omap_vram_sdram_size = size;
 }
 
 void __init omap2_set_sram_vram(u32 size, u32 start)
 {
-	omapfb_sram_vram_start = start;
-	omapfb_sram_vram_size = size;
+	omap_vram_sram_start = start;
+	omap_vram_sram_size = size;
 }
 
 #endif
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
index 0df0df9..67dc375 100644
--- a/include/linux/omapfb.h
+++ b/include/linux/omapfb.h
@@ -424,6 +424,11 @@ extern struct lcd_ctrl omap2_disp_ctrl;
 extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
 
 extern void omapfb_reserve_sdram(void);
+extern unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
+					 unsigned long sram_vstart,
+					 unsigned long sram_size,
+					 unsigned long pstart_avail,
+					 unsigned long size_avail);
 extern void omapfb_register_panel(struct lcd_panel *panel);
 extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
 extern void omapfb_notify_clients(struct omapfb_device *fbdev,
-- 
1.6.2.4