Skip to contentSkip to conversation

apalis-imx8: Fix sc_misc_otp_fuse_read() error check

PATCH In review Fabio Estevam 3 participants 4 messages Mar 13, 2024 – Mar 17, 2024 Arm i.MX and Layerscape

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 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")
---
 board/toradex/apalis-imx8/apalis-imx8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/toradex/apalis-imx8/apalis-imx8.c +1 -1
index 2483a63c6733..49719f2f5533 100644
@@ -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;
 	}
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Wednesday, March 13, 2024 9:00 AM
To: [email protected]
Cc: Marcel Ziswiler <[email protected]>; [email protected]; Francesco Dolcini <[email protected]>; [email protected]; Peng Fan <[email protected]>; [email protected]
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():

board/toradex/apalis-imx8/apalis-imx8.c +1 -1
-       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.

Quoted 8 lines

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")
Quoted 21 lines
---
 board/toradex/apalis-imx8/apalis-imx8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/toradex/apalis- renamed from board/toradex/apalis-imx8/apalis-imx8.c +0 -0

imx8/apalis-imx8.c
index 2483a63c6733..49719f2f5533 100644

board/toradex/apalis-imx8/apalis-imx8.c +1 -1
@@ -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

Acked-by on v1 1/1
#2 lore raw
In reply to Fabio Estevam

Hi Fabio

Thanks!

Quoted 12 lines · Fabio Estevam

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.

Quoted 8 lines

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")
Quoted 14 lines

---
 board/toradex/apalis-imx8/apalis-imx8.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
board/toradex/apalis-imx8/apalis-imx8.c +0 -0
index 2483a63c6733..49719f2f5533 100644
@@ -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);

board/toradex/apalis-imx8/apalis-imx8.c +1 -1
-	if (scierr) {
+	if (!scierr) {
Quoted 3 lines

  /* QP has one A72 core disabled */ is_quadplus = ((val >> 4) & 0x3) != 0x0; }

Cheers

Marcel

author reviewer
#3 lore raw
In reply to Fabio Estevam
Quoted 13 lines · Fabio Estevam

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():

board/toradex/apalis-imx8/apalis-imx8.c +1 -1
-       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.

Quoted 8 lines

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")

Applied for u-boot-imx/master, thanks.