All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig
@ 2019-09-13 22:43 Schrempf Frieder
  2019-09-13 22:43 ` [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD Schrempf Frieder
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Schrempf Frieder @ 2019-09-13 22:43 UTC (permalink / raw)
  To: u-boot

From: Frieder Schrempf <frieder.schrempf@kontron.de>

To allow SPI_FLASH_MTD being enabled separately in SPL we add a new
option. The only user currently is the stm32mp15_basic board.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 drivers/mtd/spi/Kconfig | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index d3b007a731..f5cb7f6577 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -196,4 +196,12 @@ config SPI_FLASH_MTD
 
 	  If unsure, say N
 
+config SPL_SPI_FLASH_MTD
+	bool "SPI flash MTD support for SPL"
+	depends on SPI_FLASH
+	help
+          Enable the MTD support for the SPI flash layer in SPL.
+
+	  If unsure, say N
+
 endmenu # menu "SPI Flash Support"
-- 
2.17.1

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

* [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD
  2019-09-13 22:43 [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig Schrempf Frieder
@ 2019-09-13 22:43 ` Schrempf Frieder
  2019-09-16 12:04   ` Lukasz Majewski
  2019-10-16 16:34   ` Jagan Teki
  2019-09-13 22:44 ` [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD Schrempf Frieder
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 25+ messages in thread
From: Schrempf Frieder @ 2019-09-13 22:43 UTC (permalink / raw)
  To: u-boot

From: Frieder Schrempf <frieder.schrempf@kontron.de>

As SPI_FLASH_MTD is used in SPL and U-Boot proper, we enable both,
now that a separate option for SPL was introduced.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 configs/stm32mp15_basic_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
index 09785b5dc1..390319657f 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -7,10 +7,10 @@ CONFIG_TARGET_STM32MP1=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 # CONFIG_ARMV7_VIRT is not set
+CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
-CONFIG_SPL_TEXT_BASE=0x2FFC2500
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
 CONFIG_SPL_I2C_SUPPORT=y
@@ -90,6 +90,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_SPL_SPI_FLASH_MTD=y
 CONFIG_DM_ETH=y
 CONFIG_DWC_ETH_QOS=y
 CONFIG_PHY=y
-- 
2.17.1

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-09-13 22:43 [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig Schrempf Frieder
  2019-09-13 22:43 ` [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD Schrempf Frieder
@ 2019-09-13 22:44 ` Schrempf Frieder
  2019-09-16  7:35   ` Stefan Roese
                     ` (4 more replies)
  2019-09-16 12:04 ` [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig Lukasz Majewski
  2019-10-22 18:05 ` Jagan Teki
  3 siblings, 5 replies; 25+ messages in thread
From: Schrempf Frieder @ 2019-09-13 22:44 UTC (permalink / raw)
  To: u-boot

From: Frieder Schrempf <frieder.schrempf@kontron.de>

Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
SPL. They often rely on hacks in the board header files to include
this option conditionally. To be able to fix this, we previously
introduced a separate option SPL_SPI_FLASH_MTD.

Therefore we can now adjust the Makefile and change the code in
sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).

We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
header files to the according defconfigs. The affected boards are
socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
and da850evm.

We do this all in one patch to guarantee bisectibility.

This change was tested with buildman to make sure it does not
introduce any regressions by comparing the resulting binary sizes.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 configs/aristainetos2_defconfig        |  1 +
 configs/aristainetos2b_defconfig       |  1 +
 configs/aristainetos_defconfig         |  1 +
 configs/cm_fx6_defconfig               |  1 +
 configs/display5_defconfig             |  1 +
 configs/display5_factory_defconfig     |  1 +
 configs/socfpga_arria5_defconfig       |  1 +
 configs/socfpga_cyclone5_defconfig     |  1 +
 configs/socfpga_dbm_soc1_defconfig     |  1 +
 configs/socfpga_de0_nano_soc_defconfig |  1 +
 configs/socfpga_de10_nano_defconfig    |  1 +
 configs/socfpga_is1_defconfig          |  1 +
 configs/socfpga_mcvevk_defconfig       |  1 +
 configs/socfpga_sockit_defconfig       |  1 +
 configs/socfpga_socrates_defconfig     |  1 +
 configs/socfpga_sr1500_defconfig       |  1 +
 configs/socfpga_vining_fpga_defconfig  |  1 +
 drivers/mtd/spi/Makefile               |  2 +-
 drivers/mtd/spi/sf_internal.h          |  2 +-
 drivers/mtd/spi/sf_probe.c             |  6 +++---
 include/configs/aristainetos-common.h  |  1 -
 include/configs/cm_fx6.h               |  7 -------
 include/configs/da850evm.h             |  7 +------
 include/configs/dh_imx6.h              |  1 -
 include/configs/display5.h             |  4 ----
 include/configs/gw_ventana.h           | 10 +---------
 include/configs/rcar-gen2-common.h     |  4 +---
 include/configs/socfpga_common.h       |  4 ----
 28 files changed, 25 insertions(+), 40 deletions(-)

diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
index 18ef5d2dce..0bfc117762 100644
--- a/configs/aristainetos2_defconfig
+++ b/configs/aristainetos2_defconfig
@@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
 CONFIG_PHYLIB=y
diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
index 1054c05d8c..e2da747a8f 100644
--- a/configs/aristainetos2b_defconfig
+++ b/configs/aristainetos2b_defconfig
@@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
 CONFIG_PHYLIB=y
diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
index 4080a7b310..5caf95c22f 100644
--- a/configs/aristainetos_defconfig
+++ b/configs/aristainetos_defconfig
@@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
 CONFIG_PHYLIB=y
diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
index fd0db4db5c..15be7db027 100644
--- a/configs/cm_fx6_defconfig
+++ b/configs/cm_fx6_defconfig
@@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_MII=y
 CONFIG_DM_PMIC=y
diff --git a/configs/display5_defconfig b/configs/display5_defconfig
index 8609cd5a8c..5a4cc772be 100644
--- a/configs/display5_defconfig
+++ b/configs/display5_defconfig
@@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_FEC_MXC=y
diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
index 70c64260d8..66c68e5ea9 100644
--- a/configs/display5_factory_defconfig
+++ b/configs/display5_factory_defconfig
@@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
index 89e5ff8c71..30c2d19941 100644
--- a/configs/socfpga_arria5_defconfig
+++ b/configs/socfpga_arria5_defconfig
@@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
index 00f2104276..dfe011b959 100644
--- a/configs/socfpga_cyclone5_defconfig
+++ b/configs/socfpga_cyclone5_defconfig
@@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
diff --git a/configs/socfpga_dbm_soc1_defconfig b/configs/socfpga_dbm_soc1_defconfig
index 1877010a19..ee693f3def 100644
--- a/configs/socfpga_dbm_soc1_defconfig
+++ b/configs/socfpga_dbm_soc1_defconfig
@@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
 CONFIG_MTD_DEVICE=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_ETH_DESIGNWARE=y
diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
index de50f17174..e91d6f62f8 100644
--- a/configs/socfpga_de0_nano_soc_defconfig
+++ b/configs/socfpga_de0_nano_soc_defconfig
@@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
 CONFIG_MTD_DEVICE=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
diff --git a/configs/socfpga_de10_nano_defconfig b/configs/socfpga_de10_nano_defconfig
index 03961195ac..ffe9d6c10c 100644
--- a/configs/socfpga_de10_nano_defconfig
+++ b/configs/socfpga_de10_nano_defconfig
@@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
 CONFIG_MTD_DEVICE=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
index 6ea06c1104..76ab87250b 100644
--- a/configs/socfpga_is1_defconfig
+++ b/configs/socfpga_is1_defconfig
@@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
 CONFIG_MTD_DEVICE=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
index 161bd6fca3..4d3caaa8ad 100644
--- a/configs/socfpga_mcvevk_defconfig
+++ b/configs/socfpga_mcvevk_defconfig
@@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DW=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
 CONFIG_ETH_DESIGNWARE=y
diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
index 8ec1c05571..0ffcfda21e 100644
--- a/configs/socfpga_sockit_defconfig
+++ b/configs/socfpga_sockit_defconfig
@@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
index 15f81d1a4b..193af0b0df 100644
--- a/configs/socfpga_socrates_defconfig
+++ b/configs/socfpga_socrates_defconfig
@@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
index 941bf1124a..899dd8396b 100644
--- a/configs/socfpga_sr1500_defconfig
+++ b/configs/socfpga_sr1500_defconfig
@@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=100000000
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHY_MARVELL=y
 CONFIG_DM_ETH=y
 CONFIG_PHY_GIGE=y
diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
index 96f806ab5f..f96f536169 100644
--- a/configs/socfpga_vining_fpga_defconfig
+++ b/configs/socfpga_vining_fpga_defconfig
@@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index f99f6cb16e..fb67ba32c6 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -19,5 +19,5 @@ endif
 
 obj-$(CONFIG_SPI_FLASH) += spi-nor.o
 obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
-obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
+obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
 obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index a6bf734830..8542b03685 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
 int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
 
 
-#ifdef CONFIG_SPI_FLASH_MTD
+#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
 int spi_flash_mtd_register(struct spi_flash *flash);
 void spi_flash_mtd_unregister(void);
 #endif
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 73297e1a0a..f051e473ff 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
 	if (ret)
 		goto err_read_id;
 
-#ifdef CONFIG_SPI_FLASH_MTD
+#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
 	ret = spi_flash_mtd_register(flash);
 #endif
 
@@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
 
 void spi_flash_free(struct spi_flash *flash)
 {
-#ifdef CONFIG_SPI_FLASH_MTD
+#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
 	spi_flash_mtd_unregister();
 #endif
 	spi_free_slave(flash->spi);
@@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice *dev)
 
 static int spi_flash_std_remove(struct udevice *dev)
 {
-#ifdef CONFIG_SPI_FLASH_MTD
+#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
 	spi_flash_mtd_unregister();
 #endif
 	return 0;
diff --git a/include/configs/aristainetos-common.h b/include/configs/aristainetos-common.h
index e998d9b1b2..b451c7e7dc 100644
--- a/include/configs/aristainetos-common.h
+++ b/include/configs/aristainetos-common.h
@@ -30,7 +30,6 @@
 #define CONFIG_ETHPRIME			"FEC"
 #define CONFIG_FEC_MXC_PHYADDR		0
 
-#define CONFIG_SPI_FLASH_MTD
 #define CONFIG_SYS_SPI_ST_ENABLE_WP_PIN
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
index b957e9cba4..c1a6625fcb 100644
--- a/include/configs/cm_fx6.h
+++ b/include/configs/cm_fx6.h
@@ -38,13 +38,6 @@
 #define CONFIG_MXC_UART_BASE		UART4_BASE
 #define CONFIG_SYS_BAUDRATE_TABLE	{9600, 19200, 38400, 57600, 115200}
 
-/* SPI flash */
-
-/* MTD support */
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_SPI_FLASH_MTD
-#endif
-
 /* Environment */
 #define CONFIG_ENV_SECT_SIZE		(64 * 1024)
 #define CONFIG_ENV_SIZE			(8 * 1024)
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 41f0813a01..6876134a00 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -190,16 +190,11 @@
 #define CONFIG_ENV_SECT_SIZE		CONFIG_SYS_FLASH_SECT_SZ
 #endif
 
-#ifdef CONFIG_USE_SPIFLASH
-#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
+#if defined(CONFIG_USE_SPIFLASH) && defined(CONFIG_ENV_IS_IN_SPI_FLASH)
 #define CONFIG_ENV_SIZE			(64 << 10)
 #define CONFIG_ENV_OFFSET		(512 << 10)
 #define CONFIG_ENV_SECT_SIZE	(64 << 10)
 #endif
-#ifdef CONFIG_SPL_BUILD
-#undef CONFIG_SPI_FLASH_MTD
-#endif
-#endif
 
 /*
  * U-Boot general configuration
diff --git a/include/configs/dh_imx6.h b/include/configs/dh_imx6.h
index c516e6ed4c..485bc2d997 100644
--- a/include/configs/dh_imx6.h
+++ b/include/configs/dh_imx6.h
@@ -59,7 +59,6 @@
 #if defined(CONFIG_SPL_BUILD)
 #undef CONFIG_DM_SPI
 #undef CONFIG_DM_SPI_FLASH
-#undef CONFIG_SPI_FLASH_MTD
 #endif
 
 /* UART */
diff --git a/include/configs/display5.h b/include/configs/display5.h
index e503e4a0ce..64f211307a 100644
--- a/include/configs/display5.h
+++ b/include/configs/display5.h
@@ -35,10 +35,6 @@
  * 0x1540000 - 0x1640000 : SPI.factory  (1MiB)
  */
 
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_SPI_FLASH_MTD
-#endif
-
 /* Below values are "dummy" - only to avoid build break */
 #define CONFIG_SYS_SPI_KERNEL_OFFS      0x150000
 #define CONFIG_SYS_SPI_ARGS_OFFS        0x140000
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index a27627e721..e543061bff 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -47,15 +47,7 @@
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE	       UART2_BASE
 
-#ifdef CONFIG_SPI_FLASH
-
-/* SPI */
-#ifdef CONFIG_CMD_SF
-  #define CONFIG_SPI_FLASH_MTD
-					     /* GPIO 3-19 (21248) */
-#endif
-
-#elif defined(CONFIG_SPL_NAND_SUPPORT)
+#if !defined(CONFIG_SPI_FLASH) && defined(CONFIG_SPL_NAND_SUPPORT)
 /* Enable NAND support */
 #ifdef CONFIG_CMD_NAND
   #define CONFIG_SYS_MAX_NAND_DEVICE	1
diff --git a/include/configs/rcar-gen2-common.h b/include/configs/rcar-gen2-common.h
index 71a5909045..e940a8b70a 100644
--- a/include/configs/rcar-gen2-common.h
+++ b/include/configs/rcar-gen2-common.h
@@ -46,11 +46,9 @@
 #define CONFIG_ENV_SIZE_REDUND	(CONFIG_SYS_MONITOR_LEN)
 
 /* SF MTD */
-#if defined(CONFIG_SPI_FLASH_MTD) && !defined(CONFIG_SPL_BUILD)
-#else
+#ifdef CONFIG_SPL_BUILD
 #undef CONFIG_DM_SPI
 #undef CONFIG_DM_SPI_FLASH
-#undef CONFIG_SPI_FLASH_MTD
 #endif
 
 /* Timer */
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index b11fe021a7..96b32cd99a 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -133,10 +133,6 @@
 /*
  * QSPI support
  */
-/* Enable multiple SPI NOR flash manufacturers */
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_SPI_FLASH_MTD
-#endif
 /* QSPI reference clock */
 #ifndef __ASSEMBLY__
 unsigned int cm_get_qspi_controller_clk_hz(void);
-- 
2.17.1

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-09-13 22:44 ` [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD Schrempf Frieder
@ 2019-09-16  7:35   ` Stefan Roese
  2019-09-16  7:41     ` Simon Goldschmidt
  2019-09-16 12:03   ` Lukasz Majewski
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 25+ messages in thread
From: Stefan Roese @ 2019-09-16  7:35 UTC (permalink / raw)
  To: u-boot

On 14.09.19 00:44, Schrempf Frieder wrote:
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> SPL. They often rely on hacks in the board header files to include
> this option conditionally. To be able to fix this, we previously
> introduced a separate option SPL_SPI_FLASH_MTD.
> 
> Therefore we can now adjust the Makefile and change the code in
> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> 
> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> header files to the according defconfigs. The affected boards are
> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> and da850evm.
> 
> We do this all in one patch to guarantee bisectibility.
> 
> This change was tested with buildman to make sure it does not
> introduce any regressions by comparing the resulting binary sizes.
> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-09-16  7:35   ` Stefan Roese
@ 2019-09-16  7:41     ` Simon Goldschmidt
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Goldschmidt @ 2019-09-16  7:41 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 16, 2019 at 9:36 AM Stefan Roese <sr@denx.de> wrote:
>
> On 14.09.19 00:44, Schrempf Frieder wrote:
> > From: Frieder Schrempf <frieder.schrempf@kontron.de>
> >
> > Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> > SPL. They often rely on hacks in the board header files to include
> > this option conditionally. To be able to fix this, we previously
> > introduced a separate option SPL_SPI_FLASH_MTD.
> >
> > Therefore we can now adjust the Makefile and change the code in
> > sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> >
> > We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> > header files to the according defconfigs. The affected boards are
> > socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> > and da850evm.
> >
> > We do this all in one patch to guarantee bisectibility.
> >
> > This change was tested with buildman to make sure it does not
> > introduce any regressions by comparing the resulting binary sizes.
> >
> > Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> Reviewed-by: Stefan Roese <sr@denx.de>

Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

>
> Thanks,
> Stefan

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-09-13 22:44 ` [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD Schrempf Frieder
  2019-09-16  7:35   ` Stefan Roese
@ 2019-09-16 12:03   ` Lukasz Majewski
  2019-09-17  5:28   ` Heiko Schocher
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 25+ messages in thread
From: Lukasz Majewski @ 2019-09-16 12:03 UTC (permalink / raw)
  To: u-boot

Hi Frieder,

> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> SPL. They often rely on hacks in the board header files to include
> this option conditionally. To be able to fix this, we previously
> introduced a separate option SPL_SPI_FLASH_MTD.
> 
> Therefore we can now adjust the Makefile and change the code in
> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> 
> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> header files to the according defconfigs. The affected boards are
> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> and da850evm.
> 
> We do this all in one patch to guarantee bisectibility.
> 
> This change was tested with buildman to make sure it does not
> introduce any regressions by comparing the resulting binary sizes.
> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>

Acked-by: Lukasz Majewski <lukma@denx.de>

> ---
>  configs/aristainetos2_defconfig        |  1 +
>  configs/aristainetos2b_defconfig       |  1 +
>  configs/aristainetos_defconfig         |  1 +
>  configs/cm_fx6_defconfig               |  1 +
>  configs/display5_defconfig             |  1 +
>  configs/display5_factory_defconfig     |  1 +
>  configs/socfpga_arria5_defconfig       |  1 +
>  configs/socfpga_cyclone5_defconfig     |  1 +
>  configs/socfpga_dbm_soc1_defconfig     |  1 +
>  configs/socfpga_de0_nano_soc_defconfig |  1 +
>  configs/socfpga_de10_nano_defconfig    |  1 +
>  configs/socfpga_is1_defconfig          |  1 +
>  configs/socfpga_mcvevk_defconfig       |  1 +
>  configs/socfpga_sockit_defconfig       |  1 +
>  configs/socfpga_socrates_defconfig     |  1 +
>  configs/socfpga_sr1500_defconfig       |  1 +
>  configs/socfpga_vining_fpga_defconfig  |  1 +
>  drivers/mtd/spi/Makefile               |  2 +-
>  drivers/mtd/spi/sf_internal.h          |  2 +-
>  drivers/mtd/spi/sf_probe.c             |  6 +++---
>  include/configs/aristainetos-common.h  |  1 -
>  include/configs/cm_fx6.h               |  7 -------
>  include/configs/da850evm.h             |  7 +------
>  include/configs/dh_imx6.h              |  1 -
>  include/configs/display5.h             |  4 ----
>  include/configs/gw_ventana.h           | 10 +---------
>  include/configs/rcar-gen2-common.h     |  4 +---
>  include/configs/socfpga_common.h       |  4 ----
>  28 files changed, 25 insertions(+), 40 deletions(-)
> 
> diff --git a/configs/aristainetos2_defconfig
> b/configs/aristainetos2_defconfig index 18ef5d2dce..0bfc117762 100644
> --- a/configs/aristainetos2_defconfig
> +++ b/configs/aristainetos2_defconfig
> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
>  CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=20000000
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_MTD_UBI_FASTMAP=y
>  CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>  CONFIG_PHYLIB=y
> diff --git a/configs/aristainetos2b_defconfig
> b/configs/aristainetos2b_defconfig index 1054c05d8c..e2da747a8f 100644
> --- a/configs/aristainetos2b_defconfig
> +++ b/configs/aristainetos2b_defconfig
> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=20000000
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_MTD_UBI_FASTMAP=y
>  CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>  CONFIG_PHYLIB=y
> diff --git a/configs/aristainetos_defconfig
> b/configs/aristainetos_defconfig index 4080a7b310..5caf95c22f 100644
> --- a/configs/aristainetos_defconfig
> +++ b/configs/aristainetos_defconfig
> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
>  CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=20000000
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_MTD_UBI_FASTMAP=y
>  CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>  CONFIG_PHYLIB=y
> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
> index fd0db4db5c..15be7db027 100644
> --- a/configs/cm_fx6_defconfig
> +++ b/configs/cm_fx6_defconfig
> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  CONFIG_SPI_FLASH_SST=y
>  CONFIG_SPI_FLASH_WINBOND=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHYLIB=y
>  CONFIG_MII=y
>  CONFIG_DM_PMIC=y
> diff --git a/configs/display5_defconfig b/configs/display5_defconfig
> index 8609cd5a8c..5a4cc772be 100644
> --- a/configs/display5_defconfig
> +++ b/configs/display5_defconfig
> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHYLIB=y
>  CONFIG_PHY_MARVELL=y
>  CONFIG_FEC_MXC=y
> diff --git a/configs/display5_factory_defconfig
> b/configs/display5_factory_defconfig index 70c64260d8..66c68e5ea9
> 100644 --- a/configs/display5_factory_defconfig
> +++ b/configs/display5_factory_defconfig
> @@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHYLIB=y
>  CONFIG_FEC_MXC=y
>  CONFIG_MII=y
> diff --git a/configs/socfpga_arria5_defconfig
> b/configs/socfpga_arria5_defconfig index 89e5ff8c71..30c2d19941 100644
> --- a/configs/socfpga_arria5_defconfig
> +++ b/configs/socfpga_arria5_defconfig
> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_cyclone5_defconfig
> b/configs/socfpga_cyclone5_defconfig index 00f2104276..dfe011b959
> 100644 --- a/configs/socfpga_cyclone5_defconfig
> +++ b/configs/socfpga_cyclone5_defconfig
> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_dbm_soc1_defconfig
> b/configs/socfpga_dbm_soc1_defconfig index 1877010a19..ee693f3def
> 100644 --- a/configs/socfpga_dbm_soc1_defconfig
> +++ b/configs/socfpga_dbm_soc1_defconfig
> @@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_DW=y
>  CONFIG_MTD_DEVICE=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_DM_ETH=y
>  CONFIG_PHY_GIGE=y
>  CONFIG_ETH_DESIGNWARE=y
> diff --git a/configs/socfpga_de0_nano_soc_defconfig
> b/configs/socfpga_de0_nano_soc_defconfig index de50f17174..e91d6f62f8
> 100644 --- a/configs/socfpga_de0_nano_soc_defconfig
> +++ b/configs/socfpga_de0_nano_soc_defconfig
> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_DW=y
>  CONFIG_MTD_DEVICE=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_de10_nano_defconfig
> b/configs/socfpga_de10_nano_defconfig index 03961195ac..ffe9d6c10c
> 100644 --- a/configs/socfpga_de10_nano_defconfig
> +++ b/configs/socfpga_de10_nano_defconfig
> @@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_DW=y
>  CONFIG_MTD_DEVICE=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_is1_defconfig
> b/configs/socfpga_is1_defconfig index 6ea06c1104..76ab87250b 100644
> --- a/configs/socfpga_is1_defconfig
> +++ b/configs/socfpga_is1_defconfig
> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>  CONFIG_MTD_DEVICE=y
>  CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_mcvevk_defconfig
> b/configs/socfpga_mcvevk_defconfig index 161bd6fca3..4d3caaa8ad 100644
> --- a/configs/socfpga_mcvevk_defconfig
> +++ b/configs/socfpga_mcvevk_defconfig
> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
>  CONFIG_SYS_I2C_DW=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_DW=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_DM_ETH=y
>  CONFIG_PHY_GIGE=y
>  CONFIG_ETH_DESIGNWARE=y
> diff --git a/configs/socfpga_sockit_defconfig
> b/configs/socfpga_sockit_defconfig index 8ec1c05571..0ffcfda21e 100644
> --- a/configs/socfpga_sockit_defconfig
> +++ b/configs/socfpga_sockit_defconfig
> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_socrates_defconfig
> b/configs/socfpga_socrates_defconfig index 15f81d1a4b..193af0b0df
> 100644 --- a/configs/socfpga_socrates_defconfig
> +++ b/configs/socfpga_socrates_defconfig
> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_MACRONIX=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_sr1500_defconfig
> b/configs/socfpga_sr1500_defconfig index 941bf1124a..899dd8396b 100644
> --- a/configs/socfpga_sr1500_defconfig
> +++ b/configs/socfpga_sr1500_defconfig
> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SF_DEFAULT_SPEED=100000000
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MARVELL=y
>  CONFIG_DM_ETH=y
>  CONFIG_PHY_GIGE=y
> diff --git a/configs/socfpga_vining_fpga_defconfig
> b/configs/socfpga_vining_fpga_defconfig index 96f806ab5f..f96f536169
> 100644 --- a/configs/socfpga_vining_fpga_defconfig
> +++ b/configs/socfpga_vining_fpga_defconfig
> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_MTD_UBI_FASTMAP=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
> index f99f6cb16e..fb67ba32c6 100644
> --- a/drivers/mtd/spi/Makefile
> +++ b/drivers/mtd/spi/Makefile
> @@ -19,5 +19,5 @@ endif
>  
>  obj-$(CONFIG_SPI_FLASH) += spi-nor.o
>  obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
>  obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
> diff --git a/drivers/mtd/spi/sf_internal.h
> b/drivers/mtd/spi/sf_internal.h index a6bf734830..8542b03685 100644
> --- a/drivers/mtd/spi/sf_internal.h
> +++ b/drivers/mtd/spi/sf_internal.h
> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi,
> const u8 *cmd, size_t cmd_len, int
> spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash); 
>  
> -#ifdef CONFIG_SPI_FLASH_MTD
> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>  int spi_flash_mtd_register(struct spi_flash *flash);
>  void spi_flash_mtd_unregister(void);
>  #endif
> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> index 73297e1a0a..f051e473ff 100644
> --- a/drivers/mtd/spi/sf_probe.c
> +++ b/drivers/mtd/spi/sf_probe.c
> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash
> *flash) if (ret)
>  		goto err_read_id;
>  
> -#ifdef CONFIG_SPI_FLASH_MTD
> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>  	ret = spi_flash_mtd_register(flash);
>  #endif
>  
> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int
> busnum, unsigned int cs, 
>  void spi_flash_free(struct spi_flash *flash)
>  {
> -#ifdef CONFIG_SPI_FLASH_MTD
> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>  	spi_flash_mtd_unregister();
>  #endif
>  	spi_free_slave(flash->spi);
> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice
> *dev) 
>  static int spi_flash_std_remove(struct udevice *dev)
>  {
> -#ifdef CONFIG_SPI_FLASH_MTD
> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>  	spi_flash_mtd_unregister();
>  #endif
>  	return 0;
> diff --git a/include/configs/aristainetos-common.h
> b/include/configs/aristainetos-common.h index e998d9b1b2..b451c7e7dc
> 100644 --- a/include/configs/aristainetos-common.h
> +++ b/include/configs/aristainetos-common.h
> @@ -30,7 +30,6 @@
>  #define CONFIG_ETHPRIME			"FEC"
>  #define CONFIG_FEC_MXC_PHYADDR		0
>  
> -#define CONFIG_SPI_FLASH_MTD
>  #define CONFIG_SYS_SPI_ST_ENABLE_WP_PIN
>  
>  #define CONFIG_EXTRA_ENV_SETTINGS \
> diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
> index b957e9cba4..c1a6625fcb 100644
> --- a/include/configs/cm_fx6.h
> +++ b/include/configs/cm_fx6.h
> @@ -38,13 +38,6 @@
>  #define CONFIG_MXC_UART_BASE		UART4_BASE
>  #define CONFIG_SYS_BAUDRATE_TABLE	{9600, 19200, 38400, 57600,
> 115200} 
> -/* SPI flash */
> -
> -/* MTD support */
> -#ifndef CONFIG_SPL_BUILD
> -#define CONFIG_SPI_FLASH_MTD
> -#endif
> -
>  /* Environment */
>  #define CONFIG_ENV_SECT_SIZE		(64 * 1024)
>  #define CONFIG_ENV_SIZE			(8 * 1024)
> diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
> index 41f0813a01..6876134a00 100644
> --- a/include/configs/da850evm.h
> +++ b/include/configs/da850evm.h
> @@ -190,16 +190,11 @@
>  #define CONFIG_ENV_SECT_SIZE		CONFIG_SYS_FLASH_SECT_SZ
>  #endif
>  
> -#ifdef CONFIG_USE_SPIFLASH
> -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
> +#if defined(CONFIG_USE_SPIFLASH) &&
> defined(CONFIG_ENV_IS_IN_SPI_FLASH) #define CONFIG_ENV_SIZE
> 		(64 << 10) #define CONFIG_ENV_OFFSET
> (512 << 10) #define CONFIG_ENV_SECT_SIZE	(64 << 10)
>  #endif
> -#ifdef CONFIG_SPL_BUILD
> -#undef CONFIG_SPI_FLASH_MTD
> -#endif
> -#endif
>  
Chciałbym się jeszcze dopytać - czy restauracja Kaskada / Aruana o
>  /*
>   * U-Boot general configuration
> diff --git a/include/configs/dh_imx6.h b/include/configs/dh_imx6.h
> index c516e6ed4c..485bc2d997 100644
> --- a/include/configs/dh_imx6.h
> +++ b/include/configs/dh_imx6.h
> @@ -59,7 +59,6 @@
>  #if defined(CONFIG_SPL_BUILD)
>  #undef CONFIG_DM_SPI
>  #undef CONFIG_DM_SPI_FLASH
> -#undef CONFIG_SPI_FLASH_MTD
>  #endif
>  
>  /* UART */
> diff --git a/include/configs/display5.h b/include/configs/display5.h
> index e503e4a0ce..64f211307a 100644
> --- a/include/configs/display5.h
> +++ b/include/configs/display5.h
> @@ -35,10 +35,6 @@
>   * 0x1540000 - 0x1640000 : SPI.factory  (1MiB)
>   */
>  
> -#ifndef CONFIG_SPL_BUILD
> -#define CONFIG_SPI_FLASH_MTD
> -#endif
> -
>  /* Below values are "dummy" - only to avoid build break */
>  #define CONFIG_SYS_SPI_KERNEL_OFFS      0x150000
>  #define CONFIG_SYS_SPI_ARGS_OFFS        0x140000
> diff --git a/include/configs/gw_ventana.h
> b/include/configs/gw_ventana.h index a27627e721..e543061bff 100644
> --- a/include/configs/gw_ventana.h
> +++ b/include/configs/gw_ventana.h
> @@ -47,15 +47,7 @@
>  #define CONFIG_MXC_UART
>  #define CONFIG_MXC_UART_BASE	       UART2_BASE
>  
> -#ifdef CONFIG_SPI_FLASH
> -
> -/* SPI */
> -#ifdef CONFIG_CMD_SF
> -  #define CONFIG_SPI_FLASH_MTD
> -					     /* GPIO 3-19 (21248) */
> -#endif
> -
> -#elif defined(CONFIG_SPL_NAND_SUPPORT)
> +#if !defined(CONFIG_SPI_FLASH) && defined(CONFIG_SPL_NAND_SUPPORT)
>  /* Enable NAND support */
>  #ifdef CONFIG_CMD_NAND
>    #define CONFIG_SYS_MAX_NAND_DEVICE	1
> diff --git a/include/configs/rcar-gen2-common.h
> b/include/configs/rcar-gen2-common.h index 71a5909045..e940a8b70a
> 100644 --- a/include/configs/rcar-gen2-common.h
> +++ b/include/configs/rcar-gen2-common.h
> @@ -46,11 +46,9 @@
>  #define CONFIG_ENV_SIZE_REDUND	(CONFIG_SYS_MONITOR_LEN)
>  
>  /* SF MTD */
> -#if defined(CONFIG_SPI_FLASH_MTD) && !defined(CONFIG_SPL_BUILD)
> -#else
> +#ifdef CONFIG_SPL_BUILD
>  #undef CONFIG_DM_SPI
>  #undef CONFIG_DM_SPI_FLASH
> -#undef CONFIG_SPI_FLASH_MTD
>  #endif
>  
>  /* Timer */
> diff --git a/include/configs/socfpga_common.h
> b/include/configs/socfpga_common.h index b11fe021a7..96b32cd99a 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -133,10 +133,6 @@
>  /*
>   * QSPI support
>   */
> -/* Enable multiple SPI NOR flash manufacturers */
> -#ifndef CONFIG_SPL_BUILD
> -#define CONFIG_SPI_FLASH_MTD
> -#endif
>  /* QSPI reference clock */
>  #ifndef __ASSEMBLY__
>  unsigned int cm_get_qspi_controller_clk_hz(void);



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190916/23029c42/attachment.sig>

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

* [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig
  2019-09-13 22:43 [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig Schrempf Frieder
  2019-09-13 22:43 ` [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD Schrempf Frieder
  2019-09-13 22:44 ` [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD Schrempf Frieder
@ 2019-09-16 12:04 ` Lukasz Majewski
  2019-10-22 18:05 ` Jagan Teki
  3 siblings, 0 replies; 25+ messages in thread
From: Lukasz Majewski @ 2019-09-16 12:04 UTC (permalink / raw)
  To: u-boot

Hi Frieder,

> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> To allow SPI_FLASH_MTD being enabled separately in SPL we add a new
> option. The only user currently is the stm32mp15_basic board.

Thanks for preparing the patch.

> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
>  drivers/mtd/spi/Kconfig | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
> index d3b007a731..f5cb7f6577 100644
> --- a/drivers/mtd/spi/Kconfig
> +++ b/drivers/mtd/spi/Kconfig
> @@ -196,4 +196,12 @@ config SPI_FLASH_MTD
>  
>  	  If unsure, say N
>  
> +config SPL_SPI_FLASH_MTD
> +	bool "SPI flash MTD support for SPL"
> +	depends on SPI_FLASH
> +	help
> +          Enable the MTD support for the SPI flash layer in SPL.
> +
> +	  If unsure, say N
> +
>  endmenu # menu "SPI Flash Support"

Acked-by: Lukasz Majewski <lukma@denx.de>

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190916/55524888/attachment.sig>

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

* [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD
  2019-09-13 22:43 ` [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD Schrempf Frieder
@ 2019-09-16 12:04   ` Lukasz Majewski
  2019-10-16 16:34   ` Jagan Teki
  1 sibling, 0 replies; 25+ messages in thread
From: Lukasz Majewski @ 2019-09-16 12:04 UTC (permalink / raw)
  To: u-boot

On Fri, 13 Sep 2019 22:43:43 +0000
Schrempf Frieder <frieder.schrempf@kontron.de> wrote:

> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> As SPI_FLASH_MTD is used in SPL and U-Boot proper, we enable both,
> now that a separate option for SPL was introduced.
> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
>  configs/stm32mp15_basic_defconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/stm32mp15_basic_defconfig
> b/configs/stm32mp15_basic_defconfig index 09785b5dc1..390319657f
> 100644 --- a/configs/stm32mp15_basic_defconfig
> +++ b/configs/stm32mp15_basic_defconfig
> @@ -7,10 +7,10 @@ CONFIG_TARGET_STM32MP1=y
>  CONFIG_SPL_SPI_FLASH_SUPPORT=y
>  CONFIG_SPL_SPI_SUPPORT=y
>  # CONFIG_ARMV7_VIRT is not set
> +CONFIG_SPL_TEXT_BASE=0x2FFC2500
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_FIT=y
>  CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
> -CONFIG_SPL_TEXT_BASE=0x2FFC2500
>  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
>  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
>  CONFIG_SPL_I2C_SUPPORT=y
> @@ -90,6 +90,7 @@ CONFIG_SPI_FLASH_STMICRO=y
>  CONFIG_SPI_FLASH_WINBOND=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>  CONFIG_SPI_FLASH_MTD=y
> +CONFIG_SPL_SPI_FLASH_MTD=y
>  CONFIG_DM_ETH=y
>  CONFIG_DWC_ETH_QOS=y
>  CONFIG_PHY=y

Reviewed-by: Lukasz Majewski <lukma@denx.de>

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190916/d02dd70f/attachment.sig>

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-09-13 22:44 ` [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD Schrempf Frieder
  2019-09-16  7:35   ` Stefan Roese
  2019-09-16 12:03   ` Lukasz Majewski
@ 2019-09-17  5:28   ` Heiko Schocher
  2019-09-26 14:02   ` Schrempf Frieder
  2019-10-22 18:16   ` Jagan Teki
  4 siblings, 0 replies; 25+ messages in thread
From: Heiko Schocher @ 2019-09-17  5:28 UTC (permalink / raw)
  To: u-boot

Hello Frieder,

Am 14.09.2019 um 00:44 schrieb Schrempf Frieder:
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> SPL. They often rely on hacks in the board header files to include
> this option conditionally. To be able to fix this, we previously
> introduced a separate option SPL_SPI_FLASH_MTD.
> 
> Therefore we can now adjust the Makefile and change the code in
> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> 
> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> header files to the according defconfigs. The affected boards are
> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> and da850evm.
> 
> We do this all in one patch to guarantee bisectibility.
> 
> This change was tested with buildman to make sure it does not
> introduce any regressions by comparing the resulting binary sizes.
> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
>   configs/aristainetos2_defconfig        |  1 +
>   configs/aristainetos2b_defconfig       |  1 +
>   configs/aristainetos_defconfig         |  1 +
>   configs/cm_fx6_defconfig               |  1 +
>   configs/display5_defconfig             |  1 +
>   configs/display5_factory_defconfig     |  1 +
>   configs/socfpga_arria5_defconfig       |  1 +
>   configs/socfpga_cyclone5_defconfig     |  1 +
>   configs/socfpga_dbm_soc1_defconfig     |  1 +
>   configs/socfpga_de0_nano_soc_defconfig |  1 +
>   configs/socfpga_de10_nano_defconfig    |  1 +
>   configs/socfpga_is1_defconfig          |  1 +
>   configs/socfpga_mcvevk_defconfig       |  1 +
>   configs/socfpga_sockit_defconfig       |  1 +
>   configs/socfpga_socrates_defconfig     |  1 +
>   configs/socfpga_sr1500_defconfig       |  1 +
>   configs/socfpga_vining_fpga_defconfig  |  1 +
>   drivers/mtd/spi/Makefile               |  2 +-
>   drivers/mtd/spi/sf_internal.h          |  2 +-
>   drivers/mtd/spi/sf_probe.c             |  6 +++---
>   include/configs/aristainetos-common.h  |  1 -
>   include/configs/cm_fx6.h               |  7 -------
>   include/configs/da850evm.h             |  7 +------
>   include/configs/dh_imx6.h              |  1 -
>   include/configs/display5.h             |  4 ----
>   include/configs/gw_ventana.h           | 10 +---------
>   include/configs/rcar-gen2-common.h     |  4 +---
>   include/configs/socfpga_common.h       |  4 ----
>   28 files changed, 25 insertions(+), 40 deletions(-)

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-09-13 22:44 ` [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD Schrempf Frieder
                     ` (2 preceding siblings ...)
  2019-09-17  5:28   ` Heiko Schocher
@ 2019-09-26 14:02   ` Schrempf Frieder
  2019-09-26 14:17     ` Jagan Teki
  2019-10-22 18:16   ` Jagan Teki
  4 siblings, 1 reply; 25+ messages in thread
From: Schrempf Frieder @ 2019-09-26 14:02 UTC (permalink / raw)
  To: u-boot

On 14.09.19 00:44, Schrempf Frieder wrote:
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> 
> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> SPL. They often rely on hacks in the board header files to include
> this option conditionally. To be able to fix this, we previously
> introduced a separate option SPL_SPI_FLASH_MTD.
> 
> Therefore we can now adjust the Makefile and change the code in
> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> 
> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> header files to the according defconfigs. The affected boards are
> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> and da850evm.
> 
> We do this all in one patch to guarantee bisectibility.
> 
> This change was tested with buildman to make sure it does not
> introduce any regressions by comparing the resulting binary sizes.
> 
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>

I don't know much about the U-Boot release cycle, so maybe these are 
stupid questions.

Jagan, I saw that these 3 patches are assigned to you. When will you 
pick them? For the current release, or the next one?

Do we still need an ack for patch 2/3 from the stm32mp maintainers?

Thanks,
Frieder

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-09-26 14:02   ` Schrempf Frieder
@ 2019-09-26 14:17     ` Jagan Teki
  0 siblings, 0 replies; 25+ messages in thread
From: Jagan Teki @ 2019-09-26 14:17 UTC (permalink / raw)
  To: u-boot

On Thu, Sep 26, 2019 at 7:32 PM Schrempf Frieder
<frieder.schrempf@kontron.de> wrote:
>
> On 14.09.19 00:44, Schrempf Frieder wrote:
> > From: Frieder Schrempf <frieder.schrempf@kontron.de>
> >
> > Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> > SPL. They often rely on hacks in the board header files to include
> > this option conditionally. To be able to fix this, we previously
> > introduced a separate option SPL_SPI_FLASH_MTD.
> >
> > Therefore we can now adjust the Makefile and change the code in
> > sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> >
> > We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> > header files to the according defconfigs. The affected boards are
> > socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> > and da850evm.
> >
> > We do this all in one patch to guarantee bisectibility.
> >
> > This change was tested with buildman to make sure it does not
> > introduce any regressions by comparing the resulting binary sizes.
> >
> > Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> I don't know much about the U-Boot release cycle, so maybe these are
> stupid questions.
>
> Jagan, I saw that these 3 patches are assigned to you. When will you
> pick them? For the current release, or the next one?

Next release, since it out of MW.

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

* [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD
  2019-09-13 22:43 ` [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD Schrempf Frieder
  2019-09-16 12:04   ` Lukasz Majewski
@ 2019-10-16 16:34   ` Jagan Teki
  2019-10-17  6:42     ` Schrempf Frieder
  1 sibling, 1 reply; 25+ messages in thread
From: Jagan Teki @ 2019-10-16 16:34 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 14, 2019 at 4:18 AM Schrempf Frieder
<frieder.schrempf@kontron.de> wrote:
>
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> As SPI_FLASH_MTD is used in SPL and U-Boot proper, we enable both,
> now that a separate option for SPL was introduced.
>
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
>  configs/stm32mp15_basic_defconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
> index 09785b5dc1..390319657f 100644
> --- a/configs/stm32mp15_basic_defconfig
> +++ b/configs/stm32mp15_basic_defconfig
> @@ -7,10 +7,10 @@ CONFIG_TARGET_STM32MP1=y
>  CONFIG_SPL_SPI_FLASH_SUPPORT=y
>  CONFIG_SPL_SPI_SUPPORT=y
>  # CONFIG_ARMV7_VIRT is not set
> +CONFIG_SPL_TEXT_BASE=0x2FFC2500
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_FIT=y
>  CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
> -CONFIG_SPL_TEXT_BASE=0x2FFC2500

Unrelated change wrt to commit message?

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

* [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD
  2019-10-16 16:34   ` Jagan Teki
@ 2019-10-17  6:42     ` Schrempf Frieder
  2019-10-22 12:53       ` Schrempf Frieder
  0 siblings, 1 reply; 25+ messages in thread
From: Schrempf Frieder @ 2019-10-17  6:42 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On 16.10.19 18:34, Jagan Teki wrote:
> On Sat, Sep 14, 2019 at 4:18 AM Schrempf Frieder
> <frieder.schrempf@kontron.de> wrote:
>>
>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>>
>> As SPI_FLASH_MTD is used in SPL and U-Boot proper, we enable both,
>> now that a separate option for SPL was introduced.
>>
>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>> ---
>>   configs/stm32mp15_basic_defconfig | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
>> index 09785b5dc1..390319657f 100644
>> --- a/configs/stm32mp15_basic_defconfig
>> +++ b/configs/stm32mp15_basic_defconfig
>> @@ -7,10 +7,10 @@ CONFIG_TARGET_STM32MP1=y
>>   CONFIG_SPL_SPI_FLASH_SUPPORT=y
>>   CONFIG_SPL_SPI_SUPPORT=y
>>   # CONFIG_ARMV7_VIRT is not set
>> +CONFIG_SPL_TEXT_BASE=0x2FFC2500
>>   CONFIG_DISTRO_DEFAULTS=y
>>   CONFIG_FIT=y
>>   CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
>> -CONFIG_SPL_TEXT_BASE=0x2FFC2500
> 
> Unrelated change wrt to commit message?

Yes, this is unrelated, but that's what 'menuconfig' and 'savedefconfig' 
gave me as output. So I would think it's ok. If you don't think so, feel 
free to remove this change or let me know if I should remove it.

Thanks,
Frieder

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

* [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD
  2019-10-17  6:42     ` Schrempf Frieder
@ 2019-10-22 12:53       ` Schrempf Frieder
  2019-10-22 18:10         ` Jagan Teki
  0 siblings, 1 reply; 25+ messages in thread
From: Schrempf Frieder @ 2019-10-22 12:53 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On 17.10.19 08:42, Frieder Schrempf wrote:
> Hi Jagan,
> 
> On 16.10.19 18:34, Jagan Teki wrote:
>> On Sat, Sep 14, 2019 at 4:18 AM Schrempf Frieder
>> <frieder.schrempf@kontron.de> wrote:
>>>
>>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>>>
>>> As SPI_FLASH_MTD is used in SPL and U-Boot proper, we enable both,
>>> now that a separate option for SPL was introduced.
>>>
>>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>>> ---
>>>   configs/stm32mp15_basic_defconfig | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/configs/stm32mp15_basic_defconfig 
>>> b/configs/stm32mp15_basic_defconfig
>>> index 09785b5dc1..390319657f 100644
>>> --- a/configs/stm32mp15_basic_defconfig
>>> +++ b/configs/stm32mp15_basic_defconfig
>>> @@ -7,10 +7,10 @@ CONFIG_TARGET_STM32MP1=y
>>>   CONFIG_SPL_SPI_FLASH_SUPPORT=y
>>>   CONFIG_SPL_SPI_SUPPORT=y
>>>   # CONFIG_ARMV7_VIRT is not set
>>> +CONFIG_SPL_TEXT_BASE=0x2FFC2500
>>>   CONFIG_DISTRO_DEFAULTS=y
>>>   CONFIG_FIT=y
>>>   CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
>>> -CONFIG_SPL_TEXT_BASE=0x2FFC2500
>>
>> Unrelated change wrt to commit message?
> 
> Yes, this is unrelated, but that's what 'menuconfig' and 'savedefconfig' 
> gave me as output. So I would think it's ok. If you don't think so, feel 
> free to remove this change or let me know if I should remove it.

In patchwork all three patches of this series are marked with "Changes 
Requested". Can you please let me know what needs to be fixed?

Thanks,
Frieder

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

* [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig
  2019-09-13 22:43 [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig Schrempf Frieder
                   ` (2 preceding siblings ...)
  2019-09-16 12:04 ` [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig Lukasz Majewski
@ 2019-10-22 18:05 ` Jagan Teki
  3 siblings, 0 replies; 25+ messages in thread
From: Jagan Teki @ 2019-10-22 18:05 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 14, 2019 at 4:13 AM Schrempf Frieder
<frieder.schrempf@kontron.de> wrote:
>
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> To allow SPI_FLASH_MTD being enabled separately in SPL we add a new
> option. The only user currently is the stm32mp15_basic board.
>
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---

Applied to u-boot-spi/master

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

* [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD
  2019-10-22 12:53       ` Schrempf Frieder
@ 2019-10-22 18:10         ` Jagan Teki
  2019-10-23  6:47           ` Schrempf Frieder
  0 siblings, 1 reply; 25+ messages in thread
From: Jagan Teki @ 2019-10-22 18:10 UTC (permalink / raw)
  To: u-boot

On Tue, Oct 22, 2019 at 6:23 PM Schrempf Frieder
<frieder.schrempf@kontron.de> wrote:
>
> Hi Jagan,
>
> On 17.10.19 08:42, Frieder Schrempf wrote:
> > Hi Jagan,
> >
> > On 16.10.19 18:34, Jagan Teki wrote:
> >> On Sat, Sep 14, 2019 at 4:18 AM Schrempf Frieder
> >> <frieder.schrempf@kontron.de> wrote:
> >>>
> >>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> >>>
> >>> As SPI_FLASH_MTD is used in SPL and U-Boot proper, we enable both,
> >>> now that a separate option for SPL was introduced.
> >>>
> >>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> >>> ---
> >>>   configs/stm32mp15_basic_defconfig | 3 ++-
> >>>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/configs/stm32mp15_basic_defconfig
> >>> b/configs/stm32mp15_basic_defconfig
> >>> index 09785b5dc1..390319657f 100644
> >>> --- a/configs/stm32mp15_basic_defconfig
> >>> +++ b/configs/stm32mp15_basic_defconfig
> >>> @@ -7,10 +7,10 @@ CONFIG_TARGET_STM32MP1=y
> >>>   CONFIG_SPL_SPI_FLASH_SUPPORT=y
> >>>   CONFIG_SPL_SPI_SUPPORT=y
> >>>   # CONFIG_ARMV7_VIRT is not set
> >>> +CONFIG_SPL_TEXT_BASE=0x2FFC2500
> >>>   CONFIG_DISTRO_DEFAULTS=y
> >>>   CONFIG_FIT=y
> >>>   CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
> >>> -CONFIG_SPL_TEXT_BASE=0x2FFC2500
> >>
> >> Unrelated change wrt to commit message?
> >
> > Yes, this is unrelated, but that's what 'menuconfig' and 'savedefconfig'
> > gave me as output. So I would think it's ok. If you don't think so, feel
> > free to remove this change or let me know if I should remove it.
>
> In patchwork all three patches of this series are marked with "Changes
> Requested". Can you please let me know what needs to be fixed?

Thought you might drop that unrelated change and send next version,
but anyway I have changed and

Applied to u-boot-spi/master

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-09-13 22:44 ` [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD Schrempf Frieder
                     ` (3 preceding siblings ...)
  2019-09-26 14:02   ` Schrempf Frieder
@ 2019-10-22 18:16   ` Jagan Teki
  2019-10-23  7:05     ` Schrempf Frieder
  4 siblings, 1 reply; 25+ messages in thread
From: Jagan Teki @ 2019-10-22 18:16 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 14, 2019 at 4:14 AM Schrempf Frieder
<frieder.schrempf@kontron.de> wrote:
>
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> SPL. They often rely on hacks in the board header files to include
> this option conditionally. To be able to fix this, we previously
> introduced a separate option SPL_SPI_FLASH_MTD.
>
> Therefore we can now adjust the Makefile and change the code in
> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
>
> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> header files to the according defconfigs. The affected boards are
> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> and da850evm.
>
> We do this all in one patch to guarantee bisectibility.
>
> This change was tested with buildman to make sure it does not
> introduce any regressions by comparing the resulting binary sizes.
>
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> ---
>  configs/aristainetos2_defconfig        |  1 +
>  configs/aristainetos2b_defconfig       |  1 +
>  configs/aristainetos_defconfig         |  1 +
>  configs/cm_fx6_defconfig               |  1 +
>  configs/display5_defconfig             |  1 +
>  configs/display5_factory_defconfig     |  1 +
>  configs/socfpga_arria5_defconfig       |  1 +
>  configs/socfpga_cyclone5_defconfig     |  1 +
>  configs/socfpga_dbm_soc1_defconfig     |  1 +
>  configs/socfpga_de0_nano_soc_defconfig |  1 +
>  configs/socfpga_de10_nano_defconfig    |  1 +
>  configs/socfpga_is1_defconfig          |  1 +
>  configs/socfpga_mcvevk_defconfig       |  1 +
>  configs/socfpga_sockit_defconfig       |  1 +
>  configs/socfpga_socrates_defconfig     |  1 +
>  configs/socfpga_sr1500_defconfig       |  1 +
>  configs/socfpga_vining_fpga_defconfig  |  1 +
>  drivers/mtd/spi/Makefile               |  2 +-
>  drivers/mtd/spi/sf_internal.h          |  2 +-
>  drivers/mtd/spi/sf_probe.c             |  6 +++---
>  include/configs/aristainetos-common.h  |  1 -
>  include/configs/cm_fx6.h               |  7 -------
>  include/configs/da850evm.h             |  7 +------
>  include/configs/dh_imx6.h              |  1 -
>  include/configs/display5.h             |  4 ----
>  include/configs/gw_ventana.h           | 10 +---------
>  include/configs/rcar-gen2-common.h     |  4 +---
>  include/configs/socfpga_common.h       |  4 ----
>  28 files changed, 25 insertions(+), 40 deletions(-)
>
> diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
> index 18ef5d2dce..0bfc117762 100644
> --- a/configs/aristainetos2_defconfig
> +++ b/configs/aristainetos2_defconfig
> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
>  CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=20000000
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_MTD_UBI_FASTMAP=y
>  CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>  CONFIG_PHYLIB=y
> diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
> index 1054c05d8c..e2da747a8f 100644
> --- a/configs/aristainetos2b_defconfig
> +++ b/configs/aristainetos2b_defconfig
> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=20000000
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_MTD_UBI_FASTMAP=y
>  CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>  CONFIG_PHYLIB=y
> diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
> index 4080a7b310..5caf95c22f 100644
> --- a/configs/aristainetos_defconfig
> +++ b/configs/aristainetos_defconfig
> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
>  CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=20000000
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_MTD_UBI_FASTMAP=y
>  CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>  CONFIG_PHYLIB=y
> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
> index fd0db4db5c..15be7db027 100644
> --- a/configs/cm_fx6_defconfig
> +++ b/configs/cm_fx6_defconfig
> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  CONFIG_SPI_FLASH_SST=y
>  CONFIG_SPI_FLASH_WINBOND=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHYLIB=y
>  CONFIG_MII=y
>  CONFIG_DM_PMIC=y
> diff --git a/configs/display5_defconfig b/configs/display5_defconfig
> index 8609cd5a8c..5a4cc772be 100644
> --- a/configs/display5_defconfig
> +++ b/configs/display5_defconfig
> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHYLIB=y
>  CONFIG_PHY_MARVELL=y
>  CONFIG_FEC_MXC=y
> diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
> index 70c64260d8..66c68e5ea9 100644
> --- a/configs/display5_factory_defconfig
> +++ b/configs/display5_factory_defconfig
> @@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
>  CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHYLIB=y
>  CONFIG_FEC_MXC=y
>  CONFIG_MII=y
> diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
> index 89e5ff8c71..30c2d19941 100644
> --- a/configs/socfpga_arria5_defconfig
> +++ b/configs/socfpga_arria5_defconfig
> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
> index 00f2104276..dfe011b959 100644
> --- a/configs/socfpga_cyclone5_defconfig
> +++ b/configs/socfpga_cyclone5_defconfig
> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_dbm_soc1_defconfig b/configs/socfpga_dbm_soc1_defconfig
> index 1877010a19..ee693f3def 100644
> --- a/configs/socfpga_dbm_soc1_defconfig
> +++ b/configs/socfpga_dbm_soc1_defconfig
> @@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_DW=y
>  CONFIG_MTD_DEVICE=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_DM_ETH=y
>  CONFIG_PHY_GIGE=y
>  CONFIG_ETH_DESIGNWARE=y
> diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
> index de50f17174..e91d6f62f8 100644
> --- a/configs/socfpga_de0_nano_soc_defconfig
> +++ b/configs/socfpga_de0_nano_soc_defconfig
> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_DW=y
>  CONFIG_MTD_DEVICE=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_de10_nano_defconfig b/configs/socfpga_de10_nano_defconfig
> index 03961195ac..ffe9d6c10c 100644
> --- a/configs/socfpga_de10_nano_defconfig
> +++ b/configs/socfpga_de10_nano_defconfig
> @@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_DW=y
>  CONFIG_MTD_DEVICE=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
> index 6ea06c1104..76ab87250b 100644
> --- a/configs/socfpga_is1_defconfig
> +++ b/configs/socfpga_is1_defconfig
> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>  CONFIG_MTD_DEVICE=y
>  CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
> index 161bd6fca3..4d3caaa8ad 100644
> --- a/configs/socfpga_mcvevk_defconfig
> +++ b/configs/socfpga_mcvevk_defconfig
> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
>  CONFIG_SYS_I2C_DW=y
>  CONFIG_DM_MMC=y
>  CONFIG_MMC_DW=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_DM_ETH=y
>  CONFIG_PHY_GIGE=y
>  CONFIG_ETH_DESIGNWARE=y
> diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
> index 8ec1c05571..0ffcfda21e 100644
> --- a/configs/socfpga_sockit_defconfig
> +++ b/configs/socfpga_sockit_defconfig
> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
> index 15f81d1a4b..193af0b0df 100644
> --- a/configs/socfpga_socrates_defconfig
> +++ b/configs/socfpga_socrates_defconfig
> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_MACRONIX=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
>  CONFIG_DM_ETH=y
> diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
> index 941bf1124a..899dd8396b 100644
> --- a/configs/socfpga_sr1500_defconfig
> +++ b/configs/socfpga_sr1500_defconfig
> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SF_DEFAULT_SPEED=100000000
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_PHY_MARVELL=y
>  CONFIG_DM_ETH=y
>  CONFIG_PHY_GIGE=y
> diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
> index 96f806ab5f..f96f536169 100644
> --- a/configs/socfpga_vining_fpga_defconfig
> +++ b/configs/socfpga_vining_fpga_defconfig
> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_SPANSION=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> +CONFIG_SPI_FLASH_MTD=y
>  CONFIG_MTD_UBI_FASTMAP=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
> index f99f6cb16e..fb67ba32c6 100644
> --- a/drivers/mtd/spi/Makefile
> +++ b/drivers/mtd/spi/Makefile
> @@ -19,5 +19,5 @@ endif
>
>  obj-$(CONFIG_SPI_FLASH) += spi-nor.o
>  obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
>  obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
> index a6bf734830..8542b03685 100644
> --- a/drivers/mtd/spi/sf_internal.h
> +++ b/drivers/mtd/spi/sf_internal.h
> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
>  int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
>
>
> -#ifdef CONFIG_SPI_FLASH_MTD
> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>  int spi_flash_mtd_register(struct spi_flash *flash);
>  void spi_flash_mtd_unregister(void);
>  #endif
> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> index 73297e1a0a..f051e473ff 100644
> --- a/drivers/mtd/spi/sf_probe.c
> +++ b/drivers/mtd/spi/sf_probe.c
> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
>         if (ret)
>                 goto err_read_id;
>
> -#ifdef CONFIG_SPI_FLASH_MTD
> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>         ret = spi_flash_mtd_register(flash);
>  #endif
>
> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
>
>  void spi_flash_free(struct spi_flash *flash)
>  {
> -#ifdef CONFIG_SPI_FLASH_MTD
> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>         spi_flash_mtd_unregister();
>  #endif
>         spi_free_slave(flash->spi);
> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice *dev)
>
>  static int spi_flash_std_remove(struct udevice *dev)
>  {
> -#ifdef CONFIG_SPI_FLASH_MTD
> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)

These ifdef changes look unrelated wrt actual patch. any comments?

Also please rebase and send this patch, rest look fine for me.

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

* [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD
  2019-10-22 18:10         ` Jagan Teki
@ 2019-10-23  6:47           ` Schrempf Frieder
  0 siblings, 0 replies; 25+ messages in thread
From: Schrempf Frieder @ 2019-10-23  6:47 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On 22.10.19 20:10, Jagan Teki wrote:
> On Tue, Oct 22, 2019 at 6:23 PM Schrempf Frieder
> <frieder.schrempf@kontron.de> wrote:
>>
>> Hi Jagan,
>>
>> On 17.10.19 08:42, Frieder Schrempf wrote:
>>> Hi Jagan,
>>>
>>> On 16.10.19 18:34, Jagan Teki wrote:
>>>> On Sat, Sep 14, 2019 at 4:18 AM Schrempf Frieder
>>>> <frieder.schrempf@kontron.de> wrote:
>>>>>
>>>>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>>>>>
>>>>> As SPI_FLASH_MTD is used in SPL and U-Boot proper, we enable both,
>>>>> now that a separate option for SPL was introduced.
>>>>>
>>>>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>>>>> ---
>>>>>    configs/stm32mp15_basic_defconfig | 3 ++-
>>>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/configs/stm32mp15_basic_defconfig
>>>>> b/configs/stm32mp15_basic_defconfig
>>>>> index 09785b5dc1..390319657f 100644
>>>>> --- a/configs/stm32mp15_basic_defconfig
>>>>> +++ b/configs/stm32mp15_basic_defconfig
>>>>> @@ -7,10 +7,10 @@ CONFIG_TARGET_STM32MP1=y
>>>>>    CONFIG_SPL_SPI_FLASH_SUPPORT=y
>>>>>    CONFIG_SPL_SPI_SUPPORT=y
>>>>>    # CONFIG_ARMV7_VIRT is not set
>>>>> +CONFIG_SPL_TEXT_BASE=0x2FFC2500
>>>>>    CONFIG_DISTRO_DEFAULTS=y
>>>>>    CONFIG_FIT=y
>>>>>    CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
>>>>> -CONFIG_SPL_TEXT_BASE=0x2FFC2500
>>>>
>>>> Unrelated change wrt to commit message?
>>>
>>> Yes, this is unrelated, but that's what 'menuconfig' and 'savedefconfig'
>>> gave me as output. So I would think it's ok. If you don't think so, feel
>>> free to remove this change or let me know if I should remove it.
>>
>> In patchwork all three patches of this series are marked with "Changes
>> Requested". Can you please let me know what needs to be fixed?
> 
> Thought you might drop that unrelated change and send next version,
> but anyway I have changed and

I have asked you to "let me know if I should remove it" above and you 
didn't do so. Therefore I assumed you do it yourself, or you apply it as is.

> 
> Applied to u-boot-spi/master
> 

Anyway, thanks a lot!

Regards,
Frieder

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-10-22 18:16   ` Jagan Teki
@ 2019-10-23  7:05     ` Schrempf Frieder
  2019-10-23  7:09       ` Jagan Teki
  0 siblings, 1 reply; 25+ messages in thread
From: Schrempf Frieder @ 2019-10-23  7:05 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

On 22.10.19 20:16, Jagan Teki wrote:
> On Sat, Sep 14, 2019 at 4:14 AM Schrempf Frieder
> <frieder.schrempf@kontron.de> wrote:
>>
>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>>
>> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
>> SPL. They often rely on hacks in the board header files to include
>> this option conditionally. To be able to fix this, we previously
>> introduced a separate option SPL_SPI_FLASH_MTD.
>>
>> Therefore we can now adjust the Makefile and change the code in
>> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
>>
>> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
>> header files to the according defconfigs. The affected boards are
>> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
>> and da850evm.
>>
>> We do this all in one patch to guarantee bisectibility.
>>
>> This change was tested with buildman to make sure it does not
>> introduce any regressions by comparing the resulting binary sizes.
>>
>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>> ---
>>   configs/aristainetos2_defconfig        |  1 +
>>   configs/aristainetos2b_defconfig       |  1 +
>>   configs/aristainetos_defconfig         |  1 +
>>   configs/cm_fx6_defconfig               |  1 +
>>   configs/display5_defconfig             |  1 +
>>   configs/display5_factory_defconfig     |  1 +
>>   configs/socfpga_arria5_defconfig       |  1 +
>>   configs/socfpga_cyclone5_defconfig     |  1 +
>>   configs/socfpga_dbm_soc1_defconfig     |  1 +
>>   configs/socfpga_de0_nano_soc_defconfig |  1 +
>>   configs/socfpga_de10_nano_defconfig    |  1 +
>>   configs/socfpga_is1_defconfig          |  1 +
>>   configs/socfpga_mcvevk_defconfig       |  1 +
>>   configs/socfpga_sockit_defconfig       |  1 +
>>   configs/socfpga_socrates_defconfig     |  1 +
>>   configs/socfpga_sr1500_defconfig       |  1 +
>>   configs/socfpga_vining_fpga_defconfig  |  1 +
>>   drivers/mtd/spi/Makefile               |  2 +-
>>   drivers/mtd/spi/sf_internal.h          |  2 +-
>>   drivers/mtd/spi/sf_probe.c             |  6 +++---
>>   include/configs/aristainetos-common.h  |  1 -
>>   include/configs/cm_fx6.h               |  7 -------
>>   include/configs/da850evm.h             |  7 +------
>>   include/configs/dh_imx6.h              |  1 -
>>   include/configs/display5.h             |  4 ----
>>   include/configs/gw_ventana.h           | 10 +---------
>>   include/configs/rcar-gen2-common.h     |  4 +---
>>   include/configs/socfpga_common.h       |  4 ----
>>   28 files changed, 25 insertions(+), 40 deletions(-)
>>
>> diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
>> index 18ef5d2dce..0bfc117762 100644
>> --- a/configs/aristainetos2_defconfig
>> +++ b/configs/aristainetos2_defconfig
>> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
>>   CONFIG_SF_DEFAULT_MODE=0
>>   CONFIG_SF_DEFAULT_SPEED=20000000
>>   CONFIG_SPI_FLASH_STMICRO=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_MTD_UBI_FASTMAP=y
>>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>   CONFIG_PHYLIB=y
>> diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
>> index 1054c05d8c..e2da747a8f 100644
>> --- a/configs/aristainetos2b_defconfig
>> +++ b/configs/aristainetos2b_defconfig
>> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
>>   CONFIG_SF_DEFAULT_MODE=0
>>   CONFIG_SF_DEFAULT_SPEED=20000000
>>   CONFIG_SPI_FLASH_STMICRO=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_MTD_UBI_FASTMAP=y
>>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>   CONFIG_PHYLIB=y
>> diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
>> index 4080a7b310..5caf95c22f 100644
>> --- a/configs/aristainetos_defconfig
>> +++ b/configs/aristainetos_defconfig
>> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
>>   CONFIG_SF_DEFAULT_MODE=0
>>   CONFIG_SF_DEFAULT_SPEED=20000000
>>   CONFIG_SPI_FLASH_STMICRO=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_MTD_UBI_FASTMAP=y
>>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>   CONFIG_PHYLIB=y
>> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
>> index fd0db4db5c..15be7db027 100644
>> --- a/configs/cm_fx6_defconfig
>> +++ b/configs/cm_fx6_defconfig
>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>>   CONFIG_SPI_FLASH_SST=y
>>   CONFIG_SPI_FLASH_WINBOND=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHYLIB=y
>>   CONFIG_MII=y
>>   CONFIG_DM_PMIC=y
>> diff --git a/configs/display5_defconfig b/configs/display5_defconfig
>> index 8609cd5a8c..5a4cc772be 100644
>> --- a/configs/display5_defconfig
>> +++ b/configs/display5_defconfig
>> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
>>   CONFIG_SF_DEFAULT_SPEED=50000000
>>   CONFIG_SPI_FLASH_SPANSION=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHYLIB=y
>>   CONFIG_PHY_MARVELL=y
>>   CONFIG_FEC_MXC=y
>> diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
>> index 70c64260d8..66c68e5ea9 100644
>> --- a/configs/display5_factory_defconfig
>> +++ b/configs/display5_factory_defconfig
>> @@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
>>   CONFIG_SF_DEFAULT_SPEED=50000000
>>   CONFIG_SPI_FLASH_SPANSION=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHYLIB=y
>>   CONFIG_FEC_MXC=y
>>   CONFIG_MII=y
>> diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
>> index 89e5ff8c71..30c2d19941 100644
>> --- a/configs/socfpga_arria5_defconfig
>> +++ b/configs/socfpga_arria5_defconfig
>> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
>>   CONFIG_SPI_FLASH_SPANSION=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHY_MICREL=y
>>   CONFIG_PHY_MICREL_KSZ90X1=y
>>   CONFIG_DM_ETH=y
>> diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
>> index 00f2104276..dfe011b959 100644
>> --- a/configs/socfpga_cyclone5_defconfig
>> +++ b/configs/socfpga_cyclone5_defconfig
>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>>   CONFIG_SPI_FLASH_SPANSION=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHY_MICREL=y
>>   CONFIG_PHY_MICREL_KSZ90X1=y
>>   CONFIG_DM_ETH=y
>> diff --git a/configs/socfpga_dbm_soc1_defconfig b/configs/socfpga_dbm_soc1_defconfig
>> index 1877010a19..ee693f3def 100644
>> --- a/configs/socfpga_dbm_soc1_defconfig
>> +++ b/configs/socfpga_dbm_soc1_defconfig
>> @@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
>>   CONFIG_DM_MMC=y
>>   CONFIG_MMC_DW=y
>>   CONFIG_MTD_DEVICE=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_DM_ETH=y
>>   CONFIG_PHY_GIGE=y
>>   CONFIG_ETH_DESIGNWARE=y
>> diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
>> index de50f17174..e91d6f62f8 100644
>> --- a/configs/socfpga_de0_nano_soc_defconfig
>> +++ b/configs/socfpga_de0_nano_soc_defconfig
>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>>   CONFIG_DM_MMC=y
>>   CONFIG_MMC_DW=y
>>   CONFIG_MTD_DEVICE=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHY_MICREL=y
>>   CONFIG_PHY_MICREL_KSZ90X1=y
>>   CONFIG_DM_ETH=y
>> diff --git a/configs/socfpga_de10_nano_defconfig b/configs/socfpga_de10_nano_defconfig
>> index 03961195ac..ffe9d6c10c 100644
>> --- a/configs/socfpga_de10_nano_defconfig
>> +++ b/configs/socfpga_de10_nano_defconfig
>> @@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
>>   CONFIG_DM_MMC=y
>>   CONFIG_MMC_DW=y
>>   CONFIG_MTD_DEVICE=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHY_MICREL=y
>>   CONFIG_PHY_MICREL_KSZ90X1=y
>>   CONFIG_DM_ETH=y
>> diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
>> index 6ea06c1104..76ab87250b 100644
>> --- a/configs/socfpga_is1_defconfig
>> +++ b/configs/socfpga_is1_defconfig
>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>>   CONFIG_MTD_DEVICE=y
>>   CONFIG_SPI_FLASH=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHY_MICREL=y
>>   CONFIG_PHY_MICREL_KSZ90X1=y
>>   CONFIG_DM_ETH=y
>> diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
>> index 161bd6fca3..4d3caaa8ad 100644
>> --- a/configs/socfpga_mcvevk_defconfig
>> +++ b/configs/socfpga_mcvevk_defconfig
>> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
>>   CONFIG_SYS_I2C_DW=y
>>   CONFIG_DM_MMC=y
>>   CONFIG_MMC_DW=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_DM_ETH=y
>>   CONFIG_PHY_GIGE=y
>>   CONFIG_ETH_DESIGNWARE=y
>> diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
>> index 8ec1c05571..0ffcfda21e 100644
>> --- a/configs/socfpga_sockit_defconfig
>> +++ b/configs/socfpga_sockit_defconfig
>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>>   CONFIG_SPI_FLASH_SPANSION=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHY_MICREL=y
>>   CONFIG_PHY_MICREL_KSZ90X1=y
>>   CONFIG_DM_ETH=y
>> diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
>> index 15f81d1a4b..193af0b0df 100644
>> --- a/configs/socfpga_socrates_defconfig
>> +++ b/configs/socfpga_socrates_defconfig
>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
>>   CONFIG_SPI_FLASH_MACRONIX=y
>>   CONFIG_SPI_FLASH_SPANSION=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHY_MICREL=y
>>   CONFIG_PHY_MICREL_KSZ90X1=y
>>   CONFIG_DM_ETH=y
>> diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
>> index 941bf1124a..899dd8396b 100644
>> --- a/configs/socfpga_sr1500_defconfig
>> +++ b/configs/socfpga_sr1500_defconfig
>> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
>>   CONFIG_SF_DEFAULT_SPEED=100000000
>>   CONFIG_SPI_FLASH_STMICRO=y
>>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_PHY_MARVELL=y
>>   CONFIG_DM_ETH=y
>>   CONFIG_PHY_GIGE=y
>> diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
>> index 96f806ab5f..f96f536169 100644
>> --- a/configs/socfpga_vining_fpga_defconfig
>> +++ b/configs/socfpga_vining_fpga_defconfig
>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
>>   CONFIG_SPI_FLASH_SPANSION=y
>>   CONFIG_SPI_FLASH_STMICRO=y
>>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>> +CONFIG_SPI_FLASH_MTD=y
>>   CONFIG_MTD_UBI_FASTMAP=y
>>   CONFIG_PHY_MICREL=y
>>   CONFIG_PHY_MICREL_KSZ90X1=y
>> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
>> index f99f6cb16e..fb67ba32c6 100644
>> --- a/drivers/mtd/spi/Makefile
>> +++ b/drivers/mtd/spi/Makefile
>> @@ -19,5 +19,5 @@ endif
>>
>>   obj-$(CONFIG_SPI_FLASH) += spi-nor.o
>>   obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
>> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
>> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
>>   obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
>> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
>> index a6bf734830..8542b03685 100644
>> --- a/drivers/mtd/spi/sf_internal.h
>> +++ b/drivers/mtd/spi/sf_internal.h
>> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
>>   int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
>>
>>
>> -#ifdef CONFIG_SPI_FLASH_MTD
>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>   int spi_flash_mtd_register(struct spi_flash *flash);
>>   void spi_flash_mtd_unregister(void);
>>   #endif
>> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
>> index 73297e1a0a..f051e473ff 100644
>> --- a/drivers/mtd/spi/sf_probe.c
>> +++ b/drivers/mtd/spi/sf_probe.c
>> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
>>          if (ret)
>>                  goto err_read_id;
>>
>> -#ifdef CONFIG_SPI_FLASH_MTD
>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>          ret = spi_flash_mtd_register(flash);
>>   #endif
>>
>> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
>>
>>   void spi_flash_free(struct spi_flash *flash)
>>   {
>> -#ifdef CONFIG_SPI_FLASH_MTD
>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>          spi_flash_mtd_unregister();
>>   #endif
>>          spi_free_slave(flash->spi);
>> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice *dev)
>>
>>   static int spi_flash_std_remove(struct udevice *dev)
>>   {
>> -#ifdef CONFIG_SPI_FLASH_MTD
>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> 
> These ifdef changes look unrelated wrt actual patch. any comments?

No, they are not unrelated. This is the actual reason for having this 
patch after all. We want to be able to enable/disable the code for 
CONFIG_SPI_FLASH_MTD per build target (SPL, U-Boot proper).
These changes need to be done in a single patch together with the 
defconfig and Makefile changes to sustain bisectibility.

> 
> Also please rebase and send this patch, rest look fine for me.
> 

Ok, I will rebase on current master and send a v2.

Thanks,
Frieder

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-10-23  7:05     ` Schrempf Frieder
@ 2019-10-23  7:09       ` Jagan Teki
  2019-10-23  7:25         ` Lukasz Majewski
                           ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Jagan Teki @ 2019-10-23  7:09 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 23, 2019 at 12:35 PM Schrempf Frieder
<frieder.schrempf@kontron.de> wrote:
>
> Hi Jagan,
>
> On 22.10.19 20:16, Jagan Teki wrote:
> > On Sat, Sep 14, 2019 at 4:14 AM Schrempf Frieder
> > <frieder.schrempf@kontron.de> wrote:
> >>
> >> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> >>
> >> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> >> SPL. They often rely on hacks in the board header files to include
> >> this option conditionally. To be able to fix this, we previously
> >> introduced a separate option SPL_SPI_FLASH_MTD.
> >>
> >> Therefore we can now adjust the Makefile and change the code in
> >> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> >>
> >> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> >> header files to the according defconfigs. The affected boards are
> >> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> >> and da850evm.
> >>
> >> We do this all in one patch to guarantee bisectibility.
> >>
> >> This change was tested with buildman to make sure it does not
> >> introduce any regressions by comparing the resulting binary sizes.
> >>
> >> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> >> ---
> >>   configs/aristainetos2_defconfig        |  1 +
> >>   configs/aristainetos2b_defconfig       |  1 +
> >>   configs/aristainetos_defconfig         |  1 +
> >>   configs/cm_fx6_defconfig               |  1 +
> >>   configs/display5_defconfig             |  1 +
> >>   configs/display5_factory_defconfig     |  1 +
> >>   configs/socfpga_arria5_defconfig       |  1 +
> >>   configs/socfpga_cyclone5_defconfig     |  1 +
> >>   configs/socfpga_dbm_soc1_defconfig     |  1 +
> >>   configs/socfpga_de0_nano_soc_defconfig |  1 +
> >>   configs/socfpga_de10_nano_defconfig    |  1 +
> >>   configs/socfpga_is1_defconfig          |  1 +
> >>   configs/socfpga_mcvevk_defconfig       |  1 +
> >>   configs/socfpga_sockit_defconfig       |  1 +
> >>   configs/socfpga_socrates_defconfig     |  1 +
> >>   configs/socfpga_sr1500_defconfig       |  1 +
> >>   configs/socfpga_vining_fpga_defconfig  |  1 +
> >>   drivers/mtd/spi/Makefile               |  2 +-
> >>   drivers/mtd/spi/sf_internal.h          |  2 +-
> >>   drivers/mtd/spi/sf_probe.c             |  6 +++---
> >>   include/configs/aristainetos-common.h  |  1 -
> >>   include/configs/cm_fx6.h               |  7 -------
> >>   include/configs/da850evm.h             |  7 +------
> >>   include/configs/dh_imx6.h              |  1 -
> >>   include/configs/display5.h             |  4 ----
> >>   include/configs/gw_ventana.h           | 10 +---------
> >>   include/configs/rcar-gen2-common.h     |  4 +---
> >>   include/configs/socfpga_common.h       |  4 ----
> >>   28 files changed, 25 insertions(+), 40 deletions(-)
> >>
> >> diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
> >> index 18ef5d2dce..0bfc117762 100644
> >> --- a/configs/aristainetos2_defconfig
> >> +++ b/configs/aristainetos2_defconfig
> >> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
> >>   CONFIG_SF_DEFAULT_MODE=0
> >>   CONFIG_SF_DEFAULT_SPEED=20000000
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_MTD_UBI_FASTMAP=y
> >>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>   CONFIG_PHYLIB=y
> >> diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
> >> index 1054c05d8c..e2da747a8f 100644
> >> --- a/configs/aristainetos2b_defconfig
> >> +++ b/configs/aristainetos2b_defconfig
> >> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
> >>   CONFIG_SF_DEFAULT_MODE=0
> >>   CONFIG_SF_DEFAULT_SPEED=20000000
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_MTD_UBI_FASTMAP=y
> >>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>   CONFIG_PHYLIB=y
> >> diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
> >> index 4080a7b310..5caf95c22f 100644
> >> --- a/configs/aristainetos_defconfig
> >> +++ b/configs/aristainetos_defconfig
> >> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
> >>   CONFIG_SF_DEFAULT_MODE=0
> >>   CONFIG_SF_DEFAULT_SPEED=20000000
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_MTD_UBI_FASTMAP=y
> >>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>   CONFIG_PHYLIB=y
> >> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
> >> index fd0db4db5c..15be7db027 100644
> >> --- a/configs/cm_fx6_defconfig
> >> +++ b/configs/cm_fx6_defconfig
> >> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >>   CONFIG_SPI_FLASH_SST=y
> >>   CONFIG_SPI_FLASH_WINBOND=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHYLIB=y
> >>   CONFIG_MII=y
> >>   CONFIG_DM_PMIC=y
> >> diff --git a/configs/display5_defconfig b/configs/display5_defconfig
> >> index 8609cd5a8c..5a4cc772be 100644
> >> --- a/configs/display5_defconfig
> >> +++ b/configs/display5_defconfig
> >> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
> >>   CONFIG_SF_DEFAULT_SPEED=50000000
> >>   CONFIG_SPI_FLASH_SPANSION=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHYLIB=y
> >>   CONFIG_PHY_MARVELL=y
> >>   CONFIG_FEC_MXC=y
> >> diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
> >> index 70c64260d8..66c68e5ea9 100644
> >> --- a/configs/display5_factory_defconfig
> >> +++ b/configs/display5_factory_defconfig
> >> @@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
> >>   CONFIG_SF_DEFAULT_SPEED=50000000
> >>   CONFIG_SPI_FLASH_SPANSION=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHYLIB=y
> >>   CONFIG_FEC_MXC=y
> >>   CONFIG_MII=y
> >> diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
> >> index 89e5ff8c71..30c2d19941 100644
> >> --- a/configs/socfpga_arria5_defconfig
> >> +++ b/configs/socfpga_arria5_defconfig
> >> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
> >>   CONFIG_SPI_FLASH_SPANSION=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHY_MICREL=y
> >>   CONFIG_PHY_MICREL_KSZ90X1=y
> >>   CONFIG_DM_ETH=y
> >> diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
> >> index 00f2104276..dfe011b959 100644
> >> --- a/configs/socfpga_cyclone5_defconfig
> >> +++ b/configs/socfpga_cyclone5_defconfig
> >> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
> >>   CONFIG_SPI_FLASH_SPANSION=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHY_MICREL=y
> >>   CONFIG_PHY_MICREL_KSZ90X1=y
> >>   CONFIG_DM_ETH=y
> >> diff --git a/configs/socfpga_dbm_soc1_defconfig b/configs/socfpga_dbm_soc1_defconfig
> >> index 1877010a19..ee693f3def 100644
> >> --- a/configs/socfpga_dbm_soc1_defconfig
> >> +++ b/configs/socfpga_dbm_soc1_defconfig
> >> @@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
> >>   CONFIG_DM_MMC=y
> >>   CONFIG_MMC_DW=y
> >>   CONFIG_MTD_DEVICE=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_DM_ETH=y
> >>   CONFIG_PHY_GIGE=y
> >>   CONFIG_ETH_DESIGNWARE=y
> >> diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
> >> index de50f17174..e91d6f62f8 100644
> >> --- a/configs/socfpga_de0_nano_soc_defconfig
> >> +++ b/configs/socfpga_de0_nano_soc_defconfig
> >> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
> >>   CONFIG_DM_MMC=y
> >>   CONFIG_MMC_DW=y
> >>   CONFIG_MTD_DEVICE=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHY_MICREL=y
> >>   CONFIG_PHY_MICREL_KSZ90X1=y
> >>   CONFIG_DM_ETH=y
> >> diff --git a/configs/socfpga_de10_nano_defconfig b/configs/socfpga_de10_nano_defconfig
> >> index 03961195ac..ffe9d6c10c 100644
> >> --- a/configs/socfpga_de10_nano_defconfig
> >> +++ b/configs/socfpga_de10_nano_defconfig
> >> @@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
> >>   CONFIG_DM_MMC=y
> >>   CONFIG_MMC_DW=y
> >>   CONFIG_MTD_DEVICE=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHY_MICREL=y
> >>   CONFIG_PHY_MICREL_KSZ90X1=y
> >>   CONFIG_DM_ETH=y
> >> diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
> >> index 6ea06c1104..76ab87250b 100644
> >> --- a/configs/socfpga_is1_defconfig
> >> +++ b/configs/socfpga_is1_defconfig
> >> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
> >>   CONFIG_MTD_DEVICE=y
> >>   CONFIG_SPI_FLASH=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHY_MICREL=y
> >>   CONFIG_PHY_MICREL_KSZ90X1=y
> >>   CONFIG_DM_ETH=y
> >> diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
> >> index 161bd6fca3..4d3caaa8ad 100644
> >> --- a/configs/socfpga_mcvevk_defconfig
> >> +++ b/configs/socfpga_mcvevk_defconfig
> >> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
> >>   CONFIG_SYS_I2C_DW=y
> >>   CONFIG_DM_MMC=y
> >>   CONFIG_MMC_DW=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_DM_ETH=y
> >>   CONFIG_PHY_GIGE=y
> >>   CONFIG_ETH_DESIGNWARE=y
> >> diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
> >> index 8ec1c05571..0ffcfda21e 100644
> >> --- a/configs/socfpga_sockit_defconfig
> >> +++ b/configs/socfpga_sockit_defconfig
> >> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
> >>   CONFIG_SPI_FLASH_SPANSION=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHY_MICREL=y
> >>   CONFIG_PHY_MICREL_KSZ90X1=y
> >>   CONFIG_DM_ETH=y
> >> diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
> >> index 15f81d1a4b..193af0b0df 100644
> >> --- a/configs/socfpga_socrates_defconfig
> >> +++ b/configs/socfpga_socrates_defconfig
> >> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
> >>   CONFIG_SPI_FLASH_MACRONIX=y
> >>   CONFIG_SPI_FLASH_SPANSION=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHY_MICREL=y
> >>   CONFIG_PHY_MICREL_KSZ90X1=y
> >>   CONFIG_DM_ETH=y
> >> diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
> >> index 941bf1124a..899dd8396b 100644
> >> --- a/configs/socfpga_sr1500_defconfig
> >> +++ b/configs/socfpga_sr1500_defconfig
> >> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
> >>   CONFIG_SF_DEFAULT_SPEED=100000000
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_PHY_MARVELL=y
> >>   CONFIG_DM_ETH=y
> >>   CONFIG_PHY_GIGE=y
> >> diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
> >> index 96f806ab5f..f96f536169 100644
> >> --- a/configs/socfpga_vining_fpga_defconfig
> >> +++ b/configs/socfpga_vining_fpga_defconfig
> >> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
> >>   CONFIG_SPI_FLASH_SPANSION=y
> >>   CONFIG_SPI_FLASH_STMICRO=y
> >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >> +CONFIG_SPI_FLASH_MTD=y
> >>   CONFIG_MTD_UBI_FASTMAP=y
> >>   CONFIG_PHY_MICREL=y
> >>   CONFIG_PHY_MICREL_KSZ90X1=y
> >> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
> >> index f99f6cb16e..fb67ba32c6 100644
> >> --- a/drivers/mtd/spi/Makefile
> >> +++ b/drivers/mtd/spi/Makefile
> >> @@ -19,5 +19,5 @@ endif
> >>
> >>   obj-$(CONFIG_SPI_FLASH) += spi-nor.o
> >>   obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
> >> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
> >> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
> >>   obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
> >> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
> >> index a6bf734830..8542b03685 100644
> >> --- a/drivers/mtd/spi/sf_internal.h
> >> +++ b/drivers/mtd/spi/sf_internal.h
> >> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
> >>   int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
> >>
> >>
> >> -#ifdef CONFIG_SPI_FLASH_MTD
> >> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>   int spi_flash_mtd_register(struct spi_flash *flash);
> >>   void spi_flash_mtd_unregister(void);
> >>   #endif
> >> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> >> index 73297e1a0a..f051e473ff 100644
> >> --- a/drivers/mtd/spi/sf_probe.c
> >> +++ b/drivers/mtd/spi/sf_probe.c
> >> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
> >>          if (ret)
> >>                  goto err_read_id;
> >>
> >> -#ifdef CONFIG_SPI_FLASH_MTD
> >> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>          ret = spi_flash_mtd_register(flash);
> >>   #endif
> >>
> >> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
> >>
> >>   void spi_flash_free(struct spi_flash *flash)
> >>   {
> >> -#ifdef CONFIG_SPI_FLASH_MTD
> >> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>          spi_flash_mtd_unregister();
> >>   #endif
> >>          spi_free_slave(flash->spi);
> >> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice *dev)
> >>
> >>   static int spi_flash_std_remove(struct udevice *dev)
> >>   {
> >> -#ifdef CONFIG_SPI_FLASH_MTD
> >> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >
> > These ifdef changes look unrelated wrt actual patch. any comments?
>
> No, they are not unrelated. This is the actual reason for having this
> patch after all. We want to be able to enable/disable the code for
> CONFIG_SPI_FLASH_MTD per build target (SPL, U-Boot proper).
> These changes need to be done in a single patch together with the
> defconfig and Makefile changes to sustain bisectibility.

What I'm trying to say here is, #ifdef CONFIG_SPI_FLASH_MTD and #if
CONFIG_IS_ENABLED(SPI_FLASH_MTD) is the same but the latter is
improved version which I feel it is related to another patch.

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-10-23  7:09       ` Jagan Teki
@ 2019-10-23  7:25         ` Lukasz Majewski
  2019-10-23  7:26         ` Schrempf Frieder
  2019-10-23  7:27         ` Stefan Roese
  2 siblings, 0 replies; 25+ messages in thread
From: Lukasz Majewski @ 2019-10-23  7:25 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

> On Wed, Oct 23, 2019 at 12:35 PM Schrempf Frieder
> <frieder.schrempf@kontron.de> wrote:
> >
> > Hi Jagan,
> >
> > On 22.10.19 20:16, Jagan Teki wrote:  
> > > On Sat, Sep 14, 2019 at 4:14 AM Schrempf Frieder
> > > <frieder.schrempf@kontron.de> wrote:  
> > >>
> > >> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> > >>
> > >> Most boards currently use SPI_FLASH_MTD only in U-Boot proper,
> > >> not in SPL. They often rely on hacks in the board header files
> > >> to include this option conditionally. To be able to fix this, we
> > >> previously introduced a separate option SPL_SPI_FLASH_MTD.
> > >>
> > >> Therefore we can now adjust the Makefile and change the code in
> > >> sf_probe.c and sf_internal.h to use
> > >> CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> > >>
> > >> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from
> > >> the header files to the according defconfigs. The affected
> > >> boards are socfpga, aristainetos, cm_fx6, display5, ventana,
> > >> rcar-gen2, dh_imx6 and da850evm.
> > >>
> > >> We do this all in one patch to guarantee bisectibility.
> > >>
> > >> This change was tested with buildman to make sure it does not
> > >> introduce any regressions by comparing the resulting binary
> > >> sizes.
> > >>
> > >> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> > >> ---
> > >>   configs/aristainetos2_defconfig        |  1 +
> > >>   configs/aristainetos2b_defconfig       |  1 +
> > >>   configs/aristainetos_defconfig         |  1 +
> > >>   configs/cm_fx6_defconfig               |  1 +
> > >>   configs/display5_defconfig             |  1 +
> > >>   configs/display5_factory_defconfig     |  1 +
> > >>   configs/socfpga_arria5_defconfig       |  1 +
> > >>   configs/socfpga_cyclone5_defconfig     |  1 +
> > >>   configs/socfpga_dbm_soc1_defconfig     |  1 +
> > >>   configs/socfpga_de0_nano_soc_defconfig |  1 +
> > >>   configs/socfpga_de10_nano_defconfig    |  1 +
> > >>   configs/socfpga_is1_defconfig          |  1 +
> > >>   configs/socfpga_mcvevk_defconfig       |  1 +
> > >>   configs/socfpga_sockit_defconfig       |  1 +
> > >>   configs/socfpga_socrates_defconfig     |  1 +
> > >>   configs/socfpga_sr1500_defconfig       |  1 +
> > >>   configs/socfpga_vining_fpga_defconfig  |  1 +
> > >>   drivers/mtd/spi/Makefile               |  2 +-
> > >>   drivers/mtd/spi/sf_internal.h          |  2 +-
> > >>   drivers/mtd/spi/sf_probe.c             |  6 +++---
> > >>   include/configs/aristainetos-common.h  |  1 -
> > >>   include/configs/cm_fx6.h               |  7 -------
> > >>   include/configs/da850evm.h             |  7 +------
> > >>   include/configs/dh_imx6.h              |  1 -
> > >>   include/configs/display5.h             |  4 ----
> > >>   include/configs/gw_ventana.h           | 10 +---------
> > >>   include/configs/rcar-gen2-common.h     |  4 +---
> > >>   include/configs/socfpga_common.h       |  4 ----
> > >>   28 files changed, 25 insertions(+), 40 deletions(-)
> > >>
> > >> diff --git a/configs/aristainetos2_defconfig
> > >> b/configs/aristainetos2_defconfig index 18ef5d2dce..0bfc117762
> > >> 100644 --- a/configs/aristainetos2_defconfig
> > >> +++ b/configs/aristainetos2_defconfig
> > >> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
> > >>   CONFIG_SF_DEFAULT_MODE=0
> > >>   CONFIG_SF_DEFAULT_SPEED=20000000
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_MTD_UBI_FASTMAP=y
> > >>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> > >>   CONFIG_PHYLIB=y
> > >> diff --git a/configs/aristainetos2b_defconfig
> > >> b/configs/aristainetos2b_defconfig index 1054c05d8c..e2da747a8f
> > >> 100644 --- a/configs/aristainetos2b_defconfig
> > >> +++ b/configs/aristainetos2b_defconfig
> > >> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
> > >>   CONFIG_SF_DEFAULT_MODE=0
> > >>   CONFIG_SF_DEFAULT_SPEED=20000000
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_MTD_UBI_FASTMAP=y
> > >>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> > >>   CONFIG_PHYLIB=y
> > >> diff --git a/configs/aristainetos_defconfig
> > >> b/configs/aristainetos_defconfig index 4080a7b310..5caf95c22f
> > >> 100644 --- a/configs/aristainetos_defconfig
> > >> +++ b/configs/aristainetos_defconfig
> > >> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
> > >>   CONFIG_SF_DEFAULT_MODE=0
> > >>   CONFIG_SF_DEFAULT_SPEED=20000000
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_MTD_UBI_FASTMAP=y
> > >>   CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> > >>   CONFIG_PHYLIB=y
> > >> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
> > >> index fd0db4db5c..15be7db027 100644
> > >> --- a/configs/cm_fx6_defconfig
> > >> +++ b/configs/cm_fx6_defconfig
> > >> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >>   CONFIG_SPI_FLASH_SST=y
> > >>   CONFIG_SPI_FLASH_WINBOND=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHYLIB=y
> > >>   CONFIG_MII=y
> > >>   CONFIG_DM_PMIC=y
> > >> diff --git a/configs/display5_defconfig
> > >> b/configs/display5_defconfig index 8609cd5a8c..5a4cc772be 100644
> > >> --- a/configs/display5_defconfig
> > >> +++ b/configs/display5_defconfig
> > >> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
> > >>   CONFIG_SF_DEFAULT_SPEED=50000000
> > >>   CONFIG_SPI_FLASH_SPANSION=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHYLIB=y
> > >>   CONFIG_PHY_MARVELL=y
> > >>   CONFIG_FEC_MXC=y
> > >> diff --git a/configs/display5_factory_defconfig
> > >> b/configs/display5_factory_defconfig index
> > >> 70c64260d8..66c68e5ea9 100644 ---
> > >> a/configs/display5_factory_defconfig +++
> > >> b/configs/display5_factory_defconfig @@ -74,6 +74,7 @@
> > >> CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=50000000
> > >>   CONFIG_SPI_FLASH_SPANSION=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHYLIB=y
> > >>   CONFIG_FEC_MXC=y
> > >>   CONFIG_MII=y
> > >> diff --git a/configs/socfpga_arria5_defconfig
> > >> b/configs/socfpga_arria5_defconfig index 89e5ff8c71..30c2d19941
> > >> 100644 --- a/configs/socfpga_arria5_defconfig
> > >> +++ b/configs/socfpga_arria5_defconfig
> > >> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
> > >>   CONFIG_SPI_FLASH_SPANSION=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHY_MICREL=y
> > >>   CONFIG_PHY_MICREL_KSZ90X1=y
> > >>   CONFIG_DM_ETH=y
> > >> diff --git a/configs/socfpga_cyclone5_defconfig
> > >> b/configs/socfpga_cyclone5_defconfig index
> > >> 00f2104276..dfe011b959 100644 ---
> > >> a/configs/socfpga_cyclone5_defconfig +++
> > >> b/configs/socfpga_cyclone5_defconfig @@ -48,6 +48,7 @@
> > >> CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHY_MICREL=y
> > >>   CONFIG_PHY_MICREL_KSZ90X1=y
> > >>   CONFIG_DM_ETH=y
> > >> diff --git a/configs/socfpga_dbm_soc1_defconfig
> > >> b/configs/socfpga_dbm_soc1_defconfig index
> > >> 1877010a19..ee693f3def 100644 ---
> > >> a/configs/socfpga_dbm_soc1_defconfig +++
> > >> b/configs/socfpga_dbm_soc1_defconfig @@ -46,6 +46,7 @@
> > >> CONFIG_SYS_I2C_DW=y CONFIG_DM_MMC=y
> > >>   CONFIG_MMC_DW=y
> > >>   CONFIG_MTD_DEVICE=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_DM_ETH=y
> > >>   CONFIG_PHY_GIGE=y
> > >>   CONFIG_ETH_DESIGNWARE=y
> > >> diff --git a/configs/socfpga_de0_nano_soc_defconfig
> > >> b/configs/socfpga_de0_nano_soc_defconfig index
> > >> de50f17174..e91d6f62f8 100644 ---
> > >> a/configs/socfpga_de0_nano_soc_defconfig +++
> > >> b/configs/socfpga_de0_nano_soc_defconfig @@ -43,6 +43,7 @@
> > >> CONFIG_SYS_I2C_DW=y CONFIG_DM_MMC=y
> > >>   CONFIG_MMC_DW=y
> > >>   CONFIG_MTD_DEVICE=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHY_MICREL=y
> > >>   CONFIG_PHY_MICREL_KSZ90X1=y
> > >>   CONFIG_DM_ETH=y
> > >> diff --git a/configs/socfpga_de10_nano_defconfig
> > >> b/configs/socfpga_de10_nano_defconfig index
> > >> 03961195ac..ffe9d6c10c 100644 ---
> > >> a/configs/socfpga_de10_nano_defconfig +++
> > >> b/configs/socfpga_de10_nano_defconfig @@ -39,6 +39,7 @@
> > >> CONFIG_SYS_I2C_DW=y CONFIG_DM_MMC=y
> > >>   CONFIG_MMC_DW=y
> > >>   CONFIG_MTD_DEVICE=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHY_MICREL=y
> > >>   CONFIG_PHY_MICREL_KSZ90X1=y
> > >>   CONFIG_DM_ETH=y
> > >> diff --git a/configs/socfpga_is1_defconfig
> > >> b/configs/socfpga_is1_defconfig index 6ea06c1104..76ab87250b
> > >> 100644 --- a/configs/socfpga_is1_defconfig
> > >> +++ b/configs/socfpga_is1_defconfig
> > >> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
> > >>   CONFIG_MTD_DEVICE=y
> > >>   CONFIG_SPI_FLASH=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHY_MICREL=y
> > >>   CONFIG_PHY_MICREL_KSZ90X1=y
> > >>   CONFIG_DM_ETH=y
> > >> diff --git a/configs/socfpga_mcvevk_defconfig
> > >> b/configs/socfpga_mcvevk_defconfig index 161bd6fca3..4d3caaa8ad
> > >> 100644 --- a/configs/socfpga_mcvevk_defconfig
> > >> +++ b/configs/socfpga_mcvevk_defconfig
> > >> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
> > >>   CONFIG_SYS_I2C_DW=y
> > >>   CONFIG_DM_MMC=y
> > >>   CONFIG_MMC_DW=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_DM_ETH=y
> > >>   CONFIG_PHY_GIGE=y
> > >>   CONFIG_ETH_DESIGNWARE=y
> > >> diff --git a/configs/socfpga_sockit_defconfig
> > >> b/configs/socfpga_sockit_defconfig index 8ec1c05571..0ffcfda21e
> > >> 100644 --- a/configs/socfpga_sockit_defconfig
> > >> +++ b/configs/socfpga_sockit_defconfig
> > >> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
> > >>   CONFIG_SPI_FLASH_SPANSION=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHY_MICREL=y
> > >>   CONFIG_PHY_MICREL_KSZ90X1=y
> > >>   CONFIG_DM_ETH=y
> > >> diff --git a/configs/socfpga_socrates_defconfig
> > >> b/configs/socfpga_socrates_defconfig index
> > >> 15f81d1a4b..193af0b0df 100644 ---
> > >> a/configs/socfpga_socrates_defconfig +++
> > >> b/configs/socfpga_socrates_defconfig @@ -48,6 +48,7 @@
> > >> CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_MACRONIX=y
> > >>   CONFIG_SPI_FLASH_SPANSION=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHY_MICREL=y
> > >>   CONFIG_PHY_MICREL_KSZ90X1=y
> > >>   CONFIG_DM_ETH=y
> > >> diff --git a/configs/socfpga_sr1500_defconfig
> > >> b/configs/socfpga_sr1500_defconfig index 941bf1124a..899dd8396b
> > >> 100644 --- a/configs/socfpga_sr1500_defconfig
> > >> +++ b/configs/socfpga_sr1500_defconfig
> > >> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
> > >>   CONFIG_SF_DEFAULT_SPEED=100000000
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_PHY_MARVELL=y
> > >>   CONFIG_DM_ETH=y
> > >>   CONFIG_PHY_GIGE=y
> > >> diff --git a/configs/socfpga_vining_fpga_defconfig
> > >> b/configs/socfpga_vining_fpga_defconfig index
> > >> 96f806ab5f..f96f536169 100644 ---
> > >> a/configs/socfpga_vining_fpga_defconfig +++
> > >> b/configs/socfpga_vining_fpga_defconfig @@ -72,6 +72,7 @@
> > >> CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_SPANSION=y
> > >>   CONFIG_SPI_FLASH_STMICRO=y
> > >>   # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> > >> +CONFIG_SPI_FLASH_MTD=y
> > >>   CONFIG_MTD_UBI_FASTMAP=y
> > >>   CONFIG_PHY_MICREL=y
> > >>   CONFIG_PHY_MICREL_KSZ90X1=y
> > >> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
> > >> index f99f6cb16e..fb67ba32c6 100644
> > >> --- a/drivers/mtd/spi/Makefile
> > >> +++ b/drivers/mtd/spi/Makefile
> > >> @@ -19,5 +19,5 @@ endif
> > >>
> > >>   obj-$(CONFIG_SPI_FLASH) += spi-nor.o
> > >>   obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
> > >> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
> > >> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
> > >>   obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
> > >> diff --git a/drivers/mtd/spi/sf_internal.h
> > >> b/drivers/mtd/spi/sf_internal.h index a6bf734830..8542b03685
> > >> 100644 --- a/drivers/mtd/spi/sf_internal.h
> > >> +++ b/drivers/mtd/spi/sf_internal.h
> > >> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi,
> > >> const u8 *cmd, size_t cmd_len, int
> > >> spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
> > >>
> > >>
> > >> -#ifdef CONFIG_SPI_FLASH_MTD
> > >> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> > >>   int spi_flash_mtd_register(struct spi_flash *flash);
> > >>   void spi_flash_mtd_unregister(void);
> > >>   #endif
> > >> diff --git a/drivers/mtd/spi/sf_probe.c
> > >> b/drivers/mtd/spi/sf_probe.c index 73297e1a0a..f051e473ff 100644
> > >> --- a/drivers/mtd/spi/sf_probe.c
> > >> +++ b/drivers/mtd/spi/sf_probe.c
> > >> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct
> > >> spi_flash *flash) if (ret)
> > >>                  goto err_read_id;
> > >>
> > >> -#ifdef CONFIG_SPI_FLASH_MTD
> > >> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> > >>          ret = spi_flash_mtd_register(flash);
> > >>   #endif
> > >>
> > >> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int
> > >> busnum, unsigned int cs,
> > >>
> > >>   void spi_flash_free(struct spi_flash *flash)
> > >>   {
> > >> -#ifdef CONFIG_SPI_FLASH_MTD
> > >> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> > >>          spi_flash_mtd_unregister();
> > >>   #endif
> > >>          spi_free_slave(flash->spi);
> > >> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct
> > >> udevice *dev)
> > >>
> > >>   static int spi_flash_std_remove(struct udevice *dev)
> > >>   {
> > >> -#ifdef CONFIG_SPI_FLASH_MTD
> > >> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)  
> > >
> > > These ifdef changes look unrelated wrt actual patch. any
> > > comments?  
> >
> > No, they are not unrelated. This is the actual reason for having
> > this patch after all. We want to be able to enable/disable the code
> > for CONFIG_SPI_FLASH_MTD per build target (SPL, U-Boot proper).
> > These changes need to be done in a single patch together with the
> > defconfig and Makefile changes to sustain bisectibility.  
> 
> What I'm trying to say here is, #ifdef CONFIG_SPI_FLASH_MTD and #if
> CONFIG_IS_ENABLED(SPI_FLASH_MTD) is the same but the latter is
> improved version which I feel it is related to another patch.

The spi Kconfig code is so convoluted, that we shall try to do it in a
single patch (as was done here).

Otherwise we will end up with not bisectable code.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191023/2a986fa3/attachment.sig>

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-10-23  7:09       ` Jagan Teki
  2019-10-23  7:25         ` Lukasz Majewski
@ 2019-10-23  7:26         ` Schrempf Frieder
  2019-10-23 19:25           ` Jagan Teki
  2019-10-23  7:27         ` Stefan Roese
  2 siblings, 1 reply; 25+ messages in thread
From: Schrempf Frieder @ 2019-10-23  7:26 UTC (permalink / raw)
  To: u-boot

On 23.10.19 09:09, Jagan Teki wrote:
> On Wed, Oct 23, 2019 at 12:35 PM Schrempf Frieder
> <frieder.schrempf@kontron.de> wrote:
>>
>> Hi Jagan,
>>
>> On 22.10.19 20:16, Jagan Teki wrote:
>>> On Sat, Sep 14, 2019 at 4:14 AM Schrempf Frieder
>>> <frieder.schrempf@kontron.de> wrote:
>>>>
>>>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>>>>
>>>> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
>>>> SPL. They often rely on hacks in the board header files to include
>>>> this option conditionally. To be able to fix this, we previously
>>>> introduced a separate option SPL_SPI_FLASH_MTD.
>>>>
>>>> Therefore we can now adjust the Makefile and change the code in
>>>> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
>>>>
>>>> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
>>>> header files to the according defconfigs. The affected boards are
>>>> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
>>>> and da850evm.
>>>>
>>>> We do this all in one patch to guarantee bisectibility.
>>>>
>>>> This change was tested with buildman to make sure it does not
>>>> introduce any regressions by comparing the resulting binary sizes.
>>>>
>>>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>>>> ---
>>>>    configs/aristainetos2_defconfig        |  1 +
>>>>    configs/aristainetos2b_defconfig       |  1 +
>>>>    configs/aristainetos_defconfig         |  1 +
>>>>    configs/cm_fx6_defconfig               |  1 +
>>>>    configs/display5_defconfig             |  1 +
>>>>    configs/display5_factory_defconfig     |  1 +
>>>>    configs/socfpga_arria5_defconfig       |  1 +
>>>>    configs/socfpga_cyclone5_defconfig     |  1 +
>>>>    configs/socfpga_dbm_soc1_defconfig     |  1 +
>>>>    configs/socfpga_de0_nano_soc_defconfig |  1 +
>>>>    configs/socfpga_de10_nano_defconfig    |  1 +
>>>>    configs/socfpga_is1_defconfig          |  1 +
>>>>    configs/socfpga_mcvevk_defconfig       |  1 +
>>>>    configs/socfpga_sockit_defconfig       |  1 +
>>>>    configs/socfpga_socrates_defconfig     |  1 +
>>>>    configs/socfpga_sr1500_defconfig       |  1 +
>>>>    configs/socfpga_vining_fpga_defconfig  |  1 +
>>>>    drivers/mtd/spi/Makefile               |  2 +-
>>>>    drivers/mtd/spi/sf_internal.h          |  2 +-
>>>>    drivers/mtd/spi/sf_probe.c             |  6 +++---
>>>>    include/configs/aristainetos-common.h  |  1 -
>>>>    include/configs/cm_fx6.h               |  7 -------
>>>>    include/configs/da850evm.h             |  7 +------
>>>>    include/configs/dh_imx6.h              |  1 -
>>>>    include/configs/display5.h             |  4 ----
>>>>    include/configs/gw_ventana.h           | 10 +---------
>>>>    include/configs/rcar-gen2-common.h     |  4 +---
>>>>    include/configs/socfpga_common.h       |  4 ----
>>>>    28 files changed, 25 insertions(+), 40 deletions(-)
>>>>
>>>> diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
>>>> index 18ef5d2dce..0bfc117762 100644
>>>> --- a/configs/aristainetos2_defconfig
>>>> +++ b/configs/aristainetos2_defconfig
>>>> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
>>>>    CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=20000000
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_MTD_UBI_FASTMAP=y
>>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>>>    CONFIG_PHYLIB=y
>>>> diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
>>>> index 1054c05d8c..e2da747a8f 100644
>>>> --- a/configs/aristainetos2b_defconfig
>>>> +++ b/configs/aristainetos2b_defconfig
>>>> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=20000000
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_MTD_UBI_FASTMAP=y
>>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>>>    CONFIG_PHYLIB=y
>>>> diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
>>>> index 4080a7b310..5caf95c22f 100644
>>>> --- a/configs/aristainetos_defconfig
>>>> +++ b/configs/aristainetos_defconfig
>>>> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
>>>>    CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=20000000
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_MTD_UBI_FASTMAP=y
>>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>>>    CONFIG_PHYLIB=y
>>>> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
>>>> index fd0db4db5c..15be7db027 100644
>>>> --- a/configs/cm_fx6_defconfig
>>>> +++ b/configs/cm_fx6_defconfig
>>>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    CONFIG_SPI_FLASH_SST=y
>>>>    CONFIG_SPI_FLASH_WINBOND=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHYLIB=y
>>>>    CONFIG_MII=y
>>>>    CONFIG_DM_PMIC=y
>>>> diff --git a/configs/display5_defconfig b/configs/display5_defconfig
>>>> index 8609cd5a8c..5a4cc772be 100644
>>>> --- a/configs/display5_defconfig
>>>> +++ b/configs/display5_defconfig
>>>> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=50000000
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHYLIB=y
>>>>    CONFIG_PHY_MARVELL=y
>>>>    CONFIG_FEC_MXC=y
>>>> diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
>>>> index 70c64260d8..66c68e5ea9 100644
>>>> --- a/configs/display5_factory_defconfig
>>>> +++ b/configs/display5_factory_defconfig
>>>> @@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=50000000
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHYLIB=y
>>>>    CONFIG_FEC_MXC=y
>>>>    CONFIG_MII=y
>>>> diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
>>>> index 89e5ff8c71..30c2d19941 100644
>>>> --- a/configs/socfpga_arria5_defconfig
>>>> +++ b/configs/socfpga_arria5_defconfig
>>>> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
>>>> index 00f2104276..dfe011b959 100644
>>>> --- a/configs/socfpga_cyclone5_defconfig
>>>> +++ b/configs/socfpga_cyclone5_defconfig
>>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_dbm_soc1_defconfig b/configs/socfpga_dbm_soc1_defconfig
>>>> index 1877010a19..ee693f3def 100644
>>>> --- a/configs/socfpga_dbm_soc1_defconfig
>>>> +++ b/configs/socfpga_dbm_soc1_defconfig
>>>> @@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_DM_MMC=y
>>>>    CONFIG_MMC_DW=y
>>>>    CONFIG_MTD_DEVICE=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_DM_ETH=y
>>>>    CONFIG_PHY_GIGE=y
>>>>    CONFIG_ETH_DESIGNWARE=y
>>>> diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
>>>> index de50f17174..e91d6f62f8 100644
>>>> --- a/configs/socfpga_de0_nano_soc_defconfig
>>>> +++ b/configs/socfpga_de0_nano_soc_defconfig
>>>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_DM_MMC=y
>>>>    CONFIG_MMC_DW=y
>>>>    CONFIG_MTD_DEVICE=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_de10_nano_defconfig b/configs/socfpga_de10_nano_defconfig
>>>> index 03961195ac..ffe9d6c10c 100644
>>>> --- a/configs/socfpga_de10_nano_defconfig
>>>> +++ b/configs/socfpga_de10_nano_defconfig
>>>> @@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_DM_MMC=y
>>>>    CONFIG_MMC_DW=y
>>>>    CONFIG_MTD_DEVICE=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
>>>> index 6ea06c1104..76ab87250b 100644
>>>> --- a/configs/socfpga_is1_defconfig
>>>> +++ b/configs/socfpga_is1_defconfig
>>>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_MTD_DEVICE=y
>>>>    CONFIG_SPI_FLASH=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
>>>> index 161bd6fca3..4d3caaa8ad 100644
>>>> --- a/configs/socfpga_mcvevk_defconfig
>>>> +++ b/configs/socfpga_mcvevk_defconfig
>>>> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
>>>>    CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_DM_MMC=y
>>>>    CONFIG_MMC_DW=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_DM_ETH=y
>>>>    CONFIG_PHY_GIGE=y
>>>>    CONFIG_ETH_DESIGNWARE=y
>>>> diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
>>>> index 8ec1c05571..0ffcfda21e 100644
>>>> --- a/configs/socfpga_sockit_defconfig
>>>> +++ b/configs/socfpga_sockit_defconfig
>>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
>>>> index 15f81d1a4b..193af0b0df 100644
>>>> --- a/configs/socfpga_socrates_defconfig
>>>> +++ b/configs/socfpga_socrates_defconfig
>>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SPI_FLASH_MACRONIX=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
>>>> index 941bf1124a..899dd8396b 100644
>>>> --- a/configs/socfpga_sr1500_defconfig
>>>> +++ b/configs/socfpga_sr1500_defconfig
>>>> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SF_DEFAULT_SPEED=100000000
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MARVELL=y
>>>>    CONFIG_DM_ETH=y
>>>>    CONFIG_PHY_GIGE=y
>>>> diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
>>>> index 96f806ab5f..f96f536169 100644
>>>> --- a/configs/socfpga_vining_fpga_defconfig
>>>> +++ b/configs/socfpga_vining_fpga_defconfig
>>>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_MTD_UBI_FASTMAP=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
>>>> index f99f6cb16e..fb67ba32c6 100644
>>>> --- a/drivers/mtd/spi/Makefile
>>>> +++ b/drivers/mtd/spi/Makefile
>>>> @@ -19,5 +19,5 @@ endif
>>>>
>>>>    obj-$(CONFIG_SPI_FLASH) += spi-nor.o
>>>>    obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
>>>> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
>>>> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
>>>>    obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
>>>> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
>>>> index a6bf734830..8542b03685 100644
>>>> --- a/drivers/mtd/spi/sf_internal.h
>>>> +++ b/drivers/mtd/spi/sf_internal.h
>>>> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
>>>>    int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
>>>>
>>>>
>>>> -#ifdef CONFIG_SPI_FLASH_MTD
>>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>>>    int spi_flash_mtd_register(struct spi_flash *flash);
>>>>    void spi_flash_mtd_unregister(void);
>>>>    #endif
>>>> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
>>>> index 73297e1a0a..f051e473ff 100644
>>>> --- a/drivers/mtd/spi/sf_probe.c
>>>> +++ b/drivers/mtd/spi/sf_probe.c
>>>> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
>>>>           if (ret)
>>>>                   goto err_read_id;
>>>>
>>>> -#ifdef CONFIG_SPI_FLASH_MTD
>>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>>>           ret = spi_flash_mtd_register(flash);
>>>>    #endif
>>>>
>>>> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
>>>>
>>>>    void spi_flash_free(struct spi_flash *flash)
>>>>    {
>>>> -#ifdef CONFIG_SPI_FLASH_MTD
>>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>>>           spi_flash_mtd_unregister();
>>>>    #endif
>>>>           spi_free_slave(flash->spi);
>>>> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice *dev)
>>>>
>>>>    static int spi_flash_std_remove(struct udevice *dev)
>>>>    {
>>>> -#ifdef CONFIG_SPI_FLASH_MTD
>>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>>
>>> These ifdef changes look unrelated wrt actual patch. any comments?
>>
>> No, they are not unrelated. This is the actual reason for having this
>> patch after all. We want to be able to enable/disable the code for
>> CONFIG_SPI_FLASH_MTD per build target (SPL, U-Boot proper).
>> These changes need to be done in a single patch together with the
>> defconfig and Makefile changes to sustain bisectibility.
> 
> What I'm trying to say here is, #ifdef CONFIG_SPI_FLASH_MTD and #if
> CONFIG_IS_ENABLED(SPI_FLASH_MTD) is the same but the latter is
> improved version which I feel it is related to another patch.

No, "#ifdef CONFIG_FOO" is definitely not the same as "#if 
CONFIG_IS_ENABLED(FOO)". Please have a look at the definition of 
CONFIG_IS_ENABLED: [1].

"CONFIG_IS_ENABLED(FOO)" will resolve to 1 if CONFIG_SPL_FOO and 
CONFIG_SPL_BUILD are defined.

"#ifdef CONFIG_FOO" will only resolve to 1 if CONFIG_FOO is defined.

[1] 
https://elixir.bootlin.com/u-boot/latest/source/include/linux/kconfig.h#L82

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-10-23  7:09       ` Jagan Teki
  2019-10-23  7:25         ` Lukasz Majewski
  2019-10-23  7:26         ` Schrempf Frieder
@ 2019-10-23  7:27         ` Stefan Roese
  2019-10-23 19:26           ` Jagan Teki
  2 siblings, 1 reply; 25+ messages in thread
From: Stefan Roese @ 2019-10-23  7:27 UTC (permalink / raw)
  To: u-boot

On 23.10.19 09:09, Jagan Teki wrote:
> On Wed, Oct 23, 2019 at 12:35 PM Schrempf Frieder
> <frieder.schrempf@kontron.de> wrote:
>>
>> Hi Jagan,
>>
>> On 22.10.19 20:16, Jagan Teki wrote:
>>> On Sat, Sep 14, 2019 at 4:14 AM Schrempf Frieder
>>> <frieder.schrempf@kontron.de> wrote:
>>>>
>>>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>>>>
>>>> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
>>>> SPL. They often rely on hacks in the board header files to include
>>>> this option conditionally. To be able to fix this, we previously
>>>> introduced a separate option SPL_SPI_FLASH_MTD.
>>>>
>>>> Therefore we can now adjust the Makefile and change the code in
>>>> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
>>>>
>>>> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
>>>> header files to the according defconfigs. The affected boards are
>>>> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
>>>> and da850evm.
>>>>
>>>> We do this all in one patch to guarantee bisectibility.
>>>>
>>>> This change was tested with buildman to make sure it does not
>>>> introduce any regressions by comparing the resulting binary sizes.
>>>>
>>>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>>>> ---
>>>>    configs/aristainetos2_defconfig        |  1 +
>>>>    configs/aristainetos2b_defconfig       |  1 +
>>>>    configs/aristainetos_defconfig         |  1 +
>>>>    configs/cm_fx6_defconfig               |  1 +
>>>>    configs/display5_defconfig             |  1 +
>>>>    configs/display5_factory_defconfig     |  1 +
>>>>    configs/socfpga_arria5_defconfig       |  1 +
>>>>    configs/socfpga_cyclone5_defconfig     |  1 +
>>>>    configs/socfpga_dbm_soc1_defconfig     |  1 +
>>>>    configs/socfpga_de0_nano_soc_defconfig |  1 +
>>>>    configs/socfpga_de10_nano_defconfig    |  1 +
>>>>    configs/socfpga_is1_defconfig          |  1 +
>>>>    configs/socfpga_mcvevk_defconfig       |  1 +
>>>>    configs/socfpga_sockit_defconfig       |  1 +
>>>>    configs/socfpga_socrates_defconfig     |  1 +
>>>>    configs/socfpga_sr1500_defconfig       |  1 +
>>>>    configs/socfpga_vining_fpga_defconfig  |  1 +
>>>>    drivers/mtd/spi/Makefile               |  2 +-
>>>>    drivers/mtd/spi/sf_internal.h          |  2 +-
>>>>    drivers/mtd/spi/sf_probe.c             |  6 +++---
>>>>    include/configs/aristainetos-common.h  |  1 -
>>>>    include/configs/cm_fx6.h               |  7 -------
>>>>    include/configs/da850evm.h             |  7 +------
>>>>    include/configs/dh_imx6.h              |  1 -
>>>>    include/configs/display5.h             |  4 ----
>>>>    include/configs/gw_ventana.h           | 10 +---------
>>>>    include/configs/rcar-gen2-common.h     |  4 +---
>>>>    include/configs/socfpga_common.h       |  4 ----
>>>>    28 files changed, 25 insertions(+), 40 deletions(-)
>>>>
>>>> diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
>>>> index 18ef5d2dce..0bfc117762 100644
>>>> --- a/configs/aristainetos2_defconfig
>>>> +++ b/configs/aristainetos2_defconfig
>>>> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
>>>>    CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=20000000
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_MTD_UBI_FASTMAP=y
>>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>>>    CONFIG_PHYLIB=y
>>>> diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
>>>> index 1054c05d8c..e2da747a8f 100644
>>>> --- a/configs/aristainetos2b_defconfig
>>>> +++ b/configs/aristainetos2b_defconfig
>>>> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=20000000
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_MTD_UBI_FASTMAP=y
>>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>>>    CONFIG_PHYLIB=y
>>>> diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
>>>> index 4080a7b310..5caf95c22f 100644
>>>> --- a/configs/aristainetos_defconfig
>>>> +++ b/configs/aristainetos_defconfig
>>>> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
>>>>    CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=20000000
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_MTD_UBI_FASTMAP=y
>>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
>>>>    CONFIG_PHYLIB=y
>>>> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
>>>> index fd0db4db5c..15be7db027 100644
>>>> --- a/configs/cm_fx6_defconfig
>>>> +++ b/configs/cm_fx6_defconfig
>>>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    CONFIG_SPI_FLASH_SST=y
>>>>    CONFIG_SPI_FLASH_WINBOND=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHYLIB=y
>>>>    CONFIG_MII=y
>>>>    CONFIG_DM_PMIC=y
>>>> diff --git a/configs/display5_defconfig b/configs/display5_defconfig
>>>> index 8609cd5a8c..5a4cc772be 100644
>>>> --- a/configs/display5_defconfig
>>>> +++ b/configs/display5_defconfig
>>>> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=50000000
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHYLIB=y
>>>>    CONFIG_PHY_MARVELL=y
>>>>    CONFIG_FEC_MXC=y
>>>> diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
>>>> index 70c64260d8..66c68e5ea9 100644
>>>> --- a/configs/display5_factory_defconfig
>>>> +++ b/configs/display5_factory_defconfig
>>>> @@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
>>>>    CONFIG_SF_DEFAULT_SPEED=50000000
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHYLIB=y
>>>>    CONFIG_FEC_MXC=y
>>>>    CONFIG_MII=y
>>>> diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
>>>> index 89e5ff8c71..30c2d19941 100644
>>>> --- a/configs/socfpga_arria5_defconfig
>>>> +++ b/configs/socfpga_arria5_defconfig
>>>> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
>>>> index 00f2104276..dfe011b959 100644
>>>> --- a/configs/socfpga_cyclone5_defconfig
>>>> +++ b/configs/socfpga_cyclone5_defconfig
>>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_dbm_soc1_defconfig b/configs/socfpga_dbm_soc1_defconfig
>>>> index 1877010a19..ee693f3def 100644
>>>> --- a/configs/socfpga_dbm_soc1_defconfig
>>>> +++ b/configs/socfpga_dbm_soc1_defconfig
>>>> @@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_DM_MMC=y
>>>>    CONFIG_MMC_DW=y
>>>>    CONFIG_MTD_DEVICE=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_DM_ETH=y
>>>>    CONFIG_PHY_GIGE=y
>>>>    CONFIG_ETH_DESIGNWARE=y
>>>> diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
>>>> index de50f17174..e91d6f62f8 100644
>>>> --- a/configs/socfpga_de0_nano_soc_defconfig
>>>> +++ b/configs/socfpga_de0_nano_soc_defconfig
>>>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_DM_MMC=y
>>>>    CONFIG_MMC_DW=y
>>>>    CONFIG_MTD_DEVICE=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_de10_nano_defconfig b/configs/socfpga_de10_nano_defconfig
>>>> index 03961195ac..ffe9d6c10c 100644
>>>> --- a/configs/socfpga_de10_nano_defconfig
>>>> +++ b/configs/socfpga_de10_nano_defconfig
>>>> @@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_DM_MMC=y
>>>>    CONFIG_MMC_DW=y
>>>>    CONFIG_MTD_DEVICE=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
>>>> index 6ea06c1104..76ab87250b 100644
>>>> --- a/configs/socfpga_is1_defconfig
>>>> +++ b/configs/socfpga_is1_defconfig
>>>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_MTD_DEVICE=y
>>>>    CONFIG_SPI_FLASH=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
>>>> index 161bd6fca3..4d3caaa8ad 100644
>>>> --- a/configs/socfpga_mcvevk_defconfig
>>>> +++ b/configs/socfpga_mcvevk_defconfig
>>>> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
>>>>    CONFIG_SYS_I2C_DW=y
>>>>    CONFIG_DM_MMC=y
>>>>    CONFIG_MMC_DW=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_DM_ETH=y
>>>>    CONFIG_PHY_GIGE=y
>>>>    CONFIG_ETH_DESIGNWARE=y
>>>> diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
>>>> index 8ec1c05571..0ffcfda21e 100644
>>>> --- a/configs/socfpga_sockit_defconfig
>>>> +++ b/configs/socfpga_sockit_defconfig
>>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
>>>> index 15f81d1a4b..193af0b0df 100644
>>>> --- a/configs/socfpga_socrates_defconfig
>>>> +++ b/configs/socfpga_socrates_defconfig
>>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SPI_FLASH_MACRONIX=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>>    CONFIG_DM_ETH=y
>>>> diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
>>>> index 941bf1124a..899dd8396b 100644
>>>> --- a/configs/socfpga_sr1500_defconfig
>>>> +++ b/configs/socfpga_sr1500_defconfig
>>>> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SF_DEFAULT_SPEED=100000000
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_PHY_MARVELL=y
>>>>    CONFIG_DM_ETH=y
>>>>    CONFIG_PHY_GIGE=y
>>>> diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
>>>> index 96f806ab5f..f96f536169 100644
>>>> --- a/configs/socfpga_vining_fpga_defconfig
>>>> +++ b/configs/socfpga_vining_fpga_defconfig
>>>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
>>>>    CONFIG_SPI_FLASH_SPANSION=y
>>>>    CONFIG_SPI_FLASH_STMICRO=y
>>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
>>>> +CONFIG_SPI_FLASH_MTD=y
>>>>    CONFIG_MTD_UBI_FASTMAP=y
>>>>    CONFIG_PHY_MICREL=y
>>>>    CONFIG_PHY_MICREL_KSZ90X1=y
>>>> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
>>>> index f99f6cb16e..fb67ba32c6 100644
>>>> --- a/drivers/mtd/spi/Makefile
>>>> +++ b/drivers/mtd/spi/Makefile
>>>> @@ -19,5 +19,5 @@ endif
>>>>
>>>>    obj-$(CONFIG_SPI_FLASH) += spi-nor.o
>>>>    obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
>>>> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
>>>> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
>>>>    obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
>>>> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
>>>> index a6bf734830..8542b03685 100644
>>>> --- a/drivers/mtd/spi/sf_internal.h
>>>> +++ b/drivers/mtd/spi/sf_internal.h
>>>> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
>>>>    int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
>>>>
>>>>
>>>> -#ifdef CONFIG_SPI_FLASH_MTD
>>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>>>    int spi_flash_mtd_register(struct spi_flash *flash);
>>>>    void spi_flash_mtd_unregister(void);
>>>>    #endif
>>>> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
>>>> index 73297e1a0a..f051e473ff 100644
>>>> --- a/drivers/mtd/spi/sf_probe.c
>>>> +++ b/drivers/mtd/spi/sf_probe.c
>>>> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
>>>>           if (ret)
>>>>                   goto err_read_id;
>>>>
>>>> -#ifdef CONFIG_SPI_FLASH_MTD
>>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>>>           ret = spi_flash_mtd_register(flash);
>>>>    #endif
>>>>
>>>> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
>>>>
>>>>    void spi_flash_free(struct spi_flash *flash)
>>>>    {
>>>> -#ifdef CONFIG_SPI_FLASH_MTD
>>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>>>           spi_flash_mtd_unregister();
>>>>    #endif
>>>>           spi_free_slave(flash->spi);
>>>> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice *dev)
>>>>
>>>>    static int spi_flash_std_remove(struct udevice *dev)
>>>>    {
>>>> -#ifdef CONFIG_SPI_FLASH_MTD
>>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
>>>
>>> These ifdef changes look unrelated wrt actual patch. any comments?
>>
>> No, they are not unrelated. This is the actual reason for having this
>> patch after all. We want to be able to enable/disable the code for
>> CONFIG_SPI_FLASH_MTD per build target (SPL, U-Boot proper).
>> These changes need to be done in a single patch together with the
>> defconfig and Makefile changes to sustain bisectibility.
> 
> What I'm trying to say here is, #ifdef CONFIG_SPI_FLASH_MTD and #if
> CONFIG_IS_ENABLED(SPI_FLASH_MTD) is the same

This is not correct. CONFIG_IS_ENABLED(SPI_FLASH_MTD) also handles
CONFIG_SPL_SPI_FLASH_MTD & CONFIG_TPL_SPI_FLASH_MTD.

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-10-23  7:26         ` Schrempf Frieder
@ 2019-10-23 19:25           ` Jagan Teki
  0 siblings, 0 replies; 25+ messages in thread
From: Jagan Teki @ 2019-10-23 19:25 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 23, 2019 at 12:56 PM Schrempf Frieder
<frieder.schrempf@kontron.de> wrote:
>
> On 23.10.19 09:09, Jagan Teki wrote:
> > On Wed, Oct 23, 2019 at 12:35 PM Schrempf Frieder
> > <frieder.schrempf@kontron.de> wrote:
> >>
> >> Hi Jagan,
> >>
> >> On 22.10.19 20:16, Jagan Teki wrote:
> >>> On Sat, Sep 14, 2019 at 4:14 AM Schrempf Frieder
> >>> <frieder.schrempf@kontron.de> wrote:
> >>>>
> >>>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> >>>>
> >>>> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> >>>> SPL. They often rely on hacks in the board header files to include
> >>>> this option conditionally. To be able to fix this, we previously
> >>>> introduced a separate option SPL_SPI_FLASH_MTD.
> >>>>
> >>>> Therefore we can now adjust the Makefile and change the code in
> >>>> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> >>>>
> >>>> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> >>>> header files to the according defconfigs. The affected boards are
> >>>> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> >>>> and da850evm.
> >>>>
> >>>> We do this all in one patch to guarantee bisectibility.
> >>>>
> >>>> This change was tested with buildman to make sure it does not
> >>>> introduce any regressions by comparing the resulting binary sizes.
> >>>>
> >>>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> >>>> ---
> >>>>    configs/aristainetos2_defconfig        |  1 +
> >>>>    configs/aristainetos2b_defconfig       |  1 +
> >>>>    configs/aristainetos_defconfig         |  1 +
> >>>>    configs/cm_fx6_defconfig               |  1 +
> >>>>    configs/display5_defconfig             |  1 +
> >>>>    configs/display5_factory_defconfig     |  1 +
> >>>>    configs/socfpga_arria5_defconfig       |  1 +
> >>>>    configs/socfpga_cyclone5_defconfig     |  1 +
> >>>>    configs/socfpga_dbm_soc1_defconfig     |  1 +
> >>>>    configs/socfpga_de0_nano_soc_defconfig |  1 +
> >>>>    configs/socfpga_de10_nano_defconfig    |  1 +
> >>>>    configs/socfpga_is1_defconfig          |  1 +
> >>>>    configs/socfpga_mcvevk_defconfig       |  1 +
> >>>>    configs/socfpga_sockit_defconfig       |  1 +
> >>>>    configs/socfpga_socrates_defconfig     |  1 +
> >>>>    configs/socfpga_sr1500_defconfig       |  1 +
> >>>>    configs/socfpga_vining_fpga_defconfig  |  1 +
> >>>>    drivers/mtd/spi/Makefile               |  2 +-
> >>>>    drivers/mtd/spi/sf_internal.h          |  2 +-
> >>>>    drivers/mtd/spi/sf_probe.c             |  6 +++---
> >>>>    include/configs/aristainetos-common.h  |  1 -
> >>>>    include/configs/cm_fx6.h               |  7 -------
> >>>>    include/configs/da850evm.h             |  7 +------
> >>>>    include/configs/dh_imx6.h              |  1 -
> >>>>    include/configs/display5.h             |  4 ----
> >>>>    include/configs/gw_ventana.h           | 10 +---------
> >>>>    include/configs/rcar-gen2-common.h     |  4 +---
> >>>>    include/configs/socfpga_common.h       |  4 ----
> >>>>    28 files changed, 25 insertions(+), 40 deletions(-)
> >>>>
> >>>> diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
> >>>> index 18ef5d2dce..0bfc117762 100644
> >>>> --- a/configs/aristainetos2_defconfig
> >>>> +++ b/configs/aristainetos2_defconfig
> >>>> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
> >>>>    CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=20000000
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_MTD_UBI_FASTMAP=y
> >>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>>>    CONFIG_PHYLIB=y
> >>>> diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
> >>>> index 1054c05d8c..e2da747a8f 100644
> >>>> --- a/configs/aristainetos2b_defconfig
> >>>> +++ b/configs/aristainetos2b_defconfig
> >>>> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=20000000
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_MTD_UBI_FASTMAP=y
> >>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>>>    CONFIG_PHYLIB=y
> >>>> diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
> >>>> index 4080a7b310..5caf95c22f 100644
> >>>> --- a/configs/aristainetos_defconfig
> >>>> +++ b/configs/aristainetos_defconfig
> >>>> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
> >>>>    CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=20000000
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_MTD_UBI_FASTMAP=y
> >>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>>>    CONFIG_PHYLIB=y
> >>>> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
> >>>> index fd0db4db5c..15be7db027 100644
> >>>> --- a/configs/cm_fx6_defconfig
> >>>> +++ b/configs/cm_fx6_defconfig
> >>>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    CONFIG_SPI_FLASH_SST=y
> >>>>    CONFIG_SPI_FLASH_WINBOND=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHYLIB=y
> >>>>    CONFIG_MII=y
> >>>>    CONFIG_DM_PMIC=y
> >>>> diff --git a/configs/display5_defconfig b/configs/display5_defconfig
> >>>> index 8609cd5a8c..5a4cc772be 100644
> >>>> --- a/configs/display5_defconfig
> >>>> +++ b/configs/display5_defconfig
> >>>> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=50000000
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHYLIB=y
> >>>>    CONFIG_PHY_MARVELL=y
> >>>>    CONFIG_FEC_MXC=y
> >>>> diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
> >>>> index 70c64260d8..66c68e5ea9 100644
> >>>> --- a/configs/display5_factory_defconfig
> >>>> +++ b/configs/display5_factory_defconfig
> >>>> @@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=50000000
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHYLIB=y
> >>>>    CONFIG_FEC_MXC=y
> >>>>    CONFIG_MII=y
> >>>> diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
> >>>> index 89e5ff8c71..30c2d19941 100644
> >>>> --- a/configs/socfpga_arria5_defconfig
> >>>> +++ b/configs/socfpga_arria5_defconfig
> >>>> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
> >>>> index 00f2104276..dfe011b959 100644
> >>>> --- a/configs/socfpga_cyclone5_defconfig
> >>>> +++ b/configs/socfpga_cyclone5_defconfig
> >>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_dbm_soc1_defconfig b/configs/socfpga_dbm_soc1_defconfig
> >>>> index 1877010a19..ee693f3def 100644
> >>>> --- a/configs/socfpga_dbm_soc1_defconfig
> >>>> +++ b/configs/socfpga_dbm_soc1_defconfig
> >>>> @@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_DM_MMC=y
> >>>>    CONFIG_MMC_DW=y
> >>>>    CONFIG_MTD_DEVICE=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_DM_ETH=y
> >>>>    CONFIG_PHY_GIGE=y
> >>>>    CONFIG_ETH_DESIGNWARE=y
> >>>> diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
> >>>> index de50f17174..e91d6f62f8 100644
> >>>> --- a/configs/socfpga_de0_nano_soc_defconfig
> >>>> +++ b/configs/socfpga_de0_nano_soc_defconfig
> >>>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_DM_MMC=y
> >>>>    CONFIG_MMC_DW=y
> >>>>    CONFIG_MTD_DEVICE=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_de10_nano_defconfig b/configs/socfpga_de10_nano_defconfig
> >>>> index 03961195ac..ffe9d6c10c 100644
> >>>> --- a/configs/socfpga_de10_nano_defconfig
> >>>> +++ b/configs/socfpga_de10_nano_defconfig
> >>>> @@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_DM_MMC=y
> >>>>    CONFIG_MMC_DW=y
> >>>>    CONFIG_MTD_DEVICE=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
> >>>> index 6ea06c1104..76ab87250b 100644
> >>>> --- a/configs/socfpga_is1_defconfig
> >>>> +++ b/configs/socfpga_is1_defconfig
> >>>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_MTD_DEVICE=y
> >>>>    CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
> >>>> index 161bd6fca3..4d3caaa8ad 100644
> >>>> --- a/configs/socfpga_mcvevk_defconfig
> >>>> +++ b/configs/socfpga_mcvevk_defconfig
> >>>> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
> >>>>    CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_DM_MMC=y
> >>>>    CONFIG_MMC_DW=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_DM_ETH=y
> >>>>    CONFIG_PHY_GIGE=y
> >>>>    CONFIG_ETH_DESIGNWARE=y
> >>>> diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
> >>>> index 8ec1c05571..0ffcfda21e 100644
> >>>> --- a/configs/socfpga_sockit_defconfig
> >>>> +++ b/configs/socfpga_sockit_defconfig
> >>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
> >>>> index 15f81d1a4b..193af0b0df 100644
> >>>> --- a/configs/socfpga_socrates_defconfig
> >>>> +++ b/configs/socfpga_socrates_defconfig
> >>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SPI_FLASH_MACRONIX=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
> >>>> index 941bf1124a..899dd8396b 100644
> >>>> --- a/configs/socfpga_sr1500_defconfig
> >>>> +++ b/configs/socfpga_sr1500_defconfig
> >>>> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SF_DEFAULT_SPEED=100000000
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MARVELL=y
> >>>>    CONFIG_DM_ETH=y
> >>>>    CONFIG_PHY_GIGE=y
> >>>> diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
> >>>> index 96f806ab5f..f96f536169 100644
> >>>> --- a/configs/socfpga_vining_fpga_defconfig
> >>>> +++ b/configs/socfpga_vining_fpga_defconfig
> >>>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_MTD_UBI_FASTMAP=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
> >>>> index f99f6cb16e..fb67ba32c6 100644
> >>>> --- a/drivers/mtd/spi/Makefile
> >>>> +++ b/drivers/mtd/spi/Makefile
> >>>> @@ -19,5 +19,5 @@ endif
> >>>>
> >>>>    obj-$(CONFIG_SPI_FLASH) += spi-nor.o
> >>>>    obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
> >>>> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
> >>>> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
> >>>>    obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
> >>>> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
> >>>> index a6bf734830..8542b03685 100644
> >>>> --- a/drivers/mtd/spi/sf_internal.h
> >>>> +++ b/drivers/mtd/spi/sf_internal.h
> >>>> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
> >>>>    int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
> >>>>
> >>>>
> >>>> -#ifdef CONFIG_SPI_FLASH_MTD
> >>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>>>    int spi_flash_mtd_register(struct spi_flash *flash);
> >>>>    void spi_flash_mtd_unregister(void);
> >>>>    #endif
> >>>> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> >>>> index 73297e1a0a..f051e473ff 100644
> >>>> --- a/drivers/mtd/spi/sf_probe.c
> >>>> +++ b/drivers/mtd/spi/sf_probe.c
> >>>> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
> >>>>           if (ret)
> >>>>                   goto err_read_id;
> >>>>
> >>>> -#ifdef CONFIG_SPI_FLASH_MTD
> >>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>>>           ret = spi_flash_mtd_register(flash);
> >>>>    #endif
> >>>>
> >>>> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
> >>>>
> >>>>    void spi_flash_free(struct spi_flash *flash)
> >>>>    {
> >>>> -#ifdef CONFIG_SPI_FLASH_MTD
> >>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>>>           spi_flash_mtd_unregister();
> >>>>    #endif
> >>>>           spi_free_slave(flash->spi);
> >>>> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice *dev)
> >>>>
> >>>>    static int spi_flash_std_remove(struct udevice *dev)
> >>>>    {
> >>>> -#ifdef CONFIG_SPI_FLASH_MTD
> >>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>>
> >>> These ifdef changes look unrelated wrt actual patch. any comments?
> >>
> >> No, they are not unrelated. This is the actual reason for having this
> >> patch after all. We want to be able to enable/disable the code for
> >> CONFIG_SPI_FLASH_MTD per build target (SPL, U-Boot proper).
> >> These changes need to be done in a single patch together with the
> >> defconfig and Makefile changes to sustain bisectibility.
> >
> > What I'm trying to say here is, #ifdef CONFIG_SPI_FLASH_MTD and #if
> > CONFIG_IS_ENABLED(SPI_FLASH_MTD) is the same but the latter is
> > improved version which I feel it is related to another patch.
>
> No, "#ifdef CONFIG_FOO" is definitely not the same as "#if
> CONFIG_IS_ENABLED(FOO)". Please have a look at the definition of
> CONFIG_IS_ENABLED: [1].
>
> "CONFIG_IS_ENABLED(FOO)" will resolve to 1 if CONFIG_SPL_FOO and
> CONFIG_SPL_BUILD are defined.
>
> "#ifdef CONFIG_FOO" will only resolve to 1 if CONFIG_FOO is defined.
>
> [1]
> https://elixir.bootlin.com/u-boot/latest/source/include/linux/kconfig.h#L82

Make sense, I would rather confused or missed a point. thanks.

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

* [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
  2019-10-23  7:27         ` Stefan Roese
@ 2019-10-23 19:26           ` Jagan Teki
  0 siblings, 0 replies; 25+ messages in thread
From: Jagan Teki @ 2019-10-23 19:26 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 23, 2019 at 12:57 PM Stefan Roese <sr@denx.de> wrote:
>
> On 23.10.19 09:09, Jagan Teki wrote:
> > On Wed, Oct 23, 2019 at 12:35 PM Schrempf Frieder
> > <frieder.schrempf@kontron.de> wrote:
> >>
> >> Hi Jagan,
> >>
> >> On 22.10.19 20:16, Jagan Teki wrote:
> >>> On Sat, Sep 14, 2019 at 4:14 AM Schrempf Frieder
> >>> <frieder.schrempf@kontron.de> wrote:
> >>>>
> >>>> From: Frieder Schrempf <frieder.schrempf@kontron.de>
> >>>>
> >>>> Most boards currently use SPI_FLASH_MTD only in U-Boot proper, not in
> >>>> SPL. They often rely on hacks in the board header files to include
> >>>> this option conditionally. To be able to fix this, we previously
> >>>> introduced a separate option SPL_SPI_FLASH_MTD.
> >>>>
> >>>> Therefore we can now adjust the Makefile and change the code in
> >>>> sf_probe.c and sf_internal.h to use CONFIG_IS_ENABLED(SPI_FLASH_MTD).
> >>>>
> >>>> We also need to move all occurences of CONFIG_SPI_FLASH_MTD from the
> >>>> header files to the according defconfigs. The affected boards are
> >>>> socfpga, aristainetos, cm_fx6, display5, ventana, rcar-gen2, dh_imx6
> >>>> and da850evm.
> >>>>
> >>>> We do this all in one patch to guarantee bisectibility.
> >>>>
> >>>> This change was tested with buildman to make sure it does not
> >>>> introduce any regressions by comparing the resulting binary sizes.
> >>>>
> >>>> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> >>>> ---
> >>>>    configs/aristainetos2_defconfig        |  1 +
> >>>>    configs/aristainetos2b_defconfig       |  1 +
> >>>>    configs/aristainetos_defconfig         |  1 +
> >>>>    configs/cm_fx6_defconfig               |  1 +
> >>>>    configs/display5_defconfig             |  1 +
> >>>>    configs/display5_factory_defconfig     |  1 +
> >>>>    configs/socfpga_arria5_defconfig       |  1 +
> >>>>    configs/socfpga_cyclone5_defconfig     |  1 +
> >>>>    configs/socfpga_dbm_soc1_defconfig     |  1 +
> >>>>    configs/socfpga_de0_nano_soc_defconfig |  1 +
> >>>>    configs/socfpga_de10_nano_defconfig    |  1 +
> >>>>    configs/socfpga_is1_defconfig          |  1 +
> >>>>    configs/socfpga_mcvevk_defconfig       |  1 +
> >>>>    configs/socfpga_sockit_defconfig       |  1 +
> >>>>    configs/socfpga_socrates_defconfig     |  1 +
> >>>>    configs/socfpga_sr1500_defconfig       |  1 +
> >>>>    configs/socfpga_vining_fpga_defconfig  |  1 +
> >>>>    drivers/mtd/spi/Makefile               |  2 +-
> >>>>    drivers/mtd/spi/sf_internal.h          |  2 +-
> >>>>    drivers/mtd/spi/sf_probe.c             |  6 +++---
> >>>>    include/configs/aristainetos-common.h  |  1 -
> >>>>    include/configs/cm_fx6.h               |  7 -------
> >>>>    include/configs/da850evm.h             |  7 +------
> >>>>    include/configs/dh_imx6.h              |  1 -
> >>>>    include/configs/display5.h             |  4 ----
> >>>>    include/configs/gw_ventana.h           | 10 +---------
> >>>>    include/configs/rcar-gen2-common.h     |  4 +---
> >>>>    include/configs/socfpga_common.h       |  4 ----
> >>>>    28 files changed, 25 insertions(+), 40 deletions(-)
> >>>>
> >>>> diff --git a/configs/aristainetos2_defconfig b/configs/aristainetos2_defconfig
> >>>> index 18ef5d2dce..0bfc117762 100644
> >>>> --- a/configs/aristainetos2_defconfig
> >>>> +++ b/configs/aristainetos2_defconfig
> >>>> @@ -44,6 +44,7 @@ CONFIG_SF_DEFAULT_CS=1
> >>>>    CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=20000000
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_MTD_UBI_FASTMAP=y
> >>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>>>    CONFIG_PHYLIB=y
> >>>> diff --git a/configs/aristainetos2b_defconfig b/configs/aristainetos2b_defconfig
> >>>> index 1054c05d8c..e2da747a8f 100644
> >>>> --- a/configs/aristainetos2b_defconfig
> >>>> +++ b/configs/aristainetos2b_defconfig
> >>>> @@ -42,6 +42,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=20000000
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_MTD_UBI_FASTMAP=y
> >>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>>>    CONFIG_PHYLIB=y
> >>>> diff --git a/configs/aristainetos_defconfig b/configs/aristainetos_defconfig
> >>>> index 4080a7b310..5caf95c22f 100644
> >>>> --- a/configs/aristainetos_defconfig
> >>>> +++ b/configs/aristainetos_defconfig
> >>>> @@ -43,6 +43,7 @@ CONFIG_SF_DEFAULT_BUS=3
> >>>>    CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=20000000
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_MTD_UBI_FASTMAP=y
> >>>>    CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1
> >>>>    CONFIG_PHYLIB=y
> >>>> diff --git a/configs/cm_fx6_defconfig b/configs/cm_fx6_defconfig
> >>>> index fd0db4db5c..15be7db027 100644
> >>>> --- a/configs/cm_fx6_defconfig
> >>>> +++ b/configs/cm_fx6_defconfig
> >>>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    CONFIG_SPI_FLASH_SST=y
> >>>>    CONFIG_SPI_FLASH_WINBOND=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHYLIB=y
> >>>>    CONFIG_MII=y
> >>>>    CONFIG_DM_PMIC=y
> >>>> diff --git a/configs/display5_defconfig b/configs/display5_defconfig
> >>>> index 8609cd5a8c..5a4cc772be 100644
> >>>> --- a/configs/display5_defconfig
> >>>> +++ b/configs/display5_defconfig
> >>>> @@ -75,6 +75,7 @@ CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=50000000
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHYLIB=y
> >>>>    CONFIG_PHY_MARVELL=y
> >>>>    CONFIG_FEC_MXC=y
> >>>> diff --git a/configs/display5_factory_defconfig b/configs/display5_factory_defconfig
> >>>> index 70c64260d8..66c68e5ea9 100644
> >>>> --- a/configs/display5_factory_defconfig
> >>>> +++ b/configs/display5_factory_defconfig
> >>>> @@ -74,6 +74,7 @@ CONFIG_SF_DEFAULT_MODE=0
> >>>>    CONFIG_SF_DEFAULT_SPEED=50000000
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHYLIB=y
> >>>>    CONFIG_FEC_MXC=y
> >>>>    CONFIG_MII=y
> >>>> diff --git a/configs/socfpga_arria5_defconfig b/configs/socfpga_arria5_defconfig
> >>>> index 89e5ff8c71..30c2d19941 100644
> >>>> --- a/configs/socfpga_arria5_defconfig
> >>>> +++ b/configs/socfpga_arria5_defconfig
> >>>> @@ -47,6 +47,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
> >>>> index 00f2104276..dfe011b959 100644
> >>>> --- a/configs/socfpga_cyclone5_defconfig
> >>>> +++ b/configs/socfpga_cyclone5_defconfig
> >>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_dbm_soc1_defconfig b/configs/socfpga_dbm_soc1_defconfig
> >>>> index 1877010a19..ee693f3def 100644
> >>>> --- a/configs/socfpga_dbm_soc1_defconfig
> >>>> +++ b/configs/socfpga_dbm_soc1_defconfig
> >>>> @@ -46,6 +46,7 @@ CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_DM_MMC=y
> >>>>    CONFIG_MMC_DW=y
> >>>>    CONFIG_MTD_DEVICE=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_DM_ETH=y
> >>>>    CONFIG_PHY_GIGE=y
> >>>>    CONFIG_ETH_DESIGNWARE=y
> >>>> diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig
> >>>> index de50f17174..e91d6f62f8 100644
> >>>> --- a/configs/socfpga_de0_nano_soc_defconfig
> >>>> +++ b/configs/socfpga_de0_nano_soc_defconfig
> >>>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_DM_MMC=y
> >>>>    CONFIG_MMC_DW=y
> >>>>    CONFIG_MTD_DEVICE=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_de10_nano_defconfig b/configs/socfpga_de10_nano_defconfig
> >>>> index 03961195ac..ffe9d6c10c 100644
> >>>> --- a/configs/socfpga_de10_nano_defconfig
> >>>> +++ b/configs/socfpga_de10_nano_defconfig
> >>>> @@ -39,6 +39,7 @@ CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_DM_MMC=y
> >>>>    CONFIG_MMC_DW=y
> >>>>    CONFIG_MTD_DEVICE=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_is1_defconfig b/configs/socfpga_is1_defconfig
> >>>> index 6ea06c1104..76ab87250b 100644
> >>>> --- a/configs/socfpga_is1_defconfig
> >>>> +++ b/configs/socfpga_is1_defconfig
> >>>> @@ -43,6 +43,7 @@ CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_MTD_DEVICE=y
> >>>>    CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_mcvevk_defconfig b/configs/socfpga_mcvevk_defconfig
> >>>> index 161bd6fca3..4d3caaa8ad 100644
> >>>> --- a/configs/socfpga_mcvevk_defconfig
> >>>> +++ b/configs/socfpga_mcvevk_defconfig
> >>>> @@ -42,6 +42,7 @@ CONFIG_DM_I2C=y
> >>>>    CONFIG_SYS_I2C_DW=y
> >>>>    CONFIG_DM_MMC=y
> >>>>    CONFIG_MMC_DW=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_DM_ETH=y
> >>>>    CONFIG_PHY_GIGE=y
> >>>>    CONFIG_ETH_DESIGNWARE=y
> >>>> diff --git a/configs/socfpga_sockit_defconfig b/configs/socfpga_sockit_defconfig
> >>>> index 8ec1c05571..0ffcfda21e 100644
> >>>> --- a/configs/socfpga_sockit_defconfig
> >>>> +++ b/configs/socfpga_sockit_defconfig
> >>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH_MACRONIX=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
> >>>> index 15f81d1a4b..193af0b0df 100644
> >>>> --- a/configs/socfpga_socrates_defconfig
> >>>> +++ b/configs/socfpga_socrates_defconfig
> >>>> @@ -48,6 +48,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SPI_FLASH_MACRONIX=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>>    CONFIG_DM_ETH=y
> >>>> diff --git a/configs/socfpga_sr1500_defconfig b/configs/socfpga_sr1500_defconfig
> >>>> index 941bf1124a..899dd8396b 100644
> >>>> --- a/configs/socfpga_sr1500_defconfig
> >>>> +++ b/configs/socfpga_sr1500_defconfig
> >>>> @@ -49,6 +49,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SF_DEFAULT_SPEED=100000000
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_PHY_MARVELL=y
> >>>>    CONFIG_DM_ETH=y
> >>>>    CONFIG_PHY_GIGE=y
> >>>> diff --git a/configs/socfpga_vining_fpga_defconfig b/configs/socfpga_vining_fpga_defconfig
> >>>> index 96f806ab5f..f96f536169 100644
> >>>> --- a/configs/socfpga_vining_fpga_defconfig
> >>>> +++ b/configs/socfpga_vining_fpga_defconfig
> >>>> @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH=y
> >>>>    CONFIG_SPI_FLASH_SPANSION=y
> >>>>    CONFIG_SPI_FLASH_STMICRO=y
> >>>>    # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
> >>>> +CONFIG_SPI_FLASH_MTD=y
> >>>>    CONFIG_MTD_UBI_FASTMAP=y
> >>>>    CONFIG_PHY_MICREL=y
> >>>>    CONFIG_PHY_MICREL_KSZ90X1=y
> >>>> diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
> >>>> index f99f6cb16e..fb67ba32c6 100644
> >>>> --- a/drivers/mtd/spi/Makefile
> >>>> +++ b/drivers/mtd/spi/Makefile
> >>>> @@ -19,5 +19,5 @@ endif
> >>>>
> >>>>    obj-$(CONFIG_SPI_FLASH) += spi-nor.o
> >>>>    obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o
> >>>> -obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
> >>>> +obj-$(CONFIG_$(SPL_)SPI_FLASH_MTD) += sf_mtd.o
> >>>>    obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
> >>>> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
> >>>> index a6bf734830..8542b03685 100644
> >>>> --- a/drivers/mtd/spi/sf_internal.h
> >>>> +++ b/drivers/mtd/spi/sf_internal.h
> >>>> @@ -94,7 +94,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,
> >>>>    int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
> >>>>
> >>>>
> >>>> -#ifdef CONFIG_SPI_FLASH_MTD
> >>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>>>    int spi_flash_mtd_register(struct spi_flash *flash);
> >>>>    void spi_flash_mtd_unregister(void);
> >>>>    #endif
> >>>> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> >>>> index 73297e1a0a..f051e473ff 100644
> >>>> --- a/drivers/mtd/spi/sf_probe.c
> >>>> +++ b/drivers/mtd/spi/sf_probe.c
> >>>> @@ -44,7 +44,7 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
> >>>>           if (ret)
> >>>>                   goto err_read_id;
> >>>>
> >>>> -#ifdef CONFIG_SPI_FLASH_MTD
> >>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>>>           ret = spi_flash_mtd_register(flash);
> >>>>    #endif
> >>>>
> >>>> @@ -83,7 +83,7 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
> >>>>
> >>>>    void spi_flash_free(struct spi_flash *flash)
> >>>>    {
> >>>> -#ifdef CONFIG_SPI_FLASH_MTD
> >>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>>>           spi_flash_mtd_unregister();
> >>>>    #endif
> >>>>           spi_free_slave(flash->spi);
> >>>> @@ -152,7 +152,7 @@ static int spi_flash_std_probe(struct udevice *dev)
> >>>>
> >>>>    static int spi_flash_std_remove(struct udevice *dev)
> >>>>    {
> >>>> -#ifdef CONFIG_SPI_FLASH_MTD
> >>>> +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD)
> >>>
> >>> These ifdef changes look unrelated wrt actual patch. any comments?
> >>
> >> No, they are not unrelated. This is the actual reason for having this
> >> patch after all. We want to be able to enable/disable the code for
> >> CONFIG_SPI_FLASH_MTD per build target (SPL, U-Boot proper).
> >> These changes need to be done in a single patch together with the
> >> defconfig and Makefile changes to sustain bisectibility.
> >
> > What I'm trying to say here is, #ifdef CONFIG_SPI_FLASH_MTD and #if
> > CONFIG_IS_ENABLED(SPI_FLASH_MTD) is the same
>
> This is not correct. CONFIG_IS_ENABLED(SPI_FLASH_MTD) also handles
> CONFIG_SPL_SPI_FLASH_MTD & CONFIG_TPL_SPI_FLASH_MTD.

Got it Stefan, thanks.

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

end of thread, other threads:[~2019-10-23 19:26 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13 22:43 [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig Schrempf Frieder
2019-09-13 22:43 ` [U-Boot] [PATCH 2/3] stm32mp1: configs: Add CONFIG_SPL_SPI_FLASH_MTD Schrempf Frieder
2019-09-16 12:04   ` Lukasz Majewski
2019-10-16 16:34   ` Jagan Teki
2019-10-17  6:42     ` Schrempf Frieder
2019-10-22 12:53       ` Schrempf Frieder
2019-10-22 18:10         ` Jagan Teki
2019-10-23  6:47           ` Schrempf Frieder
2019-09-13 22:44 ` [U-Boot] [PATCH 3/3] mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD Schrempf Frieder
2019-09-16  7:35   ` Stefan Roese
2019-09-16  7:41     ` Simon Goldschmidt
2019-09-16 12:03   ` Lukasz Majewski
2019-09-17  5:28   ` Heiko Schocher
2019-09-26 14:02   ` Schrempf Frieder
2019-09-26 14:17     ` Jagan Teki
2019-10-22 18:16   ` Jagan Teki
2019-10-23  7:05     ` Schrempf Frieder
2019-10-23  7:09       ` Jagan Teki
2019-10-23  7:25         ` Lukasz Majewski
2019-10-23  7:26         ` Schrempf Frieder
2019-10-23 19:25           ` Jagan Teki
2019-10-23  7:27         ` Stefan Roese
2019-10-23 19:26           ` Jagan Teki
2019-09-16 12:04 ` [U-Boot] [PATCH 1/3] mtd: spi: Add a new option SPL_SPI_FLASH_MTD to Kconfig Lukasz Majewski
2019-10-22 18:05 ` Jagan Teki

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.