Message ID | 20200329170538.25449-3-pragnesh.patel@sifive.com |
---|---|
State | Superseded |
Delegated to: | Andes |
Headers | show |
Series | RISC-V SiFive FU540 support SPL | expand |
On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > Use the OTP DM driver to set the serial environment variable. > > Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > --- > arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > board/sifive/fu540/Kconfig | 2 + > board/sifive/fu540/fu540.c | 111 ++++++------------ > 4 files changed, 61 insertions(+), 72 deletions(-) > create mode 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi b/arch/riscv/dts/fu540-c000-u-boot.dtsi > new file mode 100644 > index 0000000000..db55773bd2 > --- /dev/null > +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi > @@ -0,0 +1,14 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > +/* > + * (C) Copyright 2019 SiFive, Inc > + */ > + > +/ { > + soc { > + otp: otp@10070000 { > + compatible = "sifive,fu540-c000-otp"; > + reg = <0x0 0x10070000 0x0 0x0FFF>; > + fuse-count = <0x1000>; > + }; > + }; > +}; > diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > new file mode 100644 > index 0000000000..f1735c1385 > --- /dev/null > +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > @@ -0,0 +1,6 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > +/* > + * Copyright (C) 2019 SiFive, Inc > + */ > + > +#include "fu540-c000-u-boot.dtsi" > diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig > index 5ca21474de..900197bbb2 100644 > --- a/board/sifive/fu540/Kconfig > +++ b/board/sifive/fu540/Kconfig > @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy > imply SIFIVE_GPIO > imply CMD_GPIO > imply SMP > + imply MISC > + imply SIFIVE_OTP Mark this default y if it is SIFIVE. Jagan.
Hi Jagan, >-----Original Message----- >From: Jagan Teki <jagan@amarulasolutions.com> >Sent: 02 April 2020 14:49 >To: Pragnesh Patel <pragnesh.patel@sifive.com> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial >environment variable > >[External Email] Do not click links or attachments unless you recognize the >sender and know the content is safe > >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel ><pragnesh.patel@sifive.com> wrote: >> >> Use the OTP DM driver to set the serial environment variable. >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> >> --- >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + >> board/sifive/fu540/Kconfig | 2 + >> board/sifive/fu540/fu540.c | 111 ++++++------------ >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi >> create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi >> new file mode 100644 >> index 0000000000..db55773bd2 >> --- /dev/null >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi >> @@ -0,0 +1,14 @@ >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >> +/* >> + * (C) Copyright 2019 SiFive, Inc >> + */ >> + >> +/ { >> + soc { >> + otp: otp@10070000 { >> + compatible = "sifive,fu540-c000-otp"; >> + reg = <0x0 0x10070000 0x0 0x0FFF>; >> + fuse-count = <0x1000>; >> + }; >> + }; >> +}; >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> new file mode 100644 >> index 0000000000..f1735c1385 >> --- /dev/null >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> @@ -0,0 +1,6 @@ >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >> +/* >> + * Copyright (C) 2019 SiFive, Inc >> + */ >> + >> +#include "fu540-c000-u-boot.dtsi" >> diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig >> index 5ca21474de..900197bbb2 100644 >> --- a/board/sifive/fu540/Kconfig >> +++ b/board/sifive/fu540/Kconfig >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy >> imply SIFIVE_GPIO >> imply CMD_GPIO >> imply SMP >> + imply MISC >> + imply SIFIVE_OTP > >Mark this default y if it is SIFIVE. All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by "imply", so I am following the same. I think "imply" will make it default y. > >Jagan.
On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > > Hi Jagan, > > >-----Original Message----- > >From: Jagan Teki <jagan@amarulasolutions.com> > >Sent: 02 April 2020 14:49 > >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy > >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen > ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial > >environment variable > > > >[External Email] Do not click links or attachments unless you recognize the > >sender and know the content is safe > > > >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel > ><pragnesh.patel@sifive.com> wrote: > >> > >> Use the OTP DM driver to set the serial environment variable. > >> > >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > >> --- > >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > >> board/sifive/fu540/Kconfig | 2 + > >> board/sifive/fu540/fu540.c | 111 ++++++------------ > >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode > >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > >> create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> > >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> new file mode 100644 > >> index 0000000000..db55773bd2 > >> --- /dev/null > >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> @@ -0,0 +1,14 @@ > >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> +/* > >> + * (C) Copyright 2019 SiFive, Inc > >> + */ > >> + > >> +/ { > >> + soc { > >> + otp: otp@10070000 { > >> + compatible = "sifive,fu540-c000-otp"; > >> + reg = <0x0 0x10070000 0x0 0x0FFF>; > >> + fuse-count = <0x1000>; > >> + }; > >> + }; > >> +}; > >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> new file mode 100644 > >> index 0000000000..f1735c1385 > >> --- /dev/null > >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> @@ -0,0 +1,6 @@ > >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> +/* > >> + * Copyright (C) 2019 SiFive, Inc > >> + */ > >> + > >> +#include "fu540-c000-u-boot.dtsi" > >> diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig > >> index 5ca21474de..900197bbb2 100644 > >> --- a/board/sifive/fu540/Kconfig > >> +++ b/board/sifive/fu540/Kconfig > >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy > >> imply SIFIVE_GPIO > >> imply CMD_GPIO > >> imply SMP > >> + imply MISC > >> + imply SIFIVE_OTP > > > >Mark this default y if it is SIFIVE. > > All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by "imply", so I am following the same. I think "imply" will make it default y. Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig depends on SIFIVE SoC would select this driver so-that you no need to add impy SIFIVE_OTP here. Jagan.
Hi Jagan, >-----Original Message----- >From: Jagan Teki <jagan@amarulasolutions.com> >Sent: 02 April 2020 14:59 >To: Pragnesh Patel <pragnesh.patel@sifive.com> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial >environment variable > >[External Email] Do not click links or attachments unless you recognize the >sender and know the content is safe > >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel <pragnesh.patel@sifive.com> >wrote: >> >> >> Hi Jagan, >> >> >-----Original Message----- >> >From: Jagan Teki <jagan@amarulasolutions.com> >> >Sent: 02 April 2020 14:49 >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; >Troy >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick >Chen >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver >> >for serial environment variable >> > >> >[External Email] Do not click links or attachments unless you >> >recognize the sender and know the content is safe >> > >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel >> ><pragnesh.patel@sifive.com> wrote: >> >> >> >> Use the OTP DM driver to set the serial environment variable. >> >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> >> >> --- >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + >> >> board/sifive/fu540/Kconfig | 2 + >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> new file mode 100644 >> >> index 0000000000..db55773bd2 >> >> --- /dev/null >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> @@ -0,0 +1,14 @@ >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >> >> +/* >> >> + * (C) Copyright 2019 SiFive, Inc >> >> + */ >> >> + >> >> +/ { >> >> + soc { >> >> + otp: otp@10070000 { >> >> + compatible = "sifive,fu540-c000-otp"; >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; >> >> + fuse-count = <0x1000>; >> >> + }; >> >> + }; >> >> +}; >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> new file mode 100644 >> >> index 0000000000..f1735c1385 >> >> --- /dev/null >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> @@ -0,0 +1,6 @@ >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >> >> +/* >> >> + * Copyright (C) 2019 SiFive, Inc >> >> + */ >> >> + >> >> +#include "fu540-c000-u-boot.dtsi" >> >> diff --git a/board/sifive/fu540/Kconfig >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 100644 >> >> --- a/board/sifive/fu540/Kconfig >> >> +++ b/board/sifive/fu540/Kconfig >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy >> >> imply SIFIVE_GPIO >> >> imply CMD_GPIO >> >> imply SMP >> >> + imply MISC >> >> + imply SIFIVE_OTP >> > >> >Mark this default y if it is SIFIVE. >> >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by "imply", so I >am following the same. I think "imply" will make it default y. > >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig depends on >SIFIVE SoC would select this driver so-that you no need to add impy >SIFIVE_OTP here. I am not sure if all SiFive SoC will contain SiFive OTP controller, so it's better not to make it default y. If all Sifive SoCs contain OTP controller then I need to add another Kconfig option like "RISCV_SIFIVE" as shown below, config SIFIVE_OTP default y if RISCV_SIFIVE > >Jagan.
On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > Hi Jagan, > > >-----Original Message----- > >From: Jagan Teki <jagan@amarulasolutions.com> > >Sent: 02 April 2020 14:59 > >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy > >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen > ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial > >environment variable > > > >[External Email] Do not click links or attachments unless you recognize the > >sender and know the content is safe > > > >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel <pragnesh.patel@sifive.com> > >wrote: > >> > >> > >> Hi Jagan, > >> > >> >-----Original Message----- > >> >From: Jagan Teki <jagan@amarulasolutions.com> > >> >Sent: 02 April 2020 14:49 > >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > >Troy > >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > >Chen > >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver > >> >for serial environment variable > >> > > >> >[External Email] Do not click links or attachments unless you > >> >recognize the sender and know the content is safe > >> > > >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel > >> ><pragnesh.patel@sifive.com> wrote: > >> >> > >> >> Use the OTP DM driver to set the serial environment variable. > >> >> > >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >> --- > >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > >> >> board/sifive/fu540/Kconfig | 2 + > >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ > >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode > >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> > >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> new file mode 100644 > >> >> index 0000000000..db55773bd2 > >> >> --- /dev/null > >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> @@ -0,0 +1,14 @@ > >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> >> +/* > >> >> + * (C) Copyright 2019 SiFive, Inc > >> >> + */ > >> >> + > >> >> +/ { > >> >> + soc { > >> >> + otp: otp@10070000 { > >> >> + compatible = "sifive,fu540-c000-otp"; > >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; > >> >> + fuse-count = <0x1000>; > >> >> + }; > >> >> + }; > >> >> +}; > >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> new file mode 100644 > >> >> index 0000000000..f1735c1385 > >> >> --- /dev/null > >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> @@ -0,0 +1,6 @@ > >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> >> +/* > >> >> + * Copyright (C) 2019 SiFive, Inc > >> >> + */ > >> >> + > >> >> +#include "fu540-c000-u-boot.dtsi" > >> >> diff --git a/board/sifive/fu540/Kconfig > >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 100644 > >> >> --- a/board/sifive/fu540/Kconfig > >> >> +++ b/board/sifive/fu540/Kconfig > >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy > >> >> imply SIFIVE_GPIO > >> >> imply CMD_GPIO > >> >> imply SMP > >> >> + imply MISC > >> >> + imply SIFIVE_OTP > >> > > >> >Mark this default y if it is SIFIVE. > >> > >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by "imply", so I > >am following the same. I think "imply" will make it default y. > > > >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig depends on > >SIFIVE SoC would select this driver so-that you no need to add impy > >SIFIVE_OTP here. > > I am not sure if all SiFive SoC will contain SiFive OTP controller, so it's better not to make it default y. > > If all Sifive SoCs contain OTP controller then I need to add another Kconfig option like "RISCV_SIFIVE" as shown below, > config SIFIVE_OTP > default y if RISCV_SIFIVE Yes, use this TARGET_SIFIVE_FU540 Jagan.
Hi Jagan, >-----Original Message----- >From: Jagan Teki <jagan@amarulasolutions.com> >Sent: 07 April 2020 13:32 >To: Pragnesh Patel <pragnesh.patel@sifive.com> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial >environment variable > >[External Email] Do not click links or attachments unless you recognize the >sender and know the content is safe > >On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel <pragnesh.patel@sifive.com> >wrote: >> >> Hi Jagan, >> >> >-----Original Message----- >> >From: Jagan Teki <jagan@amarulasolutions.com> >> >Sent: 02 April 2020 14:59 >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; >Troy >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick >Chen >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver >> >for serial environment variable >> > >> >[External Email] Do not click links or attachments unless you >> >recognize the sender and know the content is safe >> > >> >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel >> ><pragnesh.patel@sifive.com> >> >wrote: >> >> >> >> >> >> Hi Jagan, >> >> >> >> >-----Original Message----- >> >> >From: Jagan Teki <jagan@amarulasolutions.com> >> >> >Sent: 02 April 2020 14:49 >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng >> >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; >> >Troy >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick >> >Chen >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM >> >> >driver for serial environment variable >> >> > >> >> >[External Email] Do not click links or attachments unless you >> >> >recognize the sender and know the content is safe >> >> > >> >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel >> >> ><pragnesh.patel@sifive.com> wrote: >> >> >> >> >> >> Use the OTP DM driver to set the serial environment variable. >> >> >> >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> >> >> >> --- >> >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ >> >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + >> >> >> board/sifive/fu540/Kconfig | 2 + >> >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ >> >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode >> >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> >> create mode 100644 >> >> >> arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> >> >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> >> new file mode 100644 >> >> >> index 0000000000..db55773bd2 >> >> >> --- /dev/null >> >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> >> @@ -0,0 +1,14 @@ >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >> >> >> +/* >> >> >> + * (C) Copyright 2019 SiFive, Inc */ >> >> >> + >> >> >> +/ { >> >> >> + soc { >> >> >> + otp: otp@10070000 { >> >> >> + compatible = "sifive,fu540-c000-otp"; >> >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; >> >> >> + fuse-count = <0x1000>; >> >> >> + }; >> >> >> + }; >> >> >> +}; >> >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> new file mode 100644 >> >> >> index 0000000000..f1735c1385 >> >> >> --- /dev/null >> >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> @@ -0,0 +1,6 @@ >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >> >> >> +/* >> >> >> + * Copyright (C) 2019 SiFive, Inc */ >> >> >> + >> >> >> +#include "fu540-c000-u-boot.dtsi" >> >> >> diff --git a/board/sifive/fu540/Kconfig >> >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 100644 >> >> >> --- a/board/sifive/fu540/Kconfig >> >> >> +++ b/board/sifive/fu540/Kconfig >> >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy >> >> >> imply SIFIVE_GPIO >> >> >> imply CMD_GPIO >> >> >> imply SMP >> >> >> + imply MISC >> >> >> + imply SIFIVE_OTP >> >> > >> >> >Mark this default y if it is SIFIVE. >> >> >> >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by >> >> "imply", so I >> >am following the same. I think "imply" will make it default y. >> > >> >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig >> >depends on SIFIVE SoC would select this driver so-that you no need to >> >add impy SIFIVE_OTP here. >> >> I am not sure if all SiFive SoC will contain SiFive OTP controller, so it's better >not to make it default y. >> >> If all Sifive SoCs contain OTP controller then I need to add another >> Kconfig option like "RISCV_SIFIVE" as shown below, config SIFIVE_OTP >> default y if RISCV_SIFIVE > >Yes, use this TARGET_SIFIVE_FU540 I am okay with this but if other future SiFive SoCs support this OTP then it would be a long chain. What's your opinion on this ? > >Jagan.
On Tue, Apr 7, 2020 at 1:40 PM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > Hi Jagan, > > >-----Original Message----- > >From: Jagan Teki <jagan@amarulasolutions.com> > >Sent: 07 April 2020 13:32 > >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy > >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen > ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial > >environment variable > > > >[External Email] Do not click links or attachments unless you recognize the > >sender and know the content is safe > > > >On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel <pragnesh.patel@sifive.com> > >wrote: > >> > >> Hi Jagan, > >> > >> >-----Original Message----- > >> >From: Jagan Teki <jagan@amarulasolutions.com> > >> >Sent: 02 April 2020 14:59 > >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > >Troy > >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > >Chen > >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver > >> >for serial environment variable > >> > > >> >[External Email] Do not click links or attachments unless you > >> >recognize the sender and know the content is safe > >> > > >> >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel > >> ><pragnesh.patel@sifive.com> > >> >wrote: > >> >> > >> >> > >> >> Hi Jagan, > >> >> > >> >> >-----Original Message----- > >> >> >From: Jagan Teki <jagan@amarulasolutions.com> > >> >> >Sent: 02 April 2020 14:49 > >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > >> >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > >> >Troy > >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > >> >Chen > >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM > >> >> >driver for serial environment variable > >> >> > > >> >> >[External Email] Do not click links or attachments unless you > >> >> >recognize the sender and know the content is safe > >> >> > > >> >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel > >> >> ><pragnesh.patel@sifive.com> wrote: > >> >> >> > >> >> >> Use the OTP DM driver to set the serial environment variable. > >> >> >> > >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >> >> --- > >> >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > >> >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > >> >> >> board/sifive/fu540/Kconfig | 2 + > >> >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ > >> >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode > >> >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> >> create mode 100644 > >> >> >> arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> >> > >> >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> >> new file mode 100644 > >> >> >> index 0000000000..db55773bd2 > >> >> >> --- /dev/null > >> >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> >> @@ -0,0 +1,14 @@ > >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> >> >> +/* > >> >> >> + * (C) Copyright 2019 SiFive, Inc */ > >> >> >> + > >> >> >> +/ { > >> >> >> + soc { > >> >> >> + otp: otp@10070000 { > >> >> >> + compatible = "sifive,fu540-c000-otp"; > >> >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; > >> >> >> + fuse-count = <0x1000>; > >> >> >> + }; > >> >> >> + }; > >> >> >> +}; > >> >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> >> new file mode 100644 > >> >> >> index 0000000000..f1735c1385 > >> >> >> --- /dev/null > >> >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> >> @@ -0,0 +1,6 @@ > >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> >> >> +/* > >> >> >> + * Copyright (C) 2019 SiFive, Inc */ > >> >> >> + > >> >> >> +#include "fu540-c000-u-boot.dtsi" > >> >> >> diff --git a/board/sifive/fu540/Kconfig > >> >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 100644 > >> >> >> --- a/board/sifive/fu540/Kconfig > >> >> >> +++ b/board/sifive/fu540/Kconfig > >> >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy > >> >> >> imply SIFIVE_GPIO > >> >> >> imply CMD_GPIO > >> >> >> imply SMP > >> >> >> + imply MISC > >> >> >> + imply SIFIVE_OTP > >> >> > > >> >> >Mark this default y if it is SIFIVE. > >> >> > >> >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by > >> >> "imply", so I > >> >am following the same. I think "imply" will make it default y. > >> > > >> >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig > >> >depends on SIFIVE SoC would select this driver so-that you no need to > >> >add impy SIFIVE_OTP here. > >> > >> I am not sure if all SiFive SoC will contain SiFive OTP controller, so it's better > >not to make it default y. > >> > >> If all Sifive SoCs contain OTP controller then I need to add another > >> Kconfig option like "RISCV_SIFIVE" as shown below, config SIFIVE_OTP > >> default y if RISCV_SIFIVE > > > >Yes, use this TARGET_SIFIVE_FU540 > > I am okay with this but if other future SiFive SoCs support this OTP then it would be a long chain. > What's your opinion on this ? That is fine, these are at least SoC not boards. boards will increment a lot but SoC may not. Having SoC dependency or select would be meaningful. Jagan.
Hi Jagan, >-----Original Message----- >From: Jagan Teki <jagan@amarulasolutions.com> >Sent: 07 April 2020 14:51 >To: Pragnesh Patel <pragnesh.patel@sifive.com> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial >environment variable > >[External Email] Do not click links or attachments unless you recognize the >sender and know the content is safe > >On Tue, Apr 7, 2020 at 1:40 PM Pragnesh Patel <pragnesh.patel@sifive.com> >wrote: >> >> Hi Jagan, >> >> >-----Original Message----- >> >From: Jagan Teki <jagan@amarulasolutions.com> >> >Sent: 07 April 2020 13:32 >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; >Troy >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick >Chen >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver >> >for serial environment variable >> > >> >[External Email] Do not click links or attachments unless you >> >recognize the sender and know the content is safe >> > >> >On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel >> ><pragnesh.patel@sifive.com> >> >wrote: >> >> >> >> Hi Jagan, >> >> >> >> >-----Original Message----- >> >> >From: Jagan Teki <jagan@amarulasolutions.com> >> >> >Sent: 02 April 2020 14:59 >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng >> >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; >> >Troy >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick >> >Chen >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM >> >> >driver for serial environment variable >> >> > >> >> >[External Email] Do not click links or attachments unless you >> >> >recognize the sender and know the content is safe >> >> > >> >> >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel >> >> ><pragnesh.patel@sifive.com> >> >> >wrote: >> >> >> >> >> >> >> >> >> Hi Jagan, >> >> >> >> >> >> >-----Original Message----- >> >> >> >From: Jagan Teki <jagan@amarulasolutions.com> >> >> >> >Sent: 02 April 2020 14:49 >> >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> >> >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra >> >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng >> >> >> ><bmeng.cn@gmail.com>; Paul Walmsley ><paul.walmsley@sifive.com>; >> >> >Troy >> >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel >> >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; >> >> >> >Rick >> >> >Chen >> >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> >> >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM >> >> >> >driver for serial environment variable >> >> >> > >> >> >> >[External Email] Do not click links or attachments unless you >> >> >> >recognize the sender and know the content is safe >> >> >> > >> >> >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel >> >> >> ><pragnesh.patel@sifive.com> wrote: >> >> >> >> >> >> >> >> Use the OTP DM driver to set the serial environment variable. >> >> >> >> >> >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> >> >> >> >> --- >> >> >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ >> >> >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + >> >> >> >> board/sifive/fu540/Kconfig | 2 + >> >> >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ >> >> >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create >> >> >> >> mode >> >> >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> >> >> create mode 100644 >> >> >> >> arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> >> >> >> >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> >> >> new file mode 100644 >> >> >> >> index 0000000000..db55773bd2 >> >> >> >> --- /dev/null >> >> >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi >> >> >> >> @@ -0,0 +1,14 @@ >> >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >> >> >> >> +/* >> >> >> >> + * (C) Copyright 2019 SiFive, Inc */ >> >> >> >> + >> >> >> >> +/ { >> >> >> >> + soc { >> >> >> >> + otp: otp@10070000 { >> >> >> >> + compatible = "sifive,fu540-c000-otp"; >> >> >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; >> >> >> >> + fuse-count = <0x1000>; >> >> >> >> + }; >> >> >> >> + }; >> >> >> >> +}; >> >> >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> >> new file mode 100644 >> >> >> >> index 0000000000..f1735c1385 >> >> >> >> --- /dev/null >> >> >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi >> >> >> >> @@ -0,0 +1,6 @@ >> >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) >> >> >> >> +/* >> >> >> >> + * Copyright (C) 2019 SiFive, Inc */ >> >> >> >> + >> >> >> >> +#include "fu540-c000-u-boot.dtsi" >> >> >> >> diff --git a/board/sifive/fu540/Kconfig >> >> >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 >> >> >> >> 100644 >> >> >> >> --- a/board/sifive/fu540/Kconfig >> >> >> >> +++ b/board/sifive/fu540/Kconfig >> >> >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy >> >> >> >> imply SIFIVE_GPIO >> >> >> >> imply CMD_GPIO >> >> >> >> imply SMP >> >> >> >> + imply MISC >> >> >> >> + imply SIFIVE_OTP >> >> >> > >> >> >> >Mark this default y if it is SIFIVE. >> >> >> >> >> >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled >> >> >> by "imply", so I >> >> >am following the same. I think "imply" will make it default y. >> >> > >> >> >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig >> >> >depends on SIFIVE SoC would select this driver so-that you no need >> >> >to add impy SIFIVE_OTP here. >> >> >> >> I am not sure if all SiFive SoC will contain SiFive OTP controller, >> >> so it's better >> >not to make it default y. >> >> >> >> If all Sifive SoCs contain OTP controller then I need to add >> >> another Kconfig option like "RISCV_SIFIVE" as shown below, config >SIFIVE_OTP >> >> default y if RISCV_SIFIVE >> > >> >Yes, use this TARGET_SIFIVE_FU540 >> >> I am okay with this but if other future SiFive SoCs support this OTP then it >would be a long chain. >> What's your opinion on this ? > >That is fine, these are at least SoC not boards. boards will increment a lot but >SoC may not. Having SoC dependency or select would be meaningful. Will update this in v7. > >Jagan.
On Wed, Apr 8, 2020 at 12:44 PM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > Hi Jagan, > > >-----Original Message----- > >From: Jagan Teki <jagan@amarulasolutions.com> > >Sent: 07 April 2020 14:51 > >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy > >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen > ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial > >environment variable > > > >[External Email] Do not click links or attachments unless you recognize the > >sender and know the content is safe > > > >On Tue, Apr 7, 2020 at 1:40 PM Pragnesh Patel <pragnesh.patel@sifive.com> > >wrote: > >> > >> Hi Jagan, > >> > >> >-----Original Message----- > >> >From: Jagan Teki <jagan@amarulasolutions.com> > >> >Sent: 07 April 2020 13:32 > >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > >Troy > >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > >Chen > >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver > >> >for serial environment variable > >> > > >> >[External Email] Do not click links or attachments unless you > >> >recognize the sender and know the content is safe > >> > > >> >On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel > >> ><pragnesh.patel@sifive.com> > >> >wrote: > >> >> > >> >> Hi Jagan, > >> >> > >> >> >-----Original Message----- > >> >> >From: Jagan Teki <jagan@amarulasolutions.com> > >> >> >Sent: 02 April 2020 14:59 > >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > >> >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > >> >Troy > >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > >> >Chen > >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM > >> >> >driver for serial environment variable > >> >> > > >> >> >[External Email] Do not click links or attachments unless you > >> >> >recognize the sender and know the content is safe > >> >> > > >> >> >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel > >> >> ><pragnesh.patel@sifive.com> > >> >> >wrote: > >> >> >> > >> >> >> > >> >> >> Hi Jagan, > >> >> >> > >> >> >> >-----Original Message----- > >> >> >> >From: Jagan Teki <jagan@amarulasolutions.com> > >> >> >> >Sent: 02 April 2020 14:49 > >> >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > >> >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > >> >> >> ><bmeng.cn@gmail.com>; Paul Walmsley > ><paul.walmsley@sifive.com>; > >> >> >Troy > >> >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > >> >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; > >> >> >> >Rick > >> >> >Chen > >> >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > >> >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM > >> >> >> >driver for serial environment variable > >> >> >> > > >> >> >> >[External Email] Do not click links or attachments unless you > >> >> >> >recognize the sender and know the content is safe > >> >> >> > > >> >> >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel > >> >> >> ><pragnesh.patel@sifive.com> wrote: > >> >> >> >> > >> >> >> >> Use the OTP DM driver to set the serial environment variable. > >> >> >> >> > >> >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > >> >> >> >> --- > >> >> >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > >> >> >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > >> >> >> >> board/sifive/fu540/Kconfig | 2 + > >> >> >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ > >> >> >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create > >> >> >> >> mode > >> >> >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> >> >> create mode 100644 > >> >> >> >> arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> >> >> > >> >> >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> >> >> new file mode 100644 > >> >> >> >> index 0000000000..db55773bd2 > >> >> >> >> --- /dev/null > >> >> >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi > >> >> >> >> @@ -0,0 +1,14 @@ > >> >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> >> >> >> +/* > >> >> >> >> + * (C) Copyright 2019 SiFive, Inc */ > >> >> >> >> + > >> >> >> >> +/ { > >> >> >> >> + soc { > >> >> >> >> + otp: otp@10070000 { > >> >> >> >> + compatible = "sifive,fu540-c000-otp"; > >> >> >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; > >> >> >> >> + fuse-count = <0x1000>; > >> >> >> >> + }; > >> >> >> >> + }; > >> >> >> >> +}; > >> >> >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> >> >> new file mode 100644 > >> >> >> >> index 0000000000..f1735c1385 > >> >> >> >> --- /dev/null > >> >> >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > >> >> >> >> @@ -0,0 +1,6 @@ > >> >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> >> >> >> +/* > >> >> >> >> + * Copyright (C) 2019 SiFive, Inc */ > >> >> >> >> + > >> >> >> >> +#include "fu540-c000-u-boot.dtsi" > >> >> >> >> diff --git a/board/sifive/fu540/Kconfig > >> >> >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 > >> >> >> >> 100644 > >> >> >> >> --- a/board/sifive/fu540/Kconfig > >> >> >> >> +++ b/board/sifive/fu540/Kconfig > >> >> >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy > >> >> >> >> imply SIFIVE_GPIO > >> >> >> >> imply CMD_GPIO > >> >> >> >> imply SMP > >> >> >> >> + imply MISC > >> >> >> >> + imply SIFIVE_OTP > >> >> >> > > >> >> >> >Mark this default y if it is SIFIVE. > >> >> >> > >> >> >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled > >> >> >> by "imply", so I > >> >> >am following the same. I think "imply" will make it default y. > >> >> > > >> >> >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig > >> >> >depends on SIFIVE SoC would select this driver so-that you no need > >> >> >to add impy SIFIVE_OTP here. > >> >> > >> >> I am not sure if all SiFive SoC will contain SiFive OTP controller, > >> >> so it's better > >> >not to make it default y. > >> >> > >> >> If all Sifive SoCs contain OTP controller then I need to add > >> >> another Kconfig option like "RISCV_SIFIVE" as shown below, config > >SIFIVE_OTP > >> >> default y if RISCV_SIFIVE > >> > > >> >Yes, use this TARGET_SIFIVE_FU540 > >> > >> I am okay with this but if other future SiFive SoCs support this OTP then it > >would be a long chain. > >> What's your opinion on this ? > > > >That is fine, these are at least SoC not boards. boards will increment a lot but > >SoC may not. Having SoC dependency or select would be meaningful. > > Will update this in v7. Sorry replied the wrong version thread. We should target to bring the FU540 U-Boot SPL support in U-Boot v2020.07. I would like to have some test on this series. Regards, Bin
Hi Jagan, On Tue, Apr 7, 2020 at 5:21 PM Jagan Teki <jagan@amarulasolutions.com> wrote: > > On Tue, Apr 7, 2020 at 1:40 PM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > > > Hi Jagan, > > > > >-----Original Message----- > > >From: Jagan Teki <jagan@amarulasolutions.com> > > >Sent: 07 April 2020 13:32 > > >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy > > >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen > > ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial > > >environment variable > > > > > >[External Email] Do not click links or attachments unless you recognize the > > >sender and know the content is safe > > > > > >On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel <pragnesh.patel@sifive.com> > > >wrote: > > >> > > >> Hi Jagan, > > >> > > >> >-----Original Message----- > > >> >From: Jagan Teki <jagan@amarulasolutions.com> > > >> >Sent: 02 April 2020 14:59 > > >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > > >Troy > > >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > > >Chen > > >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver > > >> >for serial environment variable > > >> > > > >> >[External Email] Do not click links or attachments unless you > > >> >recognize the sender and know the content is safe > > >> > > > >> >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel > > >> ><pragnesh.patel@sifive.com> > > >> >wrote: > > >> >> > > >> >> > > >> >> Hi Jagan, > > >> >> > > >> >> >-----Original Message----- > > >> >> >From: Jagan Teki <jagan@amarulasolutions.com> > > >> >> >Sent: 02 April 2020 14:49 > > >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > >> >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > > >> >Troy > > >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > > >> >Chen > > >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM > > >> >> >driver for serial environment variable > > >> >> > > > >> >> >[External Email] Do not click links or attachments unless you > > >> >> >recognize the sender and know the content is safe > > >> >> > > > >> >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel > > >> >> ><pragnesh.patel@sifive.com> wrote: > > >> >> >> > > >> >> >> Use the OTP DM driver to set the serial environment variable. > > >> >> >> > > >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > > >> >> >> --- > > >> >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > > >> >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > > >> >> >> board/sifive/fu540/Kconfig | 2 + > > >> >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ > > >> >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode > > >> >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > > >> >> >> create mode 100644 > > >> >> >> arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > >> >> >> > > >> >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi > > >> >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi > > >> >> >> new file mode 100644 > > >> >> >> index 0000000000..db55773bd2 > > >> >> >> --- /dev/null > > >> >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi > > >> >> >> @@ -0,0 +1,14 @@ > > >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > > >> >> >> +/* > > >> >> >> + * (C) Copyright 2019 SiFive, Inc */ > > >> >> >> + > > >> >> >> +/ { > > >> >> >> + soc { > > >> >> >> + otp: otp@10070000 { > > >> >> >> + compatible = "sifive,fu540-c000-otp"; > > >> >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; > > >> >> >> + fuse-count = <0x1000>; > > >> >> >> + }; > > >> >> >> + }; > > >> >> >> +}; > > >> >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > >> >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > >> >> >> new file mode 100644 > > >> >> >> index 0000000000..f1735c1385 > > >> >> >> --- /dev/null > > >> >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > >> >> >> @@ -0,0 +1,6 @@ > > >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > > >> >> >> +/* > > >> >> >> + * Copyright (C) 2019 SiFive, Inc */ > > >> >> >> + > > >> >> >> +#include "fu540-c000-u-boot.dtsi" > > >> >> >> diff --git a/board/sifive/fu540/Kconfig > > >> >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 100644 > > >> >> >> --- a/board/sifive/fu540/Kconfig > > >> >> >> +++ b/board/sifive/fu540/Kconfig > > >> >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy > > >> >> >> imply SIFIVE_GPIO > > >> >> >> imply CMD_GPIO > > >> >> >> imply SMP > > >> >> >> + imply MISC > > >> >> >> + imply SIFIVE_OTP > > >> >> > > > >> >> >Mark this default y if it is SIFIVE. > > >> >> > > >> >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by > > >> >> "imply", so I > > >> >am following the same. I think "imply" will make it default y. > > >> > > > >> >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig > > >> >depends on SIFIVE SoC would select this driver so-that you no need to > > >> >add impy SIFIVE_OTP here. > > >> > > >> I am not sure if all SiFive SoC will contain SiFive OTP controller, so it's better > > >not to make it default y. > > >> > > >> If all Sifive SoCs contain OTP controller then I need to add another > > >> Kconfig option like "RISCV_SIFIVE" as shown below, config SIFIVE_OTP > > >> default y if RISCV_SIFIVE > > > > > >Yes, use this TARGET_SIFIVE_FU540 > > > > I am okay with this but if other future SiFive SoCs support this OTP then it would be a long chain. > > What's your opinion on this ? > > That is fine, these are at least SoC not boards. boards will increment > a lot but SoC may not. Having SoC dependency or select would be > meaningful. > I am not in favor of adding default y if TARGET_SIFIVE_FU540 in the driver Kconfig file. I think we can add the "imply" or "select" in the SoC Kconfig file instead if adding such "imply" in the board level Kconfig is a concern. See an example of arch/x86/cpu/baytrail/Kconfig config INTEL_BAYTRAIL bool select HAVE_FSP select ARCH_MISC_INIT select CPU_INTEL_TURBO_NOT_PACKAGE_SCOPED imply HAVE_INTEL_ME imply ENABLE_MRC_CACHE imply AHCI_PCI imply ICH_SPI imply INTEL_ICH6_GPIO imply PINCTRL_ICH6 imply MMC imply MMC_PCI imply MMC_SDHCI imply MMC_SDHCI_SDMA imply SCSI imply SCSI_AHCI imply SPI_FLASH imply SYS_NS16550 imply USB imply USB_EHCI_HCD imply USB_XHCI_HCD imply VIDEO_VESA Regards, Bin
On Mon, Mar 30, 2020 at 1:06 AM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > Use the OTP DM driver to set the serial environment variable. > > Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > --- > arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > board/sifive/fu540/Kconfig | 2 + > board/sifive/fu540/fu540.c | 111 ++++++------------ > 4 files changed, 61 insertions(+), 72 deletions(-) > create mode 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Hi Bin, On Mon, Apr 20, 2020 at 1:24 PM Bin Meng <bmeng.cn@gmail.com> wrote: > > Hi Jagan, > > On Tue, Apr 7, 2020 at 5:21 PM Jagan Teki <jagan@amarulasolutions.com> wrote: > > > > On Tue, Apr 7, 2020 at 1:40 PM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > > > > > Hi Jagan, > > > > > > >-----Original Message----- > > > >From: Jagan Teki <jagan@amarulasolutions.com> > > > >Sent: 07 April 2020 13:32 > > > >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > > >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > > ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > > ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy > > > >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > > ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen > > > ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > > >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial > > > >environment variable > > > > > > > >[External Email] Do not click links or attachments unless you recognize the > > > >sender and know the content is safe > > > > > > > >On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel <pragnesh.patel@sifive.com> > > > >wrote: > > > >> > > > >> Hi Jagan, > > > >> > > > >> >-----Original Message----- > > > >> >From: Jagan Teki <jagan@amarulasolutions.com> > > > >> >Sent: 02 April 2020 14:59 > > > >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > > >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > > >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > > >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > > > >Troy > > > >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > > >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > > > >Chen > > > >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > > >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver > > > >> >for serial environment variable > > > >> > > > > >> >[External Email] Do not click links or attachments unless you > > > >> >recognize the sender and know the content is safe > > > >> > > > > >> >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel > > > >> ><pragnesh.patel@sifive.com> > > > >> >wrote: > > > >> >> > > > >> >> > > > >> >> Hi Jagan, > > > >> >> > > > >> >> >-----Original Message----- > > > >> >> >From: Jagan Teki <jagan@amarulasolutions.com> > > > >> >> >Sent: 02 April 2020 14:49 > > > >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > > >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > > >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > > >> >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > > > >> >Troy > > > >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > > >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > > > >> >Chen > > > >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > > >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM > > > >> >> >driver for serial environment variable > > > >> >> > > > > >> >> >[External Email] Do not click links or attachments unless you > > > >> >> >recognize the sender and know the content is safe > > > >> >> > > > > >> >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel > > > >> >> ><pragnesh.patel@sifive.com> wrote: > > > >> >> >> > > > >> >> >> Use the OTP DM driver to set the serial environment variable. > > > >> >> >> > > > >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > > > >> >> >> --- > > > >> >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > > > >> >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > > > >> >> >> board/sifive/fu540/Kconfig | 2 + > > > >> >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ > > > >> >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode > > > >> >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > > > >> >> >> create mode 100644 > > > >> >> >> arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > >> >> >> > > > >> >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi > > > >> >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi > > > >> >> >> new file mode 100644 > > > >> >> >> index 0000000000..db55773bd2 > > > >> >> >> --- /dev/null > > > >> >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi > > > >> >> >> @@ -0,0 +1,14 @@ > > > >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > > > >> >> >> +/* > > > >> >> >> + * (C) Copyright 2019 SiFive, Inc */ > > > >> >> >> + > > > >> >> >> +/ { > > > >> >> >> + soc { > > > >> >> >> + otp: otp@10070000 { > > > >> >> >> + compatible = "sifive,fu540-c000-otp"; > > > >> >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; > > > >> >> >> + fuse-count = <0x1000>; > > > >> >> >> + }; > > > >> >> >> + }; > > > >> >> >> +}; > > > >> >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > >> >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > >> >> >> new file mode 100644 > > > >> >> >> index 0000000000..f1735c1385 > > > >> >> >> --- /dev/null > > > >> >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > >> >> >> @@ -0,0 +1,6 @@ > > > >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > > > >> >> >> +/* > > > >> >> >> + * Copyright (C) 2019 SiFive, Inc */ > > > >> >> >> + > > > >> >> >> +#include "fu540-c000-u-boot.dtsi" > > > >> >> >> diff --git a/board/sifive/fu540/Kconfig > > > >> >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 100644 > > > >> >> >> --- a/board/sifive/fu540/Kconfig > > > >> >> >> +++ b/board/sifive/fu540/Kconfig > > > >> >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy > > > >> >> >> imply SIFIVE_GPIO > > > >> >> >> imply CMD_GPIO > > > >> >> >> imply SMP > > > >> >> >> + imply MISC > > > >> >> >> + imply SIFIVE_OTP > > > >> >> > > > > >> >> >Mark this default y if it is SIFIVE. > > > >> >> > > > >> >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by > > > >> >> "imply", so I > > > >> >am following the same. I think "imply" will make it default y. > > > >> > > > > >> >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig > > > >> >depends on SIFIVE SoC would select this driver so-that you no need to > > > >> >add impy SIFIVE_OTP here. > > > >> > > > >> I am not sure if all SiFive SoC will contain SiFive OTP controller, so it's better > > > >not to make it default y. > > > >> > > > >> If all Sifive SoCs contain OTP controller then I need to add another > > > >> Kconfig option like "RISCV_SIFIVE" as shown below, config SIFIVE_OTP > > > >> default y if RISCV_SIFIVE > > > > > > > >Yes, use this TARGET_SIFIVE_FU540 > > > > > > I am okay with this but if other future SiFive SoCs support this OTP then it would be a long chain. > > > What's your opinion on this ? > > > > That is fine, these are at least SoC not boards. boards will increment > > a lot but SoC may not. Having SoC dependency or select would be > > meaningful. > > > > I am not in favor of adding default y if TARGET_SIFIVE_FU540 in the > driver Kconfig file. > > I think we can add the "imply" or "select" in the SoC Kconfig file > instead if adding such "imply" in the board level Kconfig is a > concern. Technically this is an SoC driver and doesn't relate to a specific board and to be precise TARGET_SIFIVE_FU540 is SoC not the target(board). We do have several examples of following this strategy and having a driver selecting on board will be redundant to select the same in other boards if they use the same SoC. On this specific note, I've been encouraged to select it on driver Kconfig if SoC (TARGET_SIFIVE_FU540) is defined. Jagan.
Hi Jagan, On Mon, Apr 20, 2020 at 4:15 PM Jagan Teki <jagan@amarulasolutions.com> wrote: > > Hi Bin, > > On Mon, Apr 20, 2020 at 1:24 PM Bin Meng <bmeng.cn@gmail.com> wrote: > > > > Hi Jagan, > > > > On Tue, Apr 7, 2020 at 5:21 PM Jagan Teki <jagan@amarulasolutions.com> wrote: > > > > > > On Tue, Apr 7, 2020 at 1:40 PM Pragnesh Patel <pragnesh.patel@sifive.com> wrote: > > > > > > > > Hi Jagan, > > > > > > > > >-----Original Message----- > > > > >From: Jagan Teki <jagan@amarulasolutions.com> > > > > >Sent: 07 April 2020 13:32 > > > > >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > > > >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > > > ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > > > ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; Troy > > > > >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > > > ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick Chen > > > > ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > > > >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial > > > > >environment variable > > > > > > > > > >[External Email] Do not click links or attachments unless you recognize the > > > > >sender and know the content is safe > > > > > > > > > >On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel <pragnesh.patel@sifive.com> > > > > >wrote: > > > > >> > > > > >> Hi Jagan, > > > > >> > > > > >> >-----Original Message----- > > > > >> >From: Jagan Teki <jagan@amarulasolutions.com> > > > > >> >Sent: 02 April 2020 14:59 > > > > >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > > > >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > > > >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > > > >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > > > > >Troy > > > > >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > > > >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > > > > >Chen > > > > >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > > > >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver > > > > >> >for serial environment variable > > > > >> > > > > > >> >[External Email] Do not click links or attachments unless you > > > > >> >recognize the sender and know the content is safe > > > > >> > > > > > >> >On Thu, Apr 2, 2020 at 2:54 PM Pragnesh Patel > > > > >> ><pragnesh.patel@sifive.com> > > > > >> >wrote: > > > > >> >> > > > > >> >> > > > > >> >> Hi Jagan, > > > > >> >> > > > > >> >> >-----Original Message----- > > > > >> >> >From: Jagan Teki <jagan@amarulasolutions.com> > > > > >> >> >Sent: 02 April 2020 14:49 > > > > >> >> >To: Pragnesh Patel <pragnesh.patel@sifive.com> > > > > >> >> >Cc: U-Boot-Denx <u-boot@lists.denx.de>; Atish Patra > > > > >> >> ><atish.patra@wdc.com>; palmerdabbelt@google.com; Bin Meng > > > > >> >> ><bmeng.cn@gmail.com>; Paul Walmsley <paul.walmsley@sifive.com>; > > > > >> >Troy > > > > >> >> >Benjegerdes <troy.benjegerdes@sifive.com>; Anup Patel > > > > >> >> ><anup.patel@wdc.com>; Sagar Kadam <sagar.kadam@sifive.com>; Rick > > > > >> >Chen > > > > >> >> ><rick@andestech.com>; Palmer Dabbelt <palmer@dabbelt.com> > > > > >> >> >Subject: Re: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM > > > > >> >> >driver for serial environment variable > > > > >> >> > > > > > >> >> >[External Email] Do not click links or attachments unless you > > > > >> >> >recognize the sender and know the content is safe > > > > >> >> > > > > > >> >> >On Sun, Mar 29, 2020 at 10:36 PM Pragnesh Patel > > > > >> >> ><pragnesh.patel@sifive.com> wrote: > > > > >> >> >> > > > > >> >> >> Use the OTP DM driver to set the serial environment variable. > > > > >> >> >> > > > > >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> > > > > >> >> >> --- > > > > >> >> >> arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ > > > > >> >> >> .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + > > > > >> >> >> board/sifive/fu540/Kconfig | 2 + > > > > >> >> >> board/sifive/fu540/fu540.c | 111 ++++++------------ > > > > >> >> >> 4 files changed, 61 insertions(+), 72 deletions(-) create mode > > > > >> >> >> 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi > > > > >> >> >> create mode 100644 > > > > >> >> >> arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > > >> >> >> > > > > >> >> >> diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi > > > > >> >> >> b/arch/riscv/dts/fu540-c000-u-boot.dtsi > > > > >> >> >> new file mode 100644 > > > > >> >> >> index 0000000000..db55773bd2 > > > > >> >> >> --- /dev/null > > > > >> >> >> +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi > > > > >> >> >> @@ -0,0 +1,14 @@ > > > > >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > > > > >> >> >> +/* > > > > >> >> >> + * (C) Copyright 2019 SiFive, Inc */ > > > > >> >> >> + > > > > >> >> >> +/ { > > > > >> >> >> + soc { > > > > >> >> >> + otp: otp@10070000 { > > > > >> >> >> + compatible = "sifive,fu540-c000-otp"; > > > > >> >> >> + reg = <0x0 0x10070000 0x0 0x0FFF>; > > > > >> >> >> + fuse-count = <0x1000>; > > > > >> >> >> + }; > > > > >> >> >> + }; > > > > >> >> >> +}; > > > > >> >> >> diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > > >> >> >> b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > > >> >> >> new file mode 100644 > > > > >> >> >> index 0000000000..f1735c1385 > > > > >> >> >> --- /dev/null > > > > >> >> >> +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi > > > > >> >> >> @@ -0,0 +1,6 @@ > > > > >> >> >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > > > > >> >> >> +/* > > > > >> >> >> + * Copyright (C) 2019 SiFive, Inc */ > > > > >> >> >> + > > > > >> >> >> +#include "fu540-c000-u-boot.dtsi" > > > > >> >> >> diff --git a/board/sifive/fu540/Kconfig > > > > >> >> >> b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 100644 > > > > >> >> >> --- a/board/sifive/fu540/Kconfig > > > > >> >> >> +++ b/board/sifive/fu540/Kconfig > > > > >> >> >> @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy > > > > >> >> >> imply SIFIVE_GPIO > > > > >> >> >> imply CMD_GPIO > > > > >> >> >> imply SMP > > > > >> >> >> + imply MISC > > > > >> >> >> + imply SIFIVE_OTP > > > > >> >> > > > > > >> >> >Mark this default y if it is SIFIVE. > > > > >> >> > > > > >> >> All other SiFive drivers (SPI_SIFIVE, SIFIVE_GPIO) are enabled by > > > > >> >> "imply", so I > > > > >> >am following the same. I think "imply" will make it default y. > > > > >> > > > > > >> >Just mark 'default y' on SIFIVE_OTP area of drivers/misc/Kconfig > > > > >> >depends on SIFIVE SoC would select this driver so-that you no need to > > > > >> >add impy SIFIVE_OTP here. > > > > >> > > > > >> I am not sure if all SiFive SoC will contain SiFive OTP controller, so it's better > > > > >not to make it default y. > > > > >> > > > > >> If all Sifive SoCs contain OTP controller then I need to add another > > > > >> Kconfig option like "RISCV_SIFIVE" as shown below, config SIFIVE_OTP > > > > >> default y if RISCV_SIFIVE > > > > > > > > > >Yes, use this TARGET_SIFIVE_FU540 > > > > > > > > I am okay with this but if other future SiFive SoCs support this OTP then it would be a long chain. > > > > What's your opinion on this ? > > > > > > That is fine, these are at least SoC not boards. boards will increment > > > a lot but SoC may not. Having SoC dependency or select would be > > > meaningful. > > > > > > > I am not in favor of adding default y if TARGET_SIFIVE_FU540 in the > > driver Kconfig file. > > > > I think we can add the "imply" or "select" in the SoC Kconfig file > > instead if adding such "imply" in the board level Kconfig is a > > concern. > > Technically this is an SoC driver and doesn't relate to a specific > board and to be precise TARGET_SIFIVE_FU540 is SoC not the > target(board). We do have several examples of following this strategy > and having a driver selecting on board will be redundant to select the > same in other boards if they use the same SoC. > > On this specific note, I've been encouraged to select it on driver > Kconfig if SoC (TARGET_SIFIVE_FU540) is defined. Yes, I understand this is SoC specific. So as I mentioned let's do this in the SoC Kconfig file instead. Linux also is using the SoC Kconfig practice to select drivers. Regards, Bin
diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi b/arch/riscv/dts/fu540-c000-u-boot.dtsi new file mode 100644 index 0000000000..db55773bd2 --- /dev/null +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * (C) Copyright 2019 SiFive, Inc + */ + +/ { + soc { + otp: otp@10070000 { + compatible = "sifive,fu540-c000-otp"; + reg = <0x0 0x10070000 0x0 0x0FFF>; + fuse-count = <0x1000>; + }; + }; +}; diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi new file mode 100644 index 0000000000..f1735c1385 --- /dev/null +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2019 SiFive, Inc + */ + +#include "fu540-c000-u-boot.dtsi" diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig index 5ca21474de..900197bbb2 100644 --- a/board/sifive/fu540/Kconfig +++ b/board/sifive/fu540/Kconfig @@ -48,5 +48,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply SIFIVE_GPIO imply CMD_GPIO imply SMP + imply MISC + imply SIFIVE_OTP endif diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c index 47a2090251..540638c919 100644 --- a/board/sifive/fu540/fu540.c +++ b/board/sifive/fu540/fu540.c @@ -10,94 +10,61 @@ #include <dm.h> #include <linux/delay.h> #include <linux/io.h> +#include <misc.h> + +/* + * This define is a value used for error/unknown serial. + * If we really care about distinguishing errors and 0 is + * valid, we'll need a different one. + */ +#define ERROR_READING_SERIAL_NUMBER 0 #ifdef CONFIG_MISC_INIT_R -#define FU540_OTP_BASE_ADDR 0x10070000 - -struct fu540_otp_regs { - u32 pa; /* Address input */ - u32 paio; /* Program address input */ - u32 pas; /* Program redundancy cell selection input */ - u32 pce; /* OTP Macro enable input */ - u32 pclk; /* Clock input */ - u32 pdin; /* Write data input */ - u32 pdout; /* Read data output */ - u32 pdstb; /* Deep standby mode enable input (active low) */ - u32 pprog; /* Program mode enable input */ - u32 ptc; /* Test column enable input */ - u32 ptm; /* Test mode enable input */ - u32 ptm_rep;/* Repair function test mode enable input */ - u32 ptr; /* Test row enable input */ - u32 ptrim; /* Repair function enable input */ - u32 pwe; /* Write enable input (defines program cycle) */ -} __packed; - -#define BYTES_PER_FUSE 4 -#define NUM_FUSES 0x1000 - -static int fu540_otp_read(int offset, void *buf, int size) +#if CONFIG_IS_ENABLED(SIFIVE_OTP) +static u32 otp_read_serialnum(struct udevice *dev) { - struct fu540_otp_regs *regs = (void __iomem *)FU540_OTP_BASE_ADDR; - unsigned int i; - int fuseidx = offset / BYTES_PER_FUSE; - int fusecount = size / BYTES_PER_FUSE; - u32 fusebuf[fusecount]; - - /* check bounds */ - if (offset < 0 || size < 0) - return -EINVAL; - if (fuseidx >= NUM_FUSES) - return -EINVAL; - if ((fuseidx + fusecount) > NUM_FUSES) - return -EINVAL; + int ret; + u32 serial[2] = {0}; - /* init OTP */ - writel(0x01, ®s->pdstb); /* wake up from stand-by */ - writel(0x01, ®s->ptrim); /* enable repair function */ - writel(0x01, ®s->pce); /* enable input */ - - /* read all requested fuses */ - for (i = 0; i < fusecount; i++, fuseidx++) { - writel(fuseidx, ®s->pa); - - /* cycle clock to read */ - writel(0x01, ®s->pclk); - mdelay(1); - writel(0x00, ®s->pclk); - mdelay(1); - - /* read the value */ - fusebuf[i] = readl(®s->pdout); - } + for (int i = 0xfe * 4; i > 0; i -= 8) { + ret = misc_read(dev, i, serial, sizeof(serial)); - /* shut down */ - writel(0, ®s->pce); - writel(0, ®s->ptrim); - writel(0, ®s->pdstb); + if (ret != sizeof(serial)) { + printf("%s: error reading serial from OTP\n", __func__); + break; + } - /* copy out */ - memcpy(buf, fusebuf, size); + if (serial[0] == ~serial[1]) + return serial[0]; + } - return 0; + return ERROR_READING_SERIAL_NUMBER; } +#endif static u32 fu540_read_serialnum(void) { + u32 serial = ERROR_READING_SERIAL_NUMBER; + +#if CONFIG_IS_ENABLED(SIFIVE_OTP) + struct udevice *dev; int ret; - u32 serial[2] = {0}; - for (int i = 0xfe * 4; i > 0; i -= 8) { - ret = fu540_otp_read(i, serial, sizeof(serial)); - if (ret) { - printf("%s: error reading from OTP\n", __func__); - break; - } - if (serial[0] == ~serial[1]) - return serial[0]; + /* init OTP */ + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_GET_DRIVER(sifive_otp), &dev); + + if (ret) { + debug("%s: could not find otp device\n", __func__); + return serial; } - return 0; + /* read serial from OTP and set env var */ + serial = otp_read_serialnum(dev); +#endif + + return serial; } static void fu540_setup_macaddr(u32 serialnum)
Use the OTP DM driver to set the serial environment variable. Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> --- arch/riscv/dts/fu540-c000-u-boot.dtsi | 14 +++ .../dts/hifive-unleashed-a00-u-boot.dtsi | 6 + board/sifive/fu540/Kconfig | 2 + board/sifive/fu540/fu540.c | 111 ++++++------------ 4 files changed, 61 insertions(+), 72 deletions(-) create mode 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi