iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/exynos: Remove custom platform device registration code
       [not found] <CGME20170804102843eucas1p1fb17da4f86044a8ad78cc1684aa6e321@eucas1p1.samsung.com>
@ 2017-08-04 10:28 ` Marek Szyprowski
  2017-08-04 11:02   ` Joerg Roedel
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Szyprowski @ 2017-08-04 10:28 UTC (permalink / raw)
  To: iommu, linux-samsung-soc
  Cc: Marek Szyprowski, Joerg Roedel, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz

Commit 09515ef5ddad ("of/acpi: Configure dma operations at probe time for
platform/amba/pci bus devices") postponed the moment of attaching IOMMU
controller to its device, so there is no need to register IOMMU controllers
very early, before all other devices in the system. This change gives us an
opportunity to use standard platform device registration method also for
Exynos SYSMMU controllers.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/iommu/exynos-iommu.c | 36 +++++++++---------------------------
 1 file changed, 9 insertions(+), 27 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 2395478dde75..76436d4ff4d1 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -659,6 +659,13 @@ static int __init exynos_sysmmu_probe(struct platform_device *pdev)
 		}
 	}
 
+	/*
+	 * use the first registered sysmmu device for performing
+	 * dma mapping operations on iommu page tables (cpu cache flush)
+	 */
+	if (!dma_dev)
+		dma_dev = &pdev->dev;
+
 	pm_runtime_enable(dev);
 
 	return 0;
@@ -1339,8 +1346,6 @@ static int exynos_iommu_of_xlate(struct device *dev,
 	.of_xlate = exynos_iommu_of_xlate,
 };
 
-static bool init_done;
-
 static int __init exynos_iommu_init(void)
 {
 	int ret;
@@ -1373,8 +1378,6 @@ static int __init exynos_iommu_init(void)
 		goto err_set_iommu;
 	}
 
-	init_done = true;
-
 	return 0;
 err_set_iommu:
 	kmem_cache_free(lv2table_kmem_cache, zero_lv2_table);
@@ -1384,27 +1387,6 @@ static int __init exynos_iommu_init(void)
 	kmem_cache_destroy(lv2table_kmem_cache);
 	return ret;
 }
+core_initcall(exynos_iommu_init);
 
-static int __init exynos_iommu_of_setup(struct device_node *np)
-{
-	struct platform_device *pdev;
-
-	if (!init_done)
-		exynos_iommu_init();
-
-	pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root);
-	if (!pdev)
-		return -ENODEV;
-
-	/*
-	 * use the first registered sysmmu device for performing
-	 * dma mapping operations on iommu page tables (cpu cache flush)
-	 */
-	if (!dma_dev)
-		dma_dev = &pdev->dev;
-
-	return 0;
-}
-
-IOMMU_OF_DECLARE(exynos_iommu_of, "samsung,exynos-sysmmu",
-		 exynos_iommu_of_setup);
+IOMMU_OF_DECLARE(exynos_iommu_of, "samsung,exynos-sysmmu", NULL);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iommu/exynos: Remove custom platform device registration code
  2017-08-04 10:28 ` [PATCH] iommu/exynos: Remove custom platform device registration code Marek Szyprowski
@ 2017-08-04 11:02   ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2017-08-04 11:02 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: iommu, linux-samsung-soc, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz

On Fri, Aug 04, 2017 at 12:28:33PM +0200, Marek Szyprowski wrote:
> Commit 09515ef5ddad ("of/acpi: Configure dma operations at probe time for
> platform/amba/pci bus devices") postponed the moment of attaching IOMMU
> controller to its device, so there is no need to register IOMMU controllers
> very early, before all other devices in the system. This change gives us an
> opportunity to use standard platform device registration method also for
> Exynos SYSMMU controllers.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/iommu/exynos-iommu.c | 36 +++++++++---------------------------
>  1 file changed, 9 insertions(+), 27 deletions(-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-04 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20170804102843eucas1p1fb17da4f86044a8ad78cc1684aa6e321@eucas1p1.samsung.com>
2017-08-04 10:28 ` [PATCH] iommu/exynos: Remove custom platform device registration code Marek Szyprowski
2017-08-04 11:02   ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).