Skip to contentSkip to conversation

Add AM62P silicon revision detection via NVMEM

PATCH Superseded Judith Mendez 2 participants 8 messages Feb 4 – Feb 6

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add AM62P silicon revision detection via NVMEM

This series adds support for detecting AM62P silicon revisions using the NVMEM framework to read the GP_SW1 register.

Background:
===========
On AM62P SoCs, the standard JTAGID register does not provide information on silicon revision, instead the GP_SW1 register contains the information needed for proper device identification.

Proper silicon revision detection is required to apply proper workarounds and quirks for different silicon revisions, particularly for MMCSD [0].

Implementation history:
=======================
An initial implementation [0] added a second register range directly to the chipid node to access GP_SW registers. Following upstream review feedback to split the patches appropriately, an alternative RFC approach
[1] was explored that introduced a new NVMEM eFuse binding specifically for TI K3 SoCs.

This final implementation takes a simpler approach by leveraging the existing NVMEM framework with optional nvmem-cells support. The k3-socinfo driver can now optionally consume silicon revision data from the NVMEM provider, making it more flexible and avoiding the need for either direct register access or new bindings.

Implementation details:
=======================
- NVMEM support is fully optional - the driver continues to work without it and falls back to SR1.0 for AM62P devices
- When NVMEM cells are present, the driver reads GP_SW1 to accurately detect SR1.1 and SR1.2 variants

[0] https://lore.kernel.org/linux-mmc/[email protected]/
[1] https://lore.kernel.org/all/[email protected]/

Judith Mendez (2):
dt-bindings: hwinfo: ti,k3-socinfo: Add nvmem-cells support
soc: ti: k3-socinfo: Add support for AM62P variants via NVMEM

 .../bindings/hwinfo/ti,k3-socinfo.yaml        | 12 +++++
 drivers/soc/ti/k3-socinfo.c                   | 48 +++++++++++++++++--
 2 files changed, 57 insertions(+), 3 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/2 dt-bindings: hwinfo: ti,k3-socinfo: Add nvmem-cells support

Add optional nvmem-cells and nvmem-cell-names properties to support reading silicon revision information from alternate location using NVMEM providers. This is used on AM62P to read GP_SW1 register for accurate silicon revision detection.

---
 .../devicetree/bindings/hwinfo/ti,k3-socinfo.yaml    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/hwinfo/ti,k3-socinfo.yaml +12 -0
index dada28b47ea07..58cc937e13351 100644
@@ -15,6 +15,9 @@ description: |
   represented by CTRLMMR_xxx_JTAGID register which contains information about
   SoC id and revision.
 
+  On some SoCs like AM62P, the silicon revision is determined by reading
+  alternative registers via NVMEM cells.
+
 properties:
   $nodename:
     pattern: "^chipid@[0-9a-f]+$"
@@ -26,6 +29,15 @@ properties:
   reg:
     maxItems: 1
 
+  nvmem-cells:
+    maxItems: 1
+    description:
+      Reference to NVMEM node containing revision information.
+
+  nvmem-cell-names:
+    items:
+      - const: gpsw1
+
 required:
   - compatible
   - reg
Signature · 1 line
2.52.0
#2 lore raw

PATCH 2/2 soc: ti: k3-socinfo: Add support for AM62P variants via NVMEM

In reply to Judith Mendez

Add support for detecting AM62P silicon revisions.

On AM62P, silicon revision is discovered with GP_SW1 register instead of JTAGID register. Use the NVMEM framework to read GP_SW1 from the gpsw-efuse nvmem provider to determine SoC revision.

---
 drivers/soc/ti/k3-socinfo.c | 48 ++++++++++++++++++++++++++++++++++---
 1 file changed, 45 insertions(+), 3 deletions(-)
drivers/soc/ti/k3-socinfo.c +45 -3
index 42275cb5ba1c8..4b6947a9ceb4d 100644
@@ -6,6 +6,7 @@
  */
 
 #include <linux/mfd/syscon.h>
+#include <linux/nvmem-consumer.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/regmap.h>
@@ -25,6 +26,9 @@
 #define CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT	(28)
 #define CTRLMMR_WKUP_JTAGID_VARIANT_MASK	GENMASK(31, 28)
 
