All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] update is25wp256d page write capabilities
@ 2020-04-30  9:58 ` Sagar Shrikant Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: paul.walmsley, palmer, linux-riscv, linux-kernel, linux-mtd,
	Sagar Shrikant Kadam

HiFive Unleashed A00 board has is25wp256d snor chip. It is observed
that it gets configured with Serial Input Page program by the end
of spi_nor_scan. Using the post bfpt fixup hook we prioritize the
page program settings to use quad input page program (opcode:0x34)
over serial input page program (opcode: 0x12).

The patchset is tested on Linux 5.7-rc3.

Sagar Shrikant Kadam (2):
  riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  spi: nor: update page program settings for is25wp256 using post bfpt
    fixup

 arch/riscv/configs/defconfig |  2 ++
 drivers/mtd/spi-nor/issi.c   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/2] update is25wp256d page write capabilities
@ 2020-04-30  9:58 ` Sagar Shrikant Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd, Sagar Shrikant Kadam, paul.walmsley,
	palmer, linux-riscv

HiFive Unleashed A00 board has is25wp256d snor chip. It is observed
that it gets configured with Serial Input Page program by the end
of spi_nor_scan. Using the post bfpt fixup hook we prioritize the
page program settings to use quad input page program (opcode:0x34)
over serial input page program (opcode: 0x12).

The patchset is tested on Linux 5.7-rc3.

Sagar Shrikant Kadam (2):
  riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  spi: nor: update page program settings for is25wp256 using post bfpt
    fixup

 arch/riscv/configs/defconfig |  2 ++
 drivers/mtd/spi-nor/issi.c   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/2] update is25wp256d page write capabilities
@ 2020-04-30  9:58 ` Sagar Shrikant Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd, Sagar Shrikant Kadam, paul.walmsley,
	palmer, linux-riscv

HiFive Unleashed A00 board has is25wp256d snor chip. It is observed
that it gets configured with Serial Input Page program by the end
of spi_nor_scan. Using the post bfpt fixup hook we prioritize the
page program settings to use quad input page program (opcode:0x34)
over serial input page program (opcode: 0x12).

The patchset is tested on Linux 5.7-rc3.

Sagar Shrikant Kadam (2):
  riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  spi: nor: update page program settings for is25wp256 using post bfpt
    fixup

 arch/riscv/configs/defconfig |  2 ++
 drivers/mtd/spi-nor/issi.c   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

-- 
2.7.4


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  2020-04-30  9:58 ` Sagar Shrikant Kadam
  (?)
@ 2020-04-30  9:58   ` Sagar Shrikant Kadam
  -1 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: paul.walmsley, palmer, linux-riscv, linux-kernel, linux-mtd,
	Sagar Shrikant Kadam

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

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 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


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-04-30  9:58   ` Sagar Shrikant Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd, Sagar Shrikant Kadam, paul.walmsley,
	palmer, linux-riscv

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

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 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



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-04-30  9:58   ` Sagar Shrikant Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd, Sagar Shrikant Kadam, paul.walmsley,
	palmer, linux-riscv

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

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/2] spi: nor: update page program settings for is25wp256 using post bfpt fixup
  2020-04-30  9:58 ` Sagar Shrikant Kadam
  (?)
