From: Kartik <kkartik@nvidia.com>
To: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
<sumitg@nvidia.com>, <arnd@arndb.de>, <pshete@nvidia.com>,
<andriy.shevchenko@linux.intel.com>, <kkartik@nvidia.com>,
<digetx@gmail.com>, <petlozup@nvidia.com>, <windhl@126.com>,
<frank.li@vivo.com>, <robh@kernel.org>, <stefank@nvidia.com>,
<pdeschrijver@nvidia.com>, <linux-tegra@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v2 1/6] soc/tegra: fuse: Refactor resource mapping
Date: Tue, 5 Sep 2023 18:28:19 +0530 [thread overview]
Message-ID: <20230905125824.2947-2-kkartik@nvidia.com> (raw)
In-Reply-To: <20230905125824.2947-1-kkartik@nvidia.com>
To prepare for adding ACPI support to the tegra-apbmisc driver,
relocate the code responsible for mapping memory resources from
the function ‘tegra_init_apbmisc’ to the function
‘tegra_init_apbmisc_resources.’ This adjustment will allow the
code to be shared between ‘tegra_init_apbmisc’ and the upcoming
‘tegra_acpi_init_apbmisc’ function.
Signed-off-by: Kartik <kkartik@nvidia.com>
---
drivers/soc/tegra/fuse/tegra-apbmisc.c | 37 +++++++++++++++-----------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
index da970f3dbf35..06c1b3a2c7ec 100644
--- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
+++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
@@ -160,9 +160,28 @@ void __init tegra_init_revision(void)
tegra_sku_info.platform = tegra_get_platform();
}
-void __init tegra_init_apbmisc(void)
+static void tegra_init_apbmisc_resources(struct resource *apbmisc,
+ struct resource *straps)
{
void __iomem *strapping_base;
+
+ apbmisc_base = ioremap(apbmisc->start, resource_size(apbmisc));
+ if (apbmisc_base)
+ chipid = readl_relaxed(apbmisc_base + 4);
+ else
+ pr_err("failed to map APBMISC registers\n");
+
+ strapping_base = ioremap(straps->start, resource_size(straps));
+ if (strapping_base) {
+ strapping = readl_relaxed(strapping_base);
+ iounmap(strapping_base);
+ } else {
+ pr_err("failed to map strapping options registers\n");
+ }
+}
+
+void __init tegra_init_apbmisc(void)
+{
struct resource apbmisc, straps;
struct device_node *np;
@@ -219,21 +238,7 @@ void __init tegra_init_apbmisc(void)
}
}
- apbmisc_base = ioremap(apbmisc.start, resource_size(&apbmisc));
- if (!apbmisc_base) {
- pr_err("failed to map APBMISC registers\n");
- } else {
- chipid = readl_relaxed(apbmisc_base + 4);
- }
-
- strapping_base = ioremap(straps.start, resource_size(&straps));
- if (!strapping_base) {
- pr_err("failed to map strapping options registers\n");
- } else {
- strapping = readl_relaxed(strapping_base);
- iounmap(strapping_base);
- }
-
+ tegra_init_apbmisc_resources(&apbmisc, &straps);
long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code");
put:
--
2.34.1
next prev parent reply other threads:[~2023-09-05 17:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
2023-09-05 12:58 ` Kartik [this message]
2023-09-05 12:58 ` [PATCH v2 2/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Kartik
2023-09-06 14:54 ` kernel test robot
2023-09-06 17:31 ` kernel test robot
2023-09-05 12:58 ` [PATCH v2 3/6] soc/tegra: fuse: Add function to add lookups Kartik
2023-09-05 12:58 ` [PATCH v2 4/6] soc/tegra: fuse: Add function to print SKU info Kartik
2023-09-05 12:58 ` [PATCH v2 5/6] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Kartik
2023-09-05 12:58 ` [PATCH v2 6/6] soc/tegra: fuse: Add support for Tegra241 Kartik
2023-09-06 14:56 ` [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Andy Shevchenko
2023-09-07 7:11 ` Kartik
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=20230905125824.2947-2-kkartik@nvidia.com \
--to=kkartik@nvidia.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=digetx@gmail.com \
--cc=frank.li@vivo.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=pdeschrijver@nvidia.com \
--cc=petlozup@nvidia.com \
--cc=pshete@nvidia.com \
--cc=robh@kernel.org \
--cc=stefank@nvidia.com \
--cc=sumitg@nvidia.com \
--cc=thierry.reding@gmail.com \
--cc=windhl@126.com \
/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).