linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support
@ 2023-09-05 12:58 Kartik
  2023-09-05 12:58 ` [PATCH v2 1/6] soc/tegra: fuse: Refactor resource mapping Kartik
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Kartik @ 2023-09-05 12:58 UTC (permalink / raw)
  To: thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, kkartik, digetx, petlozup, windhl, frank.li,
	robh, stefank, pdeschrijver, linux-tegra, linux-kernel

This series of patches add ACPI support for Tegra194 and Tegra234 in
Tegra fuse and apbmisc drivers. It also adds support for Tegra241
which uses ACPI boot.

Kartik (6):
  soc/tegra: fuse: Refactor resource mapping
  soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
  soc/tegra: fuse: Add function to add lookups
  soc/tegra: fuse: Add function to print SKU info
  soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234
  soc/tegra: fuse: Add support for Tegra241

 drivers/soc/tegra/Kconfig              |   5 ++
 drivers/soc/tegra/fuse/fuse-tegra.c    | 119 +++++++++++++++++++------
 drivers/soc/tegra/fuse/fuse-tegra30.c  |  21 +++++
 drivers/soc/tegra/fuse/fuse.h          |   5 ++
 drivers/soc/tegra/fuse/tegra-apbmisc.c | 110 +++++++++++++++++++----
 include/soc/tegra/fuse.h               |   1 +
 6 files changed, 217 insertions(+), 44 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/6] soc/tegra: fuse: Refactor resource mapping
  2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
@ 2023-09-05 12:58 ` Kartik
  2023-09-05 12:58 ` [PATCH v2 2/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Kartik
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Kartik @ 2023-09-05 12:58 UTC (permalink / raw)
  To: thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, kkartik, digetx, petlozup, windhl, frank.li,
	robh, stefank, pdeschrijver, linux-tegra, linux-kernel

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
  2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
  2023-09-05 12:58 ` [PATCH v2 1/6] soc/tegra: fuse: Refactor resource mapping Kartik