@ 2020-04-30  9:58   ` Sagar Shrikant Kadam
  -1 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: paul.walmsley, palmer, linux-riscv, linux-kernel, linux-mtd,
	Sagar Shrikant Kadam

During SFDP parsing it is seen that the IS25WP256d device is missing 4BAIT
(4-Byte address instruction table), due to which it's page program
capacity doesn't get correctly populated and the device gets configured
with 4-byte Address Serial Input Page Program i.e. SNOR_PROTO_1_1_1
even though it can work with SNOR_PROTO_1_1_4.

Here using the post bfpt fixup hooks we update the page program
settings to 4-byte QUAD Input Page program operations.

The patch is tested on HiFive Unleashed A00 board and it benefits
few seconds of average write time for entire flash write.

QUAD Input Page Program operations:
> time mtd_debug write /dev/mtd0 0 33554432 rd32M
Copied 33554432 bytes from rd32M to address 0x00000000 in flash
real    0m 32.85s
user    0m 0.00s
sys     0m 31.79s

Serial Input Page Program operations:
> time mtd_debug write /dev/mtd0 0 33554432 rd32M
Copied 33554432 bytes from rd32M to address 0x00000000 in flash
real    0m 35.87s
user    0m 0.00s
sys     0m 35.42s

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 drivers/mtd/spi-nor/issi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c
index ffcb60e..9eb6e82 100644
--- a/drivers/mtd/spi-nor/issi.c
+++ b/drivers/mtd/spi-nor/issi.c
@@ -23,6 +23,22 @@ is25lp256_post_bfpt_fixups(struct spi_nor *nor,
 		BFPT_DWORD1_ADDRESS_BYTES_3_ONLY)
 		nor->addr_width = 4;
 
+	/*
+	 * On IS25WP256d device 4-Byte address instruction table doesn't
+	 * get populated and so the device get's configured with 4-byte
+	 * Address Serial Input Page Program i.e. SNOR_PROTO_1_1_1 even
+	 * though it supports SNOR_PROTO_1_1_4, so priorotize QUAD write
+	 * over SINGLE write if device id table holds SPI_NOR_QUAD_READ.
+	 */
+	if (strcmp(nor->info->name, "is25wp256") == 0) {
+		if (nor->info->flags & SPI_NOR_QUAD_READ) {
+			params->hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4;
+			spi_nor_set_pp_settings
+				(&params->page_programs[SNOR_CMD_PP_1_1_4],
+				 SPINOR_OP_PP_1_1_4,
+				 SNOR_PROTO_1_1_4);
+		}
+	}
 	return 0;
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/2] spi: nor: update page program settings for is25wp256 using post bfpt fixup
@ 2020-04-30  9:58   ` Sagar Shrikant Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd, Sagar Shrikant Kadam, paul.walmsley,
	palmer, linux-riscv

During SFDP parsing it is seen that the IS25WP256d device is missing 4BAIT
(4-Byte address instruction table), due to which it's page program
capacity doesn't get correctly populated and the device gets configured
with 4-byte Address Serial Input Page Program i.e. SNOR_PROTO_1_1_1
even though it can work with SNOR_PROTO_1_1_4.

Here using the post bfpt fixup hooks we update the page program
settings to 4-byte QUAD Input Page program operations.

The patch is tested on HiFive Unleashed A00 board and it benefits
few seconds of average write time for entire flash write.

QUAD Input Page Program operations:
> time mtd_debug write /dev/mtd0 0 33554432 rd32M
Copied 33554432 bytes from rd32M to address 0x00000000 in flash
real    0m 32.85s
user    0m 0.00s
sys     0m 31.79s

Serial Input Page Program operations:
> time mtd_debug write /dev/mtd0 0 33554432 rd32M
Copied 33554432 bytes from rd32M to address 0x00000000 in flash
real    0m 35.87s
user    0m 0.00s
sys     0m 35.42s

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 drivers/mtd/spi-nor/issi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c
index ffcb60e..9eb6e82 100644
--- a/drivers/mtd/spi-nor/issi.c
+++ b/drivers/mtd/spi-nor/issi.c
@@ -23,6 +23,22 @@ is25lp256_post_bfpt_fixups(struct spi_nor *nor,
 		BFPT_DWORD1_ADDRESS_BYTES_3_ONLY)
 		nor->addr_width = 4;
 
