CMD_I2C relies on either the Driver Model I2C API or the legacy I2C
API, but its Kconfig currently does not enforce either dependency.

As a result, enabling CMD_I2C without DM_I2C or SYS_I2C_LEGACY can lead
to link errors due to unresolved i2c_* symbols.

Require either DM_I2C or SYS_I2C_LEGACY to prevent unsupported
configurations while preserving support for legacy platforms.

Signed-off-by: Julien Stephan <[email protected]>
---
CMD_I2C relies on either the Driver Model I2C API or the legacy I2C
API, but its Kconfig currently does not enforce either dependency.

In order to not break some legacy I2C board, we need to keep
SYS_I2C_LEGACY in the depends on logic

$ ./tools/qconfig.py -f CMD_I2C ~DM_I2C
15 matches
MPC837XERDB cl-som-imx7 d2net_v2 db-88f6720 db-88f6820-gp inetspace_v2 
ls2080aqds_nand ls2080aqds_qspi ls2080ardb_nand net2big_v2 netspace_lite_v2 
netspace_max_v2 netspace_mini_v2 netspace_v2 work_92105
---
Changes in v2:
- Add SYS_I2C_LEGACY in the depends on logic
- Link to v1: 
https://patch.msgid.link/20260701-cmd-i2-add-dm-i2c-dependency-v1-1-19ebda3a8...@baylibre.com

To: [email protected]
Cc: GSS_MTK_Uboot_upstream <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Jerome Forissier <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: "Kory Maincent (TI.com)" <[email protected]>
Cc: Mikhail Kshevetskiy <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Andrew Goodbody <[email protected]>
---
 cmd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 032e55e8127..8303884084f 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1392,6 +1392,7 @@ config CMD_IOTRACE
 
 config CMD_I2C
        bool "i2c"
+       depends on DM_I2C || SYS_I2C_LEGACY
        help
          I2C support.
 

---
base-commit: 1a3a5c30a253031257b4738e7b1dba635d93b241
change-id: 20260701-cmd-i2-add-dm-i2c-dependency-d8b349b9f0b2

Best regards,
--  
Julien Stephan <[email protected]>

Reply via email to