From: Thierry Reding <thierry.reding@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Rob Herring <robh+dt@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
iommu@lists.linux-foundation.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 4/5] memory: tegra186: Register as memory controller
Date: Thu, 13 Feb 2020 17:39:58 +0100 [thread overview]
Message-ID: <20200213163959.819733-5-thierry.reding@gmail.com> (raw)
In-Reply-To: <20200213163959.819733-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.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@nvidia.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
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2020-02-13 16:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 16:39 [PATCH v4 0/5] memory: Introduce memory controller mini-framework Thierry Reding
2020-02-13 16:39 ` [PATCH v4 1/5] dt-bindings: Add memory controller bindings Thierry Reding
2020-02-13 16:39 ` [PATCH v4 2/5] of: Use memory-controllers property for DMA parent Thierry Reding
2020-02-13 16:39 ` [PATCH v4 3/5] memory: Introduce memory controller mini-framework Thierry Reding
2020-02-13 17:03 ` Robin Murphy
2020-02-13 18:10 ` Thierry Reding
2020-02-13 16:39 ` Thierry Reding [this message]
2020-02-13 16:39 ` [PATCH v4 5/5] iommu: arm-smmu: Get reference to memory controller Thierry Reding
2020-02-13 17:23 ` [PATCH v4 0/5] memory: Introduce memory controller mini-framework Robin Murphy
2020-02-13 18:15 ` Thierry Reding
2020-02-14 7:46 ` Maxime Ripard
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=20200213163959.819733-5-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=arnd@arndb.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox