]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm64: zynqmp: Check pmufw version
authorMichal Simek <michal.simek@xilinx.com>
Tue, 7 Feb 2017 13:32:26 +0000 (14:32 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 20 Jun 2017 14:42:13 +0000 (16:42 +0200)
If PMUFW version is not v0.3 then panic.
ZynqMP switch to CCF based clock driver which requires
PMUFW to be present at certain version.
This patch ensure that you use correct and tested PMUFW
binary.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/cpu/armv8/zynqmp/cpu.c
arch/arm/include/asm/arch-zynqmp/sys_proto.h
board/xilinx/zynqmp/zynqmp.c
include/configs/xilinx_zynqmp.h

index f7ed179c18665e3e322942bab9d0af9e9eda5bd1..94ecf9066028f1f4da7b0e0c9393bd65c44ee485 100644 (file)
@@ -129,6 +129,41 @@ int invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3,
        return regs.regs[0];
 }
 
+#define ZYNQMP_SIP_SVC_GET_API_VERSION         0xC2000001
+
+#define ZYNQMP_PM_VERSION_MAJOR                0
+#define ZYNQMP_PM_VERSION_MINOR                3
+#define ZYNQMP_PM_VERSION_MAJOR_SHIFT  16
+#define ZYNQMP_PM_VERSION_MINOR_MASK   0xFFFF
+
+#define ZYNQMP_PM_VERSION      \
+       ((ZYNQMP_PM_VERSION_MAJOR << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | \
+                                ZYNQMP_PM_VERSION_MINOR)
+
+#if defined(CONFIG_CLK_ZYNQMP)
+void zynqmp_pmufw_version(void)
+{
+       int ret;
+       u32 ret_payload[PAYLOAD_ARG_CNT];
+       u32 pm_api_version;
+
+       ret = invoke_smc(ZYNQMP_SIP_SVC_GET_API_VERSION, 0, 0, 0, 0,
+                        ret_payload);
+       pm_api_version = ret_payload[1];
+
+       if (ret)
+               panic("PMUFW is not found - Please load it!\n");
+
+       printf("PMUFW:\tv%d.%d\n",
+              pm_api_version >> ZYNQMP_PM_VERSION_MAJOR_SHIFT,
+              pm_api_version & ZYNQMP_PM_VERSION_MINOR_MASK);
+
+       if (pm_api_version != ZYNQMP_PM_VERSION)
+               panic("PMUFW version error. Expected: v%d.%d\n",
+                     ZYNQMP_PM_VERSION_MAJOR, ZYNQMP_PM_VERSION_MINOR);
+}
+#endif
+
 int zynqmp_mmio_write(const u32 address,
                      const u32 mask,
                      const u32 value)
index 4ae1bb6eef7ce356133909ce12e95f28736f28a6..d91d98a1196c16643761e615b2ad5f7ef647886d 100644 (file)
@@ -18,6 +18,7 @@ void psu_init(void);
 
 void handoff_setup(void);
 
+void zynqmp_pmufw_version(void);
 int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
 int zynqmp_mmio_read(const u32 address, u32 *value);
 int invoke_smc(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3,
index 3849b5885dfe4b4631c6cc2a5bf0fa8b85850b23..51a3d9f276b79f06b6731483ce4cede6c6608b83 100644 (file)
@@ -113,6 +113,14 @@ static char *zynqmp_get_silicon_idcode_name(void)
 }
 #endif
 
+int board_early_init_f(void)
+{
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CLK_ZYNQMP)
+       zynqmp_pmufw_version();
+#endif
+       return 0;
+}
+
 #define ZYNQMP_VERSION_SIZE    9
 
 int board_init(void)
index 52fe9d80d440d9ae02ebb4331a9a01367d57cc85..86a4579fbdb5ac54828c1248a06f2ecf2c26919d 100644 (file)
 #endif
 #endif
 
+#define CONFIG_BOARD_EARLY_INIT_F
+
 #endif /* __XILINX_ZYNQMP_H */