Populate AHB/IOMMU earlier than others. IOMMU depends on AHB. IOMMU
needs to be instanciated earlier than others so that IOMMU can
register other platform devices as IOMMU'able. Once IOMMU is
populated, IOMMU/AHB nodes are detached to prevent another
registeration.

Signed-off-by: Hiroshi Doyu <[email protected]>
---
 arch/arm/mach-tegra/tegra.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 40b031c..9098a88 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -108,6 +108,26 @@ static void __init tegra_dt_init_irq(void)
        tegra_legacy_irq_syscore_init();
 }
 
+static void tegra_of_platform_populate_iommu(void)
+{
+       int i;
+       struct platform_device *pdev;
+       const char * const path[] = {"/ahb", "/iommu", };
+
+       for (i = 0; i < ARRAY_SIZE(path); i++) {
+               struct device_node *np;
+
+               np  = of_find_node_by_path(path[i]);
+               if (!np)
+                       break;
+
+               pdev = of_platform_device_create(np, NULL, NULL);
+               of_node_put(np);
+               if (!pdev)
+                       break;
+       }
+}
+
 static void __init tegra_dt_init(void)
 {
        struct soc_device_attribute *soc_dev_attr;
@@ -137,6 +157,8 @@ static void __init tegra_dt_init(void)
 
        parent = soc_device_to_device(soc_dev);
 
+       tegra_of_platform_populate_iommu();
+
        /*
         * Finished with the static registrations now; fill in the missing
         * devices
-- 
1.8.1.5

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to