+	/*
+	 * On IS25WP256d device 4-Byte address instruction table doesn't
+	 * get populated and so the device get's configured with 4-byte
+	 * Address Serial Input Page Program i.e. SNOR_PROTO_1_1_1 even
+	 * though it supports SNOR_PROTO_1_1_4, so priorotize QUAD write
+	 * over SINGLE write if device id table holds SPI_NOR_QUAD_READ.
+	 */
+	if (strcmp(nor->info->name, "is25wp256") == 0) {
+		if (nor->info->flags & SPI_NOR_QUAD_READ) {
+			params->hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4;
+			spi_nor_set_pp_settings
+				(&params->page_programs[SNOR_CMD_PP_1_1_4],
+				 SPINOR_OP_PP_1_1_4,
+				 SNOR_PROTO_1_1_4);
+		}
+	}
 	return 0;
 }
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/2] spi: nor: update page program settings for is25wp256 using post bfpt fixup
@ 2020-04-30  9:58   ` Sagar Shrikant Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Shrikant Kadam @ 2020-04-30  9:58 UTC (permalink / raw)
  To: tudor.ambarus, miquel.raynal, richard, vigneshr
  Cc: linux-kernel, linux-mtd, Sagar Shrikant Kadam, paul.walmsley,
	palmer, linux-riscv

During SFDP parsing it is seen that the IS25WP256d device is missing 4BAIT
(4-Byte address instruction table), due to which it's page program
capacity doesn't get correctly populated and the device gets configured
with 4-byte Address Serial Input Page Program i.e. SNOR_PROTO_1_1_1
even though it can work with SNOR_PROTO_1_1_4.

Here using the post bfpt fixup hooks we update the page program
settings to 4-byte QUAD Input Page program operations.

The patch is tested on HiFive Unleashed A00 board and it benefits
few seconds of average write time for entire flash write.

QUAD Input Page Program operations:
> time mtd_debug write /dev/mtd0 0 33554432 rd32M
Copied 33554432 bytes from rd32M to address 0x00000000 in flash
real    0m 32.85s
user    0m 0.00s
sys     0m 31.79s

Serial Input Page Program operations:
> time mtd_debug write /dev/mtd0 0 33554432 rd32M
Copied 33554432 bytes from rd32M to address 0x00000000 in flash
real    0m 35.87s
user    0m 0.00s
sys     0m 35.42s

Signed-off-by: Sagar Shrikant Kadam <sagar.kadam@sifive.com>
---
 drivers/mtd/spi-nor/issi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c
index ffcb60e..9eb6e82 100644
--- a/drivers/mtd/spi-nor/issi.c
+++ b/drivers/mtd/spi-nor/issi.c
@@ -23,6 +23,22 @@ is25lp256_post_bfpt_fixups(struct spi_nor *nor,
 		BFPT_DWORD1_ADDRESS_BYTES_3_ONLY)
 		nor->addr_width = 4;
 
+	/*
+	 * On IS25WP256d device 4-Byte address instruction table doesn't
+	 * get populated and so the device get's configured with 4-byte
+	 * Address Serial Input Page Program i.e. SNOR_PROTO_1_1_1 even
+	 * though it supports SNOR_PROTO_1_1_4, so priorotize QUAD write
+	 * over SINGLE write if device id table holds SPI_NOR_QUAD_READ.
+	 */
+	if (strcmp(nor->info->name, "is25wp256") == 0) {
+		if (nor->info->flags & SPI_NOR_QUAD_READ) {
+			params->hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4;
+			spi_nor_set_pp_settings
+				(&params->page_programs[SNOR_CMD_PP_1_1_4],
+				 SPINOR_OP_PP_1_1_4,
+				 SNOR_PROTO_1_1_4);
+		}
+	}
 	return 0;
 }
 
-- 
2.7.4


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  2020-04-30  9:58   ` Sagar Shrikant Kadam
  (?)
@ 2020-05-04 22:10     ` Palmer Dabbelt
  -1 siblings, 0 replies; 30+ messages in thread
From: Palmer Dabbelt @ 2020-05-04 22:10 UTC (permalink / raw)
  To: sagar.kadam
  Cc: tudor.ambarus, miquel.raynal, richard, vigneshr, Paul Walmsley,
	linux-riscv, linux-kernel, linux-mtd, sagar.kadam

On Thu, 30 Apr 2020 02:58:51 PDT (-0700), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
> ---
>  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?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-04 22:10     ` Palmer Dabbelt
  0 siblings, 0 replies; 30+ messages in thread
