mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support
@ 2025-12-22 16:30 Tudor Ambarus
  2025-12-22 16:30 ` [PATCH v4 1/5] dt-bindings: nvmem: add google,gs101-otp Tudor Ambarus
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Tudor Ambarus @ 2025-12-22 16:30 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, Krzysztof Kozlowski

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 v4:
- bindings were not sent in v3, human error. Add them back. Compared to
  v2, add clock-names property as it's needed for
  devm_regmap_init_mmio_clk()
- driver: use devm_regmap_init_mmio_clk() to deal with clock aquisition
  and enable/disable as needed.
- dt: add clock-names prop
- Rebase and collect R-b tags
- Link to v3: https://lore.kernel.org/r/20251120-gs101-chipid-v3-0-1aeaa8b7fe35@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 (5):
      dt-bindings: nvmem: add google,gs101-otp
      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

 .../bindings/nvmem/google,gs101-otp.yaml           | 61 +++++++++++++++++
 arch/arm64/boot/dts/exynos/google/gs101.dtsi       |  8 +++
 drivers/soc/samsung/exynos-chipid.c                | 79 ++++++++++++++++++----
 3 files changed, 135 insertions(+), 13 deletions(-)
---
base-commit: 0825f376d02e58e8ee4179569e0a386e1cd0eb76
change-id: 20251031-gs101-chipid-fd84da8afa2f

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


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

* [PATCH v4 1/5] dt-bindings: nvmem: add google,gs101-otp
  2025-12-22 16:30 [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
@ 2025-12-22 16:30 ` Tudor Ambarus
  2025-12-22 16:30 ` [PATCH v4 2/5] soc: samsung: exynos-chipid: rename method Tudor Ambarus
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Tudor Ambarus @ 2025-12-22 16:30 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, Krzysztof Kozlowski

Add binding for the OTP controller found on Google GS101.

Reviewed-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 .../bindings/nvmem/google,gs101-otp.yaml           | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/Documentation/devicetree/bindings/nvmem/google,gs101-otp.yaml b/Documentation/devicetree/bindings/nvmem/google,gs101-otp.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..99e322c72f9ee1766f3393e604991364c41456fe
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/google,gs101-otp.yaml
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/google,gs101-otp.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Google GS101 OTP Controller
+
+maintainers:
+  - Tudor Ambarus <tudor.ambarus@linaro.org>
+
+description: |
+  OTP controller drives a NVMEM memory where system or user specific data
+  can be stored. The OTP controller register space is of interest as well
+  because it contains dedicated registers where it stores the Product ID
+  and the Chip ID (apart other things like TMU or ASV info).
+
+allOf:
+  - $ref: nvmem.yaml#
+
+properties:
+  compatible:
+    items:
+      - const: google,gs101-otp
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: pclk
+
+  interrupts:
+    maxItems: 1
+
+  reg:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/google,gs101.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    efuse@10000000 {
+        compatible = "google,gs101-otp";
+        reg = <0x10000000 0xf084>;
+        clocks = <&cmu_misc CLK_GOUT_MISC_OTP_CON_TOP_PCLK>;
+        clock-names = "pclk";
+        interrupts = <GIC_SPI 752 IRQ_TYPE_LEVEL_HIGH>;
+    };

-- 
2.52.0.322.g1dd061c0dc-goog


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

* [PATCH v4 2/5] soc: samsung: exynos-chipid: rename method
  2025-12-22 16:30 [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
  2025-12-22 16:30 ` [PATCH v4 1/5] dt-bindings: nvmem: add google,gs101-otp Tudor Ambarus
@ 2025-12-22 16:30 ` Tudor Ambarus
  2025-12-23  9:55   ` André Draszik
  2025-12-22 16:30 ` [PATCH v4 3/5] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Tudor Ambarus @ 2025-12-22 16:30 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.322.g1dd061c0dc-goog


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

* [PATCH v4 3/5] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info
  2025-12-22 16:30 [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
  2025-12-22 16:30 ` [PATCH v4 1/5] dt-bindings: nvmem: add google,gs101-otp Tudor Ambarus
  2025-12-22 16:30 ` [PATCH v4 2/5] soc: samsung: exynos-chipid: rename method Tudor Ambarus
@ 2025-12-22 16:30 ` Tudor Ambarus
  2025-12-22 16:30 ` [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Tudor Ambarus @ 2025-12-22 16:30 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>
Reviewed-by: André Draszik <andre.draszik@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.322.g1dd061c0dc-goog


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

* [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support
  2025-12-22 16:30 [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (2 preceding siblings ...)
  2025-12-22 16:30 ` [PATCH v4 3/5] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
@ 2025-12-22 16:30 ` Tudor Ambarus
  2025-12-23  9:56   ` André Draszik
  2025-12-23 10:18   ` André Draszik
  2025-12-22 16:30 ` [PATCH v4 5/5] arm64: dts: exynos: gs101: add OTP node Tudor Ambarus
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 14+ messages in thread
From: Tudor Ambarus @ 2025-12-22 16:30 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 | 70 ++++++++++++++++++++++++++++++++-----
 1 file changed, 61 insertions(+), 9 deletions(-)

diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 5c8660374269c87ec38ebca242918bd7b1d362e5..6ef9751e2509c94bd9625072d0b81ddb93048d4a 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -15,7 +15,8 @@
 #include <linux/array_size.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 +29,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 +72,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 +98,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_clk(&pdev->dev, "pclk", base, &reg_config);
+}
+
 static void exynos_chipid_unregister_soc(void *data)
 {
 	soc_device_unregister(data);
@@ -127,7 +166,11 @@ 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 (drv_data->efuse)
+		regmap = exynos_chipid_get_efuse_regmap(pdev);
+	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");
@@ -177,19 +220,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.322.g1dd061c0dc-goog


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

* [PATCH v4 5/5] arm64: dts: exynos: gs101: add OTP node
  2025-12-22 16:30 [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (3 preceding siblings ...)
  2025-12-22 16:30 ` [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
@ 2025-12-22 16:30 ` Tudor Ambarus
  2025-12-23 10:01   ` André Draszik
  2025-12-28 11:32 ` (subset) [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Krzysztof Kozlowski
  2025-12-28 11:33 ` Krzysztof Kozlowski
  6 siblings, 1 reply; 14+ messages in thread
From: Tudor Ambarus @ 2025-12-22 16:30 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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/google/gs101.dtsi b/arch/arm64/boot/dts/exynos/google/gs101.dtsi
index 9b38c2248016aa65293c0abf9ccaf20857d89693..e078344c9e3e558aa5d58845d0fa2849832b857b 100644
--- a/arch/arm64/boot/dts/exynos/google/gs101.dtsi
+++ b/arch/arm64/boot/dts/exynos/google/gs101.dtsi
@@ -571,6 +571,14 @@ 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>;
+			clock-names = "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.322.g1dd061c0dc-goog


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

* Re: [PATCH v4 2/5] soc: samsung: exynos-chipid: rename method
  2025-12-22 16:30 ` [PATCH v4 2/5] soc: samsung: exynos-chipid: rename method Tudor Ambarus
@ 2025-12-23  9:55   ` André Draszik
  2025-12-23 10:14     ` Tudor Ambarus
  0 siblings, 1 reply; 14+ messages in thread
From: André Draszik @ 2025-12-23  9:55 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 Mon, 2025-12-22 at 16:30 +0000, Tudor Ambarus wrote:
> 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(-)

I'm not sure this change helps with anything, in particular as the
return value is used to assign to soc_id, but in case it gets applied:

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

> 
> 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");
>  

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

* Re: [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support
  2025-12-22 16:30 ` [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
@ 2025-12-23  9:56   ` André Draszik
  2025-12-23 10:18   ` André Draszik
  1 sibling, 0 replies; 14+ messages in thread
From: André Draszik @ 2025-12-23  9:56 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 Mon, 2025-12-22 at 16:30 +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 | 70 ++++++++++++++++++++++++++++++++-----
>  1 file changed, 61 insertions(+), 9 deletions(-)

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

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

* Re: [PATCH v4 5/5] arm64: dts: exynos: gs101: add OTP node
  2025-12-22 16:30 ` [PATCH v4 5/5] arm64: dts: exynos: gs101: add OTP node Tudor Ambarus
@ 2025-12-23 10:01   ` André Draszik
  0 siblings, 0 replies; 14+ messages in thread
From: André Draszik @ 2025-12-23 10:01 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 Mon, 2025-12-22 at 16:30 +0000, Tudor Ambarus wrote:
> Add the OTP controller node.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
>  arch/arm64/boot/dts/exynos/google/gs101.dtsi | 8 ++++++++
>  1 file changed, 8 insertions(+)

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

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

* Re: [PATCH v4 2/5] soc: samsung: exynos-chipid: rename method
  2025-12-23  9:55   ` André Draszik
@ 2025-12-23 10:14     ` Tudor Ambarus
  0 siblings, 0 replies; 14+ messages in thread
From: Tudor Ambarus @ 2025-12-23 10:14 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



On 12/23/25 11:55 AM, André Draszik wrote:
> On Mon, 2025-12-22 at 16:30 +0000, Tudor Ambarus wrote:
>> 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(-)
> 
> I'm not sure this change helps with anything, in particular as the
> return value is used to assign to soc_id, but in case it gets applied:

what drove me to do the rename, and prepend exynos_ to the method name,
was that IP specific drivers should not use generic names for methods ->
those shall be left for the core.

Now about the s/soc_id/name, you're right, I could kept soc_id to align
with the soc interface. Happy to resend for this if you think it is worth
it, or drop altogether.
> 
> Reviewed-by: André Draszik <andre.draszik@linaro.org>

Cheers,
ta

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

* Re: [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support
  2025-12-22 16:30 ` [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
  2025-12-23  9:56   ` André Draszik
@ 2025-12-23 10:18   ` André Draszik
  2025-12-23 11:23     ` André Draszik
  1 sibling, 1 reply; 14+ messages in thread
From: André Draszik @ 2025-12-23 10:18 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 Mon, 2025-12-22 at 16:30 +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 | 70 ++++++++++++++++++++++++++++++++-----
>  1 file changed, 61 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
> index 5c8660374269c87ec38ebca242918bd7b1d362e5..6ef9751e2509c94bd9625072d0b81ddb93048d4a 100644
> --- a/drivers/soc/samsung/exynos-chipid.c
> +++ b/drivers/soc/samsung/exynos-chipid.c
> @@ -15,7 +15,8 @@
>  #include <linux/array_size.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 +29,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 +72,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 +98,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;

Looking closer, why is this not val? Now you're shifting the sub_rev
register value by the main rev shift, assigning the sub_rev register
value to the main rev variable.

And then, all assignments to main_rev become identical and don't need to
be duplicated.

> +
> +		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;
>  }


Cheers,
Andre'

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

* Re: [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support
  2025-12-23 10:18   ` André Draszik
@ 2025-12-23 11:23     ` André Draszik
  0 siblings, 0 replies; 14+ messages in thread
From: André Draszik @ 2025-12-23 11:23 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 Tue, 2025-12-23 at 10:18 +0000, André Draszik wrote:
> Looking closer, why is this not val? Now you're shifting the sub_rev
> register value by the main rev shift, assigning the sub_rev register
> value to the main rev variable.
> 
> And then, all assignments to main_rev become identical and don't need to
> be duplicated.

Anyway, it does work for the SoCs supported, my RB still applies. Code can be
updated in the future if the need arises.

Cheers,
Andre'

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

* Re: (subset) [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support
  2025-12-22 16:30 [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (4 preceding siblings ...)
  2025-12-22 16:30 ` [PATCH v4 5/5] arm64: dts: exynos: gs101: add OTP node Tudor Ambarus
@ 2025-12-28 11:32 ` Krzysztof Kozlowski
  2025-12-28 11:33 ` Krzysztof Kozlowski
  6 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-28 11:32 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 Mon, 22 Dec 2025 16:30:04 +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/5] dt-bindings: nvmem: add google,gs101-otp
      https://git.kernel.org/krzk/linux/c/12da6f08a07ddaddd336af878350d30449d23a54
[2/5] soc: samsung: exynos-chipid: rename method
      https://git.kernel.org/krzk/linux/c/9133ae2119cb3c948675dc566eebf11cc4bb1681
[3/5] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info
      https://git.kernel.org/krzk/linux/c/c38cfc303db9ab4d5f482ae8e36e5a677db8eee6
[4/5] soc: samsung: exynos-chipid: add google,gs101-otp support
      https://git.kernel.org/krzk/linux/c/732af51910960535382db3f6e0b33e2e2b0ff7b6

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


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

* Re: (subset) [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support
  2025-12-22 16:30 [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
                   ` (5 preceding siblings ...)
  2025-12-28 11:32 ` (subset) [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Krzysztof Kozlowski
@ 2025-12-28 11:33 ` Krzysztof Kozlowski
  6 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-28 11:33 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 Mon, 22 Dec 2025 16:30:04 +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!

[5/5] arm64: dts: exynos: gs101: add OTP node
      https://git.kernel.org/krzk/linux/c/9afdf3e1a59e23180540ecb1fe3287c308cc8113

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


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

end of thread, other threads:[~2025-12-28 11:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-22 16:30 [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Tudor Ambarus
2025-12-22 16:30 ` [PATCH v4 1/5] dt-bindings: nvmem: add google,gs101-otp Tudor Ambarus
2025-12-22 16:30 ` [PATCH v4 2/5] soc: samsung: exynos-chipid: rename method Tudor Ambarus
2025-12-23  9:55   ` André Draszik
2025-12-23 10:14     ` Tudor Ambarus
2025-12-22 16:30 ` [PATCH v4 3/5] soc: samsung: exynos-chipid: downgrade dev_info to dev_dbg for soc info Tudor Ambarus
2025-12-22 16:30 ` [PATCH v4 4/5] soc: samsung: exynos-chipid: add google,gs101-otp support Tudor Ambarus
2025-12-23  9:56   ` André Draszik
2025-12-23 10:18   ` André Draszik
2025-12-23 11:23     ` André Draszik
2025-12-22 16:30 ` [PATCH v4 5/5] arm64: dts: exynos: gs101: add OTP node Tudor Ambarus
2025-12-23 10:01   ` André Draszik
2025-12-28 11:32 ` (subset) [PATCH v4 0/5] soc: samsung: exynos-chipid: add gs101 support Krzysztof Kozlowski
2025-12-28 11:33 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®