2020-04-30 10:02:12

by Sagar Shrikant Kadam

[permalink] [raw]
Subject: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.

Enable MTD based SPI-NOR framework in order to use spi flash
available on HiFive Unleashed A00 board.

Signed-off-by: Sagar Shrikant Kadam <[email protected]>
---
arch/riscv/configs/defconfig | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 4da4886..970580b 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -80,6 +80,8 @@ CONFIG_USB_STORAGE=y
CONFIG_USB_UAS=y
CONFIG_MMC=y
CONFIG_MMC_SPI=y
+CONFIG_MTD=y
+CONFIG_MTD_SPI_NOR=y
CONFIG_RTC_CLASS=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
--
2.7.4


2020-05-04 22:12:12

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.

On Thu, 30 Apr 2020 02:58:51 PDT (-0700), [email protected] wrote:
> Enable MTD based SPI-NOR framework in order to use spi flash
> available on HiFive Unleashed A00 board.
>
> Signed-off-by: Sagar Shrikant Kadam <[email protected]>
> ---
> arch/riscv/configs/defconfig | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
> index 4da4886..970580b 100644
> --- a/arch/riscv/configs/defconfig
> +++ b/arch/riscv/configs/defconfig
> @@ -80,6 +80,8 @@ CONFIG_USB_STORAGE=y
> CONFIG_USB_UAS=y
> CONFIG_MMC=y
> CONFIG_MMC_SPI=y
> +CONFIG_MTD=y
> +CONFIG_MTD_SPI_NOR=y
> CONFIG_RTC_CLASS=y
> CONFIG_VIRTIO_PCI=y
> CONFIG_VIRTIO_BALLOON=y

From the second patch's description I'm assuming that MTD still functions
correctly without that change?

2020-05-05 07:21:30

by Sagar Shrikant Kadam

[permalink] [raw]
Subject: RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.

Hello Palmer,

> -----Original Message-----
> From: Palmer Dabbelt <[email protected]>
> Sent: Tuesday, May 5, 2020 3:40 AM
> To: Sagar Kadam <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; Paul Walmsley
> <[email protected]>; [email protected]; linux-
> [email protected]; [email protected]; Sagar Kadam
> <[email protected]>
> Subject: Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed
> A00 board.
>
> [External Email] Do not click links or attachments unless you recognize the
> sender and know the content is safe
>
> On Thu, 30 Apr 2020 02:58:51 PDT (-0700), [email protected] wrote:
> > Enable MTD based SPI-NOR framework in order to use spi flash available
> > on HiFive Unleashed A00 board.
> >
> > Signed-off-by: Sagar Shrikant Kadam <[email protected]>
> > ---
> > arch/riscv/configs/defconfig | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/riscv/configs/defconfig
> > b/arch/riscv/configs/defconfig index 4da4886..970580b 100644
> > --- a/arch/riscv/configs/defconfig
> > +++ b/arch/riscv/configs/defconfig
> > @@ -80,6 +80,8 @@ CONFIG_USB_STORAGE=y CONFIG_USB_UAS=y
> CONFIG_MMC=y
> > CONFIG_MMC_SPI=y
> > +CONFIG_MTD=y
> > +CONFIG_MTD_SPI_NOR=y
> > CONFIG_RTC_CLASS=y
> > CONFIG_VIRTIO_PCI=y
> > CONFIG_VIRTIO_BALLOON=y
>
> From the second patch's description I'm assuming that MTD still functions
> correctly without that change?

Yes Palmer, the second patch is to enable QUAD write to nor flash..
MTD function's correctly without second patch.

Using the character interface (/dev/mtd0) mtd_utils (mtd_debug : erase/read/write) work fine.
We might require CONFIG_MTD_BLOCK, CONFIG_MTD_CMDLINE_PARTS in order to use MTD partitioning.
IMHO it can be at user's choice weather to use flash partitions or not, so I have not enabled. Please let me
know if I should enable these features as well.

To demonstrate a bit more with linux 5.7-rc3

Specify on U-boot prompt:
# setenv bootargs "root=/dev/ram rw console=ttySIF0 mtdparts=spi0.0:1024k(loader1),4096K(loader2),26M(rootfs)"

After booting linux will enumerate mtd partitions:
# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00001000 "loader1"
mtd1: 00400000 00001000 "loader2"
mtd2: 01a00000 00001000 "rootfs"

# cat /proc/partitions
major minor #blocks name
31 0 1024 mtdblock0
31 1 4096 mtdblock1
31 2 26624 mtdblock2

#Format mtdblock2 with mkfs.ext3/4 and mount results in
# mkfs.ext3 /dev/mtdblock2
mke2fs 1.44.5 (15-Dec-2018)
/dev/mtdblock2 contains a ext3 file system
last mounted on /mnt on Thu Jan 1 00:00:14 1970
Proceed anyway? (y,N) y
Creating filesystem with 26624 1k blocks and 6656 inodes
Filesystem UUID: 1b09252d-e313-430c-9ecb-79b0cef003ca
Superblock backups stored on blocks:
8193, 24577

Allocating group tables: done
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

# mount
none on / type rootfs (rw)
proc on /proc type proc (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=666)
tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
tmpfs on /tmp type tmpfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs on /sys type sysfs (rw,relatime)
/dev/mtdblock2 on /mnt type ext3 (rw,relatime)

Thanks & BR,
Sagar Kadam

2020-05-05 23:26:01

by Palmer Dabbelt

[permalink] [raw]
Subject: RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.

On Tue, 05 May 2020 00:18:45 PDT (-0700), [email protected] wrote:
> Hello Palmer,
>
>> -----Original Message-----
>> From: Palmer Dabbelt <[email protected]>
>> Sent: Tuesday, May 5, 2020 3:40 AM
>> To: Sagar Kadam <[email protected]>
>> Cc: [email protected]; [email protected];
>> [email protected]; [email protected]; Paul Walmsley
>> <[email protected]>; [email protected]; linux-
>> [email protected]; [email protected]; Sagar Kadam
>> <[email protected]>
>> Subject: Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed
>> A00 board.
>>
>> [External Email] Do not click links or attachments unless you recognize the
>> sender and know the content is safe
>>
>> On Thu, 30 Apr 2020 02:58:51 PDT (-0700), [email protected] wrote:
>> > Enable MTD based SPI-NOR framework in order to use spi flash available
>> > on HiFive Unleashed A00 board.
>> >
>> > Signed-off-by: Sagar Shrikant Kadam <[email protected]>
>> > ---
>> > arch/riscv/configs/defconfig | 2 ++
>> > 1 file changed, 2 insertions(+)
>> >
>> > diff --git a/arch/riscv/configs/defconfig
>> > b/arch/riscv/configs/defconfig index 4da4886..970580b 100644
>> > --- a/arch/riscv/configs/defconfig
>> > +++ b/arch/riscv/configs/defconfig
>> > @@ -80,6 +80,8 @@ CONFIG_USB_STORAGE=y CONFIG_USB_UAS=y
>> CONFIG_MMC=y
>> > CONFIG_MMC_SPI=y
>> > +CONFIG_MTD=y
>> > +CONFIG_MTD_SPI_NOR=y
>> > CONFIG_RTC_CLASS=y
>> > CONFIG_VIRTIO_PCI=y
>> > CONFIG_VIRTIO_BALLOON=y
>>
>> From the second patch's description I'm assuming that MTD still functions
>> correctly without that change?
>
> Yes Palmer, the second patch is to enable QUAD write to nor flash..
> MTD function's correctly without second patch.
>
> Using the character interface (/dev/mtd0) mtd_utils (mtd_debug : erase/read/write) work fine.
> We might require CONFIG_MTD_BLOCK, CONFIG_MTD_CMDLINE_PARTS in order to use MTD partitioning.
> IMHO it can be at user's choice weather to use flash partitions or not, so I have not enabled. Please let me
> know if I should enable these features as well.

Looks like arm64 has these:

