Skip to contentSkip to conversation

colibri-imx8x: Fix sc_misc_otp_fuse_read() error check

PATCH In review Fabio Estevam 4 participants 5 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 colibri-imx8x: Fix sc_misc_otp_fuse_read() error check

Commit aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage") made an incorrect logic change in the error code check of sc_misc_otp_fuse_read():

- if (sc_err == SC_ERR_NONE) {

+       if (sc_err) {
                /* DX has two A35 cores disabled */
                return (val & 0xf) != 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 aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage")
---
 board/toradex/colibri-imx8x/colibri-imx8x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/toradex/colibri-imx8x/colibri-imx8x.c +1 -1
index 2c673a4a6b06..6fc8076163c6 100644
@@ -46,7 +46,7 @@ static int is_imx8dx(void)
 	u32 val = 0;
 	int sc_err = sc_misc_otp_fuse_read(-1, 6, &val);
 
-	if (sc_err) {
+	if (!sc_err) {
 		/* DX has two A35 cores disabled */
 		return (val & 0xf) != 0x0;
 	}
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines

Subject: [PATCH] colibri-imx8x: Fix sc_misc_otp_fuse_read() error check

Commit aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage") made an incorrect logic change in the error code check of sc_misc_otp_fuse_read():

board/toradex/colibri-imx8x/colibri-imx8x.c +1 -1
-       if (sc_err == SC_ERR_NONE) {
+       if (sc_err) {
                /* DX has two A35 cores disabled */
                return (val & 0xf) != 0x0;
        }

The other changes in this commit are correct.

sc_misc_otp_fuse_read() returns 0 on a successful fuse read.

Quoted 7 lines

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

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

Fixes aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage")
Quoted 20 lines
---
 board/toradex/colibri-imx8x/colibri-imx8x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/toradex/colibri-imx8x/colibri-imx8x.c +1 -2
index 2c673a4a6b06..6fc8076163c6 100644
@@ -46,7 +46,7 @@ static int is_imx8dx(void)
 	u32 val = 0;
 	int sc_err = sc_misc_otp_fuse_read(-1, 6, &val);
 
-	if (sc_err) {
+	if (!sc_err) {
 		/* DX has two A35 cores disabled */
 		return (val & 0xf) != 0x0;
 	}
--

2.34.1

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

Hi Fabio

Thanks!

Quoted 14 lines · Fabio Estevam

Commit aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage") made an incorrect logic change in the error code check of sc_misc_otp_fuse_read():

-       if (sc_err == SC_ERR_NONE) {
+       if (sc_err) {
                /* DX has two A35 cores disabled */ return (val & 0xf) != 0x0; }

The other changes in this commit are correct.

sc_misc_otp_fuse_read() returns 0 on a successful fuse read.

Quoted 7 lines

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

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

Fixes aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage")
Quoted 10 lines
board/toradex/colibri-imx8x/colibri-imx8x.c +0 -0
index 2c673a4a6b06..6fc8076163c6 100644
@@ -46,7 +46,7 @@ static int is_imx8dx(void)
  	u32 val = 0;
  	int sc_err = sc_misc_otp_fuse_read(-1, 6, &val);

board/toradex/colibri-imx8x/colibri-imx8x.c +1 -1
-	if (sc_err) {
+	if (!sc_err) {
Quoted 3 lines

  /* DX has two A35 cores disabled */ return (val & 0xf) != 0x0; }

Cheers

Marcel

Tested-by
#3 lore raw
Quoted 21 lines · Marcel Ziswiler

Hi Fabio

Thanks!

Quoted 16 lines · Fabio Estevam

Commit aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage") made an incorrect logic change in the error code check of sc_misc_otp_fuse_read():

-       if (sc_err == SC_ERR_NONE) {
+       if (sc_err) {
                /* DX has two A35 cores disabled */ return (val & 0xf) != 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.

Quoted 8 lines
Quoted 5 lines

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

Fixes aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage")
Quoted 17 lines
Quoted 10 lines
board/toradex/colibri-imx8x/colibri-imx8x.c +0 -0
index 2c673a4a6b06..6fc8076163c6 100644
@@ -46,7 +46,7 @@ static int is_imx8dx(void)
  	u32 val = 0;
  	int sc_err = sc_misc_otp_fuse_read(-1, 6, &val);

board/toradex/colibri-imx8x/colibri-imx8x.c +1 -1
-	if (sc_err) {
+	if (!sc_err) {
Quoted 3 lines

  /* DX has two A35 cores disabled */ return (val & 0xf) != 0x0; }

Cheers

Marcel

author reviewer
#4 lore raw
In reply to Fabio Estevam
Quoted 15 lines · Fabio Estevam

Commit aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage") made an incorrect logic change in the error code check of sc_misc_otp_fuse_read():

board/toradex/colibri-imx8x/colibri-imx8x.c +1 -1
-       if (sc_err == SC_ERR_NONE) {
+       if (sc_err) {
                /* DX has two A35 cores disabled */
                return (val & 0xf) != 0x0;
        }

The other changes in this commit are correct.

sc_misc_otp_fuse_read() returns 0 on a successful fuse read.

Quoted 7 lines

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

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

Fixes aa6e698a7acd ("imx: toradex/colibri-imx8x: correct SCU API usage")

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