Minor fixes for the k3_fuse driver
cover Minor fixes for the k3_fuse driver
Hi all,
This series adds some minor *non-critical* fixes to the k3_fuse misc driver in U-Boot.
Regards,
Anshul
---
Vignesh Raghavendra (4):
misc: k3_fuse: Fix printing of error codes
misc: k3_fuse: Check readback on fuse prog
misc: k3_fuse: Enable fuse Sense support
misc: k3_fuse: Limit writes to 25bit values
drivers/misc/k3_fuse.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
---
base-commit: 7995bf8dea2d5b3eb7fcb836636f4773924ec35d
change-id: 20260226-k3_fuse_fixes-c41d2ccf84bd
Best regards,
Signature · 1 line
Anshul Dalal <[email protected]>
PATCH 1/4 misc: k3_fuse: Fix printing of error codes
From: Vignesh Raghavendra <[email protected]>
Use signed int format to print error codes so that its more readable
--- drivers/misc/k3_fuse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/misc/k3_fuse.c +3 -3
@@ -28,7 +28,7 @@ int fuse_read(u32 bank, u32 word, u32 *val) *val = res.a1;if (res.a0 !=0 ) -printf ("SMC call failed: Error code %lu\n" , res.a0); +printf ("SMC call failed: Error code %ld\n" , res.a0);return res.a0; }
@@ -53,7 +53,7 @@ int fuse_prog(u32 bank, u32 word, u32 val) val, mask, 0, 0, 0, 0, &res);if (res.a0 !=0 ) -printf ("SMC call failed: Error code %lu\n" , res.a0); +printf ("SMC call failed: Error code %ld\n" , res.a0);return res.a0; }
@@ -72,7 +72,7 @@ int fuse_writebuff(ulong addr) 0, 0, 0, 0, 0, 0, &res);if (res.a0 !=0 ) -printf ("SMC call failed: Error code %lu\n" , res.a0); +printf ("SMC call failed: Error code %ld\n" , res.a0);return res.a0; }
Signature · 1 line
2.52.0
PATCH 2/4 misc: k3_fuse: Check readback on fuse prog
In reply to Anshul DalalFrom: Vignesh Raghavendra <[email protected]>
Error out if readback value doesn't match the programmed value.
--- drivers/misc/k3_fuse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/misc/k3_fuse.c +8 -1
@@ -52,8 +52,15 @@ int fuse_prog(u32 bank, u32 word, u32 val)arm_smccc_smc (K3_SIP_OTP_WRITE , word, val, mask,0 ,0 ,0 ,0 , &res); -if (res.a0 !=0 ) +if (res.a0 !=0 ) {printf ("SMC call failed: Error code %ld\n" , res.a0); +return res.a0; + } + +if (res.a1 != val) { +printf ("Readback failed, written 0x%x readback 0x%lx\n" , val, res.a1); +return -EINVAL ; + }return res.a0; }
Signature · 1 line
2.52.0
PATCH 3/4 misc: k3_fuse: Enable fuse Sense support
In reply to Anshul DalalFrom: Vignesh Raghavendra <[email protected]>
fuse sense is essentially read, map it to fuse read.
--- drivers/misc/k3_fuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/k3_fuse.c +1 -1
@@ -35,7 +35,7 @@ int fuse_read(u32 bank, u32 word, u32 *val)int fuse_sense (u32 bank,u32 word,u32 *val) { -return -EPERM ; +return fuse_read (bank, word, val); }int fuse_prog (u32 bank,u32 word,u32 val)
Signature · 1 line
2.52.0
PATCH 4/4 misc: k3_fuse: Limit writes to 25bit values
In reply to Anshul DalalFrom: Vignesh Raghavendra <[email protected]>
K3 OTP bits can only be programmed 25bits at a time. Limit the value accordingly using a 25 bit mask.
--- drivers/misc/k3_fuse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/misc/k3_fuse.c +3 -3
@@ -7,6 +7,7 @@#include <stdio.h> #include <fuse.h> #include <linux/arm-smccc.h> +#include <linux/bitops.h> #include <string.h> #define K3_SIP_OTP_WRITEBUFF 0xC2000000
@@ -41,7 +42,6 @@ int fuse_sense(u32 bank, u32 word, u32 *val)int fuse_prog (u32 bank,u32 word,u32 val) {struct arm_smccc_res res; -u32 mask = val;if (bank !=0U ) {printf ("Invalid bank argument, ONLY bank 0 is supported\n" );
@@ -49,8 +49,8 @@ int fuse_prog(u32 bank, u32 word, u32 val) }/* Make SiP SMC call and send the word, val and mask in the parameter register */ -arm_smccc_smc (K3_SIP_OTP_WRITE , word, - val, mask,0 ,0 ,0 ,0 , &res); +arm_smccc_smc (K3_SIP_OTP_WRITE , bank, word, + val,GENMASK (25 ,0 ),0 ,0 ,0 , &res);if (res.a0 !=0 ) {printf ("SMC call failed: Error code %ld\n" , res.a0);
Signature · 1 line
2.52.0
Quoted 8 lines · Anshul Dalal
This series adds some minor *non-critical* fixes to the
k3_fusemisc driver in U-Boot.Regards,
Anshul[...]
Applied to u-boot/next, thanks!
[1/4] misc: k3_fuse: Fix printing of error codes
commit: e98e9b1ec9be918c9c607a414e6121f3163adc49
[2/4] misc: k3_fuse: Check readback on fuse prog
commit: 494782b6e0e5cfe12274f57ef7a8028a665957e9
[3/4] misc: k3_fuse: Enable fuse Sense support
commit: b533d457aee435b4c19505617ce5a05be6e7255b
[4/4] misc: k3_fuse: Limit writes to 25bit values
commit: 34c7bcacfab4a7efe83e0bad259fadc145be0046Signature · 1 line
Tom