From: Thierry Reding <thierry.reding@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org,
Rob Herring <robh+dt@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Jon Hunter <jonathanh@nvidia.com>
Subject: [PATCH 06/13] memory: tegra: Extract memory client SID programming
Date: Sun, 22 Dec 2019 15:10:28 +0100 [thread overview]
Message-ID: <20191222141035.1649937-7-thierry.reding@gmail.com> (raw)
In-Reply-To: <20191222141035.1649937-1-thierry.reding@gmail.com>
From: Thierry Reding <treding@nvidia.com>
Move programming of the memory client to SID mapping into a separate
function so that it can be reused from multiple call sites.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
drivers/memory/tegra/tegra186.c | 49 ++++++++++++++++++---------------
1 file changed, 27 insertions(+), 22 deletions(-)
diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
index ad5c353dba6e..57895116c8e5 100644
--- a/drivers/memory/tegra/tegra186.c
+++ b/drivers/memory/tegra/tegra186.c
@@ -32,6 +32,32 @@ struct tegra186_mc {
const struct tegra186_mc_soc *soc;
};
+static void tegra186_mc_program_sid(struct tegra186_mc *mc)
+{
+ unsigned int i;
+
+ for (i = 0; i < mc->soc->num_clients; i++) {
+ const struct tegra186_mc_client *client = &mc->soc->clients[i];
+ u32 override, security;
+
+ override = readl(mc->regs + client->regs.override);
+ security = readl(mc->regs + client->regs.security);
+
+ dev_dbg(mc->dev, "client %s: override: %x security: %x\n",
+ client->name, override, security);
+
+ dev_dbg(mc->dev, "setting SID %u for %s\n", client->sid,
+ client->name);
+ writel(client->sid, mc->regs + client->regs.override);
+
+ override = readl(mc->regs + client->regs.override);
+ security = readl(mc->regs + client->regs.security);
+
+ dev_dbg(mc->dev, "client %s: override: %x security: %x\n",
+ client->name, override, security);
+ }
+}
+
static const struct tegra186_mc_client tegra186_mc_clients[] = {
{
.name = "ptcr",
@@ -549,7 +575,6 @@ static int tegra186_mc_probe(struct platform_device *pdev)
{
struct tegra186_mc *mc;
struct resource *res;
- unsigned int i;
int err;
mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL);
@@ -565,28 +590,8 @@ static int tegra186_mc_probe(struct platform_device *pdev)
mc->dev = &pdev->dev;
- for (i = 0; i < mc->soc->num_clients; i++) {
- const struct tegra186_mc_client *client = &mc->soc->clients[i];
- u32 override, security;
-
- override = readl(mc->regs + client->regs.override);
- security = readl(mc->regs + client->regs.security);
-
- dev_dbg(&pdev->dev, "client %s: override: %x security: %x\n",
- client->name, override, security);
-
- dev_dbg(&pdev->dev, "setting SID %u for %s\n", client->sid,
- client->name);
- writel(client->sid, mc->regs + client->regs.override);
-
- override = readl(mc->regs + client->regs.override);
- security = readl(mc->regs + client->regs.security);
-
- dev_dbg(&pdev->dev, "client %s: override: %x security: %x\n",
- client->name, override, security);
- }
-
platform_set_drvdata(pdev, mc);
+ tegra186_mc_program_sid(mc);
return err;
}
--
2.24.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-12-22 14:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-22 14:10 [PATCH 00/13] memory: tegra: Add Tegra186/Tegra194 support Thierry Reding
2019-12-22 14:10 ` [PATCH 01/13] dt-bindings: memory: Add Tegra186 memory client IDs Thierry Reding
2020-01-08 16:14 ` Rob Herring
2019-12-22 14:10 ` [PATCH 02/13] dt-bindings: memory: Add Tegra194 memory controller header Thierry Reding
2020-01-08 16:15 ` Rob Herring
2019-12-22 14:10 ` [PATCH 03/13] dt-bindings: memory: Add Tegra186 memory subsystem Thierry Reding
2020-01-08 16:19 ` Rob Herring
2019-12-22 14:10 ` [PATCH 04/13] memory: tegra: Rename tegra_mc to tegra186_mc on Tegra186 Thierry Reding
2019-12-22 14:10 ` [PATCH 05/13] memory: tegra: Add per-SoC data for Tegra186 Thierry Reding
2019-12-22 14:10 ` Thierry Reding [this message]
2019-12-22 14:10 ` [PATCH 07/13] memory: tegra: Add system sleep support Thierry Reding
2019-12-22 14:10 ` [PATCH 08/13] memory: tegra: Support DVFS on Tegra186 and later Thierry Reding
2019-12-22 14:10 ` [PATCH 09/13] memory: tegra: Only include support for enabled SoCs Thierry Reding
2019-12-22 14:10 ` [PATCH 10/13] memory: tegra: Add support for the Tegra194 memory controller Thierry Reding
2019-12-22 14:10 ` [PATCH 11/13] arm64: tegra: Add interrupt for memory controller on Tegra186 Thierry Reding
2019-12-22 14:10 ` [PATCH 12/13] arm64: tegra: Add external " Thierry Reding
2019-12-22 14:10 ` [PATCH 13/13] arm64: tegra: Add the memory subsystem on Tegra194 Thierry Reding
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=20191222141035.1649937-7-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=jonathanh@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).