Skip to contentSkip to conversation

mtd: kconfig: Fix CFI_FLASH dependency

PATCH In review Bin Meng 2 participants 9 messages Aug 7, 2021 – Aug 11, 2021

Subsystems (2)
lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/3 mtd: kconfig: Fix CFI_FLASH dependency

The DM version CFI flash driver is in driver/mtd/cfi_flash.c, which only gets built when FLASH_CFI_DRIVER is on. If CFI_FLASH is on but FLASH_CFI_DRIVER is not, nothing is enabled at all.

Fix this dependency by selecting FLASH_CFI_DRIVER when CFI_FLASH is enabled.

---

 drivers/mtd/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/Kconfig +1 -0
index ad50c5e870..b303fabe0f 100644
@@ -42,6 +42,7 @@ config FLASH_CFI_DRIVER
 config CFI_FLASH
 	bool "Enable Driver Model for CFI Flash driver"
 	depends on DM_MTD
+	select FLASH_CFI_DRIVER
 	help
 	  The Common Flash Interface specification was developed by Intel,
 	  AMD and other flash manufactures. It provides a universal method
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/3 flash.h: Remove CONFIG_SYS_FLASH_CFI from flash_info_t

Those embers wrapped with CONFIG_SYS_FLASH_CFI in struct flash_info_t are unconditionally used in the cfi_flash.c driver.

Drop the #ifdefs in the definition of flash_info_t.

---

 include/flash.h | 2 --
 1 file changed, 2 deletions(-)
