[PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial environment variable

Bin Meng bmeng.cn at gmail.com
Mon Apr 20 09:54:06 CEST 2020


Hi Jagan,

On Tue, Apr 7, 2020 at 5:21 PM Jagan Teki <jagan at amarulasolutions.com> wrote:
>
> On Tue, Apr 7, 2020 at 1:40 PM Pragnesh Patel <pragnesh.patel at sifive.com> wrote:
> >
> > Hi Jagan,
> >
> > >-----Original Message-----
> > >From: Jagan Teki <jagan at amarulasolutions.com>
> > >Sent: 07 April 2020 13:32
> > >To: Pragnesh Patel <pragnesh.patel at sifive.com>
> > >Cc: U-Boot-Denx <u-boot at lists.denx.de>; Atish Patra
> > ><atish.patra at wdc.com>; palmerdabbelt at google.com; Bin Meng
> > ><bmeng.cn at gmail.com>; Paul Walmsley <paul.walmsley at sifive.com>; Troy
> > >Benjegerdes <troy.benjegerdes at sifive.com>; Anup Patel
> > ><anup.patel at wdc.com>; Sagar Kadam <sagar.kadam at sifive.com>; Rick Chen
> > ><rick at andestech.com>; Palmer Dabbelt <palmer at 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 at sifive.com>
> > >wrote:
> > >>
> > >> Hi Jagan,
> > >>
> > >> >-----Original Message-----
> > >> >From: Jagan Teki <jagan at amarulasolutions.com>
> > >> >Sent: 02 April 2020 14:59
> > >> >To: Pragnesh Patel <pragnesh.patel at sifive.com>
> > >> >Cc: U-Boot-Denx <u-boot at lists.denx.de>; Atish Patra
> > >> ><atish.patra at wdc.com>; palmerdabbelt at google.com; Bin Meng
> > >> ><bmeng.cn at gmail.com>; Paul Walmsley <paul.walmsley at sifive.com>;
> > >Troy
> > >> >Benjegerdes <troy.benjegerdes at sifive.com>; Anup Patel
> > >> ><anup.patel at wdc.com>; Sagar Kadam <sagar.kadam at sifive.com>; Rick
> > >Chen
> > >> ><rick at andestech.com>; Palmer Dabbelt <palmer at 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 at sifive.com>
> > >> >wrote:
> > >> >>
> > >> >>
> > >> >> Hi Jagan,
> > >> >>
> > >> >> >-----Original Message-----
> > >> >> >From: Jagan Teki <jagan at amarulasolutions.com>
> > >> >> >Sent: 02 April 2020 14:49
> > >> >> >To: Pragnesh Patel <pragnesh.patel at sifive.com>
> > >> >> >Cc: U-Boot-Denx <u-boot at lists.denx.de>; Atish Patra
> > >> >> ><atish.patra at wdc.com>; palmerdabbelt at google.com; Bin Meng
> > >> >> ><bmeng.cn at gmail.com>; Paul Walmsley <paul.walmsley at sifive.com>;
> > >> >Troy
> > >> >> >Benjegerdes <troy.benjegerdes at sifive.com>; Anup Patel
> > >> >> ><anup.patel at wdc.com>; Sagar Kadam <sagar.kadam at sifive.com>; Rick
> > >> >Chen
> > >> >> ><rick at andestech.com>; Palmer Dabbelt <palmer at 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 at sifive.com> wrote:
> > >> >> >>
> > >> >> >> Use the OTP DM driver to set the serial environment variable.
> > >> >> >>
> > >> >> >> Signed-off-by: Pragnesh Patel <pragnesh.patel at 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 at 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


More information about the U-Boot mailing list