[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v6 1/2] hw/misc/sifive_u_otp: Add write function and writ
From: |
Green Wan |
Subject: |
Re: [RFC PATCH v6 1/2] hw/misc/sifive_u_otp: Add write function and write-once protection |
Date: |
Thu, 15 Oct 2020 10:09:58 +0800 |
On Wed, Oct 14, 2020 at 3:17 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Green,
>
> On Wed, Oct 14, 2020 at 3:02 PM Green Wan <green.wan@sifive.com> wrote:
> >
> > On Wed, Oct 14, 2020 at 1:37 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > Hi Green,
> > >
> > > On Mon, Sep 28, 2020 at 6:12 PM Green Wan <green.wan@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.wan@sifive.com>
> > > > Reviewed-by: Alistair Francis <alistair.francis@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.cn@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