From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jagan Teki Date: Tue, 7 Apr 2020 13:32:08 +0530 Subject: [PATCH v6 02/17] riscv: sifive: fu540: Use OTP DM driver for serial environment variable In-Reply-To: References: <20200329170538.25449-1-pragnesh.patel@sifive.com> <20200329170538.25449-3-pragnesh.patel@sifive.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Apr 2, 2020 at 3:47 PM Pragnesh Patel wrote: > > Hi Jagan, > > >-----Original Message----- > >From: Jagan Teki > >Sent: 02 April 2020 14:59 > >To: Pragnesh Patel > >Cc: U-Boot-Denx ; Atish Patra > >; palmerdabbelt at google.com; Bin Meng > >; Paul Walmsley ; Troy > >Benjegerdes ; Anup Patel > >; Sagar Kadam ; Rick Chen > >; Palmer Dabbelt > >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 > >wrote: > >> > >> > >> Hi Jagan, > >> > >> >-----Original Message----- > >> >From: Jagan Teki > >> >Sent: 02 April 2020 14:49 > >> >To: Pragnesh Patel > >> >Cc: U-Boot-Denx ; Atish Patra > >> >; palmerdabbelt at google.com; Bin Meng > >> >; Paul Walmsley ; > >Troy > >> >Benjegerdes ; Anup Patel > >> >; Sagar Kadam ; Rick > >Chen > >> >; Palmer Dabbelt > >> >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 > >> > wrote: > >> >> > >> >> Use the OTP DM driver to set the serial environment variable. > >> >> > >> >> Signed-off-by: Pragnesh Patel > >> >> --- > >> >> 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 Jagan.