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

Pragnesh Patel pragnesh.patel at sifive.com
Tue Apr 7 10:10:00 CEST 2020


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 ?

>
>Jagan.


More information about the U-Boot mailing list