From: Vignesh Raghavendra <[email protected]> Error out if readback value doesn't match the programmed value.
Signed-off-by: Vignesh Raghavendra <[email protected]> Signed-off-by: Anshul Dalal <[email protected]> --- drivers/misc/k3_fuse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/misc/k3_fuse.c b/drivers/misc/k3_fuse.c index cefdedaf411..882fd431659 100644 --- a/drivers/misc/k3_fuse.c +++ b/drivers/misc/k3_fuse.c @@ -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; } -- 2.52.0

