reg = <0x0 0x05300000 0x0 0x2000000>;
no-map;
};
- fb_reserved:linux,meson-fb {
- compatible = "shared-dma-pool";
- reusable;
- size = <0x0 0x2000000>;
- alignment = <0x0 0x400000>;
- alloc-ranges = <0x0 0x3e000000 0x0 0x2000000>;
- };
//di_reserved:linux,di {
// compatible = "amlogic, di-mem";
};
ion_reserved:linux,ion-dev {
- compatible = "amlogic, idev-mem";
- size = <0x0 0x0>;
+ compatible = "shared-dma-pool";
+ reusable;
+ size = <0x0 0x2000000>;
+ alignment = <0x0 0x400000>;
+ alloc-ranges = <0x0 0x3e000000 0x0 0x2000000>;
};
/* vdin0 CMA pool */
meson-fb {
compatible = "amlogic, meson-fb";
- memory-region = <&fb_reserved>;
dev_name = "meson-fb";
status = "okay";
interrupts = <0 3 1
reg = <0x0 0x05300000 0x0 0x2000000>;
no-map;
};
- fb_reserved:linux,meson-fb {
- compatible = "shared-dma-pool";
- reusable;
- size = <0x0 0x2000000>;
- alignment = <0x0 0x400000>;
- alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
- };
//di_reserved:linux,di {
// compatible = "amlogic, di-mem";
};
ion_reserved:linux,ion-dev {
- compatible = "amlogic, idev-mem";
- size = <0x0 0x0>;
+ compatible = "shared-dma-pool";
+ reusable;
+ size = <0x0 0x2000000>;
+ alignment = <0x0 0x400000>;
+ alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
};
/* vdin0 CMA pool */
meson-fb {
compatible = "amlogic, meson-fb";
- memory-region = <&fb_reserved>;
dev_name = "meson-fb";
status = "okay";
interrupts = <0 3 1
reg = <0x0 0x05300000 0x0 0x2000000>;
no-map;
};
- fb_reserved:linux,meson-fb {
- compatible = "shared-dma-pool";
- reusable;
- size = <0x0 0x2000000>;
- alignment = <0x0 0x400000>;
- alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
- };
//di_reserved:linux,di {
// compatible = "amlogic, di-mem";
};
ion_reserved:linux,ion-dev {
- compatible = "amlogic, idev-mem";
- size = <0x0 0x0>;
+ compatible = "shared-dma-pool";
+ reusable;
+ size = <0x0 0x2000000>;
+ alignment = <0x0 0x400000>;
+ alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
};
/* vdin0 CMA pool */
meson-fb {
compatible = "amlogic, meson-fb";
- memory-region = <&fb_reserved>;
dev_name = "meson-fb";
status = "okay";
interrupts = <0 3 1
reg = <0x0 0x05300000 0x0 0x2000000>;
no-map;
};
- fb_reserved:linux,meson-fb {
- compatible = "shared-dma-pool";
- reusable;
- size = <0x0 0x2000000>;
- alignment = <0x0 0x400000>;
- alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
- };
//di_reserved:linux,di {
// compatible = "amlogic, di-mem";
};
ion_reserved:linux,ion-dev {
- compatible = "amlogic, idev-mem";
- size = <0x0 0x0>;
+ compatible = "shared-dma-pool";
+ reusable;
+ size = <0x0 0x2000000>;
+ alignment = <0x0 0x400000>;
+ alloc-ranges = <0x0 0x7e000000 0x0 0x2000000>;
};
/* vdin0 CMA pool */
meson-fb {
compatible = "amlogic, meson-fb";
- memory-region = <&fb_reserved>;
dev_name = "meson-fb";
status = "okay";
interrupts = <0 3 1
reg = <0x0 0x05300000 0x0 0x2000000>;
no-map;
};
- fb_reserved:linux,meson-fb {
- compatible = "shared-dma-pool";
- reusable;
- size = <0x0 0x2000000>;
- alignment = <0x0 0x400000>;
- alloc-ranges = <0x0 0x3e000000 0x0 0x2000000>;
- };
//di_reserved:linux,di {
// compatible = "amlogic, di-mem";
};
ion_reserved:linux,ion-dev {
- compatible = "amlogic, idev-mem";
- size = <0x0 0x0>;
+ compatible = "shared-dma-pool";
+ reusable;
+ size = <0x0 0x2000000>;
+ alignment = <0x0 0x400000>;
+ alloc-ranges = <0x0 0x3e000000 0x0 0x2000000>;
};
/* vdin0 CMA pool */
meson-fb {
compatible = "amlogic, meson-fb";
- /* memory-region = <&fb_reserved>; */
dev_name = "meson-fb";
status = "okay";
interrupts = <0 3 1
int dev_ion_probe(struct platform_device *pdev)
{
int err = 0;
+ int i;
my_ion_heap[num_heaps].type = ION_HEAP_TYPE_SYSTEM;
my_ion_heap[num_heaps].id = ION_HEAP_TYPE_SYSTEM;
my_ion_heap[num_heaps].size = 32 * 1024 * 1024;
num_heaps++;
#endif
+ /*add CMA ion heap*/
+ my_ion_heap[num_heaps].type = ION_HEAP_TYPE_DMA;
+ my_ion_heap[num_heaps].id = ION_HEAP_TYPE_DMA;
+ my_ion_heap[num_heaps].name = "cma_ion";
+ my_ion_heap[num_heaps].priv = &pdev->dev;
+ num_heaps++;
+
/* init reserved memory */
err = of_reserved_mem_device_init(&pdev->dev);
if (err != 0)
dprintk(1, "failed get reserved memory\n");
+ heaps = kcalloc(num_heaps, sizeof(struct ion_heap *), GFP_KERNEL);
+ if (!heaps)
+ return -ENOMEM;
+ /* idev = ion_device_create(NULL); */
+ idev = ion_device_create(meson_custom_ioctl);
+ if (IS_ERR_OR_NULL(idev)) {
+ kfree(heaps);
+ panic(0);
+ return PTR_ERR(idev);
+ }
+
+ platform_set_drvdata(pdev, idev);
+ /* create the heaps as specified in the board file */
+ for (i = 0; i < num_heaps; i++) {
+ heaps[i] = ion_heap_create(&my_ion_heap[i]);
+ if (IS_ERR_OR_NULL(heaps[i])) {
+ err = PTR_ERR(heaps[i]);
+ goto failed;
+ }
+ ion_device_add_heap(idev, heaps[i]);
+ dprintk(2, "add heap type:%d id:%d\n",
+ my_ion_heap[i].type, my_ion_heap[i].id);
+ }
+
+ dprintk(1, "%s, create %d heaps\n", __func__, num_heaps);
return 0;
+failed:
+ dprintk(0, "ion heap create failed\n");
+ kfree(heaps);
+ heaps = NULL;
+ panic(0);
+ return err;
}
int dev_ion_remove(struct platform_device *pdev)
{
struct ion_device *idev = platform_get_drvdata(pdev);
int i;
-
ion_device_destroy(idev);
for (i = 0; i < num_heaps; i++)
ion_heap_destroy(heaps[i]);
*/
static int ion_dev_mem_init(struct reserved_mem *rmem, struct device *dev)
{
- int i = 0;
- int err;
- struct platform_device *pdev = to_platform_device(dev);
my_ion_heap[num_heaps].type = ION_HEAP_TYPE_CARVEOUT;
my_ion_heap[num_heaps].id = ION_HEAP_TYPE_CARVEOUT;
my_ion_heap[num_heaps].size = rmem->size;
pr_info("ion_dev_mem_init size=0x%llx\n", rmem->size);
-
num_heaps++;
- heaps = kcalloc(num_heaps, sizeof(struct ion_heap *), GFP_KERNEL);
- /* idev = ion_device_create(NULL); */
- idev = ion_device_create(meson_custom_ioctl);
- if (IS_ERR_OR_NULL(idev)) {
- kfree(heaps);
- panic(0);
- return PTR_ERR(idev);
- }
-
- platform_set_drvdata(pdev, idev);
-
- /* create the heaps as specified in the board file */
- for (i = 0; i < num_heaps; i++) {
- heaps[i] = ion_heap_create(&my_ion_heap[i]);
- if (IS_ERR_OR_NULL(heaps[i])) {
- err = PTR_ERR(heaps[i]);
- goto failed;
- }
- ion_device_add_heap(idev, heaps[i]);
- dprintk(2, "add heap type:%d id:%d\n",
- my_ion_heap[i].type, my_ion_heap[i].id);
- }
-
- dprintk(1, "%s, create %d heaps\n", __func__, num_heaps);
return 0;
-failed:
- dprintk(0, "ion heap create failed\n");
- kfree(heaps);
- heaps = NULL;
- panic(0);
- return err;
}
PAGE_ALIGN(fb_memsize[fb_index + 1]/
OSD_MAX_BUF_NUM),
0,
- (1 << ION_HEAP_TYPE_CARVEOUT),
+ (1 << ION_HEAP_TYPE_DMA),
0);
ret = ion_phys(fb_ion_client,
fb_ion_handle[fb_index][j],
ion_alloc(fb_ion_client,
fb_memsize[fb_index + 1],
0,
- (1 << ION_HEAP_TYPE_CARVEOUT),
+ (1 << ION_HEAP_TYPE_DMA),
0);
ret = ion_phys(fb_ion_client,
fb_ion_handle[fb_index][0],