]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i2c: designware: Enable mode swapping
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Tue, 20 Jan 2026 13:07:27 +0000 (14:07 +0100)
committerAndi Shyti <andi.shyti@kernel.org>
Thu, 22 Jan 2026 13:43:51 +0000 (14:43 +0100)
commitcfbcc20d5c02d6d9e5218ea493fb231b58efe6b3
tree09e433e5932e12803e91cdcb76fbf173a34e8d5f
parent38fa29b01a6a295aedb69d1bbdad70acd7d204c6
i2c: designware: Enable mode swapping

The DesignWare I2C can not be operated as I2C master and
I2C slave simultaneously, but that does not actually mean
master and slave modes can not be supported at the same
time. It just means an explicit mode swap needs to be
executed when the mode is changed. The DesignWare I2C
documentation actually describes a couple of cases where the
mode is excepted to be changed.

The I2C master will now always be supported. Both modes are
now always configured in i2c_dw_configure(), but the slave
mode will continue to be available only when the Kconfig
option I2C_SLAVE is enabled.

The driver will now start in master mode and then swap to
slave mode when a slave device is registered. After a slave
device is registered, the controller is swapped to master
mode when a transfer in master mode is started and then back
to slave mode again after the transfer is completed.

The DesignWare I2C can now be used with protocols such as
MCTP (drivers/net/mctp/mctp-i2c.c) and IPMI
(drivers/char/ipmi/) that require support for both I2C
master and I2C slave. It is now also possible to support the
SMBus Host Notification Protocol as I2C master if needed.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260120130729.1679560-4-heikki.krogerus@linux.intel.com
drivers/i2c/busses/i2c-designware-common.c
drivers/i2c/busses/i2c-designware-core.h
drivers/i2c/busses/i2c-designware-master.c
drivers/i2c/busses/i2c-designware-slave.c