[U-Boot] [PATCH v3 07/28] mtd: ensure MTD is compiled when there is a SPI NOR flash using MTD

Vignesh R
2018-12-05T05:58:29Z

Hi Miquel,

On 05/12/18 5:26 AM, Miquel Raynal wrote:
> MTD must be enabled when there is a SPI NOR flash using the
> SPI_FLASH_MTD config entry.
>

I suggest to add Kconfig dependency b/w SPI_FLASH_MTD and MTD. Something like:

diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index d735884b48db..6405fd1452d2 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -144,7 +144,7 @@ config SPI_FLASH_DATAFLASH

config SPI_FLASH_MTD
bool "SPI Flash MTD support"
- depends on SPI_FLASH
+ depends on SPI_FLASH && MTD
help
Enable the MTD support for spi flash layer, this adapter is for
translating mtd_read/mtd_write commands into spi_flash_read/write

Regards
Vignesh

> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> configs/ap121_defconfig | 1 +
> configs/ap143_defconfig | 1 +
> configs/bk4r1_defconfig | 1 +
> configs/clearfog_defconfig | 1 +
> configs/comtrend_ar5315u_ram_defconfig | 1 +
> configs/comtrend_ar5387un_ram_defconfig | 1 +
> configs/evb-rv1108_defconfig | 1 +
> configs/helios4_defconfig | 1 +
> configs/linkit-smart-7688-ram_defconfig | 1 +
> configs/linkit-smart-7688_defconfig | 1 +
> configs/netgear_cg3100d_ram_defconfig | 1 +
> configs/sagem_f at st1704_ram_defconfig | 1 +
> configs/tplink_wdr4300_defconfig | 1 +
> 13 files changed, 13 insertions(+)
>
> diff --git a/configs/ap121_defconfig b/configs/ap121_defconfig
> index 5d54267cd3..9e3af6750b 100644
> --- a/configs/ap121_defconfig
> +++ b/configs/ap121_defconfig
> @@ -34,6 +34,7 @@ CONFIG_DEFAULT_DEVICE_TREE="ap121"
> CONFIG_ENV_IS_IN_SPI_FLASH=y
> CONFIG_NET_RANDOM_ETHADDR=y
> CONFIG_DM_SPI_FLASH=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_BAR=y
> CONFIG_SPI_FLASH_ATMEL=y
> diff --git a/configs/ap143_defconfig b/configs/ap143_defconfig
> index 83eb583b56..6851df6d81 100644
> --- a/configs/ap143_defconfig
> +++ b/configs/ap143_defconfig
> @@ -33,6 +33,7 @@ CONFIG_DEFAULT_DEVICE_TREE="ap143"
> CONFIG_ENV_IS_IN_SPI_FLASH=y
> # CONFIG_NET is not set
> CONFIG_DM_SPI_FLASH=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_BAR=y
> CONFIG_SPI_FLASH_ATMEL=y
> diff --git a/configs/bk4r1_defconfig b/configs/bk4r1_defconfig
> index cf1fd0b6c6..bf2d94394b 100644
> --- a/configs/bk4r1_defconfig
> +++ b/configs/bk4r1_defconfig
> @@ -34,6 +34,7 @@ CONFIG_FSL_ESDHC=y
> CONFIG_NAND_VF610_NFC=y
> CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
> CONFIG_DM_SPI_FLASH=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_STMICRO=y
> CONFIG_SPI_FLASH_MTD=y
> diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig
> index 2e59686291..7c0c9e0762 100644
> --- a/configs/clearfog_defconfig
> +++ b/configs/clearfog_defconfig
> @@ -47,6 +47,7 @@ CONFIG_SYS_I2C_MVTWSI=y
> CONFIG_MMC_SDHCI=y
> CONFIG_MMC_SDHCI_SDMA=y
> CONFIG_MMC_SDHCI_MV=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_BAR=y
> CONFIG_SPI_FLASH_WINBOND=y
> diff --git a/configs/comtrend_ar5315u_ram_defconfig b/configs/comtrend_ar5315u_ram_defconfig
> index d9ef52e68d..7d58c6c90b 100644
> --- a/configs/comtrend_ar5315u_ram_defconfig
> +++ b/configs/comtrend_ar5315u_ram_defconfig
> @@ -38,6 +38,7 @@ CONFIG_LED=y
> CONFIG_LED_BCM6328=y
> CONFIG_LED_BLINK=y
> CONFIG_DM_SPI_FLASH=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_WINBOND=y
> CONFIG_SPI_FLASH_MTD=y
> diff --git a/configs/comtrend_ar5387un_ram_defconfig b/configs/comtrend_ar5387un_ram_defconfig
> index f129870ca0..f16b367707 100644
> --- a/configs/comtrend_ar5387un_ram_defconfig
> +++ b/configs/comtrend_ar5387un_ram_defconfig
> @@ -38,6 +38,7 @@ CONFIG_LED=y
> CONFIG_LED_BCM6328=y
> CONFIG_LED_BLINK=y
> CONFIG_DM_SPI_FLASH=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_MACRONIX=y
> CONFIG_SPI_FLASH_MTD=y
> diff --git a/configs/evb-rv1108_defconfig b/configs/evb-rv1108_defconfig
> index 2ef041f2c5..96522a3a96 100644
> --- a/configs/evb-rv1108_defconfig
> +++ b/configs/evb-rv1108_defconfig
> @@ -28,6 +28,7 @@ CONFIG_FASTBOOT_FLASH=y
> CONFIG_FASTBOOT_FLASH_MMC_DEV=1
> CONFIG_ROCKCHIP_GPIO=y
> CONFIG_SYS_I2C_ROCKCHIP=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_BAR=y
> CONFIG_SPI_FLASH_GIGADEVICE=y
> diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig
> index e30eb3d41c..03fc8d144b 100644
> --- a/configs/helios4_defconfig
> +++ b/configs/helios4_defconfig
> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
> CONFIG_MMC_SDHCI=y
> CONFIG_MMC_SDHCI_SDMA=y
> CONFIG_MMC_SDHCI_MV=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_BAR=y
> CONFIG_SPI_FLASH_WINBOND=y
> diff --git a/configs/linkit-smart-7688-ram_defconfig b/configs/linkit-smart-7688-ram_defconfig
> index 77cd1c1575..dba5ef5d2a 100644
> --- a/configs/linkit-smart-7688-ram_defconfig
> +++ b/configs/linkit-smart-7688-ram_defconfig
> @@ -33,6 +33,7 @@ CONFIG_DM_GPIO=y
> CONFIG_LED=y
> CONFIG_LED_BLINK=y
> CONFIG_LED_GPIO=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_GIGADEVICE=y
> CONFIG_SPI_FLASH_MACRONIX=y
> diff --git a/configs/linkit-smart-7688_defconfig b/configs/linkit-smart-7688_defconfig
> index 62cdda1e0a..c5d6706587 100644
> --- a/configs/linkit-smart-7688_defconfig
> +++ b/configs/linkit-smart-7688_defconfig
> @@ -37,6 +37,7 @@ CONFIG_DM_GPIO=y
> CONFIG_LED=y
> CONFIG_LED_BLINK=y
> CONFIG_LED_GPIO=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_GIGADEVICE=y
> CONFIG_SPI_FLASH_MACRONIX=y
> diff --git a/configs/netgear_cg3100d_ram_defconfig b/configs/netgear_cg3100d_ram_defconfig
> index 83e82247ab..1e7cd85f4f 100644
> --- a/configs/netgear_cg3100d_ram_defconfig
> +++ b/configs/netgear_cg3100d_ram_defconfig
> @@ -38,6 +38,7 @@ CONFIG_LED_BCM6328=y
> CONFIG_LED_BLINK=y
> CONFIG_LED_GPIO=y
> CONFIG_DM_SPI_FLASH=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_SPANSION=y
> CONFIG_SPI_FLASH_MTD=y
> diff --git a/configs/sagem_f at st1704_ram_defconfig b/configs/sagem_f at st1704_ram_defconfig
> index 91a966327a..67394e9ab0 100644
> --- a/configs/sagem_f at st1704_ram_defconfig
> +++ b/configs/sagem_f at st1704_ram_defconfig
> @@ -37,6 +37,7 @@ CONFIG_BCM6345_GPIO=y
> CONFIG_LED=y
> CONFIG_LED_GPIO=y
> CONFIG_DM_SPI_FLASH=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_WINBOND=y
> CONFIG_SPI_FLASH_MTD=y
> diff --git a/configs/tplink_wdr4300_defconfig b/configs/tplink_wdr4300_defconfig
> index 12ebd989a2..bca3ae8385 100644
> --- a/configs/tplink_wdr4300_defconfig
> +++ b/configs/tplink_wdr4300_defconfig
> @@ -24,6 +24,7 @@ CONFIG_DEFAULT_DEVICE_TREE="tplink_wdr4300"
> CONFIG_NET_RANDOM_ETHADDR=y
> CONFIG_CLK=y
> CONFIG_DM_SPI_FLASH=y
> +CONFIG_MTD=y
> CONFIG_SPI_FLASH=y
> CONFIG_SPI_FLASH_ATMEL=y
> CONFIG_SPI_FLASH_EON=y
>