#include <stdio.h>
#include <fuse.h>
#include <linux/arm-smccc.h>
+#include <linux/bitops.h>
#include <string.h>
#define K3_SIP_OTP_WRITEBUFF 0xC2000000
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");
}
/* 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);