rk: ion: ion's heap id order by heap type
authorCMY <cmy@rock-chips.com>
Tue, 23 Dec 2014 09:51:27 +0000 (17:51 +0800)
committerCMY <cmy@rock-chips.com>
Tue, 23 Dec 2014 10:16:22 +0000 (18:16 +0800)
  need update android, including:
    hardware/rk29/libgralloc_ump/
    hardware/rk29/camera/
    external/rk-pcba-test/

arch/arm/boot/dts/rk3036.dtsi
arch/arm/boot/dts/rk312x.dtsi
arch/arm/boot/dts/rk3288-fpga.dts
arch/arm/boot/dts/rk3288.dtsi
drivers/staging/android/ion/ion.c
drivers/staging/android/ion/rockchip/rockchip_ion.c
include/linux/rockchip_ion.h

index 0f885bea42d279b30df617a404db8176f372d6c3..64f4f0182f4f798d6c3793bb55bf2ef524c594f6 100755 (executable)
                #address-cells = <1>;
                #size-cells = <0>;
 
-               ion_cma: rockchip,ion-heap@1 { /* CMA HEAP */
+               ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
                        compatible = "rockchip,ion-heap";
-                       rockchip,ion_heap = <1>;
+                       rockchip,ion_heap = <4>;
                        reg = <0x00000000 0x00000000>; /* 0MB */
                };
-               rockchip,ion-heap@3 { /* VMALLOC HEAP */
+               rockchip,ion-heap@0 { /* VMALLOC HEAP */
                        compatible = "rockchip,ion-heap";
-                       rockchip,ion_heap = <3>;
+                       rockchip,ion_heap = <0>;
                };
        };
 
index 062f7df90ac13d1967d13ce98507b27507e3e668..b39e094dc4ca5112af6c66147b09aab84ea4aca9 100755 (executable)
                #address-cells = <1>;
                #size-cells = <0>;
 
-               ion_cma: rockchip,ion-heap@1 { /* CMA HEAP */
+               ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
                        compatible = "rockchip,ion-heap";
-                       rockchip,ion_heap = <1>;
+                       rockchip,ion_heap = <4>;
                        reg = <0x00000000 0x800000>; /* 8MB */
                };
