All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support
@ 2025-11-20 11:29 Tudor Ambarus
  2025-11-20 11:29 ` [PATCH v3 1/6] soc: samsung: exynos-chipid: use devm action to unregister soc device Tudor Ambarus
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Tudor Ambarus @ 2025-11-20 11:29 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alim Akhtar,
	Peter Griffin, André Draszik, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Tudor Ambarus

Dependency
==========
Typical dependency of the DT patch depending on the bindings patch,
thus the bindings patch could go via the Samsung SoC tree with
Srinivas's ack.

Description
===========
GS101 is different (but also e850 and autov9 I assume) from the SoCs
that are currently handled by the exynos-chipid driver because the
chip ID info is part of the OTP registers. GS101 OTP has a clock, an
interrupt line, a register space (that contains product and chip ID,
TMU data, ASV, etc) and a 32Kbit memory space that can be
read/program/locked with specific commands. On GS101 the "ChipID block"
is just an abstraction, it's not a physical device. When the power-on
sequence progresses, the OTP chipid values are loaded to the OTP
registers.

Add the GS101 chip ID support. The support is intentionally added in the
exynos-chipid driver, and not in a dedicated Exynos OTP driver, because
we estimate that there will not be any OTP consumers in the kernel other
than the chip ID/SoC interface. The downstream GS101 drivers confirm
this supposition.

Testing
=======
root@google-gs:~# cat /sys/devices/soc0/family
Samsung Exynos
root@google-gs:~# cat /sys/devices/soc0/machine
Oriole
root@google-gs:~# cat /sys/devices/soc0/revision
11
root@google-gs:~# cat /sys/devices/soc0/soc_id
GS101

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
Changes in v3:
- rebase so that cleanups come before the gs101 support. The inclusion
  of linux/device/devres.h is now done in the devm action patch, as it's
  first needed there.
- update error message: s/failed to read sub revision/failed to read revision
- Link to v2: https://lore.kernel.org/r/20251118-gs101-chipid-v2-0-e9f1e7460e35@linaro.org

Changes in v2:
- complete rework, treat it as a new patch set please.
- bindings were reviewed at:
  - Link: https://lore.kernel.org/linux-samsung-soc/27a5521cd7ddbed0e870ac416dc829722f1b36a5.camel@linaro.org/T/#me139353334db535806ca6462ae1e86b01ff032a7
  - addressed Andre's s/if of/is of
- part of the cleaning patches are from this trivial series:
  - Link: https://lore.kernel.org/linux-samsung-soc/20251112-chipid-trivial-v1-0-ec2dea03bd83@linaro.org/
- Link to v1: https://lore.kernel.org/r/20251031-gs101-chipid-v1-0-d78d1076b210@linaro.org

---
Tudor Ambarus (6):
      soc: samsung: exynos-chipid: use devm action to unregister soc device
      soc: samsung: exynos-chipid: use dev_err_probe where appropiate
      soc: samsung: exynos-chipid: rename method
      soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info
      soc: samsung: exynos-chipid: add google,gs101-otp support
      arm64: dts: exynos: gs101: add OTP node

 arch/arm64/boot/dts/exynos/google/gs101.dtsi |   7 ++
 drivers/soc/samsung/exynos-chipid.c          | 148 +++++++++++++++++++--------
 2 files changed, 112 insertions(+), 43 deletions(-)
---
base-commit: 303dc6bfcd269f141c3de92aad7e25e2afd1dd47
change-id: 20251031-gs101-chipid-fd84da8afa2f

Best regards,
-- 
Tudor Ambarus <tudor.ambarus@linaro.org>



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

* [PATCH v3 1/6] soc: samsung: exynos-chipid: use devm action to unregister soc device
  2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
@ 2025-11-20 11:29 ` Tudor Ambarus
  2025-12-19 14:53   ` André Draszik
  2025-11-20 11:29 ` [PATCH v3 2/6] soc: samsung: exynos-chipid: use dev_err_probe where appropiate Tudor Ambarus
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Tudor Ambarus @ 2025-11-20 11:29 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alim Akhtar,
	Peter Griffin, André Draszik, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Tudor Ambarus

Simplify the unwinding of the soc device by using a devm action.
Add the action before the exynos_asv_init() to avoid an explicit call
to soc_device_unregister().

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index d3b4b5508e0c808ee9f7b0039073ef57915d60fc..49cb113d99f314ed94730cec2b98f48a1a7b87f2 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -14,6 +14,7 @@
 
 #include <linux/array_size.h>
 #include <linux/device.h>
+#include <linux/device/devres.h>
 #include <linux/errno.h>
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
@@ -104,6 +105,11 @@ static int exynos_chipid_get_chipid_info(struct regmap *regmap,
 	return 0;
 }
 
