summaryrefslogtreecommitdiffstats
path: root/include/hw/i2c
diff options
context:
space:
mode:
authorKlaus Jensen2022-06-30 09:21:14 +0200
committerCédric Le Goater2022-06-30 09:21:14 +0200
commita8d48f59cd021b25359cc48cb8a897de7802f422 (patch)
treee1c48ca91207284a299fe895c5879fe6d8ecf341 /include/hw/i2c
parenthw/i2c: add asynchronous send (diff)
downloadqemu-a8d48f59cd021b25359cc48cb8a897de7802f422.tar.gz
qemu-a8d48f59cd021b25359cc48cb8a897de7802f422.tar.xz
qemu-a8d48f59cd021b25359cc48cb8a897de7802f422.zip
hw/i2c/aspeed: add slave device in old register mode
Add slave mode functionality for the Aspeed I2C controller in old register mode. This is implemented by realizing an I2C slave device owned by the I2C controller and attached to its own bus. The I2C slave device only implements asynchronous sends on the bus, so slaves not supporting that will not be able to communicate with it. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> [ clg: checkpatch fixes ] Message-Id: <20220601210831.67259-6-its@irrelevant.dk> Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20220630045133.32251-7-me@pjd.dev> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'include/hw/i2c')
-rw-r--r--include/hw/i2c/aspeed_i2c.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h
index 1398befc10..ba148b2f6d 100644
--- a/include/hw/i2c/aspeed_i2c.h
+++ b/include/hw/i2c/aspeed_i2c.h
@@ -223,6 +223,9 @@ struct AspeedI2CBus {
struct AspeedI2CState *controller;
+ /* slave mode */
+ I2CSlave *slave;
+
MemoryRegion mr;
I2CBus *bus;
@@ -249,6 +252,11 @@ struct AspeedI2CState {
AddressSpace dram_as;
};
+#define TYPE_ASPEED_I2C_BUS_SLAVE "aspeed.i2c.slave"
+OBJECT_DECLARE_SIMPLE_TYPE(AspeedI2CBusSlave, ASPEED_I2C_BUS_SLAVE)
+struct AspeedI2CBusSlave {
+ I2CSlave i2c;
+};
struct AspeedI2CClass {
SysBusDeviceClass parent_class;