Skip to content

Commit f77f226

Browse files
committed
wandboard: Fix wand_reserve function for any wandboard version
1 parent 221c4be commit f77f226

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

arch/arm/mach-mx6/board-wand.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <asm/mach-types.h>
2121
#include <asm/mach/arch.h>
2222
#include <asm/mach/time.h>
23+
#include <asm/setup.h>
2324

2425
#include <linux/clk.h>
2526
#include <linux/delay.h>
@@ -37,6 +38,7 @@
3738
#include <mach/iomux-v3.h>
3839
#include <mach/mx6.h>
3940

41+
4042
#include "crm_regs.h"
4143
#include "devices-imx6q.h"
4244
#include "usb.h"
@@ -1201,20 +1203,16 @@ static struct sys_timer wand_timer = {
12011203
static void __init wand_reserve(void)
12021204
{
12031205
phys_addr_t phys;
1206+
struct meminfo *mi = &meminfo;
1207+
unsigned long total_mem = 0;
1208+
int i;
12041209

12051210
if (wand_gpu_pdata.reserved_mem_size) {
1206-
if (cpu_is_mx6q())
1207-
phys = memblock_alloc_base(
1208-
wand_gpu_pdata.reserved_mem_size,
1209-
SZ_4K, SZ_2G);
1210-
else if (cpu_is_mx6dl())
1211-
phys = memblock_alloc_base(
1212-
wand_gpu_pdata.reserved_mem_size,
1213-
SZ_4K, SZ_1G);
1214-
else
1215-
phys = memblock_alloc_base(
1211+
for (i = 0; i < mi->nr_banks; i++)
1212+
total_mem += mi->bank[i].size;
1213+
phys = memblock_alloc_base(
12161214
wand_gpu_pdata.reserved_mem_size,
1217-
SZ_4K, SZ_512M);
1215+
SZ_4K, total_mem);
12181216
memblock_remove(phys, wand_gpu_pdata.reserved_mem_size);
12191217
wand_gpu_pdata.reserved_mem_base = phys;
12201218
}

0 commit comments

Comments
 (0)