+static void exynos_chipid_unregister_soc(void *data)
+{
+	soc_device_unregister(data);
+}
+
 static int exynos_chipid_probe(struct platform_device *pdev)
 {
 	const struct exynos_chipid_variant *drv_data;
@@ -152,28 +158,19 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 	if (IS_ERR(soc_dev))
 		return PTR_ERR(soc_dev);
 
-	ret = exynos_asv_init(dev, regmap);
+	ret = devm_add_action_or_reset(dev, exynos_chipid_unregister_soc,
+				       soc_dev);
 	if (ret)
-		goto err;
+		return dev_err_probe(dev, ret, "failed to add devm action\n");
 
-	platform_set_drvdata(pdev, soc_dev);
+	ret = exynos_asv_init(dev, regmap);
+	if (ret)
+		return ret;
 
 	dev_info(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
 		 soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
 
 	return 0;
-
-err:
-	soc_device_unregister(soc_dev);
-
-	return ret;
-}
-
-static void exynos_chipid_remove(struct platform_device *pdev)
-{
-	struct soc_device *soc_dev = platform_get_drvdata(pdev);
-
-	soc_device_unregister(soc_dev);
 }
 
 static const struct exynos_chipid_variant exynos4210_chipid_drv_data = {
@@ -206,7 +203,6 @@ static struct platform_driver exynos_chipid_driver = {
 		.of_match_table = exynos_chipid_of_device_ids,
 	},
 	.probe = exynos_chipid_probe,
-	.remove = exynos_chipid_remove,
 };
 module_platform_driver(exynos_chipid_driver);
 

-- 
2.52.0.rc1.455.g30608eb744-goog



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

* [PATCH v3 2/6] soc: samsung: exynos-chipid: use dev_err_probe where appropiate
  2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
  2025-11-20 11:29 ` [PATCH v3 1/6] soc: samsung: exynos-chipid: use devm action to unregister soc device Tudor Ambarus
@ 2025-11-20 11:29 ` Tudor Ambarus
  2025-12-19 14:57   ` André Draszik
  2025-11-20 11:29 ` [PATCH v3 3/6] soc: samsung: exynos-chipid: rename method Tudor Ambarus
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Tudor Ambarus @ 2025-11-20 11:29 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alim Akhtar,
	Peter Griffin, André Draszik, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Tudor Ambarus

Use dev_err_probe() to benefit of the standardized format of the error
code (e.g. "ENODEV" instead of -19), to get meanigful error messages, and
for more compact error paths.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 49cb113d99f314ed94730cec2b98f48a1a7b87f2..b9a30452ad21c326af35c06a341b28491cee6979 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -81,8 +81,8 @@ static const char *product_id_to_soc_id(unsigned int product_id)
 	return NULL;
 }
 
