[PATCH v2 0/3] Allow disabling driver model for I2C in SPL

Igor Opaniuk
2021-02-08T23:37:52Z

At present if U-Boot proper uses driver model for I2C, then SPL has to
also. While this is desirable, it places a significant barrier to moving
to driver model in some cases. For example, with a space-constrained SPL
it may be necessary to enable CONFIG_SPL_OF_PLATDATA which involves
adjusting some drivers.

This patch introduces a separate Kconfig symbols for enabling DM_I2C and
DM_I2C_GPIO support in SPL.

This will also help to get away from dirty workarounds to
achieve non-DM I2C support for SPL, which is currently used in some
board header files like:

ifdef CONFIG_SPL_BUILD
undef CONFIG_DM_I2C
endif

All occurences were replaced automatically using these bash cmds:
$ find . -type f -exec sed -i
's/ifndef CONFIG_DM_I2C/if !CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
's/ifdef CONFIG_DM_I2C/if CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
's/defined(CONFIG_DM_I2C)/CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
's/ifndef CONFIG_DM_I2C_GPIO/if !CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +
$ find . -type f -exec sed -i
's/ifdef CONFIG_DM_I2C_GPIO/if CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +
$ find . -type f -exec sed -i
's/defined(CONFIG_DM_I2C_GPIO)/CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +

Azure CI results:
https://dev.azure.com/igoropaniuk/u-boot/_build/results?buildId=5&view=results

Changes in v2:
- Applied R-b tags from Simon and Heiko
- Added additional patches that replace CONFIG_DM_I2C undefs with
CONFIG_SPL_DM_I2C for SPL build case (this should be moved to board
defconfigs by board maintainers)

Igor Opaniuk (3):
dm: i2c: allow disabling driver model in SPL
board: freescale: undef CONFIG_SPL_DM_I2C for SPL
dm: i2c: use CONFIG_IS_ENABLED macro for DM_I2C/DM_I2C_GPIO

