[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200213163959.819733-5-thierry.reding@gmail.com>
Date: Thu, 13 Feb 2020 17:39:58 +0100
From: Thierry Reding <thierry.reding@...il.com>
To: Arnd Bergmann <arnd@...db.de>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Rob Herring <robh+dt@...nel.org>
Cc: Joerg Roedel <joro@...tes.org>, Olof Johansson <olof@...om.net>,
linux-tegra@...r.kernel.org, iommu@...ts.linux-foundation.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH v4 4/5] memory: tegra186: Register as memory controller
From: Thierry Reding <treding@...dia.com>
Registering as memory controller allows other drivers to obtain a
reference to it. This is mostly useful as a way of ordering probe
between devices depending on one another.
Signed-off-by: Thierry Reding <treding@...dia.com>
---
drivers/memory/tegra/tegra186.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
index 5d53f11ca7b6..8c43702340e8 100644
--- a/drivers/memory/tegra/tegra186.c
+++ b/drivers/memory/tegra/tegra186.c
@@ -4,6 +4,7 @@
*/
#include <linux/io.h>
+#include <linux/memory-controller.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/of_device.h>
@@ -32,6 +33,7 @@ struct tegra186_mc_soc {
};
struct tegra186_mc {
+ struct memory_controller base;
struct device *dev;
void __iomem *regs;
@@ -1532,13 +1534,18 @@ static int tegra186_mc_probe(struct platform_device *pdev)
return -ENOMEM;
mc->soc = of_device_get_match_data(&pdev->dev);
+ mc->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mc->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mc->regs))
return PTR_ERR(mc->regs);
- mc->dev = &pdev->dev;
+ mc->base.dev = &pdev->dev;
+
+ err = memory_controller_register(&mc->base);
+ if (err < 0)
+ return err;
err = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
if (err < 0)
--
2.24.1
Powered by blists - more mailing lists