Based RFC v4 to fix: - Change the patch order - Add write operation to update pdin to fuse[] bit by bit - Fix wrong protection for offset 0x0~0x38 - Add SIFIVE_U_OTP_PWE_EN definition - Refine access macro for fuse[] and fuse_wo[]
Summary of Patches - First patch is to add write opertion to update pdin data to fuse[] bit by bit. Add 'write-once' feature to block second write to same bit of the OTP memory. - Second patch is to add file-backed implementation to allow users to use '-drive' to assign an OTP raw image file. OTP image file must be bigger than 16K. For example, '-drive if=none,format=raw,file=otp.img' Testing - Tested on sifive_u for both qemu and u-boot. Green Wan (2): hw/riscv: sifive_u: Add write operation and write-once protection hw/riscv: sifive_u: Add backend drive support hw/riscv/sifive_u_otp.c | 80 ++++++++++++++++++++++++++++++++- include/hw/riscv/sifive_u_otp.h | 5 +++ 2 files changed, 84 insertions(+), 1 deletion(-) -- 2.17.1