Message ID | 20190813134731.25024-5-lukma@denx.de |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
Series | spi: Split CONFIG_DM_SPI* to CONFIG_{SPL_TPL}DM_SPI* | expand |
On Tue, Aug 13, 2019 at 03:47:31PM +0200, Lukasz Majewski wrote: > This change allows more fine tuning of driver model based SPI support in > SPL and TPL. It is now possible to explicitly enable/disable the DM_SPI > support in SPL and TPL via Kconfig option. > > Before this change it was necessary to use: > /* SPI Flash Configs */ > #if defined(CONFIG_SPL_BUILD) > #undef CONFIG_DM_SPI > #undef CONFIG_DM_SPI_FLASH > #undef CONFIG_SPI_FLASH_MTD > #endif > > in the ./include/configs/<board>.h, which is error prone and shall be > avoided when we strive to switch to Kconfig. > > The goal of this patch: > > Provide distinction for DM_SPI support in both U-Boot proper and SPL (TPL). > Valid use case is when U-Boot proper wants to use DM_SPI, but SPL must > still support non DM driver. > > Another use case is the conversion of non DM/DTS SPI driver to support > DM/DTS. When such driver needs to work in both SPL and U-Boot proper, the > distinction is needed in Kconfig (also if SPL version of the driver > supports OF_PLATDATA). > > In the end of the day one would have to support following use cases (in > single driver file - e.g. mxs_spi.c): > > - U-Boot proper driver supporting DT/DTS > - U-Boot proper driver without DT/DTS support (deprecated) > - SPL driver without DT/DTS support > - SPL (and TPL) driver with DT/DTS (when the SoC has enough resources to > run full blown DT/DTS) > - SPL driver with DT/DTS and SPL_OF_PLATDATA (when one have constrained > environment with no fitImage and OF_LIBFDT support). > > Some boards do require SPI support (with DM) in SPL (TPL) and some only > have DM_SPI{_FLASH} defined to allow compiling SPL. > > This patch converts #ifdef CONFIG_DM_SPI* to #if CONFIG_IS_ENABLED(DM_SPI) > and provides corresponding defines in Kconfig. > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > Tested-by: Adam Ford <aford173@gmail.com> #da850-evm Sorry I didn't bisect down to which part of the series is doing this, but I see problems with: ls1046ardb_sdcard ls1046ardb_qspi_spl ls1043ardb_nand ls1046aqds_tfa ls1046aq ds_nand ls1046ardb_qspi ls1046aqds_sdcard_ifc ls1046aqds_SECURE_BOOT ls1046aqds_sdcard_qspi ls1 046aqds_qspi ls1043ardb_sdcard ls1043aqds_sdcard_ifc ls1046ardb_tfa ls1046ardb_tfa_SECURE_BOOT ls1043aqds_nand ls1046aqds_lpuart ls1046ardb_emmc ls1046aqds_tfa_SECURE_BOOT ls1046afrwy_tfa ls 1046aqds ls1043ardb_nand_SECURE_BOOT ls1046ardb_qspi_SECURE_BOOT ls1043aqds_sdcard_qspi Some of which are dependency problems about SPL/SPL_DM. I also see: aarch64: (for 225/225 boards) all -294.2 bss -0.0 data -11.7 rodata -72.5 spl/u-boot-spl:all -0.3 spl/u-boot-spl:text -0.3 text -210.0 [snip] ls1043ardb_nand: all -9435 data -376 rodata -2331 text -6728 ls1043ardb_sdcard: all -9435 data -376 rodata -2331 text -6728 ls1043aqds_sdcard_ifc: all -9435 data -376 rodata -2331 text -6728 ls1043aqds_nand: all -9435 data -376 rodata -2331 text -6728 ls1043ardb_nand_SECURE_BOOT: all -9435 data -376 rodata -2331 text -6728 ls1043ardb_sdcard_SECURE_BOOT: all -9435 data -376 rodata -2331 text -6728 ls1043aqds_sdcard_qspi: all -9436 bss -8 data -376 rodata -2324 text -6728 which I think means a few conversions weren't right.
Hi Tom, > On Tue, Aug 13, 2019 at 03:47:31PM +0200, Lukasz Majewski wrote: > > This change allows more fine tuning of driver model based SPI > > support in SPL and TPL. It is now possible to explicitly > > enable/disable the DM_SPI support in SPL and TPL via Kconfig option. > > > > Before this change it was necessary to use: > > /* SPI Flash Configs */ > > #if defined(CONFIG_SPL_BUILD) > > #undef CONFIG_DM_SPI > > #undef CONFIG_DM_SPI_FLASH > > #undef CONFIG_SPI_FLASH_MTD > > #endif > > > > in the ./include/configs/<board>.h, which is error prone and shall > > be avoided when we strive to switch to Kconfig. > > > > The goal of this patch: > > > > Provide distinction for DM_SPI support in both U-Boot proper and > > SPL (TPL). Valid use case is when U-Boot proper wants to use > > DM_SPI, but SPL must still support non DM driver. > > > > Another use case is the conversion of non DM/DTS SPI driver to > > support DM/DTS. When such driver needs to work in both SPL and > > U-Boot proper, the distinction is needed in Kconfig (also if SPL > > version of the driver supports OF_PLATDATA). > > > > In the end of the day one would have to support following use cases > > (in single driver file - e.g. mxs_spi.c): > > > > - U-Boot proper driver supporting DT/DTS > > - U-Boot proper driver without DT/DTS support (deprecated) > > - SPL driver without DT/DTS support > > - SPL (and TPL) driver with DT/DTS (when the SoC has enough > > resources to run full blown DT/DTS) > > - SPL driver with DT/DTS and SPL_OF_PLATDATA (when one have > > constrained environment with no fitImage and OF_LIBFDT support). > > > > Some boards do require SPI support (with DM) in SPL (TPL) and some > > only have DM_SPI{_FLASH} defined to allow compiling SPL. > > > > This patch converts #ifdef CONFIG_DM_SPI* to #if > > CONFIG_IS_ENABLED(DM_SPI) and provides corresponding defines in > > Kconfig. > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > Tested-by: Adam Ford <aford173@gmail.com> #da850-evm > > Sorry I didn't bisect down to which part of the series is doing this, > but I see problems with: > ls1046ardb_sdcard ls1046ardb_qspi_spl ls1043ardb_nand ls1046aqds_tfa > ls1046aq ds_nand ls1046ardb_qspi ls1046aqds_sdcard_ifc > ls1046aqds_SECURE_BOOT ls1046aqds_sdcard_qspi ls1 046aqds_qspi > ls1043ardb_sdcard ls1043aqds_sdcard_ifc ls1046ardb_tfa > ls1046ardb_tfa_SECURE_BOOT ls1043aqds_nand ls1046aqds_lpuart > ls1046ardb_emmc ls1046aqds_tfa_SECURE_BOOT ls1046afrwy_tfa ls 1046aqds > ls1043ardb_nand_SECURE_BOOT ls1046ardb_qspi_SECURE_BOOT > ls1043aqds_sdcard_qspi > > Some of which are dependency problems about SPL/SPL_DM. I also see: > aarch64: (for 225/225 boards) all -294.2 bss -0.0 data -11.7 > rodata -72.5 spl/u-boot-spl:all -0.3 spl/u-boot-spl:text -0.3 text > -210.0 [snip] ls1043ardb_nand: all -9435 data -376 rodata -2331 text > -6728 ls1043ardb_sdcard: all -9435 data -376 rodata -2331 text -6728 > ls1043aqds_sdcard_ifc: all -9435 data -376 rodata -2331 > text -6728 ls1043aqds_nand: all -9435 data -376 rodata -2331 text > -6728 ls1043ardb_nand_SECURE_BOOT: all -9435 data -376 rodata -2331 > text -6728 ls1043ardb_sdcard_SECURE_BOOT: all -9435 data -376 rodata > -2331 text -6728 ls1043aqds_sdcard_qspi: all -9436 bss -8 data -376 > rodata -2324 text -6728 > > which I think means a few conversions weren't right. It looks like some parts of the SPL are not build .... Is the delta of size available from travis-CI or from any other script (maybe there is some buildman switch)? > 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@denx.de
On Fri, Aug 23, 2019 at 11:02:27PM +0200, Lukasz Majewski wrote: > Hi Tom, > > > On Tue, Aug 13, 2019 at 03:47:31PM +0200, Lukasz Majewski wrote: > > > This change allows more fine tuning of driver model based SPI > > > support in SPL and TPL. It is now possible to explicitly > > > enable/disable the DM_SPI support in SPL and TPL via Kconfig option. > > > > > > Before this change it was necessary to use: > > > /* SPI Flash Configs */ > > > #if defined(CONFIG_SPL_BUILD) > > > #undef CONFIG_DM_SPI > > > #undef CONFIG_DM_SPI_FLASH > > > #undef CONFIG_SPI_FLASH_MTD > > > #endif > > > > > > in the ./include/configs/<board>.h, which is error prone and shall > > > be avoided when we strive to switch to Kconfig. > > > > > > The goal of this patch: > > > > > > Provide distinction for DM_SPI support in both U-Boot proper and > > > SPL (TPL). Valid use case is when U-Boot proper wants to use > > > DM_SPI, but SPL must still support non DM driver. > > > > > > Another use case is the conversion of non DM/DTS SPI driver to > > > support DM/DTS. When such driver needs to work in both SPL and > > > U-Boot proper, the distinction is needed in Kconfig (also if SPL > > > version of the driver supports OF_PLATDATA). > > > > > > In the end of the day one would have to support following use cases > > > (in single driver file - e.g. mxs_spi.c): > > > > > > - U-Boot proper driver supporting DT/DTS > > > - U-Boot proper driver without DT/DTS support (deprecated) > > > - SPL driver without DT/DTS support > > > - SPL (and TPL) driver with DT/DTS (when the SoC has enough > > > resources to run full blown DT/DTS) > > > - SPL driver with DT/DTS and SPL_OF_PLATDATA (when one have > > > constrained environment with no fitImage and OF_LIBFDT support). > > > > > > Some boards do require SPI support (with DM) in SPL (TPL) and some > > > only have DM_SPI{_FLASH} defined to allow compiling SPL. > > > > > > This patch converts #ifdef CONFIG_DM_SPI* to #if > > > CONFIG_IS_ENABLED(DM_SPI) and provides corresponding defines in > > > Kconfig. > > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > > Tested-by: Adam Ford <aford173@gmail.com> #da850-evm > > > > Sorry I didn't bisect down to which part of the series is doing this, > > but I see problems with: > > ls1046ardb_sdcard ls1046ardb_qspi_spl ls1043ardb_nand ls1046aqds_tfa > > ls1046aq ds_nand ls1046ardb_qspi ls1046aqds_sdcard_ifc > > ls1046aqds_SECURE_BOOT ls1046aqds_sdcard_qspi ls1 046aqds_qspi > > ls1043ardb_sdcard ls1043aqds_sdcard_ifc ls1046ardb_tfa > > ls1046ardb_tfa_SECURE_BOOT ls1043aqds_nand ls1046aqds_lpuart > > ls1046ardb_emmc ls1046aqds_tfa_SECURE_BOOT ls1046afrwy_tfa ls 1046aqds > > ls1043ardb_nand_SECURE_BOOT ls1046ardb_qspi_SECURE_BOOT > > ls1043aqds_sdcard_qspi > > > > Some of which are dependency problems about SPL/SPL_DM. I also see: > > aarch64: (for 225/225 boards) all -294.2 bss -0.0 data -11.7 > > rodata -72.5 spl/u-boot-spl:all -0.3 spl/u-boot-spl:text -0.3 text > > -210.0 [snip] ls1043ardb_nand: all -9435 data -376 rodata -2331 text > > -6728 ls1043ardb_sdcard: all -9435 data -376 rodata -2331 text -6728 > > ls1043aqds_sdcard_ifc: all -9435 data -376 rodata -2331 > > text -6728 ls1043aqds_nand: all -9435 data -376 rodata -2331 text > > -6728 ls1043ardb_nand_SECURE_BOOT: all -9435 data -376 rodata -2331 > > text -6728 ls1043ardb_sdcard_SECURE_BOOT: all -9435 data -376 rodata > > -2331 text -6728 ls1043aqds_sdcard_qspi: all -9436 bss -8 data -376 > > rodata -2324 text -6728 > > > > which I think means a few conversions weren't right. > > It looks like some parts of the SPL are not build .... Yes, there's some dependency problem Kconfig is spotting related to SPL/SPL_DM. > Is the delta of size available from travis-CI or from any other script > (maybe there is some buildman switch)? Yes, it's part of buildman. I do: $ export SOURCE_DATE_EPOCH=`date +%s` $ ./tools/buildman/buildman -o /tmp/test --step 0 -b origin/master.. --force-build -CveE $ ./tools/buildman/buildman -o /tmp/test --step 0 -b origin/master.. -Ssdel to get size changes between point A and point Z in a branch, and omit --step 0 when I need to see which patch in between them caused the size change.
Hi Tom, > On Fri, Aug 23, 2019 at 11:02:27PM +0200, Lukasz Majewski wrote: > > Hi Tom, > > > > > On Tue, Aug 13, 2019 at 03:47:31PM +0200, Lukasz Majewski wrote: > > > > This change allows more fine tuning of driver model based SPI > > > > support in SPL and TPL. It is now possible to explicitly > > > > enable/disable the DM_SPI support in SPL and TPL via Kconfig > > > > option. > > > > > > > > Before this change it was necessary to use: > > > > /* SPI Flash Configs */ > > > > #if defined(CONFIG_SPL_BUILD) > > > > #undef CONFIG_DM_SPI > > > > #undef CONFIG_DM_SPI_FLASH > > > > #undef CONFIG_SPI_FLASH_MTD > > > > #endif > > > > > > > > in the ./include/configs/<board>.h, which is error prone and > > > > shall be avoided when we strive to switch to Kconfig. > > > > > > > > The goal of this patch: > > > > > > > > Provide distinction for DM_SPI support in both U-Boot proper and > > > > SPL (TPL). Valid use case is when U-Boot proper wants to use > > > > DM_SPI, but SPL must still support non DM driver. > > > > > > > > Another use case is the conversion of non DM/DTS SPI driver to > > > > support DM/DTS. When such driver needs to work in both SPL and > > > > U-Boot proper, the distinction is needed in Kconfig (also if SPL > > > > version of the driver supports OF_PLATDATA). > > > > > > > > In the end of the day one would have to support following use > > > > cases (in single driver file - e.g. mxs_spi.c): > > > > > > > > - U-Boot proper driver supporting DT/DTS > > > > - U-Boot proper driver without DT/DTS support (deprecated) > > > > - SPL driver without DT/DTS support > > > > - SPL (and TPL) driver with DT/DTS (when the SoC has enough > > > > resources to run full blown DT/DTS) > > > > - SPL driver with DT/DTS and SPL_OF_PLATDATA (when one have > > > > constrained environment with no fitImage and OF_LIBFDT support). > > > > > > > > Some boards do require SPI support (with DM) in SPL (TPL) and > > > > some only have DM_SPI{_FLASH} defined to allow compiling SPL. > > > > > > > > This patch converts #ifdef CONFIG_DM_SPI* to #if > > > > CONFIG_IS_ENABLED(DM_SPI) and provides corresponding defines in > > > > Kconfig. > > > > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > > > Tested-by: Adam Ford <aford173@gmail.com> #da850-evm > > > > > > Sorry I didn't bisect down to which part of the series is doing > > > this, but I see problems with: > > > ls1046ardb_sdcard ls1046ardb_qspi_spl ls1043ardb_nand > > > ls1046aqds_tfa ls1046aq ds_nand ls1046ardb_qspi > > > ls1046aqds_sdcard_ifc ls1046aqds_SECURE_BOOT > > > ls1046aqds_sdcard_qspi ls1 046aqds_qspi ls1043ardb_sdcard > > > ls1043aqds_sdcard_ifc ls1046ardb_tfa ls1046ardb_tfa_SECURE_BOOT > > > ls1043aqds_nand ls1046aqds_lpuart ls1046ardb_emmc > > > ls1046aqds_tfa_SECURE_BOOT ls1046afrwy_tfa ls 1046aqds > > > ls1043ardb_nand_SECURE_BOOT ls1046ardb_qspi_SECURE_BOOT > > > ls1043aqds_sdcard_qspi > > > > > > Some of which are dependency problems about SPL/SPL_DM. I also > > > see: aarch64: (for 225/225 boards) all -294.2 bss -0.0 data -11.7 > > > rodata -72.5 spl/u-boot-spl:all -0.3 spl/u-boot-spl:text -0.3 text > > > -210.0 [snip] ls1043ardb_nand: all -9435 data -376 rodata -2331 > > > text -6728 ls1043ardb_sdcard: all -9435 data -376 rodata -2331 > > > text -6728 ls1043aqds_sdcard_ifc: all -9435 data -376 rodata -2331 > > > text -6728 ls1043aqds_nand: all -9435 data -376 rodata -2331 text > > > -6728 ls1043ardb_nand_SECURE_BOOT: all -9435 data -376 rodata > > > -2331 text -6728 ls1043ardb_sdcard_SECURE_BOOT: all -9435 data > > > -376 rodata -2331 text -6728 ls1043aqds_sdcard_qspi: all -9436 > > > bss -8 data -376 rodata -2324 text -6728 > > > > > > which I think means a few conversions weren't right. > > > > It looks like some parts of the SPL are not build .... > > Yes, there's some dependency problem Kconfig is spotting related to > SPL/SPL_DM. > > > Is the delta of size available from travis-CI or from any other > > script (maybe there is some buildman switch)? > > Yes, it's part of buildman. I do: > $ export SOURCE_DATE_EPOCH=`date +%s` > $ ./tools/buildman/buildman -o /tmp/test --step 0 -b origin/master.. > --force-build -CveE $ ./tools/buildman/buildman -o /tmp/test --step > 0 -b origin/master.. -Ssdel > > to get size changes between point A and point Z in a branch, and omit > --step 0 when I need to see which patch in between them caused the > size change. > I cannot reproduce your results on current master branch: SHA1:d22c8be964a870f59d2fdab6c67cefa0c4799364 for this series applied. echo $SOURCE_DATE_EPOCH 1567523778 ./tools/buildman/buildman.py -b HEAD --count=3 ls1043 --output-dir=../BUILD/ --force-build -CveE ./tools/buildman/buildman.py -b HEAD --count=3 ls1043 --output-dir=../BUILD/ -Ssdel Just gives me some warnings (without the size difference): aarch64: w+ ls1043aqds_nand ls1043ardb_nand ls1043aqds_sdcard_qspi ls1043aqds_sdcard_ifc ls1043ardb_nand_SECURE_BOOT ls1043ardb_sdcard ls1043ardb_sdcard_SECURE_BOOT +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) ===================== WARNING ====================== +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) This board does not use CONFIG_DM_SPI_FLASH. Please update +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) the board to use CONFIG_SPI_FLASH before the v2019.07 release. +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) Failure to update by the deadline may result in board removal. +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) See doc/driver-model/MIGRATION.txt for more info. +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) ==================================================== +(ls1043ardb_sdcard_SECURE_BOOT) This board does not use CONFIG_DM_MMC. Please update +(ls1043ardb_sdcard_SECURE_BOOT) the board to use CONFIG_DM_MMC before the v2019.04 release. +(ls1043ardb_sdcard_SECURE_BOOT) This board does not use CONFIG_DM_USB. Please update +(ls1043ardb_sdcard_SECURE_BOOT) the board to use CONFIG_DM_USB before the v2019.07 release. Am I doing something wrong? Or am I missing any extra switches for buildman? And I don't know why the ' -b HEAD..HEAD~~~ ' option returns: Range 'HEAD..HEAD~~~' has no commits , as I'm able to use HEAD with -b switch and count=X ? 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@denx.de
On Tue, Sep 03, 2019 at 05:56:36PM +0200, Lukasz Majewski wrote: > Hi Tom, > > > On Fri, Aug 23, 2019 at 11:02:27PM +0200, Lukasz Majewski wrote: > > > Hi Tom, > > > > > > > On Tue, Aug 13, 2019 at 03:47:31PM +0200, Lukasz Majewski wrote: > > > > > This change allows more fine tuning of driver model based SPI > > > > > support in SPL and TPL. It is now possible to explicitly > > > > > enable/disable the DM_SPI support in SPL and TPL via Kconfig > > > > > option. > > > > > > > > > > Before this change it was necessary to use: > > > > > /* SPI Flash Configs */ > > > > > #if defined(CONFIG_SPL_BUILD) > > > > > #undef CONFIG_DM_SPI > > > > > #undef CONFIG_DM_SPI_FLASH > > > > > #undef CONFIG_SPI_FLASH_MTD > > > > > #endif > > > > > > > > > > in the ./include/configs/<board>.h, which is error prone and > > > > > shall be avoided when we strive to switch to Kconfig. > > > > > > > > > > The goal of this patch: > > > > > > > > > > Provide distinction for DM_SPI support in both U-Boot proper and > > > > > SPL (TPL). Valid use case is when U-Boot proper wants to use > > > > > DM_SPI, but SPL must still support non DM driver. > > > > > > > > > > Another use case is the conversion of non DM/DTS SPI driver to > > > > > support DM/DTS. When such driver needs to work in both SPL and > > > > > U-Boot proper, the distinction is needed in Kconfig (also if SPL > > > > > version of the driver supports OF_PLATDATA). > > > > > > > > > > In the end of the day one would have to support following use > > > > > cases (in single driver file - e.g. mxs_spi.c): > > > > > > > > > > - U-Boot proper driver supporting DT/DTS > > > > > - U-Boot proper driver without DT/DTS support (deprecated) > > > > > - SPL driver without DT/DTS support > > > > > - SPL (and TPL) driver with DT/DTS (when the SoC has enough > > > > > resources to run full blown DT/DTS) > > > > > - SPL driver with DT/DTS and SPL_OF_PLATDATA (when one have > > > > > constrained environment with no fitImage and OF_LIBFDT support). > > > > > > > > > > Some boards do require SPI support (with DM) in SPL (TPL) and > > > > > some only have DM_SPI{_FLASH} defined to allow compiling SPL. > > > > > > > > > > This patch converts #ifdef CONFIG_DM_SPI* to #if > > > > > CONFIG_IS_ENABLED(DM_SPI) and provides corresponding defines in > > > > > Kconfig. > > > > > > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > > > > Tested-by: Adam Ford <aford173@gmail.com> #da850-evm > > > > > > > > Sorry I didn't bisect down to which part of the series is doing > > > > this, but I see problems with: > > > > ls1046ardb_sdcard ls1046ardb_qspi_spl ls1043ardb_nand > > > > ls1046aqds_tfa ls1046aq ds_nand ls1046ardb_qspi > > > > ls1046aqds_sdcard_ifc ls1046aqds_SECURE_BOOT > > > > ls1046aqds_sdcard_qspi ls1 046aqds_qspi ls1043ardb_sdcard > > > > ls1043aqds_sdcard_ifc ls1046ardb_tfa ls1046ardb_tfa_SECURE_BOOT > > > > ls1043aqds_nand ls1046aqds_lpuart ls1046ardb_emmc > > > > ls1046aqds_tfa_SECURE_BOOT ls1046afrwy_tfa ls 1046aqds > > > > ls1043ardb_nand_SECURE_BOOT ls1046ardb_qspi_SECURE_BOOT > > > > ls1043aqds_sdcard_qspi > > > > > > > > Some of which are dependency problems about SPL/SPL_DM. I also > > > > see: aarch64: (for 225/225 boards) all -294.2 bss -0.0 data -11.7 > > > > rodata -72.5 spl/u-boot-spl:all -0.3 spl/u-boot-spl:text -0.3 text > > > > -210.0 [snip] ls1043ardb_nand: all -9435 data -376 rodata -2331 > > > > text -6728 ls1043ardb_sdcard: all -9435 data -376 rodata -2331 > > > > text -6728 ls1043aqds_sdcard_ifc: all -9435 data -376 rodata -2331 > > > > text -6728 ls1043aqds_nand: all -9435 data -376 rodata -2331 text > > > > -6728 ls1043ardb_nand_SECURE_BOOT: all -9435 data -376 rodata > > > > -2331 text -6728 ls1043ardb_sdcard_SECURE_BOOT: all -9435 data > > > > -376 rodata -2331 text -6728 ls1043aqds_sdcard_qspi: all -9436 > > > > bss -8 data -376 rodata -2324 text -6728 > > > > > > > > which I think means a few conversions weren't right. > > > > > > It looks like some parts of the SPL are not build .... > > > > Yes, there's some dependency problem Kconfig is spotting related to > > SPL/SPL_DM. > > > > > Is the delta of size available from travis-CI or from any other > > > script (maybe there is some buildman switch)? > > > > Yes, it's part of buildman. I do: > > $ export SOURCE_DATE_EPOCH=`date +%s` > > $ ./tools/buildman/buildman -o /tmp/test --step 0 -b origin/master.. > > --force-build -CveE $ ./tools/buildman/buildman -o /tmp/test --step > > 0 -b origin/master.. -Ssdel > > > > to get size changes between point A and point Z in a branch, and omit > > --step 0 when I need to see which patch in between them caused the > > size change. > > > > I cannot reproduce your results on current master branch: > SHA1:d22c8be964a870f59d2fdab6c67cefa0c4799364 > > for this series applied. > > echo $SOURCE_DATE_EPOCH > 1567523778 > > ./tools/buildman/buildman.py -b HEAD --count=3 ls1043 > --output-dir=../BUILD/ --force-build -CveE > > ./tools/buildman/buildman.py -b HEAD --count=3 ls1043 > --output-dir=../BUILD/ -Ssdel > > > Just gives me some warnings (without the size difference): > > aarch64: w+ ls1043aqds_nand ls1043ardb_nand > ls1043aqds_sdcard_qspi ls1043aqds_sdcard_ifc > ls1043ardb_nand_SECURE_BOOT ls1043ardb_sdcard > ls1043ardb_sdcard_SECURE_BOOT > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > ===================== WARNING ====================== > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > This board does not use CONFIG_DM_SPI_FLASH. Please update > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > the board to use CONFIG_SPI_FLASH before the v2019.07 release. > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > Failure to update by the deadline may result in board removal. > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > See doc/driver-model/MIGRATION.txt for more info. > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > ==================================================== > +(ls1043ardb_sdcard_SECURE_BOOT) This board does not use > CONFIG_DM_MMC. Please update +(ls1043ardb_sdcard_SECURE_BOOT) the > board to use CONFIG_DM_MMC before the v2019.04 release. > +(ls1043ardb_sdcard_SECURE_BOOT) This board does not use > CONFIG_DM_USB. Please update +(ls1043ardb_sdcard_SECURE_BOOT) the > board to use CONFIG_DM_USB before the v2019.07 release. > > > Am I doing something wrong? Or am I missing any extra switches for > buildman? > > > And I don't know why the ' -b HEAD..HEAD~~~ ' option returns: > > Range 'HEAD..HEAD~~~' has no commits , as I'm able to use HEAD with > -b switch and count=X ? You should see output like (grabbing from a currently open log): 01: i2c: mxc: add CONFIG_CLK support aarch64: w+ ls1043aqds_nand ls1043ardb_nand ... 17: Merge tag 'for-v2019.10-v2' of https://gitlab.denx.de/u-boot/custodians/u-boot-i2c ... when it's run right and comparing points A and Z. As far as I can tell, it's really important for the upstream tracking part (as far as git branches goes) to be right, for this to work. So if you for example create a "SPI-conversion" branch off of master, and in turn master tracks origin/master, if you 'git merge SPI-conversion' into master then buildman --step 0 -b master does what I was talking about. Telling git "HEAD..HEAD~~~" is backwards? Play around with 'git log --oneline RANGE' to see what you need to say to get what you want.
Hi Tom, > On Tue, Sep 03, 2019 at 05:56:36PM +0200, Lukasz Majewski wrote: > > Hi Tom, > > > > > On Fri, Aug 23, 2019 at 11:02:27PM +0200, Lukasz Majewski wrote: > > > > Hi Tom, > > > > > > > > > On Tue, Aug 13, 2019 at 03:47:31PM +0200, Lukasz Majewski > > > > > wrote: > > > > > > This change allows more fine tuning of driver model based > > > > > > SPI support in SPL and TPL. It is now possible to explicitly > > > > > > enable/disable the DM_SPI support in SPL and TPL via Kconfig > > > > > > option. > > > > > > > > > > > > Before this change it was necessary to use: > > > > > > /* SPI Flash Configs */ > > > > > > #if defined(CONFIG_SPL_BUILD) > > > > > > #undef CONFIG_DM_SPI > > > > > > #undef CONFIG_DM_SPI_FLASH > > > > > > #undef CONFIG_SPI_FLASH_MTD > > > > > > #endif > > > > > > > > > > > > in the ./include/configs/<board>.h, which is error prone and > > > > > > shall be avoided when we strive to switch to Kconfig. > > > > > > > > > > > > The goal of this patch: > > > > > > > > > > > > Provide distinction for DM_SPI support in both U-Boot > > > > > > proper and SPL (TPL). Valid use case is when U-Boot proper > > > > > > wants to use DM_SPI, but SPL must still support non DM > > > > > > driver. > > > > > > > > > > > > Another use case is the conversion of non DM/DTS SPI driver > > > > > > to support DM/DTS. When such driver needs to work in both > > > > > > SPL and U-Boot proper, the distinction is needed in Kconfig > > > > > > (also if SPL version of the driver supports OF_PLATDATA). > > > > > > > > > > > > In the end of the day one would have to support following > > > > > > use cases (in single driver file - e.g. mxs_spi.c): > > > > > > > > > > > > - U-Boot proper driver supporting DT/DTS > > > > > > - U-Boot proper driver without DT/DTS support (deprecated) > > > > > > - SPL driver without DT/DTS support > > > > > > - SPL (and TPL) driver with DT/DTS (when the SoC has enough > > > > > > resources to run full blown DT/DTS) > > > > > > - SPL driver with DT/DTS and SPL_OF_PLATDATA (when one have > > > > > > constrained environment with no fitImage and OF_LIBFDT > > > > > > support). > > > > > > > > > > > > Some boards do require SPI support (with DM) in SPL (TPL) > > > > > > and some only have DM_SPI{_FLASH} defined to allow > > > > > > compiling SPL. > > > > > > > > > > > > This patch converts #ifdef CONFIG_DM_SPI* to #if > > > > > > CONFIG_IS_ENABLED(DM_SPI) and provides corresponding > > > > > > defines in Kconfig. > > > > > > > > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de> > > > > > > Tested-by: Adam Ford <aford173@gmail.com> #da850-evm > > > > > > > > > > Sorry I didn't bisect down to which part of the series is > > > > > doing this, but I see problems with: > > > > > ls1046ardb_sdcard ls1046ardb_qspi_spl ls1043ardb_nand > > > > > ls1046aqds_tfa ls1046aq ds_nand ls1046ardb_qspi > > > > > ls1046aqds_sdcard_ifc ls1046aqds_SECURE_BOOT > > > > > ls1046aqds_sdcard_qspi ls1 046aqds_qspi ls1043ardb_sdcard > > > > > ls1043aqds_sdcard_ifc ls1046ardb_tfa > > > > > ls1046ardb_tfa_SECURE_BOOT ls1043aqds_nand ls1046aqds_lpuart > > > > > ls1046ardb_emmc ls1046aqds_tfa_SECURE_BOOT ls1046afrwy_tfa ls > > > > > 1046aqds ls1043ardb_nand_SECURE_BOOT > > > > > ls1046ardb_qspi_SECURE_BOOT ls1043aqds_sdcard_qspi > > > > > > > > > > Some of which are dependency problems about SPL/SPL_DM. I > > > > > also see: aarch64: (for 225/225 boards) all -294.2 bss -0.0 > > > > > data -11.7 rodata -72.5 spl/u-boot-spl:all -0.3 > > > > > spl/u-boot-spl:text -0.3 text -210.0 [snip] ls1043ardb_nand: > > > > > all -9435 data -376 rodata -2331 text -6728 > > > > > ls1043ardb_sdcard: all -9435 data -376 rodata -2331 text > > > > > -6728 ls1043aqds_sdcard_ifc: all -9435 data -376 rodata -2331 > > > > > text -6728 ls1043aqds_nand: all -9435 data -376 rodata -2331 > > > > > text -6728 ls1043ardb_nand_SECURE_BOOT: all -9435 data -376 > > > > > rodata -2331 text -6728 ls1043ardb_sdcard_SECURE_BOOT: all > > > > > -9435 data -376 rodata -2331 text -6728 > > > > > ls1043aqds_sdcard_qspi: all -9436 bss -8 data -376 rodata > > > > > -2324 text -6728 > > > > > > > > > > which I think means a few conversions weren't right. > > > > > > > > It looks like some parts of the SPL are not build .... > > > > > > Yes, there's some dependency problem Kconfig is spotting related > > > to SPL/SPL_DM. > > > > > > > Is the delta of size available from travis-CI or from any other > > > > script (maybe there is some buildman switch)? > > > > > > Yes, it's part of buildman. I do: > > > $ export SOURCE_DATE_EPOCH=`date +%s` > > > $ ./tools/buildman/buildman -o /tmp/test --step 0 -b > > > origin/master.. --force-build -CveE $ ./tools/buildman/buildman > > > -o /tmp/test --step 0 -b origin/master.. -Ssdel > > > > > > to get size changes between point A and point Z in a branch, and > > > omit --step 0 when I need to see which patch in between them > > > caused the size change. > > > > > > > I cannot reproduce your results on current master branch: > > SHA1:d22c8be964a870f59d2fdab6c67cefa0c4799364 > > > > for this series applied. > > > > echo $SOURCE_DATE_EPOCH > > 1567523778 > > > > ./tools/buildman/buildman.py -b HEAD --count=3 ls1043 > > --output-dir=../BUILD/ --force-build -CveE > > > > ./tools/buildman/buildman.py -b HEAD --count=3 ls1043 > > --output-dir=../BUILD/ -Ssdel > > > > > > Just gives me some warnings (without the size difference): > > > > aarch64: w+ ls1043aqds_nand ls1043ardb_nand > > ls1043aqds_sdcard_qspi ls1043aqds_sdcard_ifc > > ls1043ardb_nand_SECURE_BOOT ls1043ardb_sdcard > > ls1043ardb_sdcard_SECURE_BOOT > > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > > ===================== WARNING ====================== > > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > > This board does not use CONFIG_DM_SPI_FLASH. Please update > > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > > the board to use CONFIG_SPI_FLASH before the v2019.07 release. > > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > > Failure to update by the deadline may result in board removal. > > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > > See doc/driver-model/MIGRATION.txt for more info. > > +(ls1043aqds_nand,ls1043ardb_nand,ls1043ardb_nand_SECURE_BOOT,ls1043aqds_sdcard_ifc,ls1043aqds_sdcard_qspi,ls1043ardb_sdcard,ls1043ardb_sdcard_SECURE_BOOT) > > ==================================================== > > +(ls1043ardb_sdcard_SECURE_BOOT) This board does not use > > CONFIG_DM_MMC. Please update +(ls1043ardb_sdcard_SECURE_BOOT) the > > board to use CONFIG_DM_MMC before the v2019.04 release. > > +(ls1043ardb_sdcard_SECURE_BOOT) This board does not use > > CONFIG_DM_USB. Please update +(ls1043ardb_sdcard_SECURE_BOOT) the > > board to use CONFIG_DM_USB before the v2019.07 release. > > > > > > Am I doing something wrong? Or am I missing any extra switches for > > buildman? > > > > > > And I don't know why the ' -b HEAD..HEAD~~~ ' option returns: > > > > Range 'HEAD..HEAD~~~' has no commits , as I'm able to use HEAD > > with -b switch and count=X ? > > You should see output like (grabbing from a currently open log): > 01: i2c: mxc: add CONFIG_CLK support > aarch64: w+ ls1043aqds_nand ls1043ardb_nand > ... > 17: Merge tag 'for-v2019.10-v2' of > https://gitlab.denx.de/u-boot/custodians/u-boot-i2c ... > > when it's run right and comparing points A and Z. As far as I can > tell, it's really important for the upstream tracking part (as far as > git branches goes) to be right, for this to work. So if you for > example create a "SPI-conversion" branch off of master, and in turn > master tracks origin/master, if you 'git merge SPI-conversion' into > master then buildman --step 0 -b master does what I was talking > about. Telling git "HEAD..HEAD~~~" is backwards? Play around with > 'git log --oneline RANGE' to see what you need to say to get what you > want. > Just for the record: rm -rf ../BUILD ./tools/buildman/buildman.py -b HEAD --count=4 ls1043 --output-dir=../BUILD/ --force-build -CveE ./tools/buildman/buildman.py -b HEAD --count=4 ls1043 --output-dir=../BUILD/ -Ssdel And I can reproduce the errors. (Fix is under testing now). Thanks Tom for help with setting up the test setup. 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@denx.de
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f10ca6851129..e821cb42d8bd 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -503,6 +503,8 @@ config ARCH_MVEBU select DM_SERIAL select DM_SPI select DM_SPI_FLASH + select SPL_DM_SPI if SPL + select SPL_DM_SPI_FLASH if SPL select OF_CONTROL select OF_SEPARATE select SPI @@ -911,6 +913,8 @@ config ARCH_SOCFPGA imply FAT_WRITE imply SPL imply SPL_DM + imply SPL_DM_SPI + imply SPL_DM_SPI_FLASH imply SPL_LIBDISK_SUPPORT imply SPL_MMC_SUPPORT imply SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION @@ -999,6 +1003,8 @@ config ARCH_ZYNQ select SPL_BOARD_INIT if SPL select SPL_CLK if SPL select SPL_DM if SPL + select SPL_DM_SPI if SPL + select SPL_DM_SPI_FLASH if SPL select SPL_OF_CONTROL if SPL select SPL_SEPARATE_BSS if SPL select SUPPORT_SPL @@ -1035,6 +1041,8 @@ config ARCH_ZYNQMP select OF_CONTROL select SPL_BOARD_INIT if SPL select SPL_CLK if SPL + select SPL_DM_SPI if SPI + select SPL_DM_SPI_FLASH if SPL_DM_SPI select SPL_SEPARATE_BSS if SPL select SUPPORT_SPL imply BOARD_LATE_INIT @@ -1429,6 +1437,7 @@ config TARGET_LS1046AQDS select BOARD_EARLY_INIT_F select BOARD_LATE_INIT select DM_SPI_FLASH if DM_SPI + select SPL_DM_SPI select SUPPORT_SPL select FSL_DDR_BIST if !SPL select FSL_DDR_INTERACTIVE if !SPL @@ -1449,6 +1458,7 @@ config TARGET_LS1046ARDB select BOARD_EARLY_INIT_F select BOARD_LATE_INIT select DM_SPI_FLASH if DM_SPI + select SPL_DM_SPI select POWER_MC34VR500 select SUPPORT_SPL select FSL_DDR_BIST @@ -1469,6 +1479,7 @@ config TARGET_LS1046AFRWY select BOARD_EARLY_INIT_F select BOARD_LATE_INIT select DM_SPI_FLASH if DM_SPI + select SPL_DM_SPI imply SCSI help Support for Freescale LS1046AFRWY platform. @@ -1580,6 +1591,8 @@ config ARCH_ROCKCHIP select OF_CONTROL select SPI select SPL_DM if SPL + select SPL_DM_SPI if SPL + select SPL_DM_SPI_FLASH if SPL select SPL_SYS_MALLOC_SIMPLE if SPL select SYS_MALLOC_F select SYS_THUMB_BUILD if !ARM64 diff --git a/board/l+g/vinco/vinco.c b/board/l+g/vinco/vinco.c index 029ab1239182..d7cb1bda5e03 100644 --- a/board/l+g/vinco/vinco.c +++ b/board/l+g/vinco/vinco.c @@ -33,7 +33,7 @@ DECLARE_GLOBAL_DATA_PTR; /* FIXME gpio code here need to handle through DM_GPIO */ -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return bus == 0 && cs == 0; @@ -166,7 +166,7 @@ int board_init(void) /* adress of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) vinco_spi0_hw_init(); #endif diff --git a/cmd/sf.c b/cmd/sf.c index 6ccf98ae5128..5487a05c3fca 100644 --- a/cmd/sf.c +++ b/cmd/sf.c @@ -85,7 +85,7 @@ static int do_spi_flash_probe(int argc, char * const argv[]) unsigned int speed = CONFIG_SF_DEFAULT_SPEED; unsigned int mode = CONFIG_SF_DEFAULT_MODE; char *endp; -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) struct udevice *new, *bus_dev; int ret; #else @@ -118,7 +118,7 @@ static int do_spi_flash_probe(int argc, char * const argv[]) return -1; } -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) /* Remove the old device, otherwise probe will just be a nop */ ret = spi_find_bus_and_cs(bus, cs, &bus_dev, &new); if (!ret) { diff --git a/cmd/spi.c b/cmd/spi.c index 75226fd36884..f163cec23b35 100644 --- a/cmd/spi.c +++ b/cmd/spi.c @@ -37,7 +37,7 @@ static int do_spi_xfer(int bus, int cs) struct spi_slave *slave; int ret = 0; -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) char name[30], *str; struct udevice *dev; @@ -62,7 +62,7 @@ static int do_spi_xfer(int bus, int cs) goto done; ret = spi_xfer(slave, bitlen, dout, din, SPI_XFER_BEGIN | SPI_XFER_END); -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) /* We don't get an error code in this case */ if (ret) ret = -EIO; @@ -78,7 +78,7 @@ static int do_spi_xfer(int bus, int cs) } done: spi_release_bus(slave); -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) spi_free_slave(slave); #endif diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 54154b93c949..44c5ab61ecc6 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -649,6 +649,19 @@ config SPL_UBI Enable support for loading payloads from UBI. See README.ubispl for more info. +if SPL_DM +config SPL_DM_SPI + bool "Support SPI DM drivers in SPL" + help + Enable support for SPI DM drivers in SPL. + +config SPL_DM_SPI_FLASH + bool "Support SPI DM FLASH drivers in SPL" + help + Enable support for SPI DM flash drivers in SPL. + +endif + if SPL_UBI config SPL_UBI_LOAD_BY_VOLNAME bool "Support loading volumes by name" @@ -973,6 +986,11 @@ config SPL_SPI_FLASH_SFDP_SUPPORT SPI NOR flashes using Serial Flash Discoverable Parameters (SFDP) tables as per JESD216 standard in SPL. +config SPL_SPI_FLASH_MTD + bool "Support for SPI flash MTD drivers in SPL" + help + Enable support for SPI flash MTD drivers in SPL. + config SPL_SPI_LOAD bool "Support loading from SPI flash" help @@ -1340,6 +1358,16 @@ config TPL_SPI_SUPPORT Enable support for using SPI in TPL. See SPL_SPI_SUPPORT for details. +config TPL_DM_SPI + bool "Support SPI DM drivers in TPL" + help + Enable support for SPI DM drivers in TPL. + +config TPL_DM_SPI_FLASH + bool "Support SPI DM FLASH drivers in TPL" + help + Enable support for SPI DM flash drivers in TPL. + config TPL_YMODEM_SUPPORT bool "Support loading using Ymodem" depends on TPL_SERIAL_SUPPORT diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig index 96de6f48c9f3..dfabb8f76918 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -64,6 +64,7 @@ CONFIG_DM_MMC=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_OMAP_HS=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 @@ -83,6 +84,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig index d776a0b244f2..87ef14d67dfe 100644 --- a/configs/am57xx_hs_evm_defconfig +++ b/configs/am57xx_hs_evm_defconfig @@ -62,6 +62,7 @@ CONFIG_DM_MMC=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_OMAP_HS=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 @@ -81,6 +82,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/am57xx_hs_evm_usb_defconfig b/configs/am57xx_hs_evm_usb_defconfig index 6419c53296ee..18a319532e45 100644 --- a/configs/am57xx_hs_evm_usb_defconfig +++ b/configs/am57xx_hs_evm_usb_defconfig @@ -68,6 +68,7 @@ CONFIG_DM_MMC=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_OMAP_HS=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 @@ -88,6 +89,7 @@ CONFIG_DM_REGULATOR_PALMAS=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/axm_defconfig b/configs/axm_defconfig index bb27b728df14..03be13b80d08 100644 --- a/configs/axm_defconfig +++ b/configs/axm_defconfig @@ -60,6 +60,8 @@ CONFIG_CLK_AT91=y # CONFIG_MMC is not set CONFIG_NAND=y CONFIG_NAND_ATMEL=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/chromebook_link64_defconfig b/configs/chromebook_link64_defconfig index 4bbd7a67dc14..24042aef6ab1 100644 --- a/configs/chromebook_link64_defconfig +++ b/configs/chromebook_link64_defconfig @@ -27,6 +27,8 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_CPU_SUPPORT=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_PCI=y CONFIG_SPL_PCH_SUPPORT=y diff --git a/configs/chromebook_samus_tpl_defconfig b/configs/chromebook_samus_tpl_defconfig index 973460082d6b..10ff4167c16b 100644 --- a/configs/chromebook_samus_tpl_defconfig +++ b/configs/chromebook_samus_tpl_defconfig @@ -27,11 +27,15 @@ CONFIG_BLOBLIST_ADDR=0xff7c0000 CONFIG_HANDOFF=y CONFIG_SPL_TEXT_BASE=0xffe70000 CONFIG_SPL_SEPARATE_BSS=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_NET_SUPPORT=y CONFIG_SPL_PCI=y CONFIG_SPL_PCH_SUPPORT=y CONFIG_TPL_PCI=y CONFIG_TPL_PCH_SUPPORT=y +CONFIG_TPL_DM_SPI=y +CONFIG_TPL_DM_SPI_FLASH=y CONFIG_HUSH_PARSER=y CONFIG_CMD_CPU=y # CONFIG_CMD_FLASH is not set diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig index 682e3018222e..b2c8c1dbff4d 100644 --- a/configs/dra7xx_evm_defconfig +++ b/configs/dra7xx_evm_defconfig @@ -74,6 +74,7 @@ CONFIG_MMC_OMAP_HS=y CONFIG_NAND=y CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 @@ -95,6 +96,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y diff --git a/configs/dra7xx_hs_evm_defconfig b/configs/dra7xx_hs_evm_defconfig index 7b50d2cbc6b3..b564fde65dd1 100644 --- a/configs/dra7xx_hs_evm_defconfig +++ b/configs/dra7xx_hs_evm_defconfig @@ -77,6 +77,7 @@ CONFIG_MMC_OMAP_HS=y CONFIG_NAND=y CONFIG_SYS_NAND_BUSWIDTH_16BIT=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 @@ -98,6 +99,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y diff --git a/configs/dra7xx_hs_evm_usb_defconfig b/configs/dra7xx_hs_evm_usb_defconfig index 6d6bfbc49371..1248286b8621 100644 --- a/configs/dra7xx_hs_evm_usb_defconfig +++ b/configs/dra7xx_hs_evm_usb_defconfig @@ -77,6 +77,7 @@ CONFIG_MMC_HS200_SUPPORT=y CONFIG_SPL_MMC_HS200_SUPPORT=y CONFIG_MMC_OMAP_HS=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=76800000 @@ -99,6 +100,7 @@ CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TI_QSPI=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 917e33d68306..3793c395562d 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -62,6 +62,7 @@ CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_AM654=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PINCTRL=y @@ -76,6 +77,7 @@ CONFIG_RESET_TI_SCI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_CADENCE_QSPI=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index d44e87cff6dd..b2699c537049 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -67,6 +67,7 @@ CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_AM654=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PINCTRL=y @@ -83,6 +84,7 @@ CONFIG_RESET_TI_SCI=y CONFIG_DM_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_CADENCE_QSPI=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y diff --git a/configs/ls1021aiot_qspi_defconfig b/configs/ls1021aiot_qspi_defconfig index 5dcec24005c2..00a5f13dba90 100644 --- a/configs/ls1021aiot_qspi_defconfig +++ b/configs/ls1021aiot_qspi_defconfig @@ -12,6 +12,7 @@ CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y +CONFIG_CMD_SF=y CONFIG_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="ls1021a-iot-duart" CONFIG_ENV_IS_IN_SPI_FLASH=y @@ -35,6 +36,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/ls1021aiot_sdcard_defconfig b/configs/ls1021aiot_sdcard_defconfig index 93eb83471ce9..3dc879fe7033 100644 --- a/configs/ls1021aiot_sdcard_defconfig +++ b/configs/ls1021aiot_sdcard_defconfig @@ -17,6 +17,7 @@ CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y +CONFIG_CMD_SF=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="ls1021a-iot-duart" @@ -41,6 +42,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/ls1021aqds_qspi_defconfig b/configs/ls1021aqds_qspi_defconfig index db74cc5712ec..bb1d1afcb408 100644 --- a/configs/ls1021aqds_qspi_defconfig +++ b/configs/ls1021aqds_qspi_defconfig @@ -54,6 +54,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/ls1021aqds_sdcard_qspi_defconfig b/configs/ls1021aqds_sdcard_qspi_defconfig index cc71c28259ab..285a7bcaa6ab 100644 --- a/configs/ls1021aqds_sdcard_qspi_defconfig +++ b/configs/ls1021aqds_sdcard_qspi_defconfig @@ -66,6 +66,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPIy=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/ls1021atwr_qspi_defconfig b/configs/ls1021atwr_qspi_defconfig index 911061a37881..89ef771f5d15 100644 --- a/configs/ls1021atwr_qspi_defconfig +++ b/configs/ls1021atwr_qspi_defconfig @@ -53,6 +53,7 @@ CONFIG_DM_SCSI=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPI_DM_SPI=y CONFIG_FSL_DSPI=y CONFIG_FSL_QSPI=y CONFIG_USB=y diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig index 78df9b6dd5e9..24d47ce046e6 100644 --- a/configs/sama5d2_xplained_spiflash_defconfig +++ b/configs/sama5d2_xplained_spiflash_defconfig @@ -63,6 +63,8 @@ CONFIG_I2C_EEPROM=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 diff --git a/configs/sama5d3xek_spiflash_defconfig b/configs/sama5d3xek_spiflash_defconfig index 9bf9e4f54037..9bd00e57f38c 100644 --- a/configs/sama5d3xek_spiflash_defconfig +++ b/configs/sama5d3xek_spiflash_defconfig @@ -6,10 +6,11 @@ CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 -CONFIG_SPL_SERIAL_SUPPORT=y -CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_ENV_SIZE=0x2000 +CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_ENV_OFFSET=0x6000 +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y CONFIG_NR_DRAM_BANKS=1 CONFIG_SPL=y CONFIG_DEBUG_UART_BOARD_INIT=y @@ -26,6 +27,7 @@ CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256K(env_redundant),256k(env),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=6 root=ubi0:rootfs" # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SPL_TEXT_BASE=0x300000 +CONFIG_SPL_DM_SPI=y CONFIG_SPL_SPI_LOAD=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y @@ -46,7 +48,6 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="sama5d36ek" CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_ENV_SECT_SIZE=0x1000 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_DM=y CONFIG_SPL_DM=y diff --git a/configs/sama5d4_xplained_spiflash_defconfig b/configs/sama5d4_xplained_spiflash_defconfig index b12c4766fa8a..3bd8883f8eb7 100644 --- a/configs/sama5d4_xplained_spiflash_defconfig +++ b/configs/sama5d4_xplained_spiflash_defconfig @@ -63,6 +63,7 @@ CONFIG_GENERIC_ATMEL_MCI=y CONFIG_NAND=y CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y @@ -77,6 +78,7 @@ CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y diff --git a/configs/sama5d4ek_spiflash_defconfig b/configs/sama5d4ek_spiflash_defconfig index 1b6c19ff3c6d..341d253c2366 100644 --- a/configs/sama5d4ek_spiflash_defconfig +++ b/configs/sama5d4ek_spiflash_defconfig @@ -60,6 +60,7 @@ CONFIG_GENERIC_ATMEL_MCI=y CONFIG_NAND=y CONFIG_NAND_ATMEL=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=30000000 CONFIG_SPI_FLASH_ATMEL=y @@ -74,6 +75,7 @@ CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_ATMEL_PIT_TIMER=y diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig index 27b8525fa2c1..da19d8c9a0ee 100644 --- a/configs/stm32mp15_basic_defconfig +++ b/configs/stm32mp15_basic_defconfig @@ -79,6 +79,7 @@ CONFIG_MTD=y CONFIG_NAND=y CONFIG_NAND_STM32_FMC2=y CONFIG_DM_SPI_FLASH=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y CONFIG_SPI_FLASH_MACRONIX=y @@ -108,6 +109,7 @@ CONFIG_SERIAL_RX_BUFFER=y CONFIG_STM32_SERIAL=y CONFIG_SPI=y CONFIG_DM_SPI=y +CONFIG_SPL_DM_SPI=y CONFIG_STM32_QSPI=y CONFIG_STM32_SPI=y CONFIG_USB=y diff --git a/configs/taurus_defconfig b/configs/taurus_defconfig index 403c0b67c55f..4d6bfefa0654 100644 --- a/configs/taurus_defconfig +++ b/configs/taurus_defconfig @@ -68,6 +68,8 @@ CONFIG_DFU_NAND=y # CONFIG_MMC is not set CONFIG_NAND=y CONFIG_NAND_ATMEL=y +CONFIG_SPL_DM_SPI=y +CONFIG_SPL_DM_SPI_FLASH=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index f99f6cb16e29..b9566dcbb884 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -3,7 +3,7 @@ # (C) Copyright 2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-$(CONFIG_DM_SPI_FLASH) += sf-uclass.o +obj-$(CONFIG_$(SPL_TPL_)DM_SPI_FLASH) += sf-uclass.o spi-nor-y := sf_probe.o spi-nor-ids.o ifdef CONFIG_SPL_BUILD @@ -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_TPL_)SPI_FLASH_MTD) += sf_mtd.o obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 73297e1a0a51..5bc0c1d7f234 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 @@ -53,7 +53,7 @@ err_read_id: return ret; } -#ifndef CONFIG_DM_SPI_FLASH +#if !CONFIG_IS_ENABLED(DM_SPI_FLASH) struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs, unsigned int max_hz, unsigned int spi_mode) { @@ -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/drivers/net/fm/fm.c b/drivers/net/fm/fm.c index 0a43dfe74e96..915fa171c332 100644 --- a/drivers/net/fm/fm.c +++ b/drivers/net/fm/fm.c @@ -377,7 +377,7 @@ int fm_init_common(int index, struct ccsr_fman *reg) addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH); int ret = 0; -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) struct udevice *new; /* speed and mode will be read from DT */ @@ -464,7 +464,7 @@ int fm_init_common(int index, struct ccsr_fman *reg) void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH); int ret = 0; -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) struct udevice *new; /* speed and mode will be read from DT */ diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index ae4f2958f8a2..93d20672eb51 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -4,7 +4,7 @@ # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # There are many options which enable SPI, so make this library available -ifdef CONFIG_DM_SPI +ifdef CONFIG_$(SPL_TPL_)DM_SPI obj-y += spi-uclass.o obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o obj-$(CONFIG_SOFT_SPI) += soft_spi.o diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index cf4de9ee1aaf..80002e516747 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c @@ -14,7 +14,7 @@ #include <asm/arch/clk.h> #include <asm/arch/hardware.h> -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) #include <asm/arch/at91_spi.h> #endif #ifdef CONFIG_DM_GPIO @@ -23,7 +23,7 @@ #include "atmel_spi.h" -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) static int spi_has_wdrbt(struct atmel_spi_slave *slave) { diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c index 4d2c106440b3..fe15126e74e3 100644 --- a/drivers/spi/davinci_spi.c +++ b/drivers/spi/davinci_spi.c @@ -52,7 +52,7 @@ /* SPIDEF */ #define SPIDEF_CSDEF0_MASK BIT(0) -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) #define SPI0_BUS 0 #define SPI0_BASE CONFIG_SYS_SPI_BASE /* @@ -119,7 +119,7 @@ struct davinci_spi_regs { /* davinci spi slave */ struct davinci_spi_slave { -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) struct spi_slave slave; #endif struct davinci_spi_regs *regs; @@ -343,7 +343,7 @@ out: return 0; } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) static inline struct davinci_spi_slave *to_davinci_spi(struct spi_slave *slave) { diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c index a68a51945e4e..09a60bd05b97 100644 --- a/drivers/spi/fsl_dspi.c +++ b/drivers/spi/fsl_dspi.c @@ -97,7 +97,7 @@ struct fsl_dspi_priv { struct dspi *regs; }; -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) struct fsl_dspi { struct spi_slave slave; struct fsl_dspi_priv priv; @@ -411,7 +411,8 @@ static int fsl_dspi_cfg_speed(struct fsl_dspi_priv *priv, uint speed) return 0; } -#ifndef CONFIG_DM_SPI + +#if !CONFIG_IS_ENABLED(DM_SPI) int spi_cs_is_valid(unsigned int bus, unsigned int cs) { if (((cs >= 0) && (cs < 8)) && ((bus >= 0) && (bus < 8))) diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c index c725625146d2..afb25e6ee96b 100644 --- a/drivers/spi/kirkwood_spi.c +++ b/drivers/spi/kirkwood_spi.c @@ -93,7 +93,7 @@ static int _spi_xfer(struct kwspi_registers *reg, unsigned int bitlen, return 0; } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) static struct kwspi_registers *spireg = (struct kwspi_registers *)MVEBU_SPI_BASE; diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index d94aaf9fdbd2..efcb214fae9d 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -63,7 +63,7 @@ static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave) static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs) { -#if defined(CONFIG_DM_SPI) +#if CONFIG_IS_ENABLED(DM_SPI) struct udevice *dev = mxcs->dev; struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); @@ -81,7 +81,7 @@ static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs) static void mxc_spi_cs_deactivate(struct mxc_spi_slave *mxcs) { -#if defined(CONFIG_DM_SPI) +#if CONFIG_IS_ENABLED(DM_SPI) struct udevice *dev = mxcs->dev; struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); @@ -411,7 +411,7 @@ static int mxc_spi_claim_bus_internal(struct mxc_spi_slave *mxcs, int cs) return 0; } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index ff4c700645c3..9508947c6171 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -108,7 +108,7 @@ struct mcspi { }; struct omap3_spi_priv { -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) struct spi_slave slave; #endif struct mcspi *regs; @@ -454,7 +454,7 @@ static void _omap3_spi_claim_bus(struct omap3_spi_priv *priv) writel(conf, &priv->regs->modulctrl); } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) static inline struct omap3_spi_priv *to_omap3_spi(struct spi_slave *slave) { diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c index 5ae203d8d4f8..37f83b0babbd 100644 --- a/drivers/spi/sh_qspi.c +++ b/drivers/spi/sh_qspi.c @@ -67,7 +67,7 @@ struct sh_qspi_regs { }; struct sh_qspi_slave { -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) struct spi_slave slave; #endif struct sh_qspi_regs *regs; @@ -222,7 +222,7 @@ static int sh_qspi_xfer_common(struct sh_qspi_slave *ss, unsigned int bitlen, return ret; } -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) static inline struct sh_qspi_slave *to_sh_qspi(struct spi_slave *slave) { return container_of(slave, struct sh_qspi_slave, slave); diff --git a/env/sf.c b/env/sf.c index 4f92ae0568ed..3ba06296f940 100644 --- a/env/sf.c +++ b/env/sf.c @@ -39,7 +39,7 @@ static struct spi_flash *env_flash; static int setup_flash_device(void) { -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) struct udevice *new; int ret; diff --git a/include/spi.h b/include/spi.h index 378594163b87..81e07b2da683 100644 --- a/include/spi.h +++ b/include/spi.h @@ -36,7 +36,7 @@ #define SPI_DEFAULT_WORDLEN 8 -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) /* TODO(sjg@chromium.org): Remove this and use max_hz from struct spi_slave */ struct dm_spi_bus { uint max_hz; @@ -95,7 +95,7 @@ struct dm_spi_slave_platdata { * @flags: Indication of SPI flags. */ struct spi_slave { -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) struct udevice *dev; /* struct spi_slave is dev->parentdata */ uint max_hz; uint speed; @@ -261,7 +261,7 @@ void spi_flash_copy_mmap(void *data, void *offset, size_t len); */ int spi_cs_is_valid(unsigned int bus, unsigned int cs); -#ifndef CONFIG_DM_SPI +#if !CONFIG_IS_ENABLED(DM_SPI) /** * Activate a SPI chipselect. * This function is provided by the board code when using a driver @@ -311,7 +311,7 @@ static inline int spi_w8r8(struct spi_slave *slave, unsigned char byte) return ret < 0 ? ret : din[1]; } -#ifdef CONFIG_DM_SPI +#if CONFIG_IS_ENABLED(DM_SPI) /** * struct spi_cs_info - Information about a bus chip select diff --git a/include/spi_flash.h b/include/spi_flash.h index 55b4721813a7..d63465758f00 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -52,7 +52,7 @@ struct dm_spi_flash_ops { /* Access the serial operations for a device */ #define sf_get_ops(dev) ((struct dm_spi_flash_ops *)(dev)->driver->ops) -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) /** * spi_flash_read_dm() - Read data from SPI flash * diff --git a/test/dm/spi.c b/test/dm/spi.c index ffd789cd7fb3..e101a078fd67 100644 --- a/test/dm/spi.c +++ b/test/dm/spi.c @@ -117,7 +117,7 @@ static int dm_test_spi_xfer(struct unit_test_state *uts) * Since we are about to destroy all devices, we must tell sandbox * to forget the emulation device */ -#ifdef CONFIG_DM_SPI_FLASH +#if CONFIG_IS_ENABLED(DM_SPI_FLASH) sandbox_sf_unbind_emul(state_get_current(), busnum, cs); #endif