From: Palmer Dabbelt @ 2020-05-04 22:10 UTC (permalink / raw)
  To: sagar.kadam
  Cc: vigneshr, tudor.ambarus, richard, Paul Walmsley, linux-kernel,
	linux-mtd, sagar.kadam, miquel.raynal, linux-riscv

On Thu, 30 Apr 2020 02:58:51 PDT (-0700), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
> ---
>  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?


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-04 22:10     ` Palmer Dabbelt
  0 siblings, 0 replies; 30+ messages in thread
From: Palmer Dabbelt @ 2020-05-04 22:10 UTC (permalink / raw)
  To: sagar.kadam
  Cc: vigneshr, tudor.ambarus, richard, Paul Walmsley, linux-kernel,
	linux-mtd, sagar.kadam, miquel.raynal, linux-riscv

On Thu, 30 Apr 2020 02:58:51 PDT (-0700), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
> ---
>  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?

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  2020-05-04 22:10     ` Palmer Dabbelt
  (?)
@ 2020-05-05  7:18       ` Sagar Kadam
  -1 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-05  7:18 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: tudor.ambarus, miquel.raynal, richard, vigneshr, Paul Walmsley,
	linux-riscv, linux-kernel, linux-mtd

Hello Palmer,

> -----Original Message-----
> From: Palmer Dabbelt <palmer@dabbelt.com>
> Sent: Tuesday, May 5, 2020 3:40 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> <sagar.kadam@sifive.com>
> 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), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
> > ---
> >  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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-05  7:18       ` Sagar Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-05  7:18 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: vigneshr, tudor.ambarus, richard, Paul Walmsley, linux-kernel,
	linux-mtd, miquel.raynal, linux-riscv

Hello Palmer,

> -----Original Message-----
> From: Palmer Dabbelt <palmer@dabbelt.com>
> Sent: Tuesday, May 5, 2020 3:40 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> <sagar.kadam@sifive.com>
> 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), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
> > ---
> >  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

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-05  7:18       ` Sagar Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-05  7:18 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: vigneshr, tudor.ambarus, richard, Paul Walmsley, linux-kernel,
	linux-mtd, miquel.raynal, linux-riscv

Hello Palmer,

> -----Original Message-----
> From: Palmer Dabbelt <palmer@dabbelt.com>
> Sent: Tuesday, May 5, 2020 3:40 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> <sagar.kadam@sifive.com>
> 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), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
> > ---
> >  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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  2020-05-05  7:18       ` Sagar Kadam
  (?)
@ 2020-05-05 23:23         ` Palmer Dabbelt
  -1 siblings, 0 replies; 30+ messages in thread
From: Palmer Dabbelt @ 2020-05-05 23:23 UTC (permalink / raw)
  To: sagar.kadam
  Cc: tudor.ambarus, miquel.raynal, richard, vigneshr, Paul Walmsley,
	linux-riscv, linux-kernel, linux-mtd

On Tue, 05 May 2020 00:18:45 PDT (-0700), sagar.kadam@sifive.com wrote:
> Hello Palmer,
> 
>> -----Original Message-----
>> From: Palmer Dabbelt <palmer@dabbelt.com>
>> Sent: Tuesday, May 5, 2020 3:40 AM
>> To: Sagar Kadam <sagar.kadam@sifive.com>
>> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
>> richard@nod.at; vigneshr@ti.com; Paul Walmsley
>> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
>> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
>> <sagar.kadam@sifive.com>
>> 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), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
>> > ---
>> >  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


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-05 23:23         ` Palmer Dabbelt
  0 siblings, 0 replies; 30+ messages in thread
From: Palmer Dabbelt @ 2020-05-05 23:23 UTC (permalink / raw)
  To: sagar.kadam
  Cc: vigneshr, tudor.ambarus, richard, Paul Walmsley, linux-kernel,
	linux-mtd, miquel.raynal, linux-riscv