arch/arm64/configs/defconfig:CONFIG_MTD=y
arch/arm64/configs/defconfig:CONFIG_MTD_BLOCK=y
arch/arm64/configs/defconfig:CONFIG_MTD_CFI=y
arch/arm64/configs/defconfig:CONFIG_MTD_CFI_ADV_OPTIONS=y
arch/arm64/configs/defconfig:CONFIG_MTD_CFI_INTELEXT=y
arch/arm64/configs/defconfig:CONFIG_MTD_CFI_AMDSTD=y
arch/arm64/configs/defconfig:CONFIG_MTD_CFI_STAA=y
arch/arm64/configs/defconfig:CONFIG_MTD_PHYSMAP=y
arch/arm64/configs/defconfig:CONFIG_MTD_PHYSMAP_OF=y
arch/arm64/configs/defconfig:CONFIG_MTD_DATAFLASH=y
arch/arm64/configs/defconfig:CONFIG_MTD_SST25L=y
arch/arm64/configs/defconfig:CONFIG_MTD_RAW_NAND=y
arch/arm64/configs/defconfig:CONFIG_MTD_NAND_DENALI_DT=y
arch/arm64/configs/defconfig:CONFIG_MTD_NAND_MARVELL=y
arch/arm64/configs/defconfig:CONFIG_MTD_NAND_FSL_IFC=y
arch/arm64/configs/defconfig:CONFIG_MTD_NAND_QCOM=y
arch/arm64/configs/defconfig:CONFIG_MTD_SPI_NOR=y

so I think we're good with just what you have here: MTD_BLOCK doesn't seem that
useful, and the rest are drivers. That said, these (along with SPI and
SPI_SIFIVE) should really be in Kconfig.socs rather than defconfig. Can you
send a patch that does that?

>
> To demonstrate a bit more with linux 5.7-rc3
>
> Specify on U-boot prompt:
> # setenv bootargs "root=/dev/ram rw console=ttySIF0 mtdparts=spi0.0:1024k(loader1),4096K(loader2),26M(rootfs)"
>
> After booting linux will enumerate mtd partitions:
> # cat /proc/mtd
> dev: size erasesize name
> mtd0: 00100000 00001000 "loader1"
> mtd1: 00400000 00001000 "loader2"
> mtd2: 01a00000 00001000 "rootfs"
>
> # cat /proc/partitions
> major minor #blocks name
> 31 0 1024 mtdblock0
> 31 1 4096 mtdblock1
> 31 2 26624 mtdblock2
>
> #Format mtdblock2 with mkfs.ext3/4 and mount results in
> # mkfs.ext3 /dev/mtdblock2
> mke2fs 1.44.5 (15-Dec-2018)
> /dev/mtdblock2 contains a ext3 file system
> last mounted on /mnt on Thu Jan 1 00:00:14 1970
> Proceed anyway? (y,N) y
> Creating filesystem with 26624 1k blocks and 6656 inodes
> Filesystem UUID: 1b09252d-e313-430c-9ecb-79b0cef003ca
> Superblock backups stored on blocks:
> 8193, 24577
>
> Allocating group tables: done
> Writing inode tables: done
> Creating journal (1024 blocks): done
> Writing superblocks and filesystem accounting information: done
>
> # mount
> none on / type rootfs (rw)
> proc on /proc type proc (rw,relatime)
> devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=666)
> tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
> tmpfs on /tmp type tmpfs (rw,relatime)
> tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
> sysfs on /sys type sysfs (rw,relatime)
> /dev/mtdblock2 on /mnt type ext3 (rw,relatime)
>
> Thanks & BR,
> Sagar Kadam

2020-05-06 03:58:50

by Sagar Shrikant Kadam

[permalink] [raw]
Subject: RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.

Hi Palmer,

> -----Original Message-----
> From: Palmer Dabbelt <[email protected]>
> Sent: Wednesday, May 6, 2020 4:54 AM
> To: Sagar Kadam <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; Paul Walmsley
> <[email protected]>; [email protected]; linux-
> [email protected]; [email protected]
> Subject: RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed
> A00 board.
>
> [External Email] Do not click links or attachments unless you recognize the
> sender and know the content is safe
>
> On Tue, 05 May 2020 00:18:45 PDT (-0700), [email protected] wrote:
> > Hello Palmer,
> >
> >> -----Original Message-----
> >> From: Palmer Dabbelt <[email protected]>
> >> Sent: Tuesday, May 5, 2020 3:40 AM
> >> To: Sagar Kadam <[email protected]>
> >> Cc: [email protected]; [email protected];
> >> [email protected]; [email protected]; Paul Walmsley
> >> <[email protected]>; [email protected]; linux-
> >> [email protected]; [email protected]; Sagar Kadam
> >> <[email protected]>
> >> Subject: Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive
> Unleashed
> >> A00 board.
> >>
> >> [External Email] Do not click links or attachments unless you recognize
> the
> >> sender and know the content is safe
> >>
> >> On Thu, 30 Apr 2020 02:58:51 PDT (-0700), [email protected]
> wrote:
> >> > Enable MTD based SPI-NOR framework in order to use spi flash
> available
> >> > on HiFive Unleashed A00 board.
> >> >
> >> > Signed-off-by: Sagar Shrikant Kadam <[email protected]>
> >> > ---
> >> > arch/riscv/configs/defconfig | 2 ++
> >> > 1 file changed, 2 insertions(+)
> >> >
> >> > diff --git a/arch/riscv/configs/defconfig
> >> > b/arch/riscv/configs/defconfig index 4da4886..970580b 100644
> >> > --- a/arch/riscv/configs/defconfig
> >> > +++ b/arch/riscv/configs/defconfig
> >> > @@ -80,6 +80,8 @@ CONFIG_USB_STORAGE=y CONFIG_USB_UAS=y
> >> CONFIG_MMC=y
> >> > CONFIG_MMC_SPI=y
> >> > +CONFIG_MTD=y
> >> > +CONFIG_MTD_SPI_NOR=y
> >> > CONFIG_RTC_CLASS=y
> >> > CONFIG_VIRTIO_PCI=y
> >> > CONFIG_VIRTIO_BALLOON=y
> >>
> >> From the second patch's description I'm assuming that MTD still
> functions
> >> correctly without that change?
> >
> > Yes Palmer, the second patch is to enable QUAD write to nor flash..
> > MTD function's correctly without second patch.
> >
> > Using the character interface (/dev/mtd0) mtd_utils (mtd_debug :
> erase/read/write) work fine.
> > We might require CONFIG_MTD_BLOCK, CONFIG_MTD_CMDLINE_PARTS
> in order to use MTD partitioning.
> > IMHO it can be at user's choice weather to use flash partitions or not, so I
> have not enabled. Please let me
> > know if I should enable these features as well.
>
> Looks like arm64 has these:
>
> arch/arm64/configs/defconfig:CONFIG_MTD=y
> arch/arm64/configs/defconfig:CONFIG_MTD_BLOCK=y
> arch/arm64/configs/defconfig:CONFIG_MTD_CFI=y
> arch/arm64/configs/defconfig:CONFIG_MTD_CFI_ADV_OPTIONS=y
> arch/arm64/configs/defconfig:CONFIG_MTD_CFI_INTELEXT=y
> arch/arm64/configs/defconfig:CONFIG_MTD_CFI_AMDSTD=y
> arch/arm64/configs/defconfig:CONFIG_MTD_CFI_STAA=y
> arch/arm64/configs/defconfig:CONFIG_MTD_PHYSMAP=y
> arch/arm64/configs/defconfig:CONFIG_MTD_PHYSMAP_OF=y
> arch/arm64/configs/defconfig:CONFIG_MTD_DATAFLASH=y
> arch/arm64/configs/defconfig:CONFIG_MTD_SST25L=y
> arch/arm64/configs/defconfig:CONFIG_MTD_RAW_NAND=y
> arch/arm64/configs/defconfig:CONFIG_MTD_NAND_DENALI_DT=y
> arch/arm64/configs/defconfig:CONFIG_MTD_NAND_MARVELL=y
> arch/arm64/configs/defconfig:CONFIG_MTD_NAND_FSL_IFC=y
> arch/arm64/configs/defconfig:CONFIG_MTD_NAND_QCOM=y
> arch/arm64/configs/defconfig:CONFIG_MTD_SPI_NOR=y
>
> so I think we're good with just what you have here: MTD_BLOCK doesn't
> seem that
> useful, and the rest are drivers. That said, these (along with SPI and
> SPI_SIFIVE) should really be in Kconfig.socs rather than defconfig. Can you
> send a patch that does that?
>

Yes sure, I will send a V2 series, where SPI, SPI_SIFIVE, MTD,
and MTD_SPI_NOR will be a part of Kconfig.socs.

Thanks & BR,
Sagar Kadam

> >
> > To demonstrate a bit more with linux 5.7-rc3
> >
> > Specify on U-boot prompt:
> > # setenv bootargs "root=/dev/ram rw console=ttySIF0
> mtdparts=spi0.0:1024k(loader1),4096K(loader2),26M(rootfs)"
> >
> > After booting linux will enumerate mtd partitions:
> > # cat /proc/mtd
> > dev: size erasesize name
> > mtd0: 00100000 00001000 "loader1"
> > mtd1: 00400000 00001000 "loader2"
> > mtd2: 01a00000 00001000 "rootfs"
> >
> > # cat /proc/partitions
> > major minor #blocks name
> > 31 0 1024 mtdblock0
> > 31 1 4096 mtdblock1
> > 31 2 26624 mtdblock2
> >
> > #Format mtdblock2 with mkfs.ext3/4 and mount results in
> > # mkfs.ext3 /dev/mtdblock2
> > mke2fs 1.44.5 (15-Dec-2018)
> > /dev/mtdblock2 contains a ext3 file system
> > last mounted on /mnt on Thu Jan 1 00:00:14 1970
> > Proceed anyway? (y,N) y
> > Creating filesystem with 26624 1k blocks and 6656 inodes
> > Filesystem UUID: 1b09252d-e313-430c-9ecb-79b0cef003ca
> > Superblock backups stored on blocks:
> > 8193, 24577
> >
> > Allocating group tables: done
> > Writing inode tables: done
> > Creating journal (1024 blocks): done
> > Writing superblocks and filesystem accounting information: done
> >
> > # mount
> > none on / type rootfs (rw)
> > proc on /proc type proc (rw,relatime)
> > devpts on /dev/pts type devpts
> (rw,relatime,gid=5,mode=620,ptmxmode=666)
> > tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
> > tmpfs on /tmp type tmpfs (rw,relatime)
> > tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
> > sysfs on /sys type sysfs (rw,relatime)
> > /dev/mtdblock2 on /mnt type ext3 (rw,relatime)
> >
> > Thanks & BR,
> > Sagar Kadam

2020-05-06 06:02:23

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.

