zynqmp: pm: Plumb get_chipid through FW interface
authorSoren Brinkmann <soren.brinkmann@xilinx.com>
Thu, 22 Sep 2016 19:21:11 +0000 (12:21 -0700)
committerSoren Brinkmann <soren.brinkmann@xilinx.com>
Wed, 16 Nov 2016 23:48:48 +0000 (15:48 -0800)
Use the PMUFW get_chipid call to obtain IDCODE and version register.

Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
plat/xilinx/zynqmp/aarch64/zynqmp_common.c
plat/xilinx/zynqmp/pm_service/pm_api_sys.c
plat/xilinx/zynqmp/pm_service/pm_api_sys.h
plat/xilinx/zynqmp/pm_service/pm_svc_main.c
plat/xilinx/zynqmp/zynqmp_private.h

index 11a9e760eded254fe24010f4ade0104d3fdf477c..8e461d3ced1d2bed8472e8931f29eb74bb930b57 100644 (file)
@@ -77,18 +77,6 @@ unsigned int zynqmp_get_uart_clk(void)
        return 100000000;
 }
 
-unsigned int zynqmp_get_silicon_id(void)
-{
-       uint32_t id;
-
-       id = mmio_read_32(ZYNQMP_CSU_BASEADDR + ZYNQMP_CSU_IDCODE_OFFSET);
-
-       id &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | ZYNQMP_CSU_IDCODE_SVD_MASK;
-       id >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT;
-
-       return id;
-}
-
 #if LOG_LEVEL >= LOG_LEVEL_NOTICE
 static const struct {
        unsigned int id;
@@ -140,6 +128,18 @@ static const struct {
        },
 };
 
+static unsigned int zynqmp_get_silicon_id(void)
+{
+       uint32_t id;
+
+       id = mmio_read_32(ZYNQMP_CSU_BASEADDR + ZYNQMP_CSU_IDCODE_OFFSET);
+
+       id &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK | ZYNQMP_CSU_IDCODE_SVD_MASK;
+       id >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT;
+
+       return id;
+}
+
 static char *zynqmp_get_silicon_idcode_name(void)
 {
        unsigned int id;
index a466687184f549251367854e253c80de94f0a453..b9906060640e1337249a29fac2171b7528cb8b73 100644 (file)
@@ -541,3 +541,19 @@ enum pm_ret_status pm_fpga_get_status(unsigned int *value)
        PM_PACK_PAYLOAD1(payload, PM_FPGA_GET_STATUS);
        return pm_ipi_send_sync(primary_proc, payload, value, 1);
 }
+
+/**
+ * pm_get_chipid() - Read silicon ID registers
+ * @value       Buffer for return values. Must be large enough
+ *             to hold 8 bytes.
+ *
+ * @return      Returns silicon ID registers
+ */
+enum pm_ret_status pm_get_chipid(uint32_t *value)
+{
+       uint32_t payload[PAYLOAD_ARG_CNT];
+
+       /* Send request to the PMU */
+       PM_PACK_PAYLOAD1(payload, PM_GET_CHIPID);
+       return pm_ipi_send_sync(primary_proc, payload, value, 2);
+}
index 26d83e75a8dfcaa70faf23584a029e3e3e84de31..1f681180104bfad3856c6575cd90fe8eae0dcff7 100644 (file)
@@ -115,4 +115,6 @@ enum pm_ret_status pm_fpga_load(uint32_t address_high,
                                uint32_t flags);
 enum pm_ret_status pm_fpga_get_status(unsigned int *value);
 
+enum pm_ret_status pm_get_chipid(uint32_t *value);
+
 #endif /* _PM_API_SYS_H_ */
index 9c08ffb9a34f029c4f21699cc82f500cd12b15b6..d6355834013d41e989fef22843840ee1ebf00796 100644 (file)
@@ -242,7 +242,13 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
        }
 
        case PM_GET_CHIPID:
-               SMC_RET1(handle, zynqmp_get_silicon_id());
+       {
+               uint32_t result[2];
+
+               ret = pm_get_chipid(result);
+               SMC_RET2(handle, (uint64_t)ret | ((uint64_t)result[0] << 32),
+                        result[1]);
+       }
 
        default:
                WARN("Unimplemented PM Service Call: 0x%x\n", smc_fid);
index abcdebc39fb59a935dc9b8eecb49a57d95818077..ddef37b8f3730d57e659a90d3c622e13fed56fc2 100644 (file)
@@ -39,7 +39,6 @@ void zynqmp_config_setup(void);
 unsigned int zynqmp_get_uart_clk(void);
 int zynqmp_is_pmu_up(void);
 unsigned int zynqmp_get_bootmode(void);
-unsigned int zynqmp_get_silicon_id(void);
 
 /* For FSBL handover */
 void fsbl_atf_handover(entry_point_info_t *bl32_image_ep_info,