Skip to contentSkip to conversation

soc: qcom: ocmem: Add OCMEM hardware version print

PATCH Applied Luca Weiss 3 participants 3 messages May 29, 2023 – May 30, 2023

Subsystems (2)
lore
Share & tools
lore

Luca Weiss

author
#0 lore raw

PATCH v3 1/1 soc: qcom: ocmem: Add OCMEM hardware version print

It might be useful to know what hardware version of the OCMEM block the SoC contains. Add a debug print for that.

---
This patch is depends on [0] but could also be applied in the other order, if conflicts are resolved.

[0] https://lore.kernel.org/linux-arm-msm/[email protected]/
---
Changes in v3:
- Use %lu instead of %ld for print (Konrad)
- Re-wrap lines so reading is easier (Konrad)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Use FIELD_GET macros for getting correct bits from register (take wording from mdp5: major, minor, step which hopefully is sort of accurate)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/soc/qcom/ocmem.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/soc/qcom/ocmem.c +10 -0
index c3e78411c637..ef7c1748242a 100644
@@ -76,6 +76,10 @@ struct ocmem {
 #define OCMEM_REG_GFX_MPU_START			0x00001004
 #define OCMEM_REG_GFX_MPU_END			0x00001008
 
+#define OCMEM_HW_VERSION_MAJOR(val)		FIELD_GET(GENMASK(31, 28), val)
+#define OCMEM_HW_VERSION_MINOR(val)		FIELD_GET(GENMASK(27, 16), val)
+#define OCMEM_HW_VERSION_STEP(val)		FIELD_GET(GENMASK(15, 0), val)
+
 #define OCMEM_HW_PROFILE_NUM_PORTS(val)		FIELD_GET(0x0000000f, (val))
 #define OCMEM_HW_PROFILE_NUM_MACROS(val)	FIELD_GET(0x00003f00, (val))
 
@@ -355,6 +359,12 @@ static int ocmem_dev_probe(struct platform_device *pdev)
 		}
 	}
 
+	reg = ocmem_read(ocmem, OCMEM_REG_HW_VERSION);
+	dev_dbg(dev, "OCMEM hardware version: %lu.%lu.%lu\n",
+		OCMEM_HW_VERSION_MAJOR(reg),
+		OCMEM_HW_VERSION_MINOR(reg),
+		OCMEM_HW_VERSION_STEP(reg));
+
 	reg = ocmem_read(ocmem, OCMEM_REG_HW_PROFILE);
 	ocmem->num_ports = OCMEM_HW_PROFILE_NUM_PORTS(reg);
 	ocmem->num_macros = OCMEM_HW_PROFILE_NUM_MACROS(reg);

---
base-commit: 8705151771af822ac794b44504cd72eebc423499
change-id: 20230509-ocmem-hwver-99bcb33b028b

Best regards,

Signature · 1 line
Luca Weiss <[email protected]>
Reviewed-by on v3 1/1
#1 lore raw
Quoted 10 lines · Luca Weiss

It might be useful to know what hardware version of the OCMEM block the SoC contains. Add a debug print for that.

---
This patch is depends on [0] but could also be applied in the other order, if conflicts are resolved.

[0] https://lore.kernel.org/linux-arm-msm/[email protected]/
---

Konrad

Quoted 48 lines

Changes in v3:
- Use %lu instead of %ld for print (Konrad)
- Re-wrap lines so reading is easier (Konrad)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Use FIELD_GET macros for getting correct bits from register (take wording from mdp5: major, minor, step which hopefully is sort of accurate)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 drivers/soc/qcom/ocmem.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/soc/qcom/ocmem.c +10 -1
index c3e78411c637..ef7c1748242a 100644
@@ -76,6 +76,10 @@ struct ocmem {
 #define OCMEM_REG_GFX_MPU_START			0x00001004
 #define OCMEM_REG_GFX_MPU_END			0x00001008
 
+#define OCMEM_HW_VERSION_MAJOR(val)		FIELD_GET(GENMASK(31, 28), val)
+#define OCMEM_HW_VERSION_MINOR(val)		FIELD_GET(GENMASK(27, 16), val)
+#define OCMEM_HW_VERSION_STEP(val)		FIELD_GET(GENMASK(15, 0), val)
+
 #define OCMEM_HW_PROFILE_NUM_PORTS(val)		FIELD_GET(0x0000000f, (val))
 #define OCMEM_HW_PROFILE_NUM_MACROS(val)	FIELD_GET(0x00003f00, (val))
 
@@ -355,6 +359,12 @@ static int ocmem_dev_probe(struct platform_device *pdev)
 		}
 	}
 
+	reg = ocmem_read(ocmem, OCMEM_REG_HW_VERSION);
+	dev_dbg(dev, "OCMEM hardware version: %lu.%lu.%lu\n",
+		OCMEM_HW_VERSION_MAJOR(reg),
+		OCMEM_HW_VERSION_MINOR(reg),
+		OCMEM_HW_VERSION_STEP(reg));
+
 	reg = ocmem_read(ocmem, OCMEM_REG_HW_PROFILE);
 	ocmem->num_ports = OCMEM_HW_PROFILE_NUM_PORTS(reg);
 	ocmem->num_macros = OCMEM_HW_PROFILE_NUM_MACROS(reg);
 
---

base-commit: 8705151771af822ac794b44504cd72eebc423499
change-id: 20230509-ocmem-hwver-99bcb33b028b

Best regards,

maintainer Applied
#2 lore raw
In reply to Luca Weiss
Quoted 4 lines · Luca Weiss

It might be useful to know what hardware version of the OCMEM block the SoC contains. Add a debug print for that.

Applied, thanks!

[1/1] soc: qcom: ocmem: Add OCMEM hardware version print

      commit: e81a16e77259294cd4ff0a9c1fbe5aa0e311a47d

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>