aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoj Kumar <manoj.kumar3@arm.com>2018-04-24 15:28:48 +0530
committerArvind Chauhan <arvind.chauhan@arm.com>2018-10-30 16:07:02 +0000
commit7d6509e01ad59d547c6fe685e7118d7f9af88ac9 (patch)
tree40e0c2e799683459b47fde92c15eca981bf0f0c3
parent007476f1eeb55ee44cc7dbe34bad738531f68c9a (diff)
drivers: ion: css: add ion driver for arm css subsystemsack-4.9-armlt-18.10
Change-Id: Id170c304275fd44f849461ab87b495331cc2b312 Signed-off-by: Tushar Khandelwal <tushar.khandelwal@arm.com> Signed-off-by: Manoj Kumar <manoj.kumar3@arm.com>
-rw-r--r--drivers/staging/android/ion/Kconfig6
-rw-r--r--drivers/staging/android/ion/Makefile1
-rw-r--r--drivers/staging/android/ion/css/Makefile2
-rw-r--r--drivers/staging/android/ion/css/css_ion_dev.c71
-rw-r--r--drivers/staging/android/ion/css/css_ion_driver.c103
-rw-r--r--linaro/configs/vexpress64.conf1
6 files changed, 183 insertions, 1 deletions
diff --git a/drivers/staging/android/ion/Kconfig b/drivers/staging/android/ion/Kconfig
index 175dccbf2f28..364a2ee87566 100644
--- a/drivers/staging/android/ion/Kconfig
+++ b/drivers/staging/android/ion/Kconfig
@@ -42,6 +42,12 @@ config ION_HISI
source "drivers/staging/android/ion/hisilicon/Kconfig"
+config ION_CSS
+ bool "Ion for ARM CSS subsystems"
+ depends on ION
+ help
+ ION support for ARM CSS sunsystems.
+
config ION_OF
bool "Devicetree support for Ion"
depends on ION && OF_ADDRESS
diff --git a/drivers/staging/android/ion/Makefile b/drivers/staging/android/ion/Makefile
index a9f056a3baa7..58e215bce780 100644
--- a/drivers/staging/android/ion/Makefile
+++ b/drivers/staging/android/ion/Makefile
@@ -12,5 +12,6 @@ endif
obj-$(CONFIG_ION_DUMMY) += ion_dummy_driver.o
obj-$(CONFIG_ION_TEGRA) += tegra/
obj-$(CONFIG_ION_HISI) += hisilicon/
+obj-$(CONFIG_ION_CSS) += css/
obj-$(CONFIG_ION_OF) += ion_of.o
diff --git a/drivers/staging/android/ion/css/Makefile b/drivers/staging/android/ion/css/Makefile
new file mode 100644
index 000000000000..486b3819c61a
--- /dev/null
+++ b/drivers/staging/android/ion/css/Makefile
@@ -0,0 +1,2 @@
+obj-y += css_ion_driver.o
+obj-y += css_ion_dev.o
diff --git a/drivers/staging/android/ion/css/css_ion_dev.c b/drivers/staging/android/ion/css/css_ion_dev.c
new file mode 100644
index 000000000000..6e88c492c6fd
--- /dev/null
+++ b/drivers/staging/android/ion/css/css_ion_dev.c
@@ -0,0 +1,71 @@
+/*
+ * drivers/gpu/ion/css/css_ion_dev.c
+ *
+ * Copyright (C) 2014 ARM, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
+#include "../ion.h"
+#include <linux/module.h> /* Needed by all modules */
+#include <linux/kernel.h> /* Needed for KERN_INFO */
+
+u64 css_dmamask = DMA_BIT_MASK(64);
+
+struct platform_device css_device_ion = {
+ .name = "ion-css",
+ .id = -1,
+};
+
+struct ion_platform_heap css_heaps[] = {
+ {
+ .id = ION_HEAP_TYPE_SYSTEM,
+ .type = ION_HEAP_TYPE_SYSTEM,
+ .name = "system",
+ },
+ {
+ .id = ION_HEAP_TYPE_SYSTEM_CONTIG,
+ .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
+ .name = "system contig",
+ },
+ {
+ .id = ION_HEAP_TYPE_DMA,
+ .type = ION_HEAP_TYPE_DMA,
+ .name = "ion_dma_heap-3",
+ .priv = &css_device_ion.dev,
+ }
+};
+
+struct ion_platform_data css_ion_pdata = {
+ .nr = 3,
+ .heaps = css_heaps,
+};
+
+static int __init css_ion_dev_init(void)
+{
+ css_device_ion.dev.platform_data = &css_ion_pdata;
+ css_device_ion.dev.coherent_dma_mask = css_dmamask;
+ css_device_ion.dev.dma_mask = &css_dmamask;
+
+
+ return platform_device_register(&css_device_ion);
+}
+
+static void __exit css_ion_dev_exit(void)
+{
+ platform_device_unregister(&css_device_ion);
+}
+
+module_init(css_ion_dev_init);
+module_exit(css_ion_dev_exit);
diff --git a/drivers/staging/android/ion/css/css_ion_driver.c b/drivers/staging/android/ion/css/css_ion_driver.c
new file mode 100644
index 000000000000..45fefc9652e3
--- /dev/null
+++ b/drivers/staging/android/ion/css/css_ion_driver.c
@@ -0,0 +1,103 @@
+/*
+ * drivers/gpu/ion/css/css_ion_driver.c
+ *
+ * Copyright (C) 2014 ARM, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Some parts based on drivers/staging/android/ion/tegra/tegra_ion.c
+ * which is:
+ * Copyright (C) 2011 Google, Inc.
+ */
+
+#include <linux/err.h>
+#include "../ion.h"
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include "../ion_priv.h"
+#include <linux/module.h> /* Needed by all modules */
+#include <linux/kernel.h> /* Needed for KERN_INFO */
+#include <linux/dma-mapping.h>
+
+struct ion_device *idev;
+int num_heaps;
+struct ion_heap **heaps;
+
+int css_ion_probe(struct platform_device *pdev)
+{
+ struct ion_platform_data *pdata = pdev->dev.platform_data;
+ int err;
+ int i;
+
+ arch_setup_dma_ops(&pdev->dev, 0, 0, NULL, 1);
+
+ num_heaps = pdata->nr;
+
+ heaps = kzalloc(sizeof(struct ion_heap *) * pdata->nr, GFP_KERNEL);
+
+ idev = ion_device_create(NULL);
+ if (IS_ERR_OR_NULL(idev)) {
+ kfree(heaps);
+ return PTR_ERR(idev);
+ }
+
+ /* create the heaps as specified in the board file */
+ for (i = 0; i < num_heaps; i++) {
+ struct ion_platform_heap *heap_data = &pdata->heaps[i];
+
+ heaps[i] = ion_heap_create(heap_data);
+ if (IS_ERR_OR_NULL(heaps[i])) {
+ err = PTR_ERR(heaps[i]);
+ goto err;
+ }
+ ion_device_add_heap(idev, heaps[i]);
+ }
+ platform_set_drvdata(pdev, idev);
+ return 0;
+err:
+ for (i = 0; i < num_heaps; i++) {
+ if (heaps[i])
+ ion_heap_destroy(heaps[i]);
+ }
+ kfree(heaps);
+ return err;
+}
+
+int css_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]);
+ kfree(heaps);
+ return 0;
+}
+
+static struct platform_driver css_ion_driver = {
+ .probe = css_ion_probe,
+ .remove = css_ion_remove,
+ .driver = { .name = "ion-css" }
+};
+
+static int __init css_ion_init(void)
+{
+ return platform_driver_register(&css_ion_driver);
+}
+
+static void __exit css_ion_exit(void)
+{
+ platform_driver_unregister(&css_ion_driver);
+}
+
+module_init(css_ion_init);
+module_exit(css_ion_exit);
+
diff --git a/linaro/configs/vexpress64.conf b/linaro/configs/vexpress64.conf
index b20723c174f9..93864b02e7ab 100644
--- a/linaro/configs/vexpress64.conf
+++ b/linaro/configs/vexpress64.conf
@@ -123,7 +123,6 @@ CONFIG_CMA=y
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=96
CONFIG_DRM_I2C_NXP_TDA998X=y
-CONFIG_ION_DUMMY=y
CONFIG_MALI_MIDGARD=y
CONFIG_MALI_EXPERT=y
CONFIG_MALI_PLATFORM_FAKE=y