Skip to contentSkip to conversation

xilinx: zynqmp: Fixes for silicon ID detection

PATCH New Michal Simek 2 participants 6 messages Oct 21, 2020 – Oct 27, 2020 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

cover xilinx: zynqmp: Fixes for silicon ID detection

Hi,

I found some issues with SPL where silicons were not properly detected. This series is fixing this and also fixing some minor related issues.

Thanks,
Michal

Michal Simek (4):
xilinx: zynqmp: Check return value from xilinx_pm_request()
xilinx: zynqmp: Fix debug message in zynqmp_get_silicon_idcode_name()
xilinx: zynqmp: Do not check 0 as invalid return from snprintf
xilinx: zynqmp: Use tab for macro indentation

 board/xilinx/zynqmp/zynqmp.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/4 xilinx: zynqmp: Check return value from xilinx_pm_request()

xilinx_pm_request() can failed that's why also check return value.

Fixes 050f10f103cd ("xilinx: zynqmp: remove chip_id function")

---

 board/xilinx/zynqmp/zynqmp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
board/xilinx/zynqmp/zynqmp.c +5 -1
index db3f5978a928..e65824540809 100644
@@ -192,7 +192,11 @@ static char *zynqmp_get_silicon_idcode_name(void)
 	u32 ret_payload[PAYLOAD_ARG_CNT];
 	int ret;
 
-	xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
+	ret = xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
+	if (ret) {
+		debug("%s: Getting chipid failed\n", __func__);
+		return "unknown";
+	}
 
 	/*
 	 * Firmware returns:
Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/4 xilinx: zynqmp: Fix debug message in zynqmp_get_silicon_idcode_name()

In reply to Michal Simek

Fix hex format from 0x%0X to 0x%0x to show correct numbers.

Fixes fa793165daf7 ("xilinx: zynqmp: refactor silicon name function")

---

 board/xilinx/zynqmp/zynqmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/xilinx/zynqmp/zynqmp.c +1 -1
index e65824540809..7ba2c789751e 100644
@@ -209,7 +209,7 @@ static char *zynqmp_get_silicon_idcode_name(void)
 
 	idcode  = ret_payload[1];
 	idcode2 = ret_payload[2] >> ZYNQMP_CSU_VERSION_EMPTY_SHIFT;
-	debug("%s, IDCODE: 0x%0X, IDCODE2: 0x%0X\r\n", __func__, idcode,
+	debug("%s, IDCODE: 0x%0x, IDCODE2: 0x%0x\r\n", __func__, idcode,
 	      idcode2);
 
 	for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) {
Signature · 1 line
2.28.0
#3 lore raw

PATCH 3/4 xilinx: zynqmp: Do not check 0 as invalid return from snprintf

In reply to Michal Simek

U-Boot SPL on ZynqMP is using CONFIG_SPL_USE_TINY_PRINTF which doesn't return any return value and all the time returns 0. That's why even correct snprintf was returning in SPL chip ID as "unknown". Change checking condition and allow snprintf to return 0 which is according manual patch successful return.
"If an output error is encountered, a negative value is returned."

Fixes 43a138956f7e ("arm64: zynqmp: Get rid of simple_itoa and replace it by snprintf")

---

 board/xilinx/zynqmp/zynqmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/xilinx/zynqmp/zynqmp.c +1 -1
index 7ba2c789751e..c4f24982843e 100644
@@ -223,7 +223,7 @@ static char *zynqmp_get_silicon_idcode_name(void)
 	/* Add device prefix to the name */
 	ret = snprintf(name, ZYNQMP_VERSION_SIZE, "zu%d",
 		       zynqmp_devices[i].device);
-	if (ret <= 0)
+	if (ret < 0)
 		return "unknown";
 
 	if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_EV) {
Signature · 1 line
2.28.0
#4 lore raw

PATCH 4/4 xilinx: zynqmp: Use tab for macro indentation

In reply to Michal Simek

Trivial fix.

Fixes fa793165daf7 ("xilinx: zynqmp: refactor silicon name function")

---

 board/xilinx/zynqmp/zynqmp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
board/xilinx/zynqmp/zynqmp.c +6 -6
index c4f24982843e..731285a73674 100644
@@ -40,12 +40,12 @@
 #include "pm_cfg_obj.h"
 
 #define ZYNQMP_VERSION_SIZE	7
-#define EFUSE_VCU_DIS_MASK     0x100
-#define EFUSE_VCU_DIS_SHIFT    8
-#define EFUSE_GPU_DIS_MASK     0x20
-#define EFUSE_GPU_DIS_SHIFT    5
-#define IDCODE2_PL_INIT_MASK   0x200
-#define IDCODE2_PL_INIT_SHIFT  9
+#define EFUSE_VCU_DIS_MASK	0x100
+#define EFUSE_VCU_DIS_SHIFT	8
+#define EFUSE_GPU_DIS_MASK	0x20
+#define EFUSE_GPU_DIS_SHIFT	5
+#define IDCODE2_PL_INIT_MASK	0x200
+#define IDCODE2_PL_INIT_SHIFT	9
 
 DECLARE_GLOBAL_DATA_PTR;
 
Signature · 1 line
2.28.0
Applied
#5 lore raw

cover xilinx: zynqmp: Fixes for silicon ID detection

In reply to Michal Simek

st 21. 10. 2020 v 12:29 odes?latel Michal Simek
<[email protected]> napsal:

Quoted 16 lines

Hi,

I found some issues with SPL where silicons were not properly detected. This series is fixing this and also fixing some minor related issues.

Thanks,
Michal

Michal Simek (4):
xilinx: zynqmp: Check return value from xilinx_pm_request()
xilinx: zynqmp: Fix debug message in zynqmp_get_silicon_idcode_name()
xilinx: zynqmp: Do not check 0 as invalid return from snprintf
xilinx: zynqmp: Use tab for macro indentation

Quoted 6 lines
 board/xilinx/zynqmp/zynqmp.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

--
2.28.0

Applied.
M

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs