summaryrefslogtreecommitdiff
path: root/arch/arm/mach-mx5/mx51_babbage.c
diff options
context:
space:
mode:
authorWu Guoxing <b02248@freescale.com>2010-04-09 16:57:55 +0800
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-05-25 11:20:23 +0200
commit87c17002508c548d2aeb308eb3d9536ac78927c0 (patch)
tree4c2fa8f2fd428f274ed023e403b66031b93d489a /arch/arm/mach-mx5/mx51_babbage.c
parent157f4e812d6a7ee38de3c47fd0df346ce3e4c2f4 (diff)
ENGR00122151 reserve gpu memory in kernel
add a new kernel command "gpu_memory" to reserve gpu memory in kernel Signed-off-by:Wu Guoxing <b02248@freescale.com> Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'arch/arm/mach-mx5/mx51_babbage.c')
-rw-r--r--arch/arm/mach-mx5/mx51_babbage.c68
1 files changed, 52 insertions, 16 deletions
diff --git a/arch/arm/mach-mx5/mx51_babbage.c b/arch/arm/mach-mx5/mx51_babbage.c
index 2e558307d9e3..4a962ab6f647 100644
--- a/arch/arm/mach-mx5/mx51_babbage.c
+++ b/arch/arm/mach-mx5/mx51_babbage.c
@@ -798,36 +798,72 @@ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
char *str;
- int size = SZ_512M - SZ_32M;
struct tag *t;
+ struct tag *mem_tag = 0;
+ int total_mem = SZ_512M;
+ int left_mem = 0;
+ int gpu_mem = SZ_64M;
+ int fb_mem = SZ_32M;
mxc_set_cpu_type(MXC_CPU_MX51);
get_cpu_wp = mx51_babbage_get_cpu_wp;
set_num_cpu_wp = mx51_babbage_set_num_cpu_wp;
- for_each_tag(t, tags) {
- if (t->hdr.tag != ATAG_CMDLINE)
- continue;
- str = t->u.cmdline.cmdline;
- str = strstr(str, "mem=");
- if (str != NULL) {
- str += 4;
- size = memparse(str, &str);
- if (size == 0 || size == SZ_512M)
- return;
+ for_each_tag(mem_tag, tags) {
+ if (mem_tag->hdr.tag == ATAG_MEM) {
+ total_mem = mem_tag->u.mem.size;
+ left_mem = total_mem - gpu_mem - fb_mem;
+ break;
}
}
for_each_tag(t, tags) {
- if (t->hdr.tag != ATAG_MEM)
- continue;
+ if (t->hdr.tag == ATAG_CMDLINE) {
+ str = t->u.cmdline.cmdline;
+ str = strstr(str, "mem=");
+ if (str != NULL) {
+ str += 4;
+ left_mem = memparse(str, &str);
+ if (left_mem == 0 || left_mem > total_mem)
+ left_mem = total_mem - gpu_mem - fb_mem;
+ }
+
+ str = t->u.cmdline.cmdline;
+ str = strstr(str, "gpu_memory=");
+ if (str != NULL) {
+ str += 11;
+ gpu_mem = memparse(str, &str);
+ }
+
+ break;
+ }
+ }
- t->u.mem.size = size;
+ if (mem_tag) {
+ fb_mem = total_mem - left_mem - gpu_mem;
+ if (fb_mem < 0) {
+ gpu_mem = total_mem - left_mem;
+ fb_mem = 0;
+ }
+ mem_tag->u.mem.size = left_mem;
+
+ /*reserve memory for gpu*/
+ gpu_device.resource[5].start =
+ mem_tag->u.mem.start + left_mem;
+ gpu_device.resource[5].end =
+ gpu_device.resource[5].start + gpu_mem - 1;
#if defined(CONFIG_FB_MXC_SYNC_PANEL) || \
defined(CONFIG_FB_MXC_SYNC_PANEL_MODULE)
- mxcfb_resources[0].start = t->u.mem.start + size;
- mxcfb_resources[0].end = t->u.mem.start + SZ_512M - 1;
+ if (fb_mem) {
+ mxcfb_resources[0].start =
+ gpu_device.resource[5].end + 1;
+ mxcfb_resources[0].end =
+ mxcfb_resources[0].start + fb_mem - 1;
+ } else {
+ mxcfb_resources[0].start = 0;
+ mxcfb_resources[0].end = 0;
+ }
#endif
}
}