#include <linux/kernel.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
+#include <linux/of_fdt.h>
#include <linux/rockchip/dvfs.h>
#include <linux/rockchip/common.h>
#include <linux/rockchip/cpu.h>
of_dvfs_init();
}
+extern int __init rockchip_ion_find_reserve_mem(unsigned long node,
+ const char *uname, int depth, void *data);
+static void __init rk3188_reserve(void)
+{
+ printk("%s\n", __func__);
+ of_scan_flat_dt(rockchip_ion_find_reserve_mem, NULL);
+}
+
static const char * const rk3188_dt_compat[] __initconst = {
"rockchip,rk3188",
NULL,
.init_time = rk3188_dt_init_timer,
.dt_compat = rk3188_dt_compat,
.init_late = rockchip_suspend_init,
+ .reserve = rk3188_reserve,
.restart = rk3188_restart,
MACHINE_END
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <video/of_display_timing.h>
+#include <linux/of_fdt.h>
#endif
static struct ion_device *idev;
},
};
+struct device rockchip_ion_cma_dev = {
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ .init_name = "rockchip_ion_cma",
+};
+
static int rockchip_ion_populate_heap(struct ion_platform_heap *heap)
{
unsigned int i;
if (ion_heap_meta[i].id == heap->id) {
heap->name = ion_heap_meta[i].name;
heap->type = ion_heap_meta[i].type;
+ if(heap->id == ION_CMA_HEAP_ID)
+ heap->priv = &rockchip_ion_cma_dev;
ret = 0;
break;
}
goto free_heaps;
// rockchip_ion_get_heap_adjacent(node, &pdata->heaps[idx]);
- pdata->heaps[idx].priv = dev;
pr_info("%d: %d %d %s 0x%p\n", idx, pdata->heaps[idx].type, pdata->heaps[idx].id, pdata->heaps[idx].name, pdata->heaps[idx].priv);
++idx;
return PTR_ERR(dmabuf);
data.id = (unsigned int)dmabuf;
- dma_buf_put(dmabuf);
+// dma_buf_put(dmabuf);
if (copy_to_user((void __user *)arg, &data, sizeof(struct ion_share_id_data)))
return -EFAULT;
return 0;
}
+int __init rockchip_ion_find_reserve_mem(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ __be32 *prop;
+ unsigned long len;
+ phys_addr_t size;
+ phys_addr_t base;
+
+ if (!of_flat_dt_is_compatible(node, "rockchip,ion-reserve"))
+ return 0;
+
+ prop = of_get_flat_dt_prop(node, "memory-reservation", &len);
+ if (!prop || (len != 2 * sizeof(unsigned long)))
+ return 0;
+
+ base = be32_to_cpu(prop[0]);
+ size = be32_to_cpu(prop[1]);
+
+ pr_info("%s: reserve cma memory: %x %x\n", __func__, base, size);
+
+ dma_declare_contiguous(&rockchip_ion_cma_dev, size, base, 0);
+
+ return 1;
+}
+
static const struct of_device_id rockchip_ion_dt_ids[] = {
{ .compatible = "rockchip,ion", },
{}