hw/i2c/dw: Add DesignWare I2C controller emulator
v2 cover hw/i2c/dw: Add DesignWare I2C controller emulator
v1: Initial version:
1) Add DesignWare I2C controller according to DesignWare I2C databook v2.01a.
2) Confirmed under v6.18 kernel driver.
3) The slave mode is not implemented, cause this feature is usually not used.
4) The 10 bit slave address is not implemented, cause this feature is usually not used, and not supported by qemu I2C core bus currently.
v2: Refine according to review comments:
1) Define registers by using registerfields.
2) Use SPDX license.
3) Confirmed under v6.18 kernel driver.
------
This patch seems to be a duplicate of Joel & Chris's work:
https://lore.kernel.org/qemu-devel/[email protected]/
It's just a coincidence, :)
But it's okay even if it not been merged, I just want share it and hope it can help others.
Alano Song (1):
hw/i2c/dw: Add DesignWare I2C controller emulator
hw/i2c/Kconfig | 4 + hw/i2c/dw_i2c.c | 515 ++++++++++++++++++++++++++++++++++++++++ hw/i2c/meson.build | 1 + hw/i2c/trace-events | 4 + include/hw/i2c/dw_i2c.h | 131 ++++++++++ 5 files changed, 655 insertions(+) create mode 100644 hw/i2c/dw_i2c.c create mode 100644 include/hw/i2c/dw_i2c.h
Signature · 1 line
2.43.0
PATCH v2 1/1 hw/i2c/dw: Add DesignWare I2C controller emulator
Add DesignWare I2C controller according to DesignWare I2C databook v2.01a.
Confirmed the model with i2c-tools under v6.18 kernel driver.
The slave mode is not implemented, cause this feature is usually not used.
The 10 bit slave address is not implemented, cause this feature is usually not used, and not supported by qemu I2C core bus currently.
--- hw/i2c/Kconfig | 4 + hw/i2c/dw_i2c.c | 515 ++++++++++++++++++++++++++++++++++++++++ hw/i2c/meson.build | 1 + hw/i2c/trace-events | 4 + include/hw/i2c/dw_i2c.h | 131 ++++++++++ 5 files changed, 655 insertions(+) create mode 100644 hw/i2c/dw_i2c.c create mode 100644 include/hw/i2c/dw_i2c.h
hw/i2c/Kconfig +4 -0
@@ -30,6 +30,10 @@ config IMX_I2C bool select I2C +config DW_I2C + bool + select I2C + config MPC_I2C bool select I2C
hw/i2c/dw_i2c.c new file +515 -0
515 lines not on this page · raw message
hw/i2c/meson.build +1 -0
@@ -7,6 +7,7 @@ i2c_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_i2c.c')) i2c_ss.add(when: 'CONFIG_BITBANG_I2C', if_true: files('bitbang_i2c.c')) i2c_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210_i2c.c')) i2c_ss.add(when: 'CONFIG_IMX_I2C', if_true: files('imx_i2c.c')) +i2c_ss.add(when: 'CONFIG_DW_I2C', if_true: files('dw_i2c.c')) i2c_ss.add(when: 'CONFIG_MPC_I2C', if_true: files('mpc_i2c.c')) i2c_ss.add(when: 'CONFIG_ALLWINNER_I2C', if_true: files('allwinner-i2c.c')) i2c_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('microbit_i2c.c'))
hw/i2c/trace-events +4 -0
@@ -61,3 +61,7 @@ pca954x_read_data(uint8_t value) "PCA954X read data: 0x%02x" imx_i2c_read(const char *id, const char *reg, uint64_t ofs, uint64_t value) "%s:[%s (0x%" PRIx64 ")] -> 0x%02" PRIx64 imx_i2c_write(const char *id, const char *reg, uint64_t ofs, uint64_t value) "%s:[%s (0x%" PRIx64 ")] <- 0x%02" PRIx64 + +# dw_i2c.c +dw_i2c_read(const char *id, const char *reg, uint64_t ofs, uint64_t value) "%s:[%s (0x%" PRIx64 ")] -> 0x%02" PRIx64 +dw_i2c_write(const char *id, const char *reg, uint64_t ofs, uint64_t value) "%s:[%s (0x%" PRIx64 ")] <- 0x%02" PRIx64
include/hw/i2c/dw_i2c.h new file +131 -0
131 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 15 lines · On Sat, 24 Jan 2026 at 13:16, <[email protected]> wrote:
v1: Initial version:
1) Add DesignWare I2C controller according to DesignWare I2C databook v2.01a.
2) Confirmed under v6.18 kernel driver.
3) The slave mode is not implemented, cause this feature is usually not used.
4) The 10 bit slave address is not implemented, cause this feature is usually not used, and not supported by qemu I2C core bus currently.
v2: Refine according to review comments:
1) Define registers by using registerfields.
2) Use SPDX license.
3) Confirmed under v6.18 kernel driver.
Quoted 8 lines
------
This patch seems to be a duplicate of Joel & Chris's work:
https://lore.kernel.org/qemu-devel/[email protected]/It's just a coincidence, :)
But it's okay even if it not been merged, I just want share it and hope it can help others.
Please can everybody who is interested in the designware i2c model get together and figure out what they want to do as a forward path for it?
I am not going to review any of these patches until you have collectively determined which is the best base for doing it.
thanks
-- PMM