[U-Boot] [PATCH 08/13] firmware: zynqmp: create firmware header

Michal Simek michal.simek at xilinx.com
Fri Sep 27 13:34:59 UTC 2019


From: Ibai Erkiaga <ibai.erkiaga-elorza at xilinx.com>

New firmware header to place firmware specific macro and function
declarations. The patch also moves the macros defining PM operations as
well as some helper macros.

Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza at xilinx.com>
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

 MAINTAINERS                                   |  1 +
 arch/arm/mach-zynqmp/cpu.c                    |  1 +
 arch/arm/mach-zynqmp/include/mach/sys_proto.h | 25 ------------
 board/xilinx/zynqmp/cmds.c                    |  1 +
 board/xilinx/zynqmp/zynqmp.c                  |  1 +
 drivers/firmware/firmware-zynqmp.c            |  1 +
 drivers/fpga/zynqmppl.c                       |  1 +
 include/zynqmp_firmware.h                     | 38 +++++++++++++++++++
 8 files changed, 44 insertions(+), 25 deletions(-)
 create mode 100644 include/zynqmp_firmware.h

diff --git a/MAINTAINERS b/MAINTAINERS
index f5feb89ac3e9..5d5c0fc61f03 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -460,6 +460,7 @@ F:	drivers/timer/cadence-ttc.c
 F:	drivers/usb/host/ehci-zynq.c
 F:	drivers/watchdog/cdns_wdt.c
 F:	include/zynqmppl.h
+F:	include/zynqmp_firmware.h
 F:	tools/zynqmp*
 N:	ultra96
 N:	zynqmp
diff --git a/arch/arm/mach-zynqmp/cpu.c b/arch/arm/mach-zynqmp/cpu.c
index 5ef1a52862c0..f28b964a1560 100644
--- a/arch/arm/mach-zynqmp/cpu.c
+++ b/arch/arm/mach-zynqmp/cpu.c
@@ -9,6 +9,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
+#include <zynqmp_firmware.h>
 
 #define ZYNQ_SILICON_VER_MASK	0xF000
 #define ZYNQ_SILICON_VER_SHIFT	12
diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h
index 573c4ffceed9..658974445417 100644
--- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h
+++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h
@@ -10,8 +10,6 @@
 #define PAYLOAD_ARG_CNT		5
 
 #define ZYNQMP_CSU_SILICON_VER_MASK	0xF
-#define ZYNQMP_SIP_SVC_PM_SECURE_IMG_LOAD	\
-	(PM_SIP_SVC + PM_SECURE_IMAGE)
 #define KEY_PTR_LEN	32
 
 #define ZYNQMP_FPGA_BIT_AUTH_DDR	1
@@ -22,29 +20,6 @@
 
 #define ZYNQMP_FPGA_AUTH_DDR	1
 
-#define ZYNQMP_SIP_SVC_GET_API_VERSION		\
-	(PM_SIP_SVC + PM_GET_API_VERSION)
-
-#define ZYNQMP_PM_VERSION_MAJOR		1
-#define ZYNQMP_PM_VERSION_MINOR		0
-#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)
-
-#define ZYNQMP_PM_VERSION_INVALID	~0
-
-#define PMUFW_V1_0	((1 << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | 0)
-
-#define PM_SIP_SVC	0xc2000000
-
-enum pm_api_id {
-	PM_GET_API_VERSION = 1,
-	PM_SECURE_IMAGE = 45,
-};
-
 enum {
 	IDCODE,
 	VERSION,
diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index ed7ba58c6475..f53a1b63bea6 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <env.h>
 #include <malloc.h>
+#include <zynqmp_firmware.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 6524badf299c..d9186f463f20 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -21,6 +21,7 @@
 #include <usb.h>
 #include <dwc3-uboot.h>
 #include <zynqmppl.h>
+#include <zynqmp_firmware.h>
 #include <g_dnl.h>
 #include <linux/sizes.h>
 
diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index f4d9fd9569e2..d70f34f24388 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <mailbox.h>
+#include <zynqmp_firmware.h>
 #include <asm/arch/sys_proto.h>
 
 #define PMUFW_PAYLOAD_ARG_CNT	8
diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
index f6d9d50ef15f..6168626aeef3 100644
--- a/drivers/fpga/zynqmppl.c
+++ b/drivers/fpga/zynqmppl.c
@@ -8,6 +8,7 @@
 #include <console.h>
 #include <common.h>
 #include <zynqmppl.h>
+#include <zynqmp_firmware.h>
 #include <linux/sizes.h>
 #include <asm/arch/sys_proto.h>
 #include <memalign.h>
diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h
new file mode 100644
index 000000000000..c522cae8399b
--- /dev/null
+++ b/include/zynqmp_firmware.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Xilinx Zynq MPSoC Firmware driver
+ *
+ * Copyright (C) 2018-2019 Xilinx, Inc.
+ */
+
+#ifndef _ZYNQM_FIRMWARE_H_
+#define _ZYNQM_FIRMWARE_H_
+
+#define PM_SIP_SVC      0xc2000000
+#define ZYNQMP_SIP_SVC_GET_API_VERSION          \
+	(PM_SIP_SVC + PM_GET_API_VERSION)
+#define ZYNQMP_SIP_SVC_PM_SECURE_IMG_LOAD       \
+	(PM_SIP_SVC + PM_SECURE_IMAGE)
+
+#define ZYNQMP_PM_VERSION_MAJOR         1
+#define ZYNQMP_PM_VERSION_MINOR         0
+#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)
+
+#define ZYNQMP_PM_VERSION_INVALID       ~0
+
+#define PMUFW_V1_0      ((1 << ZYNQMP_PM_VERSION_MAJOR_SHIFT) | 0)
+
+enum pm_api_id {
+	PM_GET_API_VERSION = 1,
+	PM_SET_CONFIGURATION,
+	PM_SECURE_IMAGE = 45,
+};
+
+unsigned int zynqmp_firmware_version(void);
+
+#endif /* _ZYNQMPPL_H_ */
-- 
2.17.1



More information about the U-Boot mailing list