This patch adds supports DT based intantiation of sysmmu devices. It also removes dependency on CONFIG_EXYNOS_DEV_SYSMMU which is primarily meant for nont-dt platforms.
This patch is based on "arm/exynos" branch at http://git.kernel.org/?p=linux/kernel/git/joro/iommu.git This patch is having dependency on linux-samsung-soc patchset named "add dt based support for iommu for hdmi" Signed-off-by: Rahul Sharma <[email protected]> --- drivers/iommu/Kconfig | 2 +- drivers/iommu/exynos-iommu.c | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 9f69b56..52dc41f 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -168,7 +168,7 @@ config TEGRA_IOMMU_SMMU config EXYNOS_IOMMU bool "Exynos IOMMU Support" - depends on ARCH_EXYNOS && EXYNOS_DEV_SYSMMU + depends on ARCH_EXYNOS select IOMMU_API help Support for the IOMMU(System MMU) of Samsung Exynos application diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 7fe44f8..9079f71 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -25,6 +25,7 @@ #include <linux/list.h> #include <linux/memblock.h> #include <linux/export.h> +#include <linux/of_platform.h> #include <asm/cacheflush.h> #include <asm/pgtable.h> @@ -576,6 +577,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) int i, ret; struct device *dev; struct sysmmu_drvdata *data; + struct sysmmu_platform_data *platdata; dev = &pdev->dev; @@ -634,9 +636,21 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) } } + if(dev->of_node) { + platdata = devm_kzalloc(dev, sizeof(*platdata), GFP_KERNEL); + if (!platdata) { + dev_dbg(dev, "memory allocation for pdata failed\n"); + goto err_irq; + } + + platdata->clockname = SYSMMU_CLOCK_NAME; + platdata->dbgname = (char *)dev->of_node->name; + dev->platform_data = platdata; + } + if (dev_get_platdata(dev)) { char *deli, *beg; - struct sysmmu_platform_data *platdata = dev_get_platdata(dev); + platdata = dev_get_platdata(dev); beg = platdata->clockname; @@ -670,8 +684,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) __set_fault_handler(data, &default_fault_handler); - if (dev->parent) - pm_runtime_enable(dev); + pm_runtime_enable(dev); dev_dbg(dev, "(%s) Initialized\n", data->dbgname); return 0; @@ -693,11 +706,20 @@ err_alloc: return ret; } +static struct of_device_id iommu_match_types[] = { + { + .compatible = "samsung,exynos5-sysmmu", + }, { + /* end node */ + } +}; + static struct platform_driver exynos_sysmmu_driver = { .probe = exynos_sysmmu_probe, .driver = { .owner = THIS_MODULE, .name = "exynos-sysmmu", + .of_match_table = iommu_match_types, } }; -- 1.7.0.4 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
