All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Sharma <rahul.sharma-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	prathyush.k-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	joshi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	rahul.sharma-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	prashanth.g-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	s.shirish-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org
Subject: [PATCH] iommu: exynos: add support for dt based instantiation for iommu devices
Date: Mon, 05 Nov 2012 15:18:15 +0530	[thread overview]
Message-ID: <1352108895-21087-1-git-send-email-rahul.sharma@samsung.com> (raw)

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 <rahul.sharma-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 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

             reply	other threads:[~2012-11-05  9:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05  9:48 Rahul Sharma [this message]
     [not found] ` <1352108895-21087-1-git-send-email-rahul.sharma-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-11-08 22:36   ` [PATCH] iommu: exynos: add support for dt based instantiation for iommu devices KyongHo Cho
2012-11-17 21:37   ` Joerg Roedel
     [not found]     ` <20121117213734.GV25742-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2012-11-29 11:13       ` Rahul Sharma
2012-11-05 15:22 Rahul Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352108895-21087-1-git-send-email-rahul.sharma@samsung.com \
    --to=rahul.sharma-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=joshi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=prashanth.g-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=prathyush.k-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=s.shirish-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.