.../include/asm/arch-fsl-layerscape/config.h | 2 +-
arch/arm/include/asm/arch-lpc32xx/i2c.h | 2 +-
arch/arm/include/asm/mach-imx/mxc_i2c.h | 2 +-
arch/arm/include/asm/omap_i2c.h | 2 +-
arch/arm/mach-imx/i2c-mxv7.c | 2 +-
arch/arm/mach-keystone/ddr3_spd.c | 2 +-
arch/arm/mach-kirkwood/include/mach/config.h | 2 +-
arch/arm/mach-omap2/am33xx/board.c | 2 +-
arch/arm/mach-omap2/am33xx/clk_synthesizer.c | 6 +-
arch/arm/mach-omap2/boot-common.c | 2 +-
arch/arm/mach-omap2/clocks-common.c | 2 +-
arch/arm/mach-sunxi/board.c | 2 +-
arch/powerpc/include/asm/fsl_i2c.h | 2 +-
board/freescale/common/dcu_sii9022a.c | 2 +-
board/freescale/common/diu_ch7301.c | 2 +-
board/freescale/common/emc2305.c | 4 +-
board/freescale/common/qixis.c | 4 +-
board/freescale/common/sys_eeprom.c | 20 ++--
board/freescale/common/vid.c | 24 ++---
board/freescale/common/vsc3316_3308.c | 10 +-
board/freescale/ls1012aqds/ls1012aqds.c | 2 +-
board/freescale/ls1012ardb/eth.c | 2 +-
board/freescale/ls1012ardb/ls1012ardb.c | 12 +--
board/freescale/ls1021aqds/dcu.c | 6 +-
board/freescale/ls1021aqds/ls1021aqds.c | 2 +-
board/freescale/ls1021atwr/ls1021atwr.c | 2 +-
board/freescale/ls1028a/ls1028a.c | 2 +-
board/freescale/ls1043aqds/ls1043aqds.c | 4 +-
board/freescale/ls1046afrwy/ls1046afrwy.c | 2 +-
board/freescale/ls1046aqds/ls1046aqds.c | 2 +-
board/freescale/ls1088a/eth_ls1088aqds.c | 16 +--
board/freescale/ls1088a/ls1088a.c | 60 ++++++------
board/freescale/ls2080aqds/eth.c | 14 +--
board/freescale/ls2080aqds/ls2080aqds.c | 4 +-
board/freescale/ls2080ardb/ls2080ardb.c | 2 +-
board/freescale/lx2160a/lx2160a.c | 2 +-
board/freescale/p1010rdb/p1010rdb.c | 8 +-
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +-
board/freescale/t102xrdb/t102xrdb.c | 2 +-
board/freescale/t208xqds/t208xqds.c | 2 +-
board/friendlyarm/nanopi2/onewire.c | 6 +-
board/keymile/common/ivm.c | 2 +-
board/samsung/common/misc.c | 2 +-
board/samsung/trats/trats.c | 10 +-
board/samsung/trats2/trats2.c | 10 +-
board/sunxi/board.c | 2 +-
board/ti/am335x/board.c | 8 +-
board/ti/am335x/mux.c | 2 +-
board/ti/am43xx/board.c | 12 +--
board/ti/common/board_detect.c | 4 +-
board/ti/ks2_evm/board_k2g.c | 2 +-
board/wandboard/wandboard.c | 4 +-
cmd/eeprom.c | 6 +-
cmd/i2c.c | 98 +++++++++----------
doc/driver-model/i2c-howto.rst | 2 +-
drivers/ddr/fsl/main.c | 8 +-
drivers/i2c/Kconfig | 21 ++++
drivers/i2c/Makefile | 4 +-
drivers/i2c/davinci_i2c.c | 4 +-
drivers/i2c/designware_i2c.c | 4 +-
drivers/i2c/fsl_i2c.c | 6 +-
drivers/i2c/ihs_i2c.c | 42 ++++----
drivers/i2c/lpc32xx_i2c.c | 4 +-
drivers/i2c/mv_i2c.c | 2 +-
drivers/i2c/mvtwsi.c | 16 +--
drivers/i2c/mxc_i2c.c | 4 +-
drivers/i2c/omap24xx_i2c.c | 2 +-
drivers/misc/Makefile | 2 +-
drivers/power/palmas.c | 2 +-
drivers/power/pmic/pmic_tps62362.c | 6 +-
drivers/power/pmic/pmic_tps65217.c | 14 +--
drivers/power/pmic/pmic_tps65218.c | 4 +-
drivers/power/pmic/pmic_tps65910.c | 6 +-
drivers/power/twl4030.c | 2 +-
drivers/power/twl6030.c | 2 +-
drivers/tpm/tpm_atmel_twi.c | 6 +-
drivers/usb/host/ohci-lpc32xx.c | 8 +-
include/_exports.h | 2 +-
include/config_fallbacks.h | 2 +-
include/configs/MPC8548CDS.h | 2 +-
include/configs/P1010RDB.h | 2 +-
include/configs/P2041RDB.h | 2 +-
include/configs/T102xRDB.h | 2 +-
include/configs/T104xRDB.h | 4 +-
include/configs/T208xQDS.h | 2 +-
include/configs/T208xRDB.h | 2 +-
include/configs/T4240RDB.h | 2 +-
include/configs/am43xx_evm.h | 2 +-
include/configs/corenet_ds.h | 2 +-
include/configs/imx8mp_evk.h | 2 +-
include/configs/ls1012a_common.h | 2 +-
include/configs/ls1021aiot.h | 2 +-
include/configs/ls1021aqds.h | 2 +-
include/configs/ls1021atsn.h | 2 +-
include/configs/ls1021atwr.h | 4 +-
include/configs/ls1028a_common.h | 2 +-
include/configs/ls1043a_common.h | 2 +-
include/configs/ls1046a_common.h | 4 +-
include/configs/ls1088a_common.h | 2 +-
include/configs/ls1088aqds.h | 2 +-
include/configs/ls2080a_common.h | 2 +-
include/configs/ls2080aqds.h | 2 +-
include/configs/ls2080ardb.h | 2 +-
include/configs/p1_p2_rdb_pc.h | 2 +-
include/configs/phycore_imx8mp.h | 2 +-
include/configs/sunxi-common.h | 2 +-
include/configs/ti_armv7_common.h | 2 +-
include/exports.h | 2 +-
include/i2c.h | 2 +-
include/palmas.h | 2 +-
include/twl4030.h | 2 +-
include/twl6030.h | 2 +-
112 files changed, 340 insertions(+), 319 deletions(-)

--
2.25.1