On Wed, May 6, 2020 at 9:26 AM Sagar Kadam <[email protected]> wrote:
>
> Hi Palmer,
>
> > -----Original Message-----
> > From: Palmer Dabbelt <[email protected]>
> > Sent: Wednesday, May 6, 2020 4:54 AM
> > To: Sagar Kadam <[email protected]>
> > Cc: [email protected]; [email protected];
> > [email protected]; [email protected]; Paul Walmsley
> > <[email protected]>; [email protected]; linux-
> > [email protected]; [email protected]
> > Subject: RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed
> > A00 board.
> >
> > [External Email] Do not click links or attachments unless you recognize the
> > sender and know the content is safe
> >
> > On Tue, 05 May 2020 00:18:45 PDT (-0700), [email protected] wrote:
> > > Hello Palmer,
> > >
> > >> -----Original Message-----
> > >> From: Palmer Dabbelt <[email protected]>
> > >> Sent: Tuesday, May 5, 2020 3:40 AM
> > >> To: Sagar Kadam <[email protected]>
> > >> Cc: [email protected]; [email protected];
> > >> [email protected]; [email protected]; Paul Walmsley
> > >> <[email protected]>; [email protected]; linux-
> > >> [email protected]; [email protected]; Sagar Kadam
> > >> <[email protected]>
> > >> Subject: Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive
> > Unleashed
> > >> A00 board.
> > >>
> > >> [External Email] Do not click links or attachments unless you recognize
> > the
> > >> sender and know the content is safe
> > >>
> > >> On Thu, 30 Apr 2020 02:58:51 PDT (-0700), [email protected]
> > wrote:
> > >> > Enable MTD based SPI-NOR framework in order to use spi flash
> > available
> > >> > on HiFive Unleashed A00 board.
> > >> >
> > >> > Signed-off-by: Sagar Shrikant Kadam <[email protected]>
> > >> > ---
> > >> > arch/riscv/configs/defconfig | 2 ++
> > >> > 1 file changed, 2 insertions(+)
> > >> >
> > >> > diff --git a/arch/riscv/configs/defconfig
> > >> > b/arch/riscv/configs/defconfig index 4da4886..970580b 100644
> > >> > --- a/arch/riscv/configs/defconfig
> > >> > +++ b/arch/riscv/configs/defconfig
> > >> > @@ -80,6 +80,8 @@ CONFIG_USB_STORAGE=y CONFIG_USB_UAS=y
> > >> CONFIG_MMC=y
> > >> > CONFIG_MMC_SPI=y
> > >> > +CONFIG_MTD=y
> > >> > +CONFIG_MTD_SPI_NOR=y
> > >> > CONFIG_RTC_CLASS=y
> > >> > CONFIG_VIRTIO_PCI=y
> > >> > CONFIG_VIRTIO_BALLOON=y
> > >>
> > >> From the second patch's description I'm assuming that MTD still
> > functions
> > >> correctly without that change?
> > >
> > > Yes Palmer, the second patch is to enable QUAD write to nor flash..
> > > MTD function's correctly without second patch.
> > >
> > > Using the character interface (/dev/mtd0) mtd_utils (mtd_debug :
> > erase/read/write) work fine.
> > > We might require CONFIG_MTD_BLOCK, CONFIG_MTD_CMDLINE_PARTS
> > in order to use MTD partitioning.
> > > IMHO it can be at user's choice weather to use flash partitions or not, so I
> > have not enabled. Please let me
> > > know if I should enable these features as well.
> >
> > Looks like arm64 has these:
> >
> > arch/arm64/configs/defconfig:CONFIG_MTD=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_BLOCK=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_CFI=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_CFI_ADV_OPTIONS=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_CFI_INTELEXT=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_CFI_AMDSTD=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_CFI_STAA=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_PHYSMAP=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_PHYSMAP_OF=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_DATAFLASH=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_SST25L=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_RAW_NAND=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_NAND_DENALI_DT=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_NAND_MARVELL=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_NAND_FSL_IFC=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_NAND_QCOM=y
> > arch/arm64/configs/defconfig:CONFIG_MTD_SPI_NOR=y
> >
> > so I think we're good with just what you have here: MTD_BLOCK doesn't
> > seem that
> > useful, and the rest are drivers. That said, these (along with SPI and
> > SPI_SIFIVE) should really be in Kconfig.socs rather than defconfig. Can you
> > send a patch that does that?
> >
>
> Yes sure, I will send a V2 series, where SPI, SPI_SIFIVE, MTD,
> and MTD_SPI_NOR will be a part of Kconfig.socs.

We had build issues in past by selecting major driver subsystems
in Kconfig.socs

I suggest to select SPI_SIFIVE from Kconfig.socs and other
platform independent options should go in defconfig and
rv32_defconfig.

The general rule of thumb is to force select only required
drivers from Kconfig.socs.

Regards,
Anup

