On Wed, Oct 14, 2020 at 3:17 PM Bin Meng <bmeng...@gmail.com> wrote: > > Hi Green, > > On Wed, Oct 14, 2020 at 3:02 PM Green Wan <green....@sifive.com> wrote: > > > > On Wed, Oct 14, 2020 at 1:37 PM Bin Meng <bmeng...@gmail.com> wrote: > > > > > > Hi Green, > > > > > > On Mon, Sep 28, 2020 at 6:12 PM Green Wan <green....@sifive.com> wrote: > > > > > > > > - Add write operation to update fuse data bit when PWE bit is on. > > > > - Add array, fuse_wo, to store the 'written' status for all bits > > > > of OTP to block the write operation. > > > > > > > > Signed-off-by: Green Wan <green....@sifive.com> > > > > Reviewed-by: Alistair Francis <alistair.fran...@wdc.com> > > > > --- > > > > hw/misc/sifive_u_otp.c | 30 +++++++++++++++++++++++++++++- > > > > include/hw/misc/sifive_u_otp.h | 3 +++ > > > > 2 files changed, 32 insertions(+), 1 deletion(-) > > > > > > > > > > I am not sure how you tested this. I wrote a simple U-Boot command to > > > call U-Boot sifive-otp driver to test the write functionality, but it > > > failed. > > > > > > => misc write otp@10070000 0 80200000 10 > > ^^^^^^^^^ > > Quick ask, how about 'md 80200000'? > > > > I didn't use 'misc write' command. I can check afterward. > > Note 'misc write' is a new U-Boot command I just added for testing > this QEMU functionality. Please use the U-Boot patch below: > http://patchwork.ozlabs.org/project/uboot/patch/1602657292-82815-1-git-send-email-bmeng...@gmail.com/ > Thanks for pointing it out.
I've found one bug when I revise the macro of the write function and the read is correct. It's my mistake. I will include and rerun this test as well. > > > > > => misc read otp@10070000 0 80400000 10 > > > => md 80400000 > > > 80400000: ffffffff ffffffff ffffffff ffffffff ................ > > > 80400010: 00000000 00000000 00000000 00000000 ................ > > > 80400020: 00000000 00000000 00000000 00000000 ................ > > > 80400030: 00000000 00000000 00000000 00000000 ................ > > > 80400040: 00000000 00000000 00000000 00000000 ................ > > > 80400050: 00000000 00000000 00000000 00000000 ................ > > > 80400060: 00000000 00000000 00000000 00000000 ................ > > > 80400070: 00000000 00000000 00000000 00000000 ................ > > > 80400080: 00000000 00000000 00000000 00000000 ................ > > > 80400090: 00000000 00000000 00000000 00000000 ................ > > > 804000a0: 00000000 00000000 00000000 00000000 ................ > > > 804000b0: 00000000 00000000 00000000 00000000 ................ > > > 804000c0: 00000000 00000000 00000000 00000000 ................ > > > 804000d0: 00000000 00000000 00000000 00000000 ................ > > > 804000e0: 00000000 00000000 00000000 00000000 ................ > > > 804000f0: 00000000 00000000 00000000 00000000 ................ > > > => misc write otp@10070000 0 80200010 10 > > > => misc read otp@10070000 0 80400010 10 > > > => md 80400000 > > > 80400000: ffffffff ffffffff ffffffff ffffffff ................ > > > 80400010: ffffffff ffffffff ffffffff ffffffff ................ > > > 80400020: 00000000 00000000 00000000 00000000 ................ > > > 80400030: 00000000 00000000 00000000 00000000 ................ > > > 80400040: 00000000 00000000 00000000 00000000 ................ > > > 80400050: 00000000 00000000 00000000 00000000 ................ > > > 80400060: 00000000 00000000 00000000 00000000 ................ > > > 80400070: 00000000 00000000 00000000 00000000 ................ > > > 80400080: 00000000 00000000 00000000 00000000 ................ > > > 80400090: 00000000 00000000 00000000 00000000 ................ > > > 804000a0: 00000000 00000000 00000000 00000000 ................ > > > 804000b0: 00000000 00000000 00000000 00000000 ................ > > > 804000c0: 00000000 00000000 00000000 00000000 ................ > > > 804000d0: 00000000 00000000 00000000 00000000 ................ > > > 804000e0: 00000000 00000000 00000000 00000000 ................ > > > 804000f0: 00000000 00000000 00000000 00000000 ................ > > > > > > But it can read the serial number at offset 0x3f0 > > > > > > => misc read otp@10070000 3f0 80400010 10 > > > => md 80400000 > > > 80400000: ffffffff ffffffff ffffffff ffffffff ................ > > > 80400010: 00000001 fffffffe ffffffff ffffffff ................ > > > 80400020: 00000000 00000000 00000000 00000000 ................ > > > 80400030: 00000000 00000000 00000000 00000000 ................ > > > 80400040: 00000000 00000000 00000000 00000000 ................ > > > 80400050: 00000000 00000000 00000000 00000000 ................ > > > 80400060: 00000000 00000000 00000000 00000000 ................ > > > 80400070: 00000000 00000000 00000000 00000000 ................ > > > 80400080: 00000000 00000000 00000000 00000000 ................ > > > 80400090: 00000000 00000000 00000000 00000000 ................ > > > 804000a0: 00000000 00000000 00000000 00000000 ................ > > > 804000b0: 00000000 00000000 00000000 00000000 ................ > > > 804000c0: 00000000 00000000 00000000 00000000 ................ > > > 804000d0: 00000000 00000000 00000000 00000000 ................ > > > 804000e0: 00000000 00000000 00000000 00000000 ................ > > > 804000f0: 00000000 00000000 00000000 00000000 ................ > > Regards, > Bin