Skip to contentSkip to conversation

imx8: scu_api: sync sc_rm_is_pad_owned api change

PATCH In review Marcel Ziswiler 3 participants 3 messages Dec 13, 2022 – Jan 31, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx8: scu_api: sync sc_rm_is_pad_owned api change

From: Ye Li <[email protected]>

SCFW has fixed a overflow issue in sc_rm_is_pad_owned API. This requires u-boot to update API implementation, since it will cause compatible issue. Otherwise all pad checking will have problem and cause pad setting not continue.

Due to the compatible issue, the new u-boot only works with new SCFW (API version: 1.21 and later).

old scfw + old u-boot: API overflow issue
old scfw + new u-boot, or new scfw + old u-boot: API compatible issue new scfw + new u-boot: Working

---
I stumbled over this one when working on the apalis-imx8 boot issue fix and support refresh [1] where I noticed that using the latest SCFW Ethernet won't come up. Through manual testing, I identified SCFW 1.3.1 to still work fine so I settled with that for the time being. Re-visiting this SCFW incompatibility issue again now I stumbled over this downstream commit [2] which I believe would be very suitable for upstreaming as well. With that latest SCFW 1.14.0 works fine again. So here it goes.

[1] https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
[2] https://github.com/nxp-imx/uboot-imx/commit/9be6761bccd008de16191aed325004bd982f770f

 arch/arm/include/asm/arch-imx8/sci/rpc.h | 2 +-
 drivers/misc/imx8/scu_api.c              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-imx8/sci/rpc.h +1 -1
index 9f55904f44..39de7f0e3e 100644
@@ -11,7 +11,7 @@
 /* Defines */
 
 #define SCFW_API_VERSION_MAJOR  1U
-#define SCFW_API_VERSION_MINOR  15U
+#define SCFW_API_VERSION_MINOR  21U
 
 #define SC_RPC_VERSION          1U
 
drivers/misc/imx8/scu_api.c +1 -1
index 27ecce710f..8f546e9b3f 100644
@@ -788,7 +788,7 @@ sc_bool_t sc_rm_is_pad_owned(sc_ipc_t ipc, sc_pad_t pad)
 	RPC_VER(&msg) = SC_RPC_VERSION;
 	RPC_SVC(&msg) = (u8)SC_RPC_SVC_RM;
 	RPC_FUNC(&msg) = (u8)RM_FUNC_IS_PAD_OWNED;
-	RPC_U8(&msg, 0U) = (u8)pad;
+	RPC_U16(&msg, 0U) = (u16)pad;
 	RPC_SIZE(&msg) = 2U;
 
 	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
Signature · 1 line
2.35.1
#1 lore raw

Any feedback?

@Stefano: Any plans to apply anything?

Quoted 61 lines · Marcel Ziswiler

From: Ye Li <[email protected]>

SCFW has fixed a overflow issue in sc_rm_is_pad_owned API. This requires u-boot to update API implementation, since it will cause compatible issue. Otherwise all pad checking will have problem and cause pad setting not continue.

Due to the compatible issue, the new u-boot only works with new SCFW (API version: 1.21 and later).

old scfw + old u-boot: API overflow issue
old scfw + new u-boot, or new scfw + old u-boot: API compatible issue new scfw + new u-boot: Working

---
I stumbled over this one when working on the apalis-imx8 boot issue fix and support refresh [1] where I noticed that using the latest SCFW Ethernet won't come up. Through manual testing, I identified SCFW 1.3.1 to still work fine so I settled with that for the time being. Re-visiting this SCFW incompatibility issue again now I stumbled over this downstream commit [2] which I believe would be very suitable for upstreaming as well. With that latest SCFW 1.14.0 works fine again. So here it goes.

[1] https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
[2] https://github.com/nxp-imx/uboot-imx/commit/9be6761bccd008de16191aed325004bd982f770f

 arch/arm/include/asm/arch-imx8/sci/rpc.h | 2 +-
 drivers/misc/imx8/scu_api.c              | 2 +-

 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-imx8/sci/rpc.h +0 -0
index 9f55904f44..39de7f0e3e 100644
@@ -11,7 +11,7 @@
  /* Defines */


 #define SCFW_API_VERSION_MAJOR  1U

arch/arm/include/asm/arch-imx8/sci/rpc.h +1 -1
-#define SCFW_API_VERSION_MINOR  15U
+#define SCFW_API_VERSION_MINOR  21U


 #define SC_RPC_VERSION          1U

drivers/misc/imx8/scu_api.c +1 -1
index 27ecce710f..8f546e9b3f 100644
@@ -788,7 +788,7 @@ sc_bool_t sc_rm_is_pad_owned(sc_ipc_t ipc, sc_pad_t pad)
         RPC_VER(&msg) = SC_RPC_VERSION;
         RPC_SVC(&msg) = (u8)SC_RPC_SVC_RM;
         RPC_FUNC(&msg) = (u8)RM_FUNC_IS_PAD_OWNED;
-       RPC_U8(&msg, 0U) = (u8)pad;
+       RPC_U16(&msg, 0U) = (u16)pad;
         RPC_SIZE(&msg) = 2U;


        ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);

#2 lore raw

PATCH 1/1 imx8: scu_api: sync sc_rm_is_pad_owned api change

In reply to Marcel Ziswiler
Quoted 10 lines

From: Ye Li <[email protected]>
SCFW has fixed a overflow issue in sc_rm_is_pad_owned API. This requires u-boot to update API implementation, since it will cause compatible issue. Otherwise all pad checking will have problem and cause pad setting not continue.
Due to the compatible issue, the new u-boot only works with new SCFW (API version: 1.21 and later).
old scfw + old u-boot: API overflow issue
old scfw + new u-boot, or new scfw + old u-boot: API compatible issue new scfw + new u-boot: Working

Quoted 3 lines

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================