On Tue, 05 May 2020 00:18:45 PDT (-0700), sagar.kadam@sifive.com wrote:
> Hello Palmer,
> 
>> -----Original Message-----
>> From: Palmer Dabbelt <palmer@dabbelt.com>
>> Sent: Tuesday, May 5, 2020 3:40 AM
>> To: Sagar Kadam <sagar.kadam@sifive.com>
>> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
>> richard@nod.at; vigneshr@ti.com; Paul Walmsley
>> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
>> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
>> <sagar.kadam@sifive.com>
>> 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), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
>> > ---
>> >  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



^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-05 23:23         ` Palmer Dabbelt
  0 siblings, 0 replies; 30+ messages in thread
From: Palmer Dabbelt @ 2020-05-05 23:23 UTC (permalink / raw)
  To: sagar.kadam
  Cc: vigneshr, tudor.ambarus, richard, Paul Walmsley, linux-kernel,
	linux-mtd, miquel.raynal, linux-riscv

On Tue, 05 May 2020 00:18:45 PDT (-0700), sagar.kadam@sifive.com wrote:
> Hello Palmer,
> 
>> -----Original Message-----
>> From: Palmer Dabbelt <palmer@dabbelt.com>
>> Sent: Tuesday, May 5, 2020 3:40 AM
>> To: Sagar Kadam <sagar.kadam@sifive.com>
>> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
>> richard@nod.at; vigneshr@ti.com; Paul Walmsley
>> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
>> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
>> <sagar.kadam@sifive.com>
>> 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), sagar.kadam@sifive.com 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 <sagar.kadam@sifive.com>
>> > ---
>> >  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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  2020-05-05 23:23         ` Palmer Dabbelt
  (?)
@ 2020-05-06  3:56           ` Sagar Kadam
  -1 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-06  3:56 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: tudor.ambarus, miquel.raynal, richard, vigneshr, Paul Walmsley,
	linux-riscv, linux-kernel, linux-mtd

Hi Palmer,

> -----Original Message-----
> From: Palmer Dabbelt <palmer@dabbelt.com>
> Sent: Wednesday, May 6, 2020 4:54 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org
> 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), sagar.kadam@sifive.com wrote:
> > Hello Palmer,
> >
> >> -----Original Message-----
> >> From: Palmer Dabbelt <palmer@dabbelt.com>
> >> Sent: Tuesday, May 5, 2020 3:40 AM
> >> To: Sagar Kadam <sagar.kadam@sifive.com>
> >> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> >> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> >> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> >> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> >> <sagar.kadam@sifive.com>
> >> 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), sagar.kadam@sifive.com
> 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 <sagar.kadam@sifive.com>
> >> > ---
> >> >  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


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-06  3:56           ` Sagar Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-06  3:56 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: vigneshr, tudor.ambarus, richard, Paul Walmsley, linux-kernel,
	linux-mtd, miquel.raynal, linux-riscv

Hi Palmer,

> -----Original Message-----
> From: Palmer Dabbelt <palmer@dabbelt.com>
> Sent: Wednesday, May 6, 2020 4:54 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org
> 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), sagar.kadam@sifive.com wrote:
> > Hello Palmer,
> >
> >> -----Original Message-----
> >> From: Palmer Dabbelt <palmer@dabbelt.com>
> >> Sent: Tuesday, May 5, 2020 3:40 AM
> >> To: Sagar Kadam <sagar.kadam@sifive.com>
> >> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> >> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> >> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> >> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> >> <sagar.kadam@sifive.com>
> >> 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), sagar.kadam@sifive.com
> 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 <sagar.kadam@sifive.com>
> >> > ---
> >> >  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


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-06  3:56           ` Sagar Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-06  3:56 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: vigneshr, tudor.ambarus, richard, Paul Walmsley, linux-kernel,
	linux-mtd, miquel.raynal, linux-riscv

Hi Palmer,

> -----Original Message-----
> From: Palmer Dabbelt <palmer@dabbelt.com>
> Sent: Wednesday, May 6, 2020 4:54 AM
> To: Sagar Kadam <sagar.kadam@sifive.com>
> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org
> 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), sagar.kadam@sifive.com wrote:
> > Hello Palmer,
> >
> >> -----Original Message-----
> >> From: Palmer Dabbelt <palmer@dabbelt.com>
> >> Sent: Tuesday, May 5, 2020 3:40 AM
> >> To: Sagar Kadam <sagar.kadam@sifive.com>
> >> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> >> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> >> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> >> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> >> <sagar.kadam@sifive.com>
> >> 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), sagar.kadam@sifive.com
> 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 <sagar.kadam@sifive.com>
> >> > ---
> >> >  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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  2020-05-06  3:56           ` Sagar Kadam
  (?)