@ 2023-09-05 12:58 ` 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
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 11+ messages in thread
From: Kartik @ 2023-09-05 12:58 UTC (permalink / raw)
  To: thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, kkartik, digetx, petlozup, windhl, frank.li,
	robh, stefank, pdeschrijver, linux-tegra, linux-kernel

In preparation to ACPI support in Tegra fuse driver add function
tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver.

Note that function tegra_acpi_init_apbmisc() is not placed in the __init
section, because it will be called during probe.

Signed-off-by: Kartik <kkartik@nvidia.com>
---
 drivers/soc/tegra/fuse/fuse.h          |  1 +
 drivers/soc/tegra/fuse/tegra-apbmisc.c | 72 ++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
index 90f23be73894..a41e9f85281a 100644
--- a/drivers/soc/tegra/fuse/fuse.h
+++ b/drivers/soc/tegra/fuse/fuse.h
@@ -69,6 +69,7 @@ struct tegra_fuse {
 
 void tegra_init_revision(void);
 void tegra_init_apbmisc(void);
+void tegra_acpi_init_apbmisc(void);
 
 u32 __init tegra_fuse_read_spare(unsigned int spare);
 u32 __init tegra_fuse_read_early(unsigned int offset);
diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
index 06c1b3a2c7ec..ce8c3c25b6a6 100644
--- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
+++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
@@ -3,9 +3,11 @@
  * Copyright (c) 2014-2023, NVIDIA CORPORATION.  All rights reserved.
  */
 
+#include <linux/acpi.h>
 #include <linux/export.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
@@ -128,6 +130,11 @@ static const struct of_device_id apbmisc_match[] __initconst = {
 	{},
 };
 
+static const struct acpi_device_id apbmisc_acpi_match[] = {
+	{ "NVDA2010" },
+	{ /* sentinel */ }
+};
+
 void __init tegra_init_revision(void)
 {
 	u8 chip_id, minor_rev;
@@ -180,6 +187,12 @@ static void tegra_init_apbmisc_resources(struct resource *apbmisc,
 	}
 }
 
+/**
+ * tegra_init_apbmisc - Initializes Tegra APBMISC and Strapping registers.
+ *
+ * This is called during early init as some of the old 32-bit ARM code needs
+ * information from the APBMISC registers very early during boot.
+ */
 void __init tegra_init_apbmisc(void)
 {
 	struct resource apbmisc, straps;
@@ -244,3 +257,62 @@ void __init tegra_init_apbmisc(void)
 put:
 	of_node_put(np);
 }
+
+#ifdef CONFIG_ACPI
+void tegra_acpi_init_apbmisc(void)
+{
+	struct resource *resources[2] = { NULL };
+	struct resource_entry *rentry, *tmp;
+	struct acpi_device *adev = NULL;
+	struct list_head resource_list;
+	int rcount = 0;
+	int ret;
+
+	adev = acpi_dev_get_first_match_dev(apbmisc_acpi_match[0].id, NULL, -1);
+	if (!adev)
+		return;
+
+	INIT_LIST_HEAD(&resource_list);
+
+	ret = acpi_dev_get_memory_resources(adev, &resource_list);
+	if (ret < 0) {
+		pr_err("failed to get APBMISC memory resources");
+		goto out_put_acpi_dev;
+	}
+
+	/*
+	 * Get required memory resources.
+	 *
+	 * resources[0]: apbmisc.
+	 * resources[1]: straps.
+	 */
+	resource_list_for_each_entry_safe(rentry, tmp, &resource_list) {
+		if (rcount >= ARRAY_SIZE(resources))
+			break;
+
+		resources[rcount++] = rentry->res;
+	}
+
+	if (!resources[0]) {
+		pr_err("failed to get APBMISC registers\n");
+		goto out_free_resource_list;
+	}
+
+	if (!resources[1]) {
+		pr_err("failed to get strapping options registers\n");
+		goto out_free_resource_list;
+	}
+
+	tegra_init_apbmisc_resources(resources[0], resources[1]);
+
+out_free_resource_list:
+	acpi_dev_free_resource_list(&resource_list);
+
+out_put_acpi_dev:
+	acpi_dev_put(adev);
+}
+#else
+void tegra_acpi_init_apbmisc(void)
+{
+}
+#endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/6] soc/tegra: fuse: Add function to add lookups
  2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
  2023-09-05 12:58 ` [PATCH v2 1/6] soc/tegra: fuse: Refactor resource mapping Kartik
  2023-09-05 12:58 ` [PATCH v2 2/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Kartik
@ 2023-09-05 12:58 ` Kartik
  2023-09-05 12:58 ` [PATCH v2 4/6] soc/tegra: fuse: Add function to print SKU info Kartik
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Kartik @ 2023-09-05 12:58 UTC (permalink / raw)
  To: thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, kkartik, digetx, petlozup, windhl, frank.li,
	robh, stefank, pdeschrijver, linux-tegra, linux-kernel

Add helper function tegra_fuse_add_lookups() to register Tegra fuse
nvmem lookups. So, this can be shared between tegra_fuse_init() and
ACPI probe, which is to be introduced later.

Signed-off-by: Kartik <kkartik@nvidia.com>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index a2c28f493a75..821bb485ec45 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -113,6 +113,24 @@ static void tegra_fuse_restore(void *base)
 	fuse->clk = NULL;
 }
 
+static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
+{
+	size_t size;
+
+	if (!fuse->soc->lookups)
+		return 0;
+
+	size = size_mul(sizeof(*fuse->lookups), fuse->soc->num_lookups);
+
+	fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
+	if (!fuse->lookups)
+		return -ENOMEM;
+
+	nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
+
+	return 0;
+}
+
 static int tegra_fuse_probe(struct platform_device *pdev)
 {
 	void __iomem *base = fuse->base;
@@ -407,6 +425,7 @@ static int __init tegra_init_fuse(void)
 	const struct of_device_id *match;
 	struct device_node *np;
 	struct resource regs;
+	int err;
 
 	tegra_init_apbmisc();
 
@@ -504,12 +523,10 @@ static int __init tegra_init_fuse(void)
 	pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
 		 tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
 
-	if (fuse->soc->lookups) {
-		size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups;
-
-		fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL);
-		if (fuse->lookups)
-			nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups);
+	err = tegra_fuse_add_lookups(fuse);
+	if (err) {
+		pr_err("failed to add FUSE lookups\n");
+		return err;
 	}
 
 	return 0;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 4/6] soc/tegra: fuse: Add function to print SKU info
  2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
                   ` (2 preceding siblings ...)
  2023-09-05 12:58 ` [PATCH v2 3/6] soc/tegra: fuse: Add function to add lookups Kartik
@ 2023-09-05 12:58 ` Kartik
  2023-09-05 12:58 ` [PATCH v2 5/6] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Kartik
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Kartik @ 2023-09-05 12:58 UTC (permalink / raw)
  To: thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, kkartik, digetx, petlozup, windhl, frank.li,
	robh, stefank, pdeschrijver, linux-tegra, linux-kernel

Add helper function tegra_fuse_print_sku_info() to print Tegra SKU
information. So, it can be shared between tegra_fuse_init() and
ACPI probe which is to be introduced later.

Signed-off-by: Kartik <kkartik@nvidia.com>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 821bb485ec45..64f7001823ce 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -113,6 +113,16 @@ static void tegra_fuse_restore(void *base)
 	fuse->clk = NULL;
 }
 
+static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info)
+{
+	pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n",
+		tegra_revision_name[tegra_sku_info->revision],
+		tegra_sku_info->sku_id, tegra_sku_info->cpu_process_id,
+		tegra_sku_info->soc_process_id);
+	pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
+		tegra_sku_info->cpu_speedo_id, tegra_sku_info->soc_speedo_id);
+}
+
 static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
 {
 	size_t size;
@@ -516,12 +526,7 @@ static int __init tegra_init_fuse(void)
 
 	fuse->soc->init(fuse);
 
-	pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n",
-		tegra_revision_name[tegra_sku_info.revision],
-		tegra_sku_info.sku_id, tegra_sku_info.cpu_process_id,
-		tegra_sku_info.soc_process_id);
-	pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n",
-		 tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id);
+	tegra_fuse_print_sku_info(&tegra_sku_info);
 
 	err = tegra_fuse_add_lookups(fuse);
 	if (err) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 5/6] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234
  2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
                   ` (3 preceding siblings ...)
  2023-09-05 12:58 ` [PATCH v2 4/6] soc/tegra: fuse: Add function to print SKU info Kartik
@ 2023-09-05 12:58 ` 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
  6 siblings, 0 replies; 11+ messages in thread
