From e5099d323a8a37fc4b1a52b7b15069ad762b3565 Mon Sep 17 00:00:00 2001 From: Stephan Rafin Date: Mon, 24 Sep 2012 15:15:42 +0800 Subject: wandboard: Fix wand_reserve function for any wandboard version (cherry picked from commit f77f22601e4f4bcbf3e14a48266a4fe3fa56e6e0) --- arch/arm/mach-mx6/board-wand.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-mx6/board-wand.c b/arch/arm/mach-mx6/board-wand.c index d12c677127a1..aa53d6e1d3d8 100644 --- a/arch/arm/mach-mx6/board-wand.c +++ b/arch/arm/mach-mx6/board-wand.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,7 @@ #include #include + #include "crm_regs.h" #include "devices-imx6q.h" #include "usb.h" @@ -1201,20 +1203,16 @@ static struct sys_timer wand_timer = { static void __init wand_reserve(void) { phys_addr_t phys; + struct meminfo *mi = &meminfo; + unsigned long total_mem = 0; + int i; if (wand_gpu_pdata.reserved_mem_size) { - if (cpu_is_mx6q()) - phys = memblock_alloc_base( - wand_gpu_pdata.reserved_mem_size, - SZ_4K, SZ_2G); - else if (cpu_is_mx6dl()) - phys = memblock_alloc_base( - wand_gpu_pdata.reserved_mem_size, - SZ_4K, SZ_1G); - else - phys = memblock_alloc_base( + for (i = 0; i < mi->nr_banks; i++) + total_mem += mi->bank[i].size; + phys = memblock_alloc_base( wand_gpu_pdata.reserved_mem_size, - SZ_4K, SZ_512M); + SZ_4K, total_mem); memblock_remove(phys, wand_gpu_pdata.reserved_mem_size); wand_gpu_pdata.reserved_mem_base = phys; } -- cgit v1.2.1