-static int exynos_chipid_get_chipid_info(struct regmap *regmap,
-		const struct exynos_chipid_variant *data,
+static int exynos_chipid_get_chipid_info(struct device *dev,
+		struct regmap *regmap, const struct exynos_chipid_variant *data,
 		struct exynos_chipid_info *soc_info)
 {
 	int ret;
@@ -90,13 +90,14 @@ static int exynos_chipid_get_chipid_info(struct regmap *regmap,
 
 	ret = regmap_read(regmap, EXYNOS_CHIPID_REG_PRO_ID, &val);
 	if (ret < 0)
-		return ret;
+		return dev_err_probe(dev, ret, "failed to read Product ID\n");
 	soc_info->product_id = val & EXYNOS_MASK;
 
 	if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) {
 		ret = regmap_read(regmap, data->rev_reg, &val);
 		if (ret < 0)
-			return ret;
+			return dev_err_probe(dev, ret,
+					     "failed to read revision\n");
 	}
 	main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
 	sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
@@ -123,13 +124,15 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 
 	drv_data = of_device_get_match_data(dev);
 	if (!drv_data)
-		return -EINVAL;
+		return dev_err_probe(dev, -EINVAL,
+				     "failed to get match data\n");
 
 	regmap = device_node_to_regmap(dev->of_node);
 	if (IS_ERR(regmap))
-		return PTR_ERR(regmap);
+		return dev_err_probe(dev, PTR_ERR(regmap),
+				     "failed to get regmap\n");
 
-	ret = exynos_chipid_get_chipid_info(regmap, drv_data, &soc_info);
+	ret = exynos_chipid_get_chipid_info(dev, regmap, drv_data, &soc_info);
 	if (ret < 0)
 		return ret;
 
@@ -148,15 +151,14 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 	if (!soc_dev_attr->revision)
 		return -ENOMEM;
 	soc_dev_attr->soc_id = product_id_to_soc_id(soc_info.product_id);
-	if (!soc_dev_attr->soc_id) {
-		pr_err("Unknown SoC\n");
-		return -ENODEV;
-	}
+	if (!soc_dev_attr->soc_id)
+		return dev_err_probe(dev, -ENODEV, "Unknown SoC\n");
 
 	/* please note that the actual registration will be deferred */
 	soc_dev = soc_device_register(soc_dev_attr);
 	if (IS_ERR(soc_dev))
-		return PTR_ERR(soc_dev);
+		return dev_err_probe(dev, PTR_ERR(soc_dev),
+				     "failed to register to the soc interface\n");
 
 	ret = devm_add_action_or_reset(dev, exynos_chipid_unregister_soc,
 				       soc_dev);

-- 
2.52.0.rc1.455.g30608eb744-goog



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

* [PATCH v3 3/6] soc: samsung: exynos-chipid: rename method
  2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
  2025-11-20 11:29 ` [PATCH v3 1/6] soc: samsung: exynos-chipid: use devm action to unregister soc device Tudor Ambarus
  2025-11-20 11:29 ` [PATCH v3 2/6] soc: samsung: exynos-chipid: use dev_err_probe where appropiate Tudor Ambarus
@ 2025-11-20 11:29 ` Tudor Ambarus
  2025-11-20 11:29 ` [PATCH v3 4/6] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Tudor Ambarus @ 2025-11-20 11:29 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alim Akhtar,
	Peter Griffin, André Draszik, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Tudor Ambarus

s/product_id_to_soc_id/exynos_product_id_to_name.
Prepend exynos_ to avoid name space pollution. The method translates the
product id to a name, rename the method to make that clear. While
touching the code where it is called, add a blank line for readability
purposes.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index b9a30452ad21c326af35c06a341b28491cee6979..88d264ef1b8835e15f774ff5a31f5b3de20f74ea 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -71,7 +71,7 @@ static const struct exynos_soc_id {
 	{ "EXYNOSAUTOV920", 0x0A920000 },
 };
 
-static const char *product_id_to_soc_id(unsigned int product_id)
+static const char *exynos_product_id_to_name(unsigned int product_id)
 {
 	int i;
 
@@ -150,7 +150,8 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 						soc_info.revision);
 	if (!soc_dev_attr->revision)
 		return -ENOMEM;
-	soc_dev_attr->soc_id = product_id_to_soc_id(soc_info.product_id);
+
+	soc_dev_attr->soc_id = exynos_product_id_to_name(soc_info.product_id);
 	if (!soc_dev_attr->soc_id)
 		return dev_err_probe(dev, -ENODEV, "Unknown SoC\n");
 

-- 
2.52.0.rc1.455.g30608eb744-goog



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

* [PATCH v3 4/6] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info
  2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (2 preceding siblings ...)
  2025-11-20 11:29 ` [PATCH v3 3/6] soc: samsung: exynos-chipid: rename method Tudor Ambarus
@ 2025-11-20 11:29 ` Tudor Ambarus
  2025-12-19 14:58   ` André Draszik
  2025-11-20 11:29 ` [PATCH v3 5/6] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Tudor Ambarus @ 2025-11-20 11:29 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alim Akhtar,
	Peter Griffin, André Draszik, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Tudor Ambarus

The SoC information is exposed to userspace using the standard soc
interface. Downgrade to dev_dbg to stop polluting the console log.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 88d264ef1b8835e15f774ff5a31f5b3de20f74ea..5c8660374269c87ec38ebca242918bd7b1d362e5 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -170,8 +170,8 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	dev_info(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
-		 soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
+	dev_dbg(dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
+		soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
 
 	return 0;
 }

-- 
2.52.0.rc1.455.g30608eb744-goog



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

* [PATCH v3 5/6] soc: samsung: exynos-chipid: add google,gs101-otp support
  2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (3 preceding siblings ...)
  2025-11-20 11:29 ` [PATCH v3 4/6] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
@ 2025-11-20 11:29 ` Tudor Ambarus
  2025-12-19 15:10   ` André Draszik
  2025-11-20 11:29 ` [PATCH v3 6/6] arm64: dts: exynos: gs101: add OTP node Tudor Ambarus
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Tudor Ambarus @ 2025-11-20 11:29 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alim Akhtar,
	Peter Griffin, André Draszik, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Tudor Ambarus

GS101 is different (but also e850 and autov9 I assume) from the SoCs
that are currently handled by the exynos-chipid driver because the
chip ID info is part of the OTP registers. GS101 OTP has a clock, an
interrupt line, a register space (that contains product and chip ID,
TMU data, ASV, etc) and a 32Kbit memory space that can be
read/program/locked with specific commands. On GS101 the "ChipID block"
is just an abstraction, it's not a physical device. When the power-on
sequence progresses, the OTP chipid values are loaded to the OTP
registers.

Add the GS101 chip ID support. The support is intentionally added in the
exynos-chipid driver, and not in a dedicated Exynos OTP driver, because
we estimate that there will not be any OTP consumers in the kernel other
than the chip ID/SoC interface. The downstream GS101 drivers confirm
this supposition.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/soc/samsung/exynos-chipid.c | 87 ++++++++++++++++++++++++++++++++-----
 1 file changed, 75 insertions(+), 12 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 5c8660374269c87ec38ebca242918bd7b1d362e5..06eb6ef8740d3f58eda52c8e71cf40074d2deb1f 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -13,9 +13,11 @@
  */
 
 #include <linux/array_size.h>
+#include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/device/devres.h>
-#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/ioport.h>
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -28,9 +30,11 @@
 #include "exynos-asv.h"
 
 struct exynos_chipid_variant {
-	unsigned int rev_reg;		/* revision register offset */
+	unsigned int main_rev_reg;	/* main revision register offset */
+	unsigned int sub_rev_reg;	/* sub revision register offset */
 	unsigned int main_rev_shift;	/* main revision offset in rev_reg */
 	unsigned int sub_rev_shift;	/* sub revision offset in rev_reg */
+	bool efuse;
 };
 
 struct exynos_chipid_info {
@@ -69,6 +73,8 @@ static const struct exynos_soc_id {
 	{ "EXYNOS990", 0xE9830000 },
 	{ "EXYNOSAUTOV9", 0xAAA80000 },
 	{ "EXYNOSAUTOV920", 0x0A920000 },
+	/* Compatible with: google,gs101-otp */
+	{ "GS101", 0x9845000 },
 };
 
 static const char *exynos_product_id_to_name(unsigned int product_id)
@@ -93,19 +99,53 @@ static int exynos_chipid_get_chipid_info(struct device *dev,
 		return dev_err_probe(dev, ret, "failed to read Product ID\n");
 	soc_info->product_id = val & EXYNOS_MASK;
 
-	if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) {
-		ret = regmap_read(regmap, data->rev_reg, &val);
+	if (data->sub_rev_reg == EXYNOS_CHIPID_REG_PRO_ID) {
+		/* exynos4210 case */
+		main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
+		sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
+	} else {
+		unsigned int val2;
+
+		ret = regmap_read(regmap, data->sub_rev_reg, &val2);
 		if (ret < 0)
 			return dev_err_probe(dev, ret,
 					     "failed to read revision\n");
+
+		if (data->main_rev_reg == EXYNOS_CHIPID_REG_PRO_ID)
+			/* gs101 case */
+			main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
+		else
+			/* exynos850 case */
+			main_rev = (val2 >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
+
+		sub_rev = (val2 >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
 	}
-	main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
-	sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
+
 	soc_info->revision = (main_rev << EXYNOS_REV_PART_SHIFT) | sub_rev;
 
 	return 0;
 }
 
+static struct regmap *exynos_chipid_get_efuse_regmap(struct platform_device *pdev)
+{
+	struct resource *res;
+	void __iomem *base;
+
+	base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(base))
+		return ERR_CAST(base);
+
+	const struct regmap_config reg_config = {
+		.reg_bits = 32,
+		.reg_stride = 4,
+		.val_bits = 32,
+		.use_relaxed_mmio = true,
+		.max_register = (resource_size(res) - reg_config.reg_stride),
+	};
+
+	return devm_regmap_init_mmio(&pdev->dev, base, &reg_config);
+}
+
 static void exynos_chipid_unregister_soc(void *data)
 {
 	soc_device_unregister(data);
@@ -127,10 +167,24 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, -EINVAL,
 				     "failed to get match data\n");
 
-	regmap = device_node_to_regmap(dev->of_node);
-	if (IS_ERR(regmap))
-		return dev_err_probe(dev, PTR_ERR(regmap),
-				     "failed to get regmap\n");
+	if (drv_data->efuse) {
+		struct clk *clk;
+
+		regmap = exynos_chipid_get_efuse_regmap(pdev);
+		if (IS_ERR(regmap))
+			return dev_err_probe(dev, PTR_ERR(regmap),
+					     "failed to get efuse regmap\n");
+
+		clk = devm_clk_get_enabled(dev, NULL);
+		if (IS_ERR(clk))
+			return dev_err_probe(dev, PTR_ERR(clk),
+					     "failed to get clock\n");
+	} else {
+		regmap = device_node_to_regmap(dev->of_node);
+		if (IS_ERR(regmap))
+			return dev_err_probe(dev, PTR_ERR(regmap),
+					     "failed to get regmap\n");
+	}
 
 	ret = exynos_chipid_get_chipid_info(dev, regmap, drv_data, &soc_info);
 	if (ret < 0)
@@ -177,19 +231,28 @@ static int exynos_chipid_probe(struct platform_device *pdev)
 }
 
 static const struct exynos_chipid_variant exynos4210_chipid_drv_data = {
-	.rev_reg	= 0x0,
 	.main_rev_shift	= 4,
 	.sub_rev_shift	= 0,
 };
 
 static const struct exynos_chipid_variant exynos850_chipid_drv_data = {
-	.rev_reg	= 0x10,
+	.main_rev_reg	= 0x10,
+	.sub_rev_reg	= 0x10,
 	.main_rev_shift	= 20,
 	.sub_rev_shift	= 16,
 };
 
+static const struct exynos_chipid_variant gs101_chipid_drv_data = {
+	.sub_rev_reg	= 0x10,
+	.sub_rev_shift	= 16,
+	.efuse = true,
+};
+
 static const struct of_device_id exynos_chipid_of_device_ids[] = {
 	{
+		.compatible	= "google,gs101-otp",
+		.data		= &gs101_chipid_drv_data,
+	}, {
 		.compatible	= "samsung,exynos4210-chipid",
 		.data		= &exynos4210_chipid_drv_data,
 	}, {

-- 
2.52.0.rc1.455.g30608eb744-goog



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

* [PATCH v3 6/6] arm64: dts: exynos: gs101: add OTP node
  2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (4 preceding siblings ...)
  2025-11-20 11:29 ` [PATCH v3 5/6] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
@ 2025-11-20 11:29 ` Tudor Ambarus
  2025-12-21 13:50 ` [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Krzysztof Kozlowski
  2025-12-21 13:52 ` (subset) " Krzysztof Kozlowski
  7 siblings, 0 replies; 15+ messages in thread
From: Tudor Ambarus @ 2025-11-20 11:29 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alim Akhtar,
	Peter Griffin, André Draszik, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel,
	Tudor Ambarus

Add the OTP controller node.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 arch/arm64/boot/dts/exynos/google/gs101.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/google/gs101.dtsi b/arch/arm64/boot/dts/exynos/google/gs101.dtsi
index d06d1d05f36408137a8acd98e43d48ea7d4f4292..4be983d4e291b3afe3530fbea0163f70c1a74671 100644
--- a/arch/arm64/boot/dts/exynos/google/gs101.dtsi
+++ b/arch/arm64/boot/dts/exynos/google/gs101.dtsi
@@ -571,6 +571,13 @@ soc: soc@0 {
 		#size-cells = <1>;
 		ranges = <0x0 0x0 0x0 0x40000000>;
 
+		efuse@10000000 {
+			compatible = "google,gs101-otp";
+			reg = <0x10000000 0xf084>;
+			clocks = <&cmu_misc CLK_GOUT_MISC_OTP_CON_TOP_PCLK>;
+			interrupts = <GIC_SPI 752 IRQ_TYPE_LEVEL_HIGH 0>;
+		};
+
 		cmu_misc: clock-controller@10010000 {
 			compatible = "google,gs101-cmu-misc";
 			reg = <0x10010000 0x10000>;

-- 
2.52.0.rc1.455.g30608eb744-goog



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

* Re: [PATCH v3 1/6] soc: samsung: exynos-chipid: use devm action to unregister soc device
  2025-11-20 11:29 ` [PATCH v3 1/6] soc: samsung: exynos-chipid: use devm action to unregister soc device Tudor Ambarus
@ 2025-12-19 14:53   ` André Draszik
  0 siblings, 0 replies; 15+ messages in thread
From: André Draszik @ 2025-12-19 14:53 UTC (permalink / raw)
  To: Tudor Ambarus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Alim Akhtar, Peter Griffin, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel

On Thu, 2025-11-20 at 11:29 +0000, Tudor Ambarus wrote:
> Simplify the unwinding of the soc device by using a devm action.
> Add the action before the exynos_asv_init() to avoid an explicit call
> to soc_device_unregister().
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
>  drivers/soc/samsung/exynos-chipid.c | 28 ++++++++++++----------------
>  1 file changed, 12 insertions(+), 16 deletions(-)

Reviewed-by: André Draszik <andre.draszik@linaro.org>


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

* Re: [PATCH v3 2/6] soc: samsung: exynos-chipid: use dev_err_probe where appropiate
  2025-11-20 11:29 ` [PATCH v3 2/6] soc: samsung: exynos-chipid: use dev_err_probe where appropiate Tudor Ambarus
@ 2025-12-19 14:57   ` André Draszik
  0 siblings, 0 replies; 15+ messages in thread
From: André Draszik @ 2025-12-19 14:57 UTC (permalink / raw)
  To: Tudor Ambarus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Alim Akhtar, Peter Griffin, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel

On Thu, 2025-11-20 at 11:29 +0000, Tudor Ambarus wrote:
> Use dev_err_probe() to benefit of the standardized format of the error
> code (e.g. "ENODEV" instead of -19), to get meanigful error messages, and
> for more compact error paths.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
>  drivers/soc/samsung/exynos-chipid.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)

Reviewed-by: André Draszik <andre.draszik@linaro.org>


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

* Re: [PATCH v3 4/6] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info
  2025-11-20 11:29 ` [PATCH v3 4/6] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
@ 2025-12-19 14:58   ` André Draszik
  0 siblings, 0 replies; 15+ messages in thread
From: André Draszik @ 2025-12-19 14:58 UTC (permalink / raw)
  To: Tudor Ambarus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Alim Akhtar, Peter Griffin, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel

On Thu, 2025-11-20 at 11:29 +0000, Tudor Ambarus wrote:
> The SoC information is exposed to userspace using the standard soc
> interface. Downgrade to dev_dbg to stop polluting the console log.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
>  drivers/soc/samsung/exynos-chipid.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: André Draszik <andre.draszik@linaro.org>


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

* Re: [PATCH v3 5/6] soc: samsung: exynos-chipid: add google,gs101-otp support
  2025-11-20 11:29 ` [PATCH v3 5/6] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
@ 2025-12-19 15:10   ` André Draszik
  2025-12-22 14:12     ` Tudor Ambarus
  0 siblings, 1 reply; 15+ messages in thread
From: André Draszik @ 2025-12-19 15:10 UTC (permalink / raw)
  To: Tudor Ambarus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Alim Akhtar, Peter Griffin, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel

On Thu, 2025-11-20 at 11:29 +0000, Tudor Ambarus wrote:
> GS101 is different (but also e850 and autov9 I assume) from the SoCs
> that are currently handled by the exynos-chipid driver because the
> chip ID info is part of the OTP registers. GS101 OTP has a clock, an
> interrupt line, a register space (that contains product and chip ID,
> TMU data, ASV, etc) and a 32Kbit memory space that can be
> read/program/locked with specific commands. On GS101 the "ChipID block"
> is just an abstraction, it's not a physical device. When the power-on
> sequence progresses, the OTP chipid values are loaded to the OTP
> registers.
> 
> Add the GS101 chip ID support. The support is intentionally added in the
> exynos-chipid driver, and not in a dedicated Exynos OTP driver, because
> we estimate that there will not be any OTP consumers in the kernel other
> than the chip ID/SoC interface. The downstream GS101 drivers confirm
> this supposition.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
>  drivers/soc/samsung/exynos-chipid.c | 87 ++++++++++++++++++++++++++++++++-----
>  1 file changed, 75 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
> index 5c8660374269c87ec38ebca242918bd7b1d362e5..06eb6ef8740d3f58eda52c8e71cf40074d2deb1f 100644
> --- a/drivers/soc/samsung/exynos-chipid.c
> +++ b/drivers/soc/samsung/exynos-chipid.c
> @@ -13,9 +13,11 @@
>   */
>  
>  #include <linux/array_size.h>
> +#include <linux/clk.h>
>  #include <linux/device.h>
>  #include <linux/device/devres.h>
> -#include <linux/errno.h>
> +#include <linux/err.h>
> +#include <linux/ioport.h>
>  #include <linux/mfd/syscon.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> @@ -28,9 +30,11 @@
>  #include "exynos-asv.h"
>  
>  struct exynos_chipid_variant {
> -	unsigned int rev_reg;		/* revision register offset */
> +	unsigned int main_rev_reg;	/* main revision register offset */
> +	unsigned int sub_rev_reg;	/* sub revision register offset */
>  	unsigned int main_rev_shift;	/* main revision offset in rev_reg */
>  	unsigned int sub_rev_shift;	/* sub revision offset in rev_reg */
> +	bool efuse;
>  };
>  
>  struct exynos_chipid_info {
> @@ -69,6 +73,8 @@ static const struct exynos_soc_id {
>  	{ "EXYNOS990", 0xE9830000 },
>  	{ "EXYNOSAUTOV9", 0xAAA80000 },
>  	{ "EXYNOSAUTOV920", 0x0A920000 },
> +	/* Compatible with: google,gs101-otp */
> +	{ "GS101", 0x9845000 },
>  };
>  
>  static const char *exynos_product_id_to_name(unsigned int product_id)
> @@ -93,19 +99,53 @@ static int exynos_chipid_get_chipid_info(struct device *dev,
>  		return dev_err_probe(dev, ret, "failed to read Product ID\n");
>  	soc_info->product_id = val & EXYNOS_MASK;
>  
> -	if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) {
> -		ret = regmap_read(regmap, data->rev_reg, &val);
> +	if (data->sub_rev_reg == EXYNOS_CHIPID_REG_PRO_ID) {
> +		/* exynos4210 case */
> +		main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
> +		sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
> +	} else {
> +		unsigned int val2;
> +
> +		ret = regmap_read(regmap, data->sub_rev_reg, &val2);
>  		if (ret < 0)
>  			return dev_err_probe(dev, ret,
>  					     "failed to read revision\n");
> +
> +		if (data->main_rev_reg == EXYNOS_CHIPID_REG_PRO_ID)
> +			/* gs101 case */
> +			main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
> +		else
> +			/* exynos850 case */
> +			main_rev = (val2 >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
> +
> +		sub_rev = (val2 >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;

The above looks a little fragile, comparing register offsets between different
hardware platforms and macros, but I guess it works for now and isn't really
much different to before.

>  	}
> -	main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
> -	sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
> +
>  	soc_info->revision = (main_rev << EXYNOS_REV_PART_SHIFT) | sub_rev;
>  
>  	return 0;
>  }
>  
> +static struct regmap *exynos_chipid_get_efuse_regmap(struct platform_device *pdev)
> +{
> +	struct resource *res;
> +	void __iomem *base;
> +
> +	base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> +	if (IS_ERR(base))
> +		return ERR_CAST(base);
> +
> +	const struct regmap_config reg_config = {
> +		.reg_bits = 32,
> +		.reg_stride = 4,
> +		.val_bits = 32,
> +		.use_relaxed_mmio = true,
> +		.max_register = (resource_size(res) - reg_config.reg_stride),
> +	};
> +
> +	return devm_regmap_init_mmio(&pdev->dev, base, &reg_config);
> +}
> +
>  static void exynos_chipid_unregister_soc(void *data)
>  {
>  	soc_device_unregister(data);
> @@ -127,10 +167,24 @@ static int exynos_chipid_probe(struct platform_device *pdev)
>  		return dev_err_probe(dev, -EINVAL,
>  				     "failed to get match data\n");
>  
> -	regmap = device_node_to_regmap(dev->of_node);
> -	if (IS_ERR(regmap))
> -		return dev_err_probe(dev, PTR_ERR(regmap),
> -				     "failed to get regmap\n");
> +	if (drv_data->efuse) {
> +		struct clk *clk;
> +
> +		regmap = exynos_chipid_get_efuse_regmap(pdev);
> +		if (IS_ERR(regmap))
> +			return dev_err_probe(dev, PTR_ERR(regmap),
> +					     "failed to get efuse regmap\n");
> +
> +		clk = devm_clk_get_enabled(dev, NULL);
> +		if (IS_ERR(clk))
> +			return dev_err_probe(dev, PTR_ERR(clk),
> +					     "failed to get clock\n");

Could you use devm_regmap_init_mmio_clk() instead?

Cheers,
Andre'

> +	} else {
> +		regmap = device_node_to_regmap(dev->of_node);
> +		if (IS_ERR(regmap))
> +			return dev_err_probe(dev, PTR_ERR(regmap),
> +					     "failed to get regmap\n");
> +	}
>  
>  	ret = exynos_chipid_get_chipid_info(dev, regmap, drv_data, &soc_info);
>  	if (ret < 0)
> @@ -177,19 +231,28 @@ static int exynos_chipid_probe(struct platform_device *pdev)
>  }
>  
>  static const struct exynos_chipid_variant exynos4210_chipid_drv_data = {
> -	.rev_reg	= 0x0,
>  	.main_rev_shift	= 4,
>  	.sub_rev_shift	= 0,
>  };
>  
>  static const struct exynos_chipid_variant exynos850_chipid_drv_data = {
> -	.rev_reg	= 0x10,
> +	.main_rev_reg	= 0x10,
> +	.sub_rev_reg	= 0x10,
>  	.main_rev_shift	= 20,
>  	.sub_rev_shift	= 16,
>  };
>  
> +static const struct exynos_chipid_variant gs101_chipid_drv_data = {
> +	.sub_rev_reg	= 0x10,
> +	.sub_rev_shift	= 16,
> +	.efuse = true,
> +};
> +
>  static const struct of_device_id exynos_chipid_of_device_ids[] = {
>  	{
> +		.compatible	= "google,gs101-otp",
> +		.data		= &gs101_chipid_drv_data,
> +	}, {
>  		.compatible	= "samsung,exynos4210-chipid",
>  		.data		= &exynos4210_chipid_drv_data,
>  	}, {


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

* Re: [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support
  2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (5 preceding siblings ...)
  2025-11-20 11:29 ` [PATCH v3 6/6] arm64: dts: exynos: gs101: add OTP node Tudor Ambarus
@ 2025-12-21 13:50 ` Krzysztof Kozlowski
  2025-12-21 13:52 ` (subset) " Krzysztof Kozlowski
  7 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-21 13:50 UTC (permalink / raw)
  To: Tudor Ambarus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Alim Akhtar, Peter Griffin, André Draszik,
	Srinivas Kandagatla
  Cc: semen.protsenko, willmcvicker, kernel-team, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-kernel

On 20/11/2025 12:29, Tudor Ambarus wrote:
> Dependency
> ==========
> Typical dependency of the DT patch depending on the bindings patch,
> thus the bindings patch could go via the Samsung SoC tree with
> Srinivas's ack.
> 
> Description
> ===========
> GS101 is different (but also e850 and autov9 I assume) from the SoCs
> that are currently handled by the exynos-chipid driver because the
> chip ID info is part of the OTP registers. GS101 OTP has a clock, an
> interrupt line, a register space (that contains product and chip ID,
> TMU data, ASV, etc) and a 32Kbit memory space that can be
> read/program/locked with specific commands. On GS101 the "ChipID block"
> is just an abstraction, it's not a physical device. When the power-on
> sequence progresses, the OTP chipid values are loaded to the OTP
> registers.
> 
> Add the GS101 chip ID support. The support is intentionally added in the
> exynos-chipid driver, and not in a dedicated Exynos OTP driver, because
> we estimate that there will not be any OTP consumers in the kernel other
> than the chip ID/SoC interface. The downstream GS101 drivers confirm
> this supposition.
> 

Patches look fine to me, I took already two, but the rest please send
new version after implementing Andre's feedback (thanks for review!).

Best regards,
Krzysztof


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

* Re: (subset) [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support
  2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (6 preceding siblings ...)
  2025-12-21 13:50 ` [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Krzysztof Kozlowski
@ 2025-12-21 13:52 ` Krzysztof Kozlowski
  7 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-21 13:52 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Alim Akhtar,
	Peter Griffin, André Draszik, Srinivas Kandagatla,
	Tudor Ambarus
  Cc: semen.protsenko, willmcvicker, kernel-team, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-kernel


On Thu, 20 Nov 2025 11:29:34 +0000, Tudor Ambarus wrote:
> Dependency
> ==========
> Typical dependency of the DT patch depending on the bindings patch,
> thus the bindings patch could go via the Samsung SoC tree with
> Srinivas's ack.
> 
> Description
> ===========
> GS101 is different (but also e850 and autov9 I assume) from the SoCs
> that are currently handled by the exynos-chipid driver because the
> chip ID info is part of the OTP registers. GS101 OTP has a clock, an
> interrupt line, a register space (that contains product and chip ID,
> TMU data, ASV, etc) and a 32Kbit memory space that can be
> read/program/locked with specific commands. On GS101 the "ChipID block"
> is just an abstraction, it's not a physical device. When the power-on
> sequence progresses, the OTP chipid values are loaded to the OTP
> registers.
> 
> [...]

Applied, thanks!

[1/6] soc: samsung: exynos-chipid: use devm action to unregister soc device
      https://git.kernel.org/krzk/linux/c/1b3376d2167766e9f5ac05a03ca4625777090ce7
[2/6] soc: samsung: exynos-chipid: use dev_err_probe where appropiate
      https://git.kernel.org/krzk/linux/c/8dfbb5fcb773a6481407ec890280cc3b1ff8e234

Best regards,
-- 
Krzysztof Kozlowski <krzk@kernel.org>



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

* Re: [PATCH v3 5/6] soc: samsung: exynos-chipid: add google,gs101-otp support
  2025-12-19 15:10   ` André Draszik
@ 2025-12-22 14:12     ` Tudor Ambarus
  2025-12-22 14:39       ` André Draszik
  0 siblings, 1 reply; 15+ messages in thread
From: Tudor Ambarus @ 2025-12-22 14:12 UTC (permalink / raw)
  To: André Draszik, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Alim Akhtar, Peter Griffin, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel

Hi!

On 12/19/25 5:10 PM, André Draszik wrote:

cut

>>  static const char *exynos_product_id_to_name(unsigned int product_id)
>> @@ -93,19 +99,53 @@ static int exynos_chipid_get_chipid_info(struct device *dev,
>>  		return dev_err_probe(dev, ret, "failed to read Product ID\n");
>>  	soc_info->product_id = val & EXYNOS_MASK;
>>  
>> -	if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) {
>> -		ret = regmap_read(regmap, data->rev_reg, &val);
>> +	if (data->sub_rev_reg == EXYNOS_CHIPID_REG_PRO_ID) {
>> +		/* exynos4210 case */
>> +		main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
>> +		sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
>> +	} else {
>> +		unsigned int val2;
>> +
>> +		ret = regmap_read(regmap, data->sub_rev_reg, &val2);
>>  		if (ret < 0)
>>  			return dev_err_probe(dev, ret,
>>  					     "failed to read revision\n");
>> +
>> +		if (data->main_rev_reg == EXYNOS_CHIPID_REG_PRO_ID)
>> +			/* gs101 case */
>> +			main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
>> +		else
>> +			/* exynos850 case */
>> +			main_rev = (val2 >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
>> +
>> +		sub_rev = (val2 >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
> 
> The above looks a little fragile, comparing register offsets between different
> hardware platforms and macros, but I guess it works for now and isn't really
> much different to before.

Right, I thought we'll get this in faster if I keep the old style.

I can introduce a drv_data->get_chipid_info() method and add methods for exynos4210
and exynos850 before adding the g101 support. It duplicated a bit the code when I
tried it, and I chose to keep it as it is now. Happy to switch to a drv data method
if you prefer, just say.

cut

>> @@ -127,10 +167,24 @@ static int exynos_chipid_probe(struct platform_device *pdev)
>>  		return dev_err_probe(dev, -EINVAL,
>>  				     "failed to get match data\n");
>>  
>> -	regmap = device_node_to_regmap(dev->of_node);
>> -	if (IS_ERR(regmap))
>> -		return dev_err_probe(dev, PTR_ERR(regmap),
>> -				     "failed to get regmap\n");
>> +	if (drv_data->efuse) {
>> +		struct clk *clk;
>> +
>> +		regmap = exynos_chipid_get_efuse_regmap(pdev);
>> +		if (IS_ERR(regmap))
>> +			return dev_err_probe(dev, PTR_ERR(regmap),
>> +					     "failed to get efuse regmap\n");
>> +
>> +		clk = devm_clk_get_enabled(dev, NULL);
>> +		if (IS_ERR(clk))
>> +			return dev_err_probe(dev, PTR_ERR(clk),
>> +					     "failed to get clock\n");
> 
> Could you use devm_regmap_init_mmio_clk() instead?

Will do, thanks! I'll need to introduce a clock-names property in the bindings.

Cheers,
ta


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

* Re: [PATCH v3 5/6] soc: samsung: exynos-chipid: add google,gs101-otp support
  2025-12-22 14:12     ` Tudor Ambarus
@ 2025-12-22 14:39       ` André Draszik
  0 siblings, 0 replies; 15+ messages in thread
From: André Draszik @ 2025-12-22 14:39 UTC (permalink / raw)
  To: Tudor Ambarus, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Alim Akhtar, Peter Griffin, Srinivas Kandagatla
  Cc: Krzysztof Kozlowski, semen.protsenko, willmcvicker, kernel-team,
	devicetree, linux-arm-kernel, linux-samsung-soc, linux-kernel

Hi Tudor,

On Mon, 2025-12-22 at 16:12 +0200, Tudor Ambarus wrote:
> Hi!
> 
> On 12/19/25 5:10 PM, André Draszik wrote:
> 
> cut
> 
> > >  static const char *exynos_product_id_to_name(unsigned int product_id)
> > > @@ -93,19 +99,53 @@ static int exynos_chipid_get_chipid_info(struct device *dev,
> > >  		return dev_err_probe(dev, ret, "failed to read Product ID\n");
> > >  	soc_info->product_id = val & EXYNOS_MASK;
> > >  
> > > -	if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) {
> > > -		ret = regmap_read(regmap, data->rev_reg, &val);
> > > +	if (data->sub_rev_reg == EXYNOS_CHIPID_REG_PRO_ID) {
> > > +		/* exynos4210 case */
> > > +		main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
> > > +		sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
> > > +	} else {
> > > +		unsigned int val2;
> > > +
> > > +		ret = regmap_read(regmap, data->sub_rev_reg, &val2);
> > >  		if (ret < 0)
> > >  			return dev_err_probe(dev, ret,
> > >  					     "failed to read revision\n");
> > > +
> > > +		if (data->main_rev_reg == EXYNOS_CHIPID_REG_PRO_ID)
> > > +			/* gs101 case */
> > > +			main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
> > > +		else
> > > +			/* exynos850 case */
> > > +			main_rev = (val2 >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
> > > +
> > > +		sub_rev = (val2 >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
> > 
> > The above looks a little fragile, comparing register offsets between different
> > hardware platforms and macros, but I guess it works for now and isn't really
> > much different to before.
> 
> Right, I thought we'll get this in faster if I keep the old style.
> 
> I can introduce a drv_data->get_chipid_info() method and add methods for exynos4210
> and exynos850 before adding the g101 support. It duplicated a bit the code when I
> tried it, and I chose to keep it as it is now. Happy to switch to a drv data method
> if you prefer, just say.

The above was simply an observation, and as mentioned it's not really worse than
before, therefore OK to leave from my pov.


Cheers,
A.


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

end of thread, other threads:[~2025-12-22 14:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-20 11:29 [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
2025-11-20 11:29 ` [PATCH v3 1/6] soc: samsung: exynos-chipid: use devm action to unregister soc device Tudor Ambarus
2025-12-19 14:53   ` André Draszik
2025-11-20 11:29 ` [PATCH v3 2/6] soc: samsung: exynos-chipid: use dev_err_probe where appropiate Tudor Ambarus
2025-12-19 14:57   ` André Draszik
2025-11-20 11:29 ` [PATCH v3 3/6] soc: samsung: exynos-chipid: rename method Tudor Ambarus
2025-11-20 11:29 ` [PATCH v3 4/6] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
2025-12-19 14:58   ` André Draszik
2025-11-20 11:29 ` [PATCH v3 5/6] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
2025-12-19 15:10   ` André Draszik
2025-12-22 14:12     ` Tudor Ambarus
2025-12-22 14:39       ` André Draszik
2025-11-20 11:29 ` [PATCH v3 6/6] arm64: dts: exynos: gs101: add OTP node Tudor Ambarus
2025-12-21 13:50 ` [PATCH v3 0/6] soc: samsung: exynos-chipid: add gs101 support Krzysztof Kozlowski
2025-12-21 13:52 ` (subset) " Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.