]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
xilinx: zynqmp: remove chip_id function
authorIbai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Tue, 4 Aug 2020 22:17:30 +0000 (23:17 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 20 Aug 2020 07:49:20 +0000 (09:49 +0200)
Remove chip_id function and integrate the firmware call in the
zynqmp_get_silicon_idcode_name function. The change avoids querying the
firmware twice and makes the code bit more clear.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/mach-zynqmp/include/mach/sys_proto.h
board/xilinx/zynqmp/zynqmp.c

index 4078f958fc611a710f948e38cfef2d0c04d3230d..f2b3ceab13587b93a430e2e1b6365ec4ab8e8167 100644 (file)
@@ -49,7 +49,6 @@ int zynqmp_mmio_read(const u32 address, u32 *value);
 
 void initialize_tcm(bool mode);
 void mem_map_fill(void);
-int chip_id(unsigned char id);
 #if defined(CONFIG_SYS_MEM_RSVD_FOR_MMU) || defined(CONFIG_DEFINE_TCM_OCM_MMAP)
 void tcm_init(u8 mode);
 #endif
index 2b95a61dd0aa96ff8615876a0624da929d6571a0..2a430a9e4638c0c30440da1bd2b7e3d65e1f3743 100644 (file)
@@ -197,41 +197,6 @@ static const struct {
 };
 #endif
 
-int chip_id(unsigned char id)
-{
-       int val = -EINVAL;
-       u32 ret_payload[PAYLOAD_ARG_CNT];
-
-       xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
-
-       /*
-        * Firmware returns:
-        * payload[0][31:0]  = status of the operation
-        * payload[1]] = IDCODE
-        * payload[2][19:0]  = Version
-        * payload[2][28:20] = EXTENDED_IDCODE
-        * payload[2][29] = PL_INIT
-        */
-       switch (id) {
-       case IDCODE:
-               val = ret_payload[1];
-               val &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK |
-                       ZYNQMP_CSU_IDCODE_SVD_MASK;
-               val >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT;
-               break;
-       case VERSION:
-               val = ret_payload[2] & ZYNQMP_CSU_SILICON_VER_MASK;
-               break;
-       case IDCODE2:
-               val = ret_payload[2] >> ZYNQMP_CSU_VERSION_EMPTY_SHIFT;
-               break;
-       default:
-               printf("%s, Invalid Req:0x%x\n", __func__, id);
-       }
-
-       return val;
-}
-
 #define ZYNQMP_VERSION_SIZE            9
 #define ZYNQMP_PL_STATUS_BIT           9
 #define ZYNQMP_IPDIS_VCU_BIT           8
@@ -248,9 +213,27 @@ static char *zynqmp_get_silicon_idcode_name(void)
        u32 i, id, ver, j;
        char *buf;
        static char name[ZYNQMP_VERSION_SIZE];
+       u32 ret_payload[PAYLOAD_ARG_CNT];
+
+       xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
+
+       /*
+        * Firmware returns:
+        * payload[0][31:0]  = status of the operation
+        * payload[1]] = IDCODE
+        * payload[2][19:0]  = Version
+        * payload[2][28:20] = EXTENDED_IDCODE
+        * payload[2][29] = PL_INIT
+        */
+
+       /* Get IDCODE field */
+       id = ret_payload[1];
+       id &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | ZYNQMP_CSU_IDCODE_SVD_MASK;
+       id >>=  ZYNQMP_CSU_IDCODE_SVD_SHIFT;
+
+       /* Shift silicon version info */
+       ver = ret_payload[2] >> ZYNQMP_CSU_VERSION_EMPTY_SHIFT;
 
-       id = chip_id(IDCODE);
-       ver = chip_id(IDCODE2);
        debug("%s, ID: 0x%0X, Ver: 0x%0X\r\n", __func__, id, ver);
 
        for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) {