diff mbox series

apalis-imx8: Fix sc_misc_otp_fuse_read() error check

Message ID 20240313005941.2654166-1-festevam@gmail.com
State Accepted
Commit cd7af7ee5a06b367fb0f866346ea82c69b96e2f8
Delegated to: Fabio Estevam
Headers show
Series apalis-imx8: Fix sc_misc_otp_fuse_read() error check | expand

Commit Message

Fabio Estevam March 13, 2024, 12:59 a.m. UTC
Commit bfb3409d676f ("imx: toradex/apalis-imx8: correct SCU API usage")
made an incorrect logic change in the error code check of
sc_misc_otp_fuse_read():

-       if (scierr == SC_ERR_NONE) {
+       if (scierr) {
                /* QP has one A72 core disabled */
                is_quadplus = ((val >> 4) & 0x3) != 0x0;
        }

The other changes in this commit are correct.

sc_misc_otp_fuse_read() returns 0 on a successful fuse read.

This inversion causes board_mem_get_layout() to report incorrect RAM size.

Go back the original error check logic to fix the problem.

Fixes: bfb3409d676f ("imx: toradex/apalis-imx8: correct SCU API usage")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 board/toradex/apalis-imx8/apalis-imx8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peng Fan March 13, 2024, 2:18 a.m. UTC | #1
> -----Original Message-----
> From: Fabio Estevam <festevam@gmail.com>
> Sent: Wednesday, March 13, 2024 9:00 AM
> To: festevam@gmail.com
> Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>;
> hiago.franco@toradex.com; Francesco Dolcini
> <francesco.dolcini@toradex.com>; u-boot@lists.denx.de; Peng Fan
> <peng.fan@nxp.com>; joao.goncalves@toradex.com
> Subject: [PATCH] apalis-imx8: Fix sc_misc_otp_fuse_read() error check
> 
> Commit bfb3409d676f ("imx: toradex/apalis-imx8: correct SCU API usage")
> made an incorrect logic change in the error code check of
> sc_misc_otp_fuse_read():
> 
> -       if (scierr == SC_ERR_NONE) {
> +       if (scierr) {
>                 /* QP has one A72 core disabled */
>                 is_quadplus = ((val >> 4) & 0x3) != 0x0;
>         }
> 
> The other changes in this commit are correct.
> 
> sc_misc_otp_fuse_read() returns 0 on a successful fuse read.
> 
> This inversion causes board_mem_get_layout() to report incorrect RAM size.
> 
> Go back the original error check logic to fix the problem.
> 
> Fixes: bfb3409d676f ("imx: toradex/apalis-imx8: correct SCU API usage")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
>  board/toradex/apalis-imx8/apalis-imx8.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-
> imx8/apalis-imx8.c
> index 2483a63c6733..49719f2f5533 100644
> --- a/board/toradex/apalis-imx8/apalis-imx8.c
> +++ b/board/toradex/apalis-imx8/apalis-imx8.c
> @@ -133,7 +133,7 @@ void board_mem_get_layout(u64
> *phys_sdram_1_start,
>  	struct tdx_user_fuses tdxramfuses;
>  	int scierr = sc_misc_otp_fuse_read(-1, 6, &val);
> 
> -	if (scierr) {
> +	if (!scierr) {
>  		/* QP has one A72 core disabled */
>  		is_quadplus = ((val >> 4) & 0x3) != 0x0;
>  	}
> --
> 2.34.1
Marcel Ziswiler March 13, 2024, 8:08 a.m. UTC | #2
Hi Fabio

Thanks!

On Tue, 2024-03-12 at 21:59 -0300, Fabio Estevam wrote:
> Commit bfb3409d676f ("imx: toradex/apalis-imx8: correct SCU API usage")
> made an incorrect logic change in the error code check of
> sc_misc_otp_fuse_read():
> 
> -       if (scierr == SC_ERR_NONE) {
> +       if (scierr) {
>                 /* QP has one A72 core disabled */
>                 is_quadplus = ((val >> 4) & 0x3) != 0x0;
>         }
> 
> The other changes in this commit are correct.
> 
> sc_misc_otp_fuse_read() returns 0 on a successful fuse read.
> 
> This inversion causes board_mem_get_layout() to report incorrect RAM size.
> 
> Go back the original error check logic to fix the problem.
> 
> Fixes: bfb3409d676f ("imx: toradex/apalis-imx8: correct SCU API usage")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

> ---
>  board/toradex/apalis-imx8/apalis-imx8.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
> index 2483a63c6733..49719f2f5533 100644
> --- a/board/toradex/apalis-imx8/apalis-imx8.c
> +++ b/board/toradex/apalis-imx8/apalis-imx8.c
> @@ -133,7 +133,7 @@ void board_mem_get_layout(u64 *phys_sdram_1_start,
>  	struct tdx_user_fuses tdxramfuses;
>  	int scierr = sc_misc_otp_fuse_read(-1, 6, &val);
>  
> -	if (scierr) {
> +	if (!scierr) {
>  		/* QP has one A72 core disabled */
>  		is_quadplus = ((val >> 4) & 0x3) != 0x0;
>  	}

Cheers

Marcel
Fabio Estevam March 17, 2024, 11:55 p.m. UTC | #3
On Tue, Mar 12, 2024 at 9:59 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Commit bfb3409d676f ("imx: toradex/apalis-imx8: correct SCU API usage")
> made an incorrect logic change in the error code check of
> sc_misc_otp_fuse_read():
>
> -       if (scierr == SC_ERR_NONE) {
> +       if (scierr) {
>                 /* QP has one A72 core disabled */
>                 is_quadplus = ((val >> 4) & 0x3) != 0x0;
>         }
>
> The other changes in this commit are correct.
>
> sc_misc_otp_fuse_read() returns 0 on a successful fuse read.
>
> This inversion causes board_mem_get_layout() to report incorrect RAM size.
>
> Go back the original error check logic to fix the problem.
>
> Fixes: bfb3409d676f ("imx: toradex/apalis-imx8: correct SCU API usage")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Applied for u-boot-imx/master, thanks.
diff mbox series

Patch

diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
index 2483a63c6733..49719f2f5533 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -133,7 +133,7 @@  void board_mem_get_layout(u64 *phys_sdram_1_start,
 	struct tdx_user_fuses tdxramfuses;
 	int scierr = sc_misc_otp_fuse_read(-1, 6, &val);
 
-	if (scierr) {
+	if (!scierr) {
 		/* QP has one A72 core disabled */
 		is_quadplus = ((val >> 4) & 0x3) != 0x0;
 	}