@ 2020-05-06  5:09             ` Anup Patel
  -1 siblings, 0 replies; 30+ messages in thread
From: Anup Patel @ 2020-05-06  5:09 UTC (permalink / raw)
  To: Sagar Kadam
  Cc: Palmer Dabbelt, vigneshr, tudor.ambarus, richard, Paul Walmsley,
	linux-kernel, linux-mtd, miquel.raynal, linux-riscv

On Wed, May 6, 2020 at 9:26 AM Sagar Kadam <sagar.kadam@sifive.com> wrote:
>
> Hi Palmer,
>
> > -----Original Message-----
> > From: Palmer Dabbelt <palmer@dabbelt.com>
> > Sent: Wednesday, May 6, 2020 4:54 AM
> > To: Sagar Kadam <sagar.kadam@sifive.com>
> > Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> > richard@nod.at; vigneshr@ti.com; Paul Walmsley
> > <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> > kernel@vger.kernel.org; linux-mtd@lists.infradead.org
> > 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), sagar.kadam@sifive.com wrote:
> > > Hello Palmer,
> > >
> > >> -----Original Message-----
> > >> From: Palmer Dabbelt <palmer@dabbelt.com>
> > >> Sent: Tuesday, May 5, 2020 3:40 AM
> > >> To: Sagar Kadam <sagar.kadam@sifive.com>
> > >> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> > >> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> > >> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> > >> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> > >> <sagar.kadam@sifive.com>
> > >> 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), sagar.kadam@sifive.com
> > 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 <sagar.kadam@sifive.com>
> > >> > ---
> > >> >  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
>

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-06  5:09             ` Anup Patel
  0 siblings, 0 replies; 30+ messages in thread
From: Anup Patel @ 2020-05-06  5:09 UTC (permalink / raw)
  To: Sagar Kadam
  Cc: vigneshr, tudor.ambarus, richard, miquel.raynal, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, linux-mtd, linux-riscv

On Wed, May 6, 2020 at 9:26 AM Sagar Kadam <sagar.kadam@sifive.com> wrote:
>
> Hi Palmer,
>
> > -----Original Message-----
> > From: Palmer Dabbelt <palmer@dabbelt.com>
> > Sent: Wednesday, May 6, 2020 4:54 AM
> > To: Sagar Kadam <sagar.kadam@sifive.com>
> > Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> > richard@nod.at; vigneshr@ti.com; Paul Walmsley
> > <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> > kernel@vger.kernel.org; linux-mtd@lists.infradead.org
> > 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), sagar.kadam@sifive.com wrote:
> > > Hello Palmer,
> > >
> > >> -----Original Message-----
> > >> From: Palmer Dabbelt <palmer@dabbelt.com>
> > >> Sent: Tuesday, May 5, 2020 3:40 AM
> > >> To: Sagar Kadam <sagar.kadam@sifive.com>
> > >> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> > >> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> > >> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> > >> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> > >> <sagar.kadam@sifive.com>
> > >> 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), sagar.kadam@sifive.com
> > 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 <sagar.kadam@sifive.com>
> > >> > ---
> > >> >  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
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-06  5:09             ` Anup Patel
  0 siblings, 0 replies; 30+ messages in thread
From: Anup Patel @ 2020-05-06  5:09 UTC (permalink / raw)
  To: Sagar Kadam
  Cc: vigneshr, tudor.ambarus, richard, miquel.raynal, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, linux-mtd, linux-riscv

On Wed, May 6, 2020 at 9:26 AM Sagar Kadam <sagar.kadam@sifive.com> wrote:
>
> Hi Palmer,
>
> > -----Original Message-----
> > From: Palmer Dabbelt <palmer@dabbelt.com>
> > Sent: Wednesday, May 6, 2020 4:54 AM
> > To: Sagar Kadam <sagar.kadam@sifive.com>
> > Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> > richard@nod.at; vigneshr@ti.com; Paul Walmsley
> > <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> > kernel@vger.kernel.org; linux-mtd@lists.infradead.org
> > 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), sagar.kadam@sifive.com wrote:
> > > Hello Palmer,
> > >
> > >> -----Original Message-----
> > >> From: Palmer Dabbelt <palmer@dabbelt.com>
> > >> Sent: Tuesday, May 5, 2020 3:40 AM
> > >> To: Sagar Kadam <sagar.kadam@sifive.com>
> > >> Cc: tudor.ambarus@microchip.com; miquel.raynal@bootlin.com;
> > >> richard@nod.at; vigneshr@ti.com; Paul Walmsley
> > >> <paul.walmsley@sifive.com>; linux-riscv@lists.infradead.org; linux-
> > >> kernel@vger.kernel.org; linux-mtd@lists.infradead.org; Sagar Kadam
> > >> <sagar.kadam@sifive.com>
> > >> 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), sagar.kadam@sifive.com
> > 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 <sagar.kadam@sifive.com>
> > >> > ---
> > >> >  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
>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  2020-05-06  5:09             ` Anup Patel
  (?)
