From: Ye Li <ye...@nxp.com>

To support more RDC instances on i.MX93, update API to latest
definition.

Signed-off-by: Ye Li <ye...@nxp.com>
Signed-off-by: Peng Fan <peng....@nxp.com>
---
 arch/arm/include/asm/mach-imx/s400_api.h |  2 +-
 drivers/misc/sentinel/s400_api.c         | 21 +++++++++++++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/mach-imx/s400_api.h 
b/arch/arm/include/asm/mach-imx/s400_api.h
index b3e6b3fa45d..d09c078df01 100644
--- a/arch/arm/include/asm/mach-imx/s400_api.h
+++ b/arch/arm/include/asm/mach-imx/s400_api.h
@@ -32,7 +32,7 @@ struct imx8ulp_s400_msg {
        u32 data[(S400_MAX_MSG - 1U)];
 };
 
-int ahab_release_rdc(u8 core_id, bool xrdc, u32 *response);
+int ahab_release_rdc(u8 core_id, u8 xrdc, u32 *response);
 int ahab_auth_oem_ctnr(ulong ctnr_addr, u32 *response);
 int ahab_release_container(u32 *response);
 int ahab_verify_image(u32 img_id, u32 *response);
diff --git a/drivers/misc/sentinel/s400_api.c b/drivers/misc/sentinel/s400_api.c
index 3d791bc868e..4e90171420f 100644
--- a/drivers/misc/sentinel/s400_api.c
+++ b/drivers/misc/sentinel/s400_api.c
@@ -14,7 +14,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int ahab_release_rdc(u8 core_id, bool xrdc, u32 *response)
+int ahab_release_rdc(u8 core_id, u8 xrdc, u32 *response)
 {
        struct udevice *dev = gd->arch.s400_dev;
        int size = sizeof(struct imx8ulp_s400_msg);
@@ -30,10 +30,23 @@ int ahab_release_rdc(u8 core_id, bool xrdc, u32 *response)
        msg.tag = AHAB_CMD_TAG;
        msg.size = 2;
        msg.command = AHAB_RELEASE_RDC_REQ_CID;
-       if (xrdc)
-               msg.data[0] = (0x78 << 8) | core_id;
-       else
+       switch (xrdc) {
+       case 0:
                msg.data[0] = (0x74 << 8) | core_id;
+               break;
+       case 1:
+               msg.data[0] = (0x78 << 8) | core_id;
+               break;
+       case 2:
+               msg.data[0] = (0x82 << 8) | core_id;
+               break;
+       case 3:
+               msg.data[0] = (0x86 << 8) | core_id;
+               break;
+       default:
+               printf("Error: wrong xrdc index %u\n", xrdc);
+               return -EINVAL;
+       }
 
        ret = misc_call(dev, false, &msg, size, &msg, size);
        if (ret)
-- 
2.36.0

Reply via email to