+#define GP_SW1_VALID_BIT			BIT(4)
+#define GP_SW1_ADR_MASK			GENMASK(3, 0)
+
 #define CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT	(12)
 #define CTRLMMR_WKUP_JTAGID_PARTNO_MASK		GENMASK(27, 12)
 
@@ -70,6 +74,29 @@ static const char * const am62lx_rev_string_map[] = {
 	"1.0", "1.1",
 };
 
+static const char * const am62p_gpsw_rev_string_map[] = {
+	"1.0", "1.1", "1.2",
+};
+
+static int
+k3_chipinfo_get_gpsw_variant(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	u32 gpsw_val, adr_val = 0;
+	int ret;
+
+	ret = nvmem_cell_read_u32(dev, "gpsw1", &gpsw_val);
+	if (ret)
+		return ret;
+
+	if (!(gpsw_val & GP_SW1_VALID_BIT))
+		return 0;
+
+	adr_val = gpsw_val & GP_SW1_ADR_MASK;
+
+	return adr_val;
+}
+
 static int
 k3_chipinfo_partno_to_names(unsigned int partno,
 			    struct soc_device_attribute *soc_dev_attr)
@@ -86,9 +113,11 @@ k3_chipinfo_partno_to_names(unsigned int partno,
 }
 
 static int
-k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant,
-			  struct soc_device_attribute *soc_dev_attr)
+k3_chipinfo_variant_to_sr(struct platform_device *pdev, unsigned int partno,
+			  unsigned int variant, struct soc_device_attribute *soc_dev_attr)
 {
+	int gpsw_variant = 0;
+
 	switch (partno) {
 	case JTAG_ID_PARTNO_J721E:
 		if (variant >= ARRAY_SIZE(j721e_rev_string_map))
@@ -102,6 +131,19 @@ k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant,
 		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%s",
 						   am62lx_rev_string_map[variant]);
 		break;
+	case JTAG_ID_PARTNO_AM62PX:
+		/* Check GP_SW1 for silicon revision */
+		gpsw_variant = k3_chipinfo_get_gpsw_variant(pdev);
+		if (gpsw_variant == -EPROBE_DEFER)
+			return gpsw_variant;
+		if (gpsw_variant < 0 || gpsw_variant >= ARRAY_SIZE(am62p_gpsw_rev_string_map)) {
+			dev_warn(&pdev->dev, "Failed to get silicon variant (%d), set SR1.0\n",
+				 gpsw_variant);
+			gpsw_variant = 0;
+		}
+		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%s",
+						   am62p_gpsw_rev_string_map[gpsw_variant]);
+		break;
 	default:
 		variant++;
 		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%x.0",