From: Kartik @ 2023-09-05 12:58 UTC (permalink / raw)
  To: thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, kkartik, digetx, petlozup, windhl, frank.li,
	robh, stefank, pdeschrijver, linux-tegra, linux-kernel

Add ACPI support for Tegra194 & Tegra243 SoC's. This requires
following modifications to the probe with ACPI boot is used:
 - Initialize soc data.
 - Add nvmem lookups.
 - Register soc device.
 - use devm_clk_get_optional() instead of devm_clk_get() to get
   fuse->clk, as fuse clocks are not required when using ACPI boot.

Also, drop '__init' keyword for tegra_soc_device_register() as this is also
used by tegra_fuse_probe().

Signed-off-by: Kartik <kkartik@nvidia.com>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 68 ++++++++++++++++++++++-------
 1 file changed, 52 insertions(+), 16 deletions(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 64f7001823ce..f35f9651a653 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -3,11 +3,13 @@
  * Copyright (c) 2013-2023, NVIDIA CORPORATION.  All rights reserved.
  */
 
+#include <linux/acpi.h>
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/kobject.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/mod_devicetable.h>
 #include <linux/nvmem-consumer.h>
 #include <linux/nvmem-provider.h>
 #include <linux/of.h>
@@ -94,6 +96,11 @@ static const struct of_device_id tegra_fuse_match[] = {
 	{ /* sentinel */ }
 };
 
+static const struct acpi_device_id tegra_fuse_acpi_match[] = {
+	{ "NVDA200F" },
+	{ /* sentinel */ }
+};
+
 static int tegra_fuse_read(void *priv, unsigned int offset, void *value,
 			   size_t bytes)
 {
@@ -148,6 +155,37 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
+	/* Initialize the soc data and lookups if using ACPI boot. */
+	if (is_acpi_node(pdev->dev.fwnode) && !fuse->soc) {
+		u8 chip;
+
+		tegra_acpi_init_apbmisc();
+
+		chip = tegra_get_chip_id();
+		switch (chip) {
+#if defined(CONFIG_ARCH_TEGRA_194_SOC)
+		case TEGRA194:
+			fuse->soc = &tegra194_fuse_soc;
+			break;
+#endif
+#if defined(CONFIG_ARCH_TEGRA_234_SOC)
+		case TEGRA234:
+			fuse->soc = &tegra234_fuse_soc;
+			break;
+#endif
+		default:
+			return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip);
+		}
+
+		fuse->soc->init(fuse);
+		tegra_fuse_print_sku_info(&tegra_sku_info);
+		tegra_soc_device_register();
+
+		err = tegra_fuse_add_lookups(fuse);
+		if (err)
+			return dev_err_probe(&pdev->dev, err, "failed to add FUSE lookups\n");
+	}
+
 	err = devm_add_action(&pdev->dev, tegra_fuse_restore, (void __force *)base);
 	if (err)
 		return err;
@@ -158,14 +196,9 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 		return PTR_ERR(fuse->base);
 	fuse->phys = res->start;
 
-	fuse->clk = devm_clk_get(&pdev->dev, "fuse");
-	if (IS_ERR(fuse->clk)) {
-		if (PTR_ERR(fuse->clk) != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "failed to get FUSE clock: %ld",
-				PTR_ERR(fuse->clk));
-
-		return PTR_ERR(fuse->clk);
-	}
+	fuse->clk = devm_clk_get_optional(&pdev->dev, "fuse");
+	if (IS_ERR(fuse->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n");
 
 	platform_set_drvdata(pdev, fuse);
 	fuse->dev = &pdev->dev;
@@ -207,12 +240,8 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 	}
 
 	fuse->rst = devm_reset_control_get_optional(&pdev->dev, "fuse");
-	if (IS_ERR(fuse->rst)) {
-		err = PTR_ERR(fuse->rst);
-		dev_err(&pdev->dev, "failed to get FUSE reset: %pe\n",
-			fuse->rst);
-		return err;
-	}
+	if (IS_ERR(fuse->rst))
+		return dev_err_probe(&pdev->dev, PTR_ERR(fuse->rst), "failed to get FUSE reset");
 
 	/*
 	 * FUSE clock is enabled at a boot time, hence this resume/suspend
@@ -294,6 +323,7 @@ static struct platform_driver tegra_fuse_driver = {
 	.driver = {
 		.name = "tegra-fuse",
 		.of_match_table = tegra_fuse_match,
+		.acpi_match_table = tegra_fuse_acpi_match,
 		.pm = &tegra_fuse_pm,
 		.suppress_bind_attrs = true,
 	},
@@ -315,7 +345,13 @@ u32 __init tegra_fuse_read_early(unsigned int offset)
 
 int tegra_fuse_readl(unsigned long offset, u32 *value)
 {
-	if (!fuse->read || !fuse->clk)
+	/*
+	 * Wait for fuse->clk to be initialized if device-tree boot is used.
+	 */
+	if (is_of_node(fuse->dev->fwnode) && !fuse->clk)
+		return -EPROBE_DEFER;
+
+	if (!fuse->read)
 		return -EPROBE_DEFER;
 
 	if (IS_ERR(fuse->clk))
@@ -398,7 +434,7 @@ const struct attribute_group tegra194_soc_attr_group = {
 };
 #endif
 
-struct device * __init tegra_soc_device_register(void)
+struct device *tegra_soc_device_register(void)
 {
 	struct soc_device_attribute *attr;
 	struct soc_device *dev;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 6/6] soc/tegra: fuse: Add support for Tegra241
  2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
                   ` (4 preceding siblings ...)
  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 ` Kartik
  2023-09-06 14:56 ` [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Andy Shevchenko
  6 siblings, 0 replies; 11+ messages in thread
From: Kartik @ 2023-09-05 12:58 UTC (permalink / raw)
  To: thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, kkartik, digetx, petlozup, windhl, frank.li,
	robh, stefank, pdeschrijver, linux-tegra, linux-kernel

Add support for Tegra241 which use ACPI boot.

Signed-off-by: Kartik <kkartik@nvidia.com>
---
 drivers/soc/tegra/Kconfig              |  5 +++++
 drivers/soc/tegra/fuse/fuse-tegra.c    |  5 +++++
 drivers/soc/tegra/fuse/fuse-tegra30.c  | 21 +++++++++++++++++++++
 drivers/soc/tegra/fuse/fuse.h          |  4 ++++
 drivers/soc/tegra/fuse/tegra-apbmisc.c |  1 +
 include/soc/tegra/fuse.h               |  1 +
 6 files changed, 37 insertions(+)

diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig
index 6f3098822969..5f5d9d663fef 100644
--- a/drivers/soc/tegra/Kconfig
+++ b/drivers/soc/tegra/Kconfig
@@ -133,6 +133,11 @@ config ARCH_TEGRA_234_SOC
 	help
 	  Enable support for the NVIDIA Tegra234 SoC.
 
+config ARCH_TEGRA_241_SOC
+	bool "NVIDIA Tegra241 SoC"
+	help
+	  Enable support for the NVIDIA Tegra241 SoC.
+
 endif
 endif
 
diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index f35f9651a653..eb11465e8092 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -172,6 +172,11 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 		case TEGRA234:
 			fuse->soc = &tegra234_fuse_soc;
 			break;
+#endif
+#if defined(CONFIG_ARCH_TEGRA_241_SOC)
+		case TEGRA241:
+			fuse->soc = &tegra241_fuse_soc;
+			break;
 #endif
 		default:
 			return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip);
diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c
index e94d46372a63..34fcc23a6449 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra30.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra30.c
@@ -678,3 +678,24 @@ const struct tegra_fuse_soc tegra234_fuse_soc = {
 	.clk_suspend_on = false,
 };
 #endif
+
+#if defined(CONFIG_ARCH_TEGRA_241_SOC)
+static const struct tegra_fuse_info tegra241_fuse_info = {
+	.read = tegra30_fuse_read,
+	.size = 0x16008,
+	.spare = 0xcf0,
+};
+
+static const struct nvmem_keepout tegra241_fuse_keepouts[] = {
+	{ .start = 0xc, .end = 0x1600c }
+};
+
+const struct tegra_fuse_soc tegra241_fuse_soc = {
+	.init = tegra30_fuse_init,
+	.info = &tegra241_fuse_info,
+	.keepouts = tegra241_fuse_keepouts,
+	.num_keepouts = ARRAY_SIZE(tegra241_fuse_keepouts),
+	.soc_attr_group = &tegra194_soc_attr_group,
+	.clk_suspend_on = false,
+};
+#endif
diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
index a41e9f85281a..f3b705327c20 100644
--- a/drivers/soc/tegra/fuse/fuse.h
+++ b/drivers/soc/tegra/fuse/fuse.h
@@ -136,4 +136,8 @@ extern const struct tegra_fuse_soc tegra194_fuse_soc;
 extern const struct tegra_fuse_soc tegra234_fuse_soc;
 #endif
 
+#ifdef CONFIG_ARCH_TEGRA_241_SOC
+extern const struct tegra_fuse_soc tegra241_fuse_soc;
+#endif
+
 #endif
diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c
index ce8c3c25b6a6..f5b241a527c2 100644
--- a/drivers/soc/tegra/fuse/tegra-apbmisc.c
+++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c
@@ -64,6 +64,7 @@ bool tegra_is_silicon(void)
 	switch (tegra_get_chip_id()) {
 	case TEGRA194:
 	case TEGRA234:
+	case TEGRA241:
 	case TEGRA264:
 		if (tegra_get_platform() == 0)
 			return true;
diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h
index 3a513be50243..8f421b9f7585 100644
--- a/include/soc/tegra/fuse.h
+++ b/include/soc/tegra/fuse.h
@@ -17,6 +17,7 @@
 #define TEGRA186	0x18
 #define TEGRA194	0x19
 #define TEGRA234	0x23
+#define TEGRA241	0x24
 #define TEGRA264	0x26
 
 #define TEGRA_FUSE_SKU_CALIB_0	0xf0
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
  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
  1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2023-09-06 14:54 UTC (permalink / raw)
  To: Kartik, thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, digetx, petlozup, windhl, frank.li, robh,
	stefank, pdeschrijver, linux-tegra, linux-kernel
  Cc: oe-kbuild-all

Hi Kartik,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tegra/for-next]
[also build test WARNING on linus/master v6.5 next-20230906]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Kartik/soc-tegra-fuse-Refactor-resource-mapping/20230906-032546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
patch link:    https://lore.kernel.org/r/20230905125824.2947-3-kkartik%40nvidia.com
patch subject: [PATCH v2 2/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
config: arm-defconfig (https://download.01.org/0day-ci/archive/20230906/202309062233.ytjhz7lC-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230906/202309062233.ytjhz7lC-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309062233.ytjhz7lC-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/soc/tegra/fuse/tegra-apbmisc.c:133:36: warning: 'apbmisc_acpi_match' defined but not used [-Wunused-const-variable=]
     133 | static const struct acpi_device_id apbmisc_acpi_match[] = {
         |                                    ^~~~~~~~~~~~~~~~~~


vim +/apbmisc_acpi_match +133 drivers/soc/tegra/fuse/tegra-apbmisc.c

   132	
 > 133	static const struct acpi_device_id apbmisc_acpi_match[] = {
   134		{ "NVDA2010" },
   135		{ /* sentinel */ }
   136	};
   137	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support
  2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
                   ` (5 preceding siblings ...)
  2023-09-05 12:58 ` [PATCH v2 6/6] soc/tegra: fuse: Add support for Tegra241 Kartik
@ 2023-09-06 14:56 ` Andy Shevchenko
  2023-09-07  7:11   ` Kartik
  6 siblings, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2023-09-06 14:56 UTC (permalink / raw)
  To: Kartik
  Cc: thierry.reding, jonathanh, sumitg, arnd, pshete, digetx, petlozup,
	windhl, frank.li, robh, stefank, pdeschrijver, linux-tegra,
	linux-kernel

On Tue, Sep 05, 2023 at 06:28:18PM +0530, Kartik wrote:
> This series of patches add ACPI support for Tegra194 and Tegra234 in
> Tegra fuse and apbmisc drivers. It also adds support for Tegra241
> which uses ACPI boot.

Neither here, nor in the individual patches I do _not_ see the changelog.
What's going on?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
  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
  1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2023-09-06 17:31 UTC (permalink / raw)
  To: Kartik, thierry.reding, jonathanh, sumitg, arnd, pshete,
	andriy.shevchenko, digetx, petlozup, windhl, frank.li, robh,
	stefank, pdeschrijver, linux-tegra, linux-kernel
  Cc: llvm, oe-kbuild-all

Hi Kartik,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tegra/for-next]
[also build test WARNING on linus/master v6.5 next-20230906]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Kartik/soc-tegra-fuse-Refactor-resource-mapping/20230906-032546
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
patch link:    https://lore.kernel.org/r/20230905125824.2947-3-kkartik%40nvidia.com
patch subject: [PATCH v2 2/6] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()
config: arm64-randconfig-r023-20230906 (https://download.01.org/0day-ci/archive/20230907/202309070129.gFw1OFMp-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230907/202309070129.gFw1OFMp-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309070129.gFw1OFMp-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/soc/tegra/fuse/tegra-apbmisc.c:133:36: warning: unused variable 'apbmisc_acpi_match' [-Wunused-const-variable]
   static const struct acpi_device_id apbmisc_acpi_match[] = {
                                      ^
   1 warning generated.


vim +/apbmisc_acpi_match +133 drivers/soc/tegra/fuse/tegra-apbmisc.c

   132	
 > 133	static const struct acpi_device_id apbmisc_acpi_match[] = {
   134		{ "NVDA2010" },
   135		{ /* sentinel */ }
   136	};
   137	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support
  2023-09-06 14:56 ` [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Andy Shevchenko
@ 2023-09-07  7:11   ` Kartik
  0 siblings, 0 replies; 11+ messages in thread
From: Kartik @ 2023-09-07  7:11 UTC (permalink / raw)
  To: andriy.shevchenko
  Cc: arnd, digetx, frank.li, jonathanh, kkartik, linux-kernel,
	linux-tegra, pdeschrijver, petlozup, pshete, robh, stefank,
	sumitg, thierry.reding, windhl

On Wed, 2023-09-06 at 17:56 +0300, Andy Shevchenko wrote:
>On Tue, Sep 05, 2023 at 06:28:18PM +0530, Kartik wrote:
>> This series of patches add ACPI support for Tegra194 and Tegra234 in
>> Tegra fuse and apbmisc drivers. It also adds support for Tegra241
>> which uses ACPI boot.
>
>Neither here, nor in the individual patches I do _not_ see the changelog.
>What's going on?
>
>--
>With Best Regards,
>Andy Shevchenko

Apologies for the confusion. I've posted v3 of this series with changelogs.

Regards,
Kartik

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-09-07 15:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-05 12:58 [PATCH v2 0/6] soc/tegra: fuse: Add ACPI support Kartik
2023-09-05 12:58 ` [PATCH v2 1/6] soc/tegra: fuse: Refactor resource mapping Kartik
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

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).