Commit 832ce20278db00aeeed5576f1296a6d905d31563
Committed by
Jagan Teki
1 parent
73d74b5881
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
mtd: spi: Clean up usage of CONFIG_SPI_FLASH_MTD
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> Acked-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Showing 26 changed files with 23 additions and 37 deletions Side-by-side Diff
- configs/aristainetos2_defconfig
- configs/aristainetos2b_defconfig
- configs/aristainetos_defconfig
- configs/cm_fx6_defconfig
- configs/socfpga_arria5_defconfig
- configs/socfpga_cyclone5_defconfig
- configs/socfpga_dbm_soc1_defconfig
- configs/socfpga_de0_nano_soc_defconfig
- configs/socfpga_de10_nano_defconfig
- configs/socfpga_is1_defconfig
- configs/socfpga_mcvevk_defconfig
- configs/socfpga_sockit_defconfig
- configs/socfpga_socrates_defconfig
- configs/socfpga_sr1500_defconfig
- configs/socfpga_vining_fpga_defconfig
- drivers/mtd/spi/Makefile
- drivers/mtd/spi/sf_internal.h
- drivers/mtd/spi/sf_probe.c
- include/configs/aristainetos-common.h
- include/configs/cm_fx6.h
- include/configs/da850evm.h
- include/configs/dh_imx6.h
- include/configs/display5.h
- include/configs/gw_ventana.h
- include/configs/rcar-gen2-common.h
- include/configs/socfpga_common.h
configs/aristainetos2_defconfig
configs/aristainetos2b_defconfig
configs/aristainetos_defconfig
configs/cm_fx6_defconfig
configs/socfpga_arria5_defconfig
configs/socfpga_cyclone5_defconfig
configs/socfpga_dbm_soc1_defconfig
configs/socfpga_de0_nano_soc_defconfig
configs/socfpga_de10_nano_defconfig
configs/socfpga_is1_defconfig
configs/socfpga_mcvevk_defconfig
configs/socfpga_sockit_defconfig
configs/socfpga_socrates_defconfig
configs/socfpga_sr1500_defconfig
configs/socfpga_vining_fpga_defconfig
drivers/mtd/spi/Makefile
drivers/mtd/spi/sf_internal.h
drivers/mtd/spi/sf_probe.c
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | if (ret) |
45 | 45 | goto err_read_id; |
46 | 46 | |
47 | -#ifdef CONFIG_SPI_FLASH_MTD | |
47 | +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) | |
48 | 48 | ret = spi_flash_mtd_register(flash); |
49 | 49 | #endif |
50 | 50 | |
... | ... | @@ -83,7 +83,7 @@ |
83 | 83 | |
84 | 84 | void spi_flash_free(struct spi_flash *flash) |
85 | 85 | { |
86 | -#ifdef CONFIG_SPI_FLASH_MTD | |
86 | +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) | |
87 | 87 | spi_flash_mtd_unregister(); |
88 | 88 | #endif |
89 | 89 | spi_free_slave(flash->spi); |
... | ... | @@ -152,7 +152,7 @@ |
152 | 152 | |
153 | 153 | static int spi_flash_std_remove(struct udevice *dev) |
154 | 154 | { |
155 | -#ifdef CONFIG_SPI_FLASH_MTD | |
155 | +#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) | |
156 | 156 | spi_flash_mtd_unregister(); |
157 | 157 | #endif |
158 | 158 | return 0; |
include/configs/aristainetos-common.h
include/configs/cm_fx6.h
... | ... | @@ -38,13 +38,6 @@ |
38 | 38 | #define CONFIG_MXC_UART_BASE UART4_BASE |
39 | 39 | #define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200} |
40 | 40 | |
41 | -/* SPI flash */ | |
42 | - | |
43 | -/* MTD support */ | |
44 | -#ifndef CONFIG_SPL_BUILD | |
45 | -#define CONFIG_SPI_FLASH_MTD | |
46 | -#endif | |
47 | - | |
48 | 41 | /* Environment */ |
49 | 42 | #define CONFIG_ENV_SECT_SIZE (64 * 1024) |
50 | 43 | #define CONFIG_ENV_SIZE (8 * 1024) |
include/configs/da850evm.h
... | ... | @@ -190,15 +190,10 @@ |
190 | 190 | #define CONFIG_ENV_SECT_SIZE CONFIG_SYS_FLASH_SECT_SZ |
191 | 191 | #endif |
192 | 192 | |
193 | -#ifdef CONFIG_USE_SPIFLASH | |
194 | -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH | |
193 | +#if defined(CONFIG_USE_SPIFLASH) && defined(CONFIG_ENV_IS_IN_SPI_FLASH) | |
195 | 194 | #define CONFIG_ENV_SIZE (64 << 10) |
196 | 195 | #define CONFIG_ENV_OFFSET (512 << 10) |
197 | 196 | #define CONFIG_ENV_SECT_SIZE (64 << 10) |
198 | -#endif | |
199 | -#ifdef CONFIG_SPL_BUILD | |
200 | -#undef CONFIG_SPI_FLASH_MTD | |
201 | -#endif | |
202 | 197 | #endif |
203 | 198 | |
204 | 199 | /* |
include/configs/dh_imx6.h
include/configs/display5.h
include/configs/gw_ventana.h
... | ... | @@ -47,15 +47,7 @@ |
47 | 47 | #define CONFIG_MXC_UART |
48 | 48 | #define CONFIG_MXC_UART_BASE UART2_BASE |
49 | 49 | |
50 | -#ifdef CONFIG_SPI_FLASH | |
51 | - | |
52 | -/* SPI */ | |
53 | -#ifdef CONFIG_CMD_SF | |
54 | - #define CONFIG_SPI_FLASH_MTD | |
55 | - /* GPIO 3-19 (21248) */ | |
56 | -#endif | |
57 | - | |
58 | -#elif defined(CONFIG_SPL_NAND_SUPPORT) | |
50 | +#if !defined(CONFIG_SPI_FLASH) && defined(CONFIG_SPL_NAND_SUPPORT) | |
59 | 51 | /* Enable NAND support */ |
60 | 52 | #ifdef CONFIG_CMD_NAND |
61 | 53 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
include/configs/rcar-gen2-common.h
... | ... | @@ -46,11 +46,9 @@ |
46 | 46 | #define CONFIG_ENV_SIZE_REDUND (CONFIG_SYS_MONITOR_LEN) |
47 | 47 | |
48 | 48 | /* SF MTD */ |
49 | -#if defined(CONFIG_SPI_FLASH_MTD) && !defined(CONFIG_SPL_BUILD) | |
50 | -#else | |
49 | +#ifdef CONFIG_SPL_BUILD | |
51 | 50 | #undef CONFIG_DM_SPI |
52 | 51 | #undef CONFIG_DM_SPI_FLASH |
53 | -#undef CONFIG_SPI_FLASH_MTD | |
54 | 52 | #endif |
55 | 53 | |
56 | 54 | /* Timer */ |
include/configs/socfpga_common.h
... | ... | @@ -132,10 +132,6 @@ |
132 | 132 | /* |
133 | 133 | * QSPI support |
134 | 134 | */ |
135 | -/* Enable multiple SPI NOR flash manufacturers */ | |
136 | -#ifndef CONFIG_SPL_BUILD | |
137 | -#define CONFIG_SPI_FLASH_MTD | |
138 | -#endif | |
139 | 135 | /* QSPI reference clock */ |
140 | 136 | #ifndef __ASSEMBLY__ |
141 | 137 | unsigned int cm_get_qspi_controller_clk_hz(void); |