From 8baee857736f53ee57ca81f91e45b56659a1cedb Mon Sep 17 00:00:00 2001 From: Xu Jianqun Date: Thu, 21 Jan 2016 14:47:27 +0800 Subject: [PATCH] staging: ion: rockchip: support cma-heap With this patch, ion could alloc by cma heap. Change-Id: I23b4ebf3b6f8de573c9833574f926f38db1c67bc Signed-off-by: Xu Jianqun --- drivers/staging/android/ion/rockchip/rockchip_ion.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/staging/android/ion/rockchip/rockchip_ion.c b/drivers/staging/android/ion/rockchip/rockchip_ion.c index a54a48e45a08..e61c89f1c9c5 100644 --- a/drivers/staging/android/ion/rockchip/rockchip_ion.c +++ b/drivers/staging/android/ion/rockchip/rockchip_ion.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -177,6 +178,7 @@ static long rk_custom_ioctl(struct ion_client *client, static int rk_ion_of_heap(struct ion_platform_heap *myheap, struct device_node *node) { + unsigned int reg[2] = {0,}; int itype; for (itype = 0; itype < ARRAY_SIZE(ion_heap_meta); itype++) { @@ -186,6 +188,15 @@ static int rk_ion_of_heap(struct ion_platform_heap *myheap, myheap->name = node->name; myheap->align = SZ_1M; myheap->id = ion_heap_meta[itype].id; + if (!strcmp("cma-heap", node->name)) { + myheap->type = ION_HEAP_TYPE_DMA; + if (!of_property_read_u32_array(node, "reg", reg, 2)) { + myheap->base = reg[0]; + myheap->size = reg[1]; + return 1; + } + } + if (!strcmp("system-heap", node->name)) { myheap->type = ION_HEAP_TYPE_SYSTEM; return 1; -- 2.34.1