@@ -173,7 +215,7 @@ static int k3_chipinfo_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	ret = k3_chipinfo_variant_to_sr(partno_id, variant, soc_dev_attr);
+	ret = k3_chipinfo_variant_to_sr(pdev, partno_id, variant, soc_dev_attr);
 	if (ret) {
 		dev_err(dev, "Unknown SoC SR[0x%08X]: %d\n", jtag_id, ret);
 		goto err;
Signature · 1 line
2.52.0
#3 lore raw

Re: [PATCH 2/2] soc: ti: k3-socinfo: Add support for AM62P variants via NVMEM

Quoted 44 lines · Judith Mendez

Add support for detecting AM62P silicon revisions.

On AM62P, silicon revision is discovered with GP_SW1 register instead of JTAGID register. Use the NVMEM framework to read GP_SW1 from the gpsw-efuse nvmem provider to determine SoC revision.

---
  drivers/soc/ti/k3-socinfo.c | 48 ++++++++++++++++++++++++++++++++++---
  1 file changed, 45 insertions(+), 3 deletions(-)
drivers/soc/ti/k3-socinfo.c +11 -0
index 42275cb5ba1c8..4b6947a9ceb4d 100644
@@ -6,6 +6,7 @@
   */
 
  #include <linux/mfd/syscon.h>
+#include <linux/nvmem-consumer.h>
  #include <linux/of.h>
  #include <linux/of_address.h>
  #include <linux/regmap.h>
@@ -25,6 +26,9 @@
  #define CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT	(28)
  #define CTRLMMR_WKUP_JTAGID_VARIANT_MASK	GENMASK(31, 28)
 
+#define GP_SW1_VALID_BIT			BIT(4)
+#define GP_SW1_ADR_MASK			GENMASK(3, 0)
+
  #define CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT	(12)
  #define CTRLMMR_WKUP_JTAGID_PARTNO_MASK		GENMASK(27, 12)
 
@@ -70,6 +74,29 @@ static const char * const am62lx_rev_string_map[] = {
  	"1.0", "1.1",
  };
 
+static const char * const am62p_gpsw_rev_string_map[] = {
+	"1.0", "1.1", "1.2",
+};
+
+static int
+k3_chipinfo_get_gpsw_variant(struct platform_device *pdev)
+{

drivers/soc/ti/k3-socinfo.c static const char * const am62lx_rev_string_map[] = { · line 93

Quoted 10 lines
drivers/soc/ti/k3-socinfo.c +10 -0
+	struct device *dev = &pdev->dev;
+	u32 gpsw_val, adr_val = 0;
+	int ret;
+
+	ret = nvmem_cell_read_u32(dev, "gpsw1", &gpsw_val);
+	if (ret)
+		return ret;
+
+	if (!(gpsw_val & GP_SW1_VALID_BIT))
+		return 0;

Return -1 here so you will get the warning message about setting default SR1.0.

drivers/soc/ti/k3-socinfo.c static const char * const am62lx_rev_string_map[] = { · line 97

Quoted 4 lines
drivers/soc/ti/k3-socinfo.c +4 -0
+
+	adr_val = gpsw_val & GP_SW1_ADR_MASK;
+
+	return adr_val;

Merge the above two lines,

return gpsw_val & GP_SW1_ADR_MASK;

Or maybe try using FIELD_GET() or similar if you are feeling fancy.

drivers/soc/ti/k3-socinfo.c k3_chipinfo_partno_to_names(unsigned int partno, · line 116

Quoted 12 lines
drivers/soc/ti/k3-socinfo.c +3 -2
+}
+
  static int
  k3_chipinfo_partno_to_names(unsigned int partno,
  			    struct soc_device_attribute *soc_dev_attr)
@@ -86,9 +113,11 @@ k3_chipinfo_partno_to_names(unsigned int partno,
  }
 
  static int
-k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant,
-			  struct soc_device_attribute *soc_dev_attr)
+k3_chipinfo_variant_to_sr(struct platform_device *pdev, unsigned int partno,

You pass in the platform_device struct pointer, but only ever use the ->dev member, just pass in the "dev" device pointer.

Otherwise LGTM

Andrew

Quoted 36 lines
drivers/soc/ti/k3-socinfo.c +17 -1
+			  unsigned int variant, struct soc_device_attribute *soc_dev_attr)
  {
+	int gpsw_variant = 0;
+
  	switch (partno) {
  	case JTAG_ID_PARTNO_J721E:
  		if (variant >= ARRAY_SIZE(j721e_rev_string_map))
@@ -102,6 +131,19 @@ k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant,
  		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%s",
  						   am62lx_rev_string_map[variant]);
  		break;
+	case JTAG_ID_PARTNO_AM62PX:
+		/* Check GP_SW1 for silicon revision */
+		gpsw_variant = k3_chipinfo_get_gpsw_variant(pdev);
+		if (gpsw_variant == -EPROBE_DEFER)
+			return gpsw_variant;
+		if (gpsw_variant < 0 || gpsw_variant >= ARRAY_SIZE(am62p_gpsw_rev_string_map)) {
+			dev_warn(&pdev->dev, "Failed to get silicon variant (%d), set SR1.0\n",
+				 gpsw_variant);
+			gpsw_variant = 0;
+		}
+		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%s",
+						   am62p_gpsw_rev_string_map[gpsw_variant]);
+		break;
  	default:
  		variant++;
  		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%x.0",
@@ -173,7 +215,7 @@ static int k3_chipinfo_probe(struct platform_device *pdev)
  		goto err;
  	}
 
-	ret = k3_chipinfo_variant_to_sr(partno_id, variant, soc_dev_attr);
+	ret = k3_chipinfo_variant_to_sr(pdev, partno_id, variant, soc_dev_attr);
  	if (ret) {
  		dev_err(dev, "Unknown SoC SR[0x%08X]: %d\n", jtag_id, ret);
  		goto err;
#4 lore raw

Re: [PATCH 2/2] soc: ti: k3-socinfo: Add support for AM62P variants via NVMEM

Hi Andrew,

Quoted 81 lines · Andrew Davis
Quoted 40 lines · Judith Mendez

Add support for detecting AM62P silicon revisions.

On AM62P, silicon revision is discovered with GP_SW1 register instead of JTAGID register. Use the NVMEM framework to read GP_SW1 from the gpsw-efuse nvmem provider to determine SoC revision.

---
  drivers/soc/ti/k3-socinfo.c | 48 ++++++++++++++++++++++++++++++++++---

  1 file changed, 45 insertions(+), 3 deletions(-)
drivers/soc/ti/k3-socinfo.c +11 -0
index 42275cb5ba1c8..4b6947a9ceb4d 100644
@@ -6,6 +6,7 @@
    */
   #include <linux/mfd/syscon.h>
+#include <linux/nvmem-consumer.h>
   #include <linux/of.h>
   #include <linux/of_address.h>
   #include <linux/regmap.h>
@@ -25,6 +26,9 @@
   #define CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT    (28)
   #define CTRLMMR_WKUP_JTAGID_VARIANT_MASK    GENMASK(31, 28)
+#define GP_SW1_VALID_BIT            BIT(4)
+#define GP_SW1_ADR_MASK            GENMASK(3, 0)
+
   #define CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT    (12)
   #define CTRLMMR_WKUP_JTAGID_PARTNO_MASK        GENMASK(27, 12)
@@ -70,6 +74,29 @@ static const char * const am62lx_rev_string_map[] = {
       "1.0", "1.1",
   };
+static const char * const am62p_gpsw_rev_string_map[] = {
+    "1.0", "1.1", "1.2",
+};
+
+static int
+k3_chipinfo_get_gpsw_variant(struct platform_device *pdev)
+{

drivers/soc/ti/k3-socinfo.c static const char * const am62lx_rev_string_map[] = { · line 92

Quoted 10 lines
drivers/soc/ti/k3-socinfo.c +10 -0
+    struct device *dev = &pdev->dev;
+    u32 gpsw_val, adr_val = 0;
+    int ret;
+
+    ret = nvmem_cell_read_u32(dev, "gpsw1", &gpsw_val);
+    if (ret)
+        return ret;
+
+    if (!(gpsw_val & GP_SW1_VALID_BIT))
+        return 0;

Return -1 here so you will get the warning message about setting default SR1.0.

drivers/soc/ti/k3-socinfo.c static const char * const am62lx_rev_string_map[] = { · line 97

Quoted 4 lines
drivers/soc/ti/k3-socinfo.c +4 -0
+
+    adr_val = gpsw_val & GP_SW1_ADR_MASK;
+
+    return adr_val;

Merge the above two lines,

return gpsw_val & GP_SW1_ADR_MASK;

Or maybe try using FIELD_GET() or similar if you are feeling fancy.

Quoted 11 lines
drivers/soc/ti/k3-socinfo.c +2 -0
+}
+

  static int
  k3_chipinfo_partno_to_names(unsigned int partno, struct soc_device_attribute *soc_dev_attr)

drivers/soc/ti/k3-socinfo.c +0 -0
@@ -86,9 +113,11 @@ k3_chipinfo_partno_to_names(unsigned int partno,
   }

  static int

drivers/soc/ti/k3-socinfo.c +1 -2
-k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant,
-              struct soc_device_attribute *soc_dev_attr)
+k3_chipinfo_variant_to_sr(struct platform_device *pdev, unsigned int 
Quoted 1 line

partno,

You pass in the platform_device struct pointer, but only ever use the ->dev member, just pass in the "dev" device pointer.

Quoted 4 lines

Otherwise LGTM

Andrew

Thanks for reviewing!
Will fix according to your review and respin the series.

~ Judith

#5 lore raw

Re: [PATCH 2/2] soc: ti: k3-socinfo: Add support for AM62P variants via NVMEM

In reply to Andrew Davis

Andrew,

Quoted 45 lines · Andrew Davis
Quoted 44 lines · Judith Mendez

Add support for detecting AM62P silicon revisions.

On AM62P, silicon revision is discovered with GP_SW1 register instead of JTAGID register. Use the NVMEM framework to read GP_SW1 from the gpsw-efuse nvmem provider to determine SoC revision.

---
  drivers/soc/ti/k3-socinfo.c | 48 ++++++++++++++++++++++++++++++++++---

  1 file changed, 45 insertions(+), 3 deletions(-)
drivers/soc/ti/k3-socinfo.c +15 -0
index 42275cb5ba1c8..4b6947a9ceb4d 100644
@@ -6,6 +6,7 @@
    */
   #include <linux/mfd/syscon.h>
+#include <linux/nvmem-consumer.h>
   #include <linux/of.h>
   #include <linux/of_address.h>
   #include <linux/regmap.h>
@@ -25,6 +26,9 @@
   #define CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT    (28)
   #define CTRLMMR_WKUP_JTAGID_VARIANT_MASK    GENMASK(31, 28)
+#define GP_SW1_VALID_BIT            BIT(4)
+#define GP_SW1_ADR_MASK            GENMASK(3, 0)
+
   #define CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT    (12)
   #define CTRLMMR_WKUP_JTAGID_PARTNO_MASK        GENMASK(27, 12)
@@ -70,6 +74,29 @@ static const char * const am62lx_rev_string_map[] = {
       "1.0", "1.1",
   };
+static const char * const am62p_gpsw_rev_string_map[] = {
+    "1.0", "1.1", "1.2",
+};
+
+static int
+k3_chipinfo_get_gpsw_variant(struct platform_device *pdev)
+{
+    struct device *dev = &pdev->dev;
+    u32 gpsw_val, adr_val = 0;
+    int ret;
+
Quoted 8 lines

drivers/soc/ti/k3-socinfo.c static const char * const am62lx_rev_string_map[] = { · line 93

Quoted 6 lines
drivers/soc/ti/k3-socinfo.c +6 -0
+    ret = nvmem_cell_read_u32(dev, "gpsw1", &gpsw_val);
+    if (ret)
+        return ret;
+
+    if (!(gpsw_val & GP_SW1_VALID_BIT))
+        return 0;

Return -1 here so you will get the warning message about setting default SR1.0.

Actually, thinking about this some more... If valid bit is zero, that means that we have detected SR1.0. Id rather return zero instead of printing an error to the user and overwriting with zero. What do you think?

~ Judith

#6 lore raw

Re: [PATCH 2/2] soc: ti: k3-socinfo: Add support for AM62P variants via NVMEM

Quoted 57 lines · Judith Mendez

Andrew,

Quoted 45 lines · Andrew Davis
Quoted 44 lines · Judith Mendez

Add support for detecting AM62P silicon revisions.

On AM62P, silicon revision is discovered with GP_SW1 register instead of JTAGID register. Use the NVMEM framework to read GP_SW1 from the gpsw-efuse nvmem provider to determine SoC revision.

---
  drivers/soc/ti/k3-socinfo.c | 48 ++++++++++++++++++++++++++++++++++---

  1 file changed, 45 insertions(+), 3 deletions(-)
drivers/soc/ti/k3-socinfo.c +15 -0
index 42275cb5ba1c8..4b6947a9ceb4d 100644
@@ -6,6 +6,7 @@
    */
   #include <linux/mfd/syscon.h>
+#include <linux/nvmem-consumer.h>
   #include <linux/of.h>
   #include <linux/of_address.h>
   #include <linux/regmap.h>
@@ -25,6 +26,9 @@
   #define CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT    (28)
   #define CTRLMMR_WKUP_JTAGID_VARIANT_MASK    GENMASK(31, 28)
+#define GP_SW1_VALID_BIT            BIT(4)
+#define GP_SW1_ADR_MASK            GENMASK(3, 0)
+
   #define CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT    (12)
   #define CTRLMMR_WKUP_JTAGID_PARTNO_MASK        GENMASK(27, 12)
@@ -70,6 +74,29 @@ static const char * const am62lx_rev_string_map[] = {
       "1.0", "1.1",
   };
+static const char * const am62p_gpsw_rev_string_map[] = {
+    "1.0", "1.1", "1.2",
+};
+
+static int
+k3_chipinfo_get_gpsw_variant(struct platform_device *pdev)
+{
+    struct device *dev = &pdev->dev;
+    u32 gpsw_val, adr_val = 0;
+    int ret;
+
Quoted 8 lines

drivers/soc/ti/k3-socinfo.c static const char * const am62lx_rev_string_map[] = { · line 93

Quoted 6 lines
drivers/soc/ti/k3-socinfo.c +6 -0
+    ret = nvmem_cell_read_u32(dev, "gpsw1", &gpsw_val);
+    if (ret)
+        return ret;
+
+    if (!(gpsw_val & GP_SW1_VALID_BIT))
+        return 0;

Return -1 here so you will get the warning message about setting default SR1.0.

Quoted 2 lines

Actually, thinking about this some more... If valid bit is zero, that means that we have detected SR1.0.

To me a valid bit set to zero means the register is not valid.. If you are saying that bit actually signals SR1.0 then that bit is not well named.

Although if the whole register is simply all zeros for SR1.0 then do you actually need this check at all? When you do extract the revision from the lowest bits (gpsw_val & GP_SW1_ADR_MASK) the result will also be 0, which is the SR1.0 value anyway.

Andrew

Quoted 5 lines

Id rather return zero instead of
printing an error to the user and overwriting with zero. What do you think?

~ Judith

#7 lore raw

Re: [PATCH 2/2] soc: ti: k3-socinfo: Add support for AM62P variants via NVMEM

Quoted 63 lines · Andrew Davis
Quoted 59 lines · Judith Mendez

Andrew,

Quoted 47 lines · Andrew Davis
Quoted 46 lines · Judith Mendez

Add support for detecting AM62P silicon revisions.

On AM62P, silicon revision is discovered with GP_SW1 register instead of JTAGID register. Use the NVMEM framework to read GP_SW1 from the gpsw-efuse nvmem provider to determine SoC revision.

---
  drivers/soc/ti/k3-socinfo.c | 48 +++++++++++++++++++++++++++++++++
+---

  1 file changed, 45 insertions(+), 3 deletions(-)
drivers/soc/ti/k3-socinfo.c +15 -0
index 42275cb5ba1c8..4b6947a9ceb4d 100644
@@ -6,6 +6,7 @@
    */
   #include <linux/mfd/syscon.h>
+#include <linux/nvmem-consumer.h>
   #include <linux/of.h>
   #include <linux/of_address.h>
   #include <linux/regmap.h>
@@ -25,6 +26,9 @@
   #define CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT    (28)
   #define CTRLMMR_WKUP_JTAGID_VARIANT_MASK    GENMASK(31, 28)
+#define GP_SW1_VALID_BIT            BIT(4)
+#define GP_SW1_ADR_MASK            GENMASK(3, 0)
+
   #define CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT    (12)
   #define CTRLMMR_WKUP_JTAGID_PARTNO_MASK        GENMASK(27, 12)
@@ -70,6 +74,29 @@ static const char * const am62lx_rev_string_map[] 
 = {
       "1.0", "1.1",
   };
+static const char * const am62p_gpsw_rev_string_map[] = {
+    "1.0", "1.1", "1.2",
+};
+
+static int
+k3_chipinfo_get_gpsw_variant(struct platform_device *pdev)
+{
+    struct device *dev = &pdev->dev;
+    u32 gpsw_val, adr_val = 0;
+    int ret;
+
Quoted 8 lines

drivers/soc/ti/k3-socinfo.c static const char * const am62lx_rev_string_map[] = { · line 93

Quoted 6 lines
drivers/soc/ti/k3-socinfo.c +6 -0
+    ret = nvmem_cell_read_u32(dev, "gpsw1", &gpsw_val);
+    if (ret)
+        return ret;
+
+    if (!(gpsw_val & GP_SW1_VALID_BIT))
+        return 0;

Return -1 here so you will get the warning message about setting default SR1.0.

Quoted 2 lines

Actually, thinking about this some more... If valid bit is zero, that means that we have detected SR1.0.

Quoted 7 lines

To me a valid bit set to zero means the register is not valid.. If you are saying that bit actually signals SR1.0 then that bit is not well named.

Although if the whole register is simply all zeros for SR1.0 then do you actually need this check at all? When you do extract the revision from the lowest bits (gpsw_val & GP_SW1_ADR_MASK) the result will also be 0, which is the SR1.0 value anyway.

Ok, sounds like a plan. Will drop valid bit parsing and respin the series, thanks.

~ Judith