-               rockchip,ion-heap@3 { /* VMALLOC HEAP */
+               rockchip,ion-heap@0 { /* VMALLOC HEAP */
                        compatible = "rockchip,ion-heap";
-                       rockchip,ion_heap = <3>;
+                       rockchip,ion_heap = <0>;
                };
        };
        cif: cif@1010a000 {
index bca81c030d9a5ce0ab3ce91002c1ffbc8d77484b..5eee1dd814e5d2fa1a4c4e4d15d342562982d112 100755 (executable)
                compatible = "rockchip,ion";
                #address-cells = <1>;
                #size-cells = <0>;
-               ion_cma: rockchip,ion-heap@1 { /* CMA HEAP */
+               ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
                        compatible = "rockchip,ion-heap";
-                       rockchip,ion_heap = <1>;
+                       rockchip,ion_heap = <4>;
                        reg = <0x00000000 0x04000000>; /* 64MB */
                };
-               rockchip,ion-heap@3 { /* VMALLOC HEAP */
+               rockchip,ion-heap@0 { /* VMALLOC HEAP */
                        compatible = "rockchip,ion-heap";
-                       rockchip,ion_heap = <3>;
+                       rockchip,ion_heap = <0>;
                };
        };
 
index 742d12a890a67da239835a21eabb69572bb237d0..a1d7c4bde5dbde4818b3c52ae1debcdd4ae4dc85 100755 (executable)
                #address-cells = <1>;
                #size-cells = <0>;
 
-               ion_cma: rockchip,ion-heap@1 { /* CMA HEAP */
+               ion_cma: rockchip,ion-heap@4 { /* CMA HEAP */
                        compatible = "rockchip,ion-heap";
-                       rockchip,ion_heap = <1>;
+                       rockchip,ion_heap = <4>;
                        reg = <0x00000000 0x28000000>; /* 640MB */
                };
-               rockchip,ion-heap@3 { /* VMALLOC HEAP */
+               rockchip,ion-heap@0 { /* VMALLOC HEAP */
                        compatible = "rockchip,ion-heap";
-                       rockchip,ion_heap = <3>;
+                       rockchip,ion_heap = <0>;
                };
        };
 
index bde5f6eeb0873fd29dc5dde999205987a1c5464c..369cfe68e82acd5bb2882a3bd8b482100d886431 100755 (executable)
@@ -807,7 +807,7 @@ int ion_map_iommu(struct device *iommu_dev, struct ion_client *client,
 
        mutex_lock(&buffer->lock);
 
-       if (ION_IS_CACHED(buffer->flags)) {
+       if (ion_buffer_cached(buffer)) {
                pr_err("%s: Cannot map iommu as cached.\n", __func__);
                ret = -EINVAL;
                goto out;
index cb957f9506a0c83b542b86d6faa1e0d7b9a707a7..34fb2cbb5cfdf1d7a97147ccad4f0a3f220ada91 100755 (executable)
@@ -45,7 +45,14 @@ extern struct ion_handle *ion_handle_get_by_id(struct ion_client *client,
                                                int id);
 extern int ion_handle_put(struct ion_handle *handle);
 
+#define ION_CMA_HEAP_NAME              "cma"
+#define ION_IOMMU_HEAP_NAME            "iommu"
+#define ION_VMALLOC_HEAP_NAME          "vmalloc"
+#define ION_DRM_HEAP_NAME              "drm"
+#define ION_CARVEOUT_HEAP_NAME         "carveout"
+
 #define MAX_ION_HEAP           10
+
 static struct ion_platform_heap ion_plat_heap[MAX_ION_HEAP];
 struct ion_platform_data ion_pdata = {
        .nr = 0,
@@ -112,10 +119,6 @@ static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
        pr_debug("[%s %d] cmd=%X\n", __func__, __LINE__, cmd);
 
        switch (cmd) {
-       case ION_IOC_CLEAN_CACHES:
-       case ION_IOC_INV_CACHES:
-       case ION_IOC_CLEAN_INV_CACHES:
-               break;
        case ION_IOC_GET_PHYS:
        {
                struct ion_phys_data data;
@@ -139,47 +142,6 @@ static long rockchip_custom_ioctl (struct ion_client *client, unsigned int cmd,
                        return -EFAULT;
                break;
        }
-       case ION_IOC_GET_SHARE_ID:
-       {
-               struct ion_share_id_data data;
-               struct dma_buf *dmabuf = NULL;
-
-               if (copy_from_user(&data, (void __user *)arg,
-                                       sizeof(struct ion_share_id_data)))
-                       return -EFAULT;
-
-               dmabuf = dma_buf_get(data.fd);
-               if (IS_ERR(dmabuf))
-                       return PTR_ERR(dmabuf);
-
-               data.id = (unsigned int)dmabuf;
-//             dma_buf_put(dmabuf);
-
-               if (copy_to_user((void __user *)arg, &data, sizeof(struct ion_share_id_data)))
-                       return -EFAULT;
-
-               break;
-       }
-       case ION_IOC_SHARE_BY_ID:
-       {
-               struct ion_share_id_data data;
-               int fd = 0;
-
-               if (copy_from_user(&data, (void __user *)arg,
-                                       sizeof(struct ion_share_id_data)))
-                       return -EFAULT;
-
-               fd = dma_buf_fd((struct dma_buf*)data.id, O_CLOEXEC);
-               if (fd < 0)
-                       return fd;
-
-               data.fd = fd;
-
-               if (copy_to_user((void __user *)arg, &data, sizeof(struct ion_share_id_data)))
-                       return -EFAULT;
-
-               break;
-       }
        default:
                return -ENOTTY;
        }
index 7ce449dea2b47b26d2edff618bbc493205a04886..59d6bf7ce53f3ab65c29e02ed6bc7a186d522be2 100644 (file)
 #include <linux/ion.h>
 #endif
 
-#define ROCKCHIP_ION_VERSION   "v1.0"
+#define ROCKCHIP_ION_VERSION   "v1.1"
 
+/*
+ * ion_heap_ids order by ion_heap_type
+ */
 enum ion_heap_ids {
-       INVALID_HEAP_ID = -1,
-       ION_CMA_HEAP_ID = 1,
-       ION_IOMMU_HEAP_ID,
-       ION_VMALLOC_HEAP_ID,
-       ION_DRM_HEAP_ID,
-       ION_CARVEOUT_HEAP_ID,
-
-       ION_HEAP_ID_RESERVED = 31
+       ION_VMALLOC_HEAP_ID = 0,
+       ION_CARVEOUT_HEAP_ID = 2,
+       ION_CMA_HEAP_ID = 4,
+       ION_DRM_HEAP_ID = 5,
 };
 
 #define ION_HEAP(bit) (1 << (bit))
 
-#define ION_CMA_HEAP_NAME              "cma"
-#define ION_IOMMU_HEAP_NAME            "iommu"
-#define ION_VMALLOC_HEAP_NAME          "vmalloc"
-#define ION_DRM_HEAP_NAME              "drm"
-#define ION_CARVEOUT_HEAP_NAME         "carveout"
-
-#define ION_SET_CACHED(__cache)                (__cache | ION_FLAG_CACHED)
-#define ION_SET_UNCACHED(__cache)      (__cache & ~ION_FLAG_CACHED)
-#define ION_IS_CACHED(__flags)         ((__flags) & ION_FLAG_CACHED)
-
-/* struct ion_flush_data - data passed to ion for flushing caches
- *
- * @handle:    handle with data to flush
- * @fd:                fd to flush
- * @vaddr:     userspace virtual address mapped with mmap
- * @offset:    offset into the handle to flush
- * @length:    length of handle to flush
- *
- * Performs cache operations on the handle. If p is the start address
- * of the handle, p + offset through p + offset + length will have
- * the cache operations performed
- */
-struct ion_flush_data {
-       ion_user_handle_t handle;
-       int fd;
-       void *vaddr;
-       unsigned int offset;
-       unsigned int length;
-};
-
 struct ion_phys_data {
        ion_user_handle_t handle;
        unsigned long phys;
        unsigned long size;
 };
 
-struct ion_share_id_data {
-       int fd;
-       unsigned int id;
-};
-
 #define ION_IOC_ROCKCHIP_MAGIC 'R'
 
-/**
- * Clean the caches of the handle specified.
- */
-#define ION_IOC_CLEAN_CACHES   _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
-                                               struct ion_flush_data)
-/**
- * Invalidate the caches of the handle specified.
- */
-#define ION_IOC_INV_CACHES     _IOWR(ION_IOC_ROCKCHIP_MAGIC, 1, \
-                                               struct ion_flush_data)
-/**
- * Clean and invalidate the caches of the handle specified.
- */
-#define ION_IOC_CLEAN_INV_CACHES       _IOWR(ION_IOC_ROCKCHIP_MAGIC, 2, \
-                                               struct ion_flush_data)
-
 /**
  * Get phys addr of the handle specified.
  */
-#define ION_IOC_GET_PHYS       _IOWR(ION_IOC_ROCKCHIP_MAGIC, 3, \
+#define ION_IOC_GET_PHYS       _IOWR(ION_IOC_ROCKCHIP_MAGIC, 0, \
                                                struct ion_phys_data)
 
-/**
- * Get share object of the fd specified.
- */
-#define ION_IOC_GET_SHARE_ID   _IOWR(ION_IOC_ROCKCHIP_MAGIC, 4, \
-                                               struct ion_share_id_data)
-
-/**
- * Set share object and associate new fd.
- */
-#define ION_IOC_SHARE_BY_ID    _IOWR(ION_IOC_ROCKCHIP_MAGIC, 5, \
-                                               struct ion_share_id_data)
-
 #endif