>
> Thanks & BR,
> Sagar Kadam
>
> > >
> > > To demonstrate a bit more with linux 5.7-rc3
> > >
> > > Specify on U-boot prompt:
> > > # setenv bootargs "root=/dev/ram rw console=ttySIF0
> > mtdparts=spi0.0:1024k(loader1),4096K(loader2),26M(rootfs)"
> > >
> > > After booting linux will enumerate mtd partitions:
> > > # cat /proc/mtd
> > > dev: size erasesize name
> > > mtd0: 00100000 00001000 "loader1"
> > > mtd1: 00400000 00001000 "loader2"
> > > mtd2: 01a00000 00001000 "rootfs"
> > >
> > > # cat /proc/partitions
> > > major minor #blocks name
> > > 31 0 1024 mtdblock0
> > > 31 1 4096 mtdblock1
> > > 31 2 26624 mtdblock2
> > >
> > > #Format mtdblock2 with mkfs.ext3/4 and mount results in
> > > # mkfs.ext3 /dev/mtdblock2
> > > mke2fs 1.44.5 (15-Dec-2018)
> > > /dev/mtdblock2 contains a ext3 file system
> > > last mounted on /mnt on Thu Jan 1 00:00:14 1970
> > > Proceed anyway? (y,N) y
> > > Creating filesystem with 26624 1k blocks and 6656 inodes
> > > Filesystem UUID: 1b09252d-e313-430c-9ecb-79b0cef003ca
> > > Superblock backups stored on blocks:
> > > 8193, 24577
> > >
> > > Allocating group tables: done
> > > Writing inode tables: done
> > > Creating journal (1024 blocks): done
> > > Writing superblocks and filesystem accounting information: done
> > >
> > > # mount
> > > none on / type rootfs (rw)
> > > proc on /proc type proc (rw,relatime)
> > > devpts on /dev/pts type devpts
> > (rw,relatime,gid=5,mode=620,ptmxmode=666)
> > > tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
> > > tmpfs on /tmp type tmpfs (rw,relatime)
> > > tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
> > > sysfs on /sys type sysfs (rw,relatime)
> > > /dev/mtdblock2 on /mnt type ext3 (rw,relatime)
> > >
> > > Thanks & BR,
> > > Sagar Kadam
>

2020-05-06 07:28:59

by Andreas Schwab

[permalink] [raw]
Subject: Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.

On Mai 06 2020, Anup Patel wrote:

> We had build issues in past by selecting major driver subsystems
> in Kconfig.socs
>
> I suggest to select SPI_SIFIVE from Kconfig.socs

SPI_SIFIVE can be m, don't override that.

Andreas.

--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."

2020-05-10 15:36:39

by Sagar Shrikant Kadam

[permalink] [raw]
Subject: RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.

Hi,

> -----Original Message-----
> From: Andreas Schwab <[email protected]>
> Sent: Wednesday, May 6, 2020 12:57 PM
> To: Anup Patel <[email protected]>
> Cc: Sagar Kadam <[email protected]>; Palmer Dabbelt
> <[email protected]>; [email protected]; [email protected];
> [email protected]; Paul Walmsley <[email protected]>; linux-
> [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed
> A00 board.
>
> [External Email] Do not click links or attachments unless you recognize the
> sender and know the content is safe
>
> On Mai 06 2020, Anup Patel wrote:
>

Thanks for suggestions Anup and Andreas.
I missed to reply, sorry for that.

> > We had build issues in past by selecting major driver subsystems
> > in Kconfig.socs
> >

Please let me know if I am wrong, are you stating about the build issues, fixed in
commit bd6f20333c67 ("RISC-V: Only select essential drivers for SOC_VIRT config")
which was due to all platform dependent and independent driver's enabled in Kconfig.soc
for virtual platform.
Kconfig.socs as meant for platform drivers we can guard SPI_SIFIVE with a guard "if SPI"
so that come across " WARNING: unmet direct dependencies detected for SPI_SIFIVE"
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -7,6 +7,7 @@ config SOC_SIFIVE
select CLK_SIFIVE
select CLK_SIFIVE_FU540_PRCI
select SIFIVE_PLIC
+ imply SPI_SIFIVE if SPI
help
This enables support for SiFive SoC platform hardware.

> > I suggest to select SPI_SIFIVE from Kconfig.socs
>
> SPI_SIFIVE can be m, don't override that.
>
> Andreas.
>
Currently SPI and SPI_SIFIVE are default enabled via defconfig.
In Kconfig.socs if we force the config option using "select" SPI_SIFIVE will lose its configurable option.
So I was thinking of using the weak dependency using "imply" as above, so that SPI_SIFIVE can
still be modular if required i.e 'm'.
We can then have other platform independent driver's ( SPI, MTD and MTD_SPI_NOR) required for
enabling SPI_NOR flash into the defconfig.
This way we can have SPI_SIFIVE in Kconfig.soc's and SPI_SIFIVE will also be modular
Please let me know your views on this, or if I am missing something.

Thanks & BR,
Sagar Kadam

> --
> Andreas Schwab, [email protected]
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA
> AEC1
> "And now for something completely different."