return ret;
}
- for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
- word = STM32_OTP_HASH_KEY_START + i;
+ for (i = 0, word = STM32_OTP_HASH_KEY_START;
+ i < STM32_OTP_HASH_KEY_SIZE;
+ i++, word++, addr += 4) {
val = __be32_to_cpu(*(u32 *)addr);
if (print)
printf("Fuse OTP %i : %x\n", word, val);
log_err("Fuse OTP %i failed\n", word);
return ret;
}
-
- addr += 4;
+ /* on success, lock the OTP for HASH key */
+ val = 1;
+ ret = misc_write(dev, STM32_BSEC_LOCK(word), &val, 4);
+ if (ret != 4) {
+ log_err("Lock OTP %i failed\n", word);
+ return ret;
+ }
}
return 0;