include/flash.h +0 -2
index 42b18a6047..f3959f5012 100644
@@ -21,7 +21,6 @@ typedef struct {
 	ulong	flash_id;		/* combined device & manufacturer code	*/
 	ulong	start[CONFIG_SYS_MAX_FLASH_SECT];   /* virtual sector start address */
 	uchar	protect[CONFIG_SYS_MAX_FLASH_SECT]; /* sector protection status	*/
-#ifdef CONFIG_SYS_FLASH_CFI
 	uchar	portwidth;		/* the width of the port		*/
 	uchar	chipwidth;		/* the width of the chip		*/
 	uchar	chip_lsb;		/* extra Least Significant Bit in the */
@@ -45,7 +44,6 @@ typedef struct {
 	ulong   addr_unlock2;		/* unlock address 2 for AMD flash roms  */
 	uchar   sr_supported;		/* status register supported            */
 	const char *name;		/* human-readable name	                */
-#endif
 #ifdef CONFIG_DM_MTD
 	struct mtd_info *mtd;
 #endif
Signature · 1 line
2.25.1
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] flash.h: Remove CONFIG_SYS_FLASH_CFI from flash_info_t

Quoted 6 lines · Bin Meng

Those embers wrapped with CONFIG_SYS_FLASH_CFI in struct flash_info_t are unconditionally used in the cfi_flash.c driver.

Drop the #ifdefs in the definition of flash_info_t.

Thanks,
Stefan

Quoted 19 lines

---

  include/flash.h | 2 --
  1 file changed, 2 deletions(-)
include/flash.h +0 -1
index 42b18a6047..f3959f5012 100644
@@ -21,7 +21,6 @@ typedef struct {
  	ulong	flash_id;		/* combined device & manufacturer code	*/
  	ulong	start[CONFIG_SYS_MAX_FLASH_SECT];   /* virtual sector start address */
  	uchar	protect[CONFIG_SYS_MAX_FLASH_SECT]; /* sector protection status	*/
-#ifdef CONFIG_SYS_FLASH_CFI
  	uchar	portwidth;		/* the width of the port		*/
  	uchar	chipwidth;		/* the width of the chip		*/
  	uchar	chip_lsb;		/* extra Least Significant Bit in the */

include/flash.h typedef struct { · line 49

Quoted 7 lines
include/flash.h +0 -1
@@ -45,7 +44,6 @@ typedef struct {
  	ulong   addr_unlock2;		/* unlock address 2 for AMD flash roms  */
  	uchar   sr_supported;		/* status register supported            */
  	const char *name;		/* human-readable name	                */
-#endif
  #ifdef CONFIG_DM_MTD
  	struct mtd_info *mtd;
  #endif

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#3 lore raw

Re: [PATCH 2/3] flash.h: Remove CONFIG_SYS_FLASH_CFI from flash_info_t

In reply to Bin Meng
Quoted 6 lines · Bin Meng

Those embers wrapped with CONFIG_SYS_FLASH_CFI in struct flash_info_t are unconditionally used in the cfi_flash.c driver.

Drop the #ifdefs in the definition of flash_info_t.

Applied to u-boot-cfi-flash/master

Thanks,
Stefan

Quoted 19 lines

---

  include/flash.h | 2 --
  1 file changed, 2 deletions(-)
include/flash.h +0 -1
index 42b18a6047..f3959f5012 100644
@@ -21,7 +21,6 @@ typedef struct {
  	ulong	flash_id;		/* combined device & manufacturer code	*/
  	ulong	start[CONFIG_SYS_MAX_FLASH_SECT];   /* virtual sector start address */
  	uchar	protect[CONFIG_SYS_MAX_FLASH_SECT]; /* sector protection status	*/
-#ifdef CONFIG_SYS_FLASH_CFI
  	uchar	portwidth;		/* the width of the port		*/
  	uchar	chipwidth;		/* the width of the chip		*/
  	uchar	chip_lsb;		/* extra Least Significant Bit in the */

include/flash.h typedef struct { · line 49

Quoted 7 lines
include/flash.h +0 -1
@@ -45,7 +44,6 @@ typedef struct {
  	ulong   addr_unlock2;		/* unlock address 2 for AMD flash roms  */
  	uchar   sr_supported;		/* status register supported            */
  	const char *name;		/* human-readable name	                */
-#endif
  #ifdef CONFIG_DM_MTD
  	struct mtd_info *mtd;
  #endif

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
author
#4 lore raw

PATCH 3/3 riscv: qemu: Enable MTD NOR flash support

In reply to Bin Meng

Enable support to the 2 NOR flashes on the QEMU RISC-V virt machine.

---

 board/emulation/qemu-riscv/Kconfig | 2 ++
 include/configs/qemu-riscv.h       | 2 ++
 2 files changed, 4 insertions(+)
board/emulation/qemu-riscv/Kconfig +2 -0
index 0818048ba6..a7de82d3bf 100644
@@ -64,5 +64,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	imply VIRTIO_PCI
 	imply VIRTIO_NET
 	imply VIRTIO_BLK
+	imply MTD_NOR_FLASH
+	imply CFI_FLASH
 
 endif
include/configs/qemu-riscv.h +2 -0
index 5291de83f8..bbeea96e27 100644
@@ -29,6 +29,8 @@
 
 #define CONFIG_STANDALONE_LOAD_ADDR	0x80200000
 
+#define CONFIG_SYS_MAX_FLASH_BANKS	2
+
 #define RISCV_MMODE_TIMERBASE		0x2000000
 #define RISCV_MMODE_TIMER_FREQ		1000000
 
Signature · 1 line
2.25.1
Reviewed-by on v1 3/3
#5 lore raw

Re: [PATCH 3/3] riscv: qemu: Enable MTD NOR flash support

Quoted 3 lines · Bin Meng

Enable support to the 2 NOR flashes on the QEMU RISC-V virt machine.

Thanks,
Stefan

Quoted 24 lines

---

  board/emulation/qemu-riscv/Kconfig | 2 ++
  include/configs/qemu-riscv.h       | 2 ++
  2 files changed, 4 insertions(+)
board/emulation/qemu-riscv/Kconfig +2 -0
index 0818048ba6..a7de82d3bf 100644
@@ -64,5 +64,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
  	imply VIRTIO_PCI
  	imply VIRTIO_NET
  	imply VIRTIO_BLK
+	imply MTD_NOR_FLASH
+	imply CFI_FLASH
 
  endif
include/configs/qemu-riscv.h +0 -0
index 5291de83f8..bbeea96e27 100644

include/configs/qemu-riscv.h line 36

Quoted 8 lines
include/configs/qemu-riscv.h +2 -0
@@ -29,6 +29,8 @@
 
  #define CONFIG_STANDALONE_LOAD_ADDR	0x80200000
 
+#define CONFIG_SYS_MAX_FLASH_BANKS	2
+
  #define RISCV_MMODE_TIMERBASE		0x2000000
  #define RISCV_MMODE_TIMER_FREQ		1000000
 

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#6 lore raw

Re: [PATCH 3/3] riscv: qemu: Enable MTD NOR flash support

In reply to Bin Meng
Quoted 3 lines · Bin Meng

Enable support to the 2 NOR flashes on the QEMU RISC-V virt machine.

Applied to u-boot-cfi-flash/master

Thanks,
Stefan

Quoted 24 lines

---

  board/emulation/qemu-riscv/Kconfig | 2 ++
  include/configs/qemu-riscv.h       | 2 ++
  2 files changed, 4 insertions(+)
board/emulation/qemu-riscv/Kconfig +2 -0
index 0818048ba6..a7de82d3bf 100644
@@ -64,5 +64,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
  	imply VIRTIO_PCI
  	imply VIRTIO_NET
  	imply VIRTIO_BLK
+	imply MTD_NOR_FLASH
+	imply CFI_FLASH
 
  endif
include/configs/qemu-riscv.h +0 -0
index 5291de83f8..bbeea96e27 100644

include/configs/qemu-riscv.h line 36

Quoted 8 lines
include/configs/qemu-riscv.h +2 -0
@@ -29,6 +29,8 @@
 
  #define CONFIG_STANDALONE_LOAD_ADDR	0x80200000
 
+#define CONFIG_SYS_MAX_FLASH_BANKS	2
+
  #define RISCV_MMODE_TIMERBASE		0x2000000
  #define RISCV_MMODE_TIMER_FREQ		1000000
 

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Reviewed-by on v1 1/3
#7 lore raw
In reply to Bin Meng
Quoted 8 lines · Bin Meng

The DM version CFI flash driver is in driver/mtd/cfi_flash.c, which only gets built when FLASH_CFI_DRIVER is on. If CFI_FLASH is on but FLASH_CFI_DRIVER is not, nothing is enabled at all.

Fix this dependency by selecting FLASH_CFI_DRIVER when CFI_FLASH is enabled.

Thanks,
Stefan

Quoted 11 lines

---

  drivers/mtd/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/mtd/Kconfig +0 -0
index ad50c5e870..b303fabe0f 100644

drivers/mtd/Kconfig config FLASH_CFI_DRIVER · line 48

Quoted 7 lines
drivers/mtd/Kconfig +1 -0
@@ -42,6 +42,7 @@ config FLASH_CFI_DRIVER
  config CFI_FLASH
  	bool "Enable Driver Model for CFI Flash driver"
  	depends on DM_MTD
+	select FLASH_CFI_DRIVER
  	help
  	  The Common Flash Interface specification was developed by Intel,
  	  AMD and other flash manufactures. It provides a universal method

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#8 lore raw
In reply to Bin Meng
Quoted 8 lines · Bin Meng

The DM version CFI flash driver is in driver/mtd/cfi_flash.c, which only gets built when FLASH_CFI_DRIVER is on. If CFI_FLASH is on but FLASH_CFI_DRIVER is not, nothing is enabled at all.

Fix this dependency by selecting FLASH_CFI_DRIVER when CFI_FLASH is enabled.

Applied to u-boot-cfi-flash/master

Thanks,
Stefan

Quoted 11 lines

---

  drivers/mtd/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/mtd/Kconfig +0 -0
index ad50c5e870..b303fabe0f 100644

drivers/mtd/Kconfig config FLASH_CFI_DRIVER · line 48

Quoted 7 lines
drivers/mtd/Kconfig +1 -0
@@ -42,6 +42,7 @@ config FLASH_CFI_DRIVER
  config CFI_FLASH
  	bool "Enable Driver Model for CFI Flash driver"
  	depends on DM_MTD
+	select FLASH_CFI_DRIVER
  	help
  	  The Common Flash Interface specification was developed by Intel,
  	  AMD and other flash manufactures. It provides a universal method

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]