summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2019-09-27 14:08:41 +0200
committerMichal Simek <michal.simek@xilinx.com>2019-10-08 09:55:11 +0200
commitb6039aad2d233622729282d1ecd9963366dbf0b4 (patch)
treecbbf120ef70f6f4ac92b64a9c77881da0aeabadb
parent325a22dc196a8738ba8389b8a4086345ff5e98db (diff)
downloadu-boot-b6039aad2d233622729282d1ecd9963366dbf0b4.tar.gz
firmware: zynqmp: Separate function for sending message via mailbox
U-Boot running in EL3 can't use SMC that's why there is a need to talk to PMUFW directly via mailbox. The same logic is applied to all functions which need to talk to PMUFW that's why move this logic to separate function to avoid code duplication. Also SMC request ID can be composed from PM_SIP_SVC offset that's why ZYNQMP_SIP_SVC_GET_API_VERSION macro can be removed completely. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r--drivers/firmware/firmware-zynqmp.c19
-rw-r--r--include/zynqmp_firmware.h2
2 files changed, 10 insertions, 11 deletions
diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index 8327214290..304398fed6 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -49,6 +49,14 @@ static int ipi_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen)
return ret;
}
+static int send_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen)
+{
+ if (IS_ENABLED(CONFIG_SPL_BUILD))
+ return ipi_req(req, req_len, res, res_maxlen);
+
+ return invoke_smc(req[0] + PM_SIP_SVC, 0, 0, 0, 0, res);
+}
+
unsigned int zynqmp_firmware_version(void)
{
int ret;
@@ -61,16 +69,9 @@ unsigned int zynqmp_firmware_version(void)
* asking PMUFW again.
**/
if (pm_api_version == ZYNQMP_PM_VERSION_INVALID) {
- if (IS_ENABLED(CONFIG_SPL_BUILD)) {
- const u32 request[] = { PM_GET_API_VERSION };
-
- ret = ipi_req(request, ARRAY_SIZE(request),
- ret_payload, 2);
- } else {
- ret = invoke_smc(ZYNQMP_SIP_SVC_GET_API_VERSION, 0, 0,
- 0, 0, ret_payload);
- };
+ const u32 request[] = { PM_GET_API_VERSION };
+ ret = send_req(request, ARRAY_SIZE(request), ret_payload, 2);
if (ret)
panic("PMUFW is not found - Please load it!\n");
diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h
index 30bf870b02..cebac74e91 100644
--- a/include/zynqmp_firmware.h
+++ b/include/zynqmp_firmware.h
@@ -15,8 +15,6 @@ enum pm_api_id {
};
#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)