@ 2020-05-06  7:26               ` Andreas Schwab
  -1 siblings, 0 replies; 30+ messages in thread
From: Andreas Schwab @ 2020-05-06  7:26 UTC (permalink / raw)
  To: Anup Patel
  Cc: Sagar Kadam, Palmer Dabbelt, vigneshr, tudor.ambarus, richard,
	Paul Walmsley, linux-kernel, linux-mtd, miquel.raynal,
	linux-riscv

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, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-06  7:26               ` Andreas Schwab
  0 siblings, 0 replies; 30+ messages in thread
From: Andreas Schwab @ 2020-05-06  7:26 UTC (permalink / raw)
  To: Anup Patel
  Cc: vigneshr, tudor.ambarus, richard, miquel.raynal, linux-kernel,
	Palmer Dabbelt, Sagar Kadam, Paul Walmsley, linux-mtd,
	linux-riscv

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, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-06  7:26               ` Andreas Schwab
  0 siblings, 0 replies; 30+ messages in thread
From: Andreas Schwab @ 2020-05-06  7:26 UTC (permalink / raw)
  To: Anup Patel
  Cc: vigneshr, tudor.ambarus, richard, miquel.raynal, linux-kernel,
	Palmer Dabbelt, Sagar Kadam, Paul Walmsley, linux-mtd,
	linux-riscv

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, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
  2020-05-06  7:26               ` Andreas Schwab
  (?)
@ 2020-05-10 15:32                 ` Sagar Kadam
  -1 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-10 15:32 UTC (permalink / raw)
  To: Andreas Schwab, Anup Patel
  Cc: Palmer Dabbelt, vigneshr, tudor.ambarus, richard, Paul Walmsley,
	linux-kernel, linux-mtd, miquel.raynal, linux-riscv

Hi,

> -----Original Message-----
> From: Andreas Schwab <schwab@linux-m68k.org>
> Sent: Wednesday, May 6, 2020 12:57 PM
> To: Anup Patel <anup@brainfault.org>
> Cc: Sagar Kadam <sagar.kadam@sifive.com>; Palmer Dabbelt
> <palmer@dabbelt.com>; vigneshr@ti.com; tudor.ambarus@microchip.com;
> richard@nod.at; Paul Walmsley <paul.walmsley@sifive.com>; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org;
> miquel.raynal@bootlin.com; linux-riscv@lists.infradead.org
> 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, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA
> AEC1
> "And now for something completely different."

^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-10 15:32                 ` Sagar Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-10 15:32 UTC (permalink / raw)
  To: Andreas Schwab, Anup Patel
  Cc: vigneshr, tudor.ambarus, richard, miquel.raynal, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, linux-mtd, linux-riscv

Hi,

> -----Original Message-----
> From: Andreas Schwab <schwab@linux-m68k.org>
> Sent: Wednesday, May 6, 2020 12:57 PM
> To: Anup Patel <anup@brainfault.org>
> Cc: Sagar Kadam <sagar.kadam@sifive.com>; Palmer Dabbelt
> <palmer@dabbelt.com>; vigneshr@ti.com; tudor.ambarus@microchip.com;
> richard@nod.at; Paul Walmsley <paul.walmsley@sifive.com>; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org;
> miquel.raynal@bootlin.com; linux-riscv@lists.infradead.org
> 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, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA
> AEC1
> "And now for something completely different."


^ permalink raw reply	[flat|nested] 30+ messages in thread

* RE: [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board.
@ 2020-05-10 15:32                 ` Sagar Kadam
  0 siblings, 0 replies; 30+ messages in thread
From: Sagar Kadam @ 2020-05-10 15:32 UTC (permalink / raw)
  To: Andreas Schwab, Anup Patel
  Cc: vigneshr, tudor.ambarus, richard, miquel.raynal, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, linux-mtd, linux-riscv

Hi,

> -----Original Message-----
> From: Andreas Schwab <schwab@linux-m68k.org>
> Sent: Wednesday, May 6, 2020 12:57 PM
> To: Anup Patel <anup@brainfault.org>
> Cc: Sagar Kadam <sagar.kadam@sifive.com>; Palmer Dabbelt
> <palmer@dabbelt.com>; vigneshr@ti.com; tudor.ambarus@microchip.com;
> richard@nod.at; Paul Walmsley <paul.walmsley@sifive.com>; linux-
> kernel@vger.kernel.org; linux-mtd@lists.infradead.org;
> miquel.raynal@bootlin.com; linux-riscv@lists.infradead.org
> 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, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA
> AEC1
> "And now for something completely different."

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2020-05-10 15:32 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  9:58 [PATCH 0/2] update is25wp256d page write capabilities Sagar Shrikant Kadam
2020-04-30  9:58 ` Sagar Shrikant Kadam
2020-04-30  9:58 ` Sagar Shrikant Kadam
2020-04-30  9:58 ` [PATCH 1/2] riscv: defconfig: enable spi nor on Hifive Unleashed A00 board Sagar Shrikant Kadam
2020-04-30  9:58   ` Sagar Shrikant Kadam
2020-04-30  9:58   ` Sagar Shrikant Kadam
2020-05-04 22:10   ` Palmer Dabbelt
2020-05-04 22:10     ` Palmer Dabbelt
2020-05-04 22:10     ` Palmer Dabbelt
2020-05-05  7:18     ` Sagar Kadam
2020-05-05  7:18       ` Sagar Kadam
2020-05-05  7:18       ` Sagar Kadam
2020-05-05 23:23       ` Palmer Dabbelt
2020-05-05 23:23         ` Palmer Dabbelt
2020-05-05 23:23         ` Palmer Dabbelt
2020-05-06  3:56         ` Sagar Kadam
2020-05-06  3:56           ` Sagar Kadam
2020-05-06  3:56           ` Sagar Kadam
2020-05-06  5:09           ` Anup Patel
2020-05-06  5:09             ` Anup Patel
2020-05-06  5:09             ` Anup Patel
2020-05-06  7:26             ` Andreas Schwab
2020-05-06  7:26               ` Andreas Schwab
2020-05-06  7:26               ` Andreas Schwab
2020-05-10 15:32               ` Sagar Kadam
2020-05-10 15:32                 ` Sagar Kadam
2020-05-10 15:32                 ` Sagar Kadam
2020-04-30  9:58 ` [PATCH 2/2] spi: nor: update page program settings for is25wp256 using post bfpt fixup Sagar Shrikant Kadam
2020-04-30  9:58   ` Sagar Shrikant Kadam
2020-04-30  9:58   ` Sagar Shrikant Kadam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.