summaryrefslogtreecommitdiff
path: root/drivers/misc/imx8ulp/s400_api.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-05-23 09:25:39 -0400
committerTom Rini <trini@konsulko.com>2022-05-23 09:25:39 -0400
commit004d30c786056d443d40428c4b1c11e2f8f0bc32 (patch)
treea6c7d28590d20c5f88f292804bcb22ebfa36d942 /drivers/misc/imx8ulp/s400_api.c
parent6f00b97d7e5760d92566317dde6c4b9224790827 (diff)
parent4d573d5c98234cad328de77c773c3c3d79258255 (diff)
Merge tag 'u-boot-imx-20220523' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
u-boot-imx-20220523 ------------------- CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/12087 Additionally to u-boot-imx20200520: - DH MX8MP - i.MX GPIO: reading GPIO when direction is output - Menlo i.MX53: switch to DM And from u-boot-imx20200520: - fix Verdin hang - add pca9450 regulator - conversion to DM_SERIAL - NAND block handling - fix crypto - enable cache on some boards - add ACC board (MX6)
Diffstat (limited to 'drivers/misc/imx8ulp/s400_api.c')
-rw-r--r--drivers/misc/imx8ulp/s400_api.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/misc/imx8ulp/s400_api.c b/drivers/misc/imx8ulp/s400_api.c
index 3ffdeb2ad2a..87f5880ccb8 100644
--- a/drivers/misc/imx8ulp/s400_api.c
+++ b/drivers/misc/imx8ulp/s400_api.c
@@ -272,6 +272,47 @@ int ahab_release_caam(u32 core_did, u32 *response)
return ret;
}
+int ahab_get_fw_version(u32 *fw_version, u32 *sha1, u32 *response)
+{
+ struct udevice *dev = gd->arch.s400_dev;
+ int size = sizeof(struct imx8ulp_s400_msg);
+ struct imx8ulp_s400_msg msg;
+ int ret;
+
+ if (!dev) {
+ printf("s400 dev is not initialized\n");
+ return -ENODEV;
+ }
+
+ if (!fw_version) {
+ printf("Invalid parameters for f/w version read\n");
+ return -EINVAL;
+ }
+
+ if (!sha1) {
+ printf("Invalid parameters for commit sha1\n");
+ return -EINVAL;
+ }
+
+ msg.version = AHAB_VERSION;
+ msg.tag = AHAB_CMD_TAG;
+ msg.size = 1;
+ msg.command = AHAB_GET_FW_VERSION_CID;
+
+ ret = misc_call(dev, false, &msg, size, &msg, size);
+ if (ret)
+ printf("Error: %s: ret %d, response 0x%x\n",
+ __func__, ret, msg.data[0]);
+
+ if (response)
+ *response = msg.data[0];
+
+ *fw_version = msg.data[1];
+ *sha1 = msg.data[2];
+
+ return ret;
+}
+
int ahab_dump_buffer(u32 *buffer, u32 buffer_length)
{
struct udevice *dev = gd->arch.s400_dev;