[v1] memory: tegra: Register SMMU after MC driver became ready

Message ID 20180508165530.12746-1-digetx@gmail.com
State Accepted
Headers show
Series
  • [v1] memory: tegra: Register SMMU after MC driver became ready
Related show

Commit Message

Dmitry Osipenko May 8, 2018, 4:55 p.m.
Memory Controller driver invokes SMMU driver registration and MC's
registers mapping is shared with SMMU. This mapping goes away if MC
driver probing fails after SMMU registration.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/memory/tegra/mc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Thierry Reding May 18, 2018, 10:32 a.m. | #1
On Tue, May 08, 2018 at 07:55:30PM +0300, Dmitry Osipenko wrote:
> Memory Controller driver invokes SMMU driver registration and MC's
> registers mapping is shared with SMMU. This mapping goes away if MC
> driver probing fails after SMMU registration.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/memory/tegra/mc.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

Applied, thanks.

Thierry

Patch

diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index 49dd7ad1459f..22ec959db7d3 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -692,15 +692,6 @@  static int tegra_mc_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	if (IS_ENABLED(CONFIG_TEGRA_IOMMU_SMMU)) {
-		mc->smmu = tegra_smmu_probe(&pdev->dev, mc->soc->smmu, mc);
-		if (IS_ERR(mc->smmu)) {
-			dev_err(&pdev->dev, "failed to probe SMMU: %ld\n",
-				PTR_ERR(mc->smmu));
-			return PTR_ERR(mc->smmu);
-		}
-	}
-
 	err = tegra_mc_reset_setup(mc);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register reset controller: %d\n",
@@ -726,6 +717,15 @@  static int tegra_mc_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	if (IS_ENABLED(CONFIG_TEGRA_IOMMU_SMMU)) {
+		mc->smmu = tegra_smmu_probe(&pdev->dev, mc->soc->smmu, mc);
+		if (IS_ERR(mc->smmu)) {
+			dev_err(&pdev->dev, "failed to probe SMMU: %ld\n",
+				PTR_ERR(mc->smmu));
+			return PTR_ERR(mc->smmu);
+		}
+	}
+
 	return 0;
 }