qemu-e2k/hw/i2c
Peter Delevoryas 3648d31fa8 hw/i2c/aspeed: Fix old reg slave receive
I think when Klaus ported his slave mode changes from the original patch
series to the rewritten I2C module, he changed the behavior of the first
byte that is received by the slave device.

What's supposed to happen is that the AspeedI2CBus's slave device's
i2c_event callback should run, and if the event is "send_async", then it
should populate the byte buffer with the 8-bit I2C address that is being
sent to. Since we only support "send_async", the lowest bit should
always be 0 (indicating that the master is requesting to send data).

This is the code Klaus had previously, for reference. [1]

    switch (event) {
    case I2C_START_SEND:
        bus->buf = bus->dev_addr << 1;

        bus->buf &= I2CD_BYTE_BUF_RX_MASK;
        bus->buf <<= I2CD_BYTE_BUF_RX_SHIFT;

        bus->intr_status |= (I2CD_INTR_SLAVE_ADDR_RX_MATCH | I2CD_INTR_RX_DONE);
        aspeed_i2c_set_state(bus, I2CD_STXD);

        break;

[1]: https://lore.kernel.org/qemu-devel/20220331165737.1073520-4-its@irrelevant.dk/

Fixes: a8d48f59cd ("hw/i2c/aspeed: add slave device in old register mode")
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Message-Id: <20220820225712.713209-2-peter@pjd.dev>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2022-10-24 11:20:15 +02:00
..
Kconfig Kconfig: Add I2C_DEVICES device group 2022-02-21 13:30:20 +00:00
aspeed_i2c.c hw/i2c/aspeed: Fix old reg slave receive 2022-10-24 11:20:15 +02:00
bitbang_i2c.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
core.c hw/i2c: add asynchronous send 2022-06-30 09:21:14 +02:00
exynos4210_i2c.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
i2c_mux_pca954x.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
imx_i2c.c hw/i2c: Rename i2c_set_slave_address() -> i2c_slave_set_address() 2021-07-08 14:15:01 -05:00
meson.build hw/i2c: add support for PMBus 2021-07-08 14:15:45 -05:00
microbit_i2c.c microbit_i2c: Fix coredump when dump-vmstate 2020-10-20 16:12:00 +01:00
mpc_i2c.c hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
npcm7xx_smbus.c hw/i2c/npcm7xx_smbus: Simplify npcm7xx_smbus_init() 2021-03-05 15:17:34 +00:00
omap_i2c.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
pm_smbus.c hw/i2c: Introduce i2c_start_recv() and i2c_start_send() 2021-07-08 14:15:01 -05:00
pmbus_device.c hw/i2c/pmbus: Add idle state to return 0xff's 2022-07-14 16:24:38 +02:00
ppc4xx_i2c.c hw/i2c/ppc4xx_i2c: Replace i2c_send_recv() by i2c_recv() & i2c_send() 2021-07-08 14:15:01 -05:00
smbus_eeprom.c i2c/smbus_eeprom: Add feature bit to SPD data 2021-07-29 10:59:49 +10:00
smbus_ich9.c acpi: ich9-smb: add support for AcpiDevAmlIf interface 2022-06-09 19:32:48 -04:00
smbus_master.c hw/i2c: Introduce i2c_start_recv() and i2c_start_send() 2021-07-08 14:15:01 -05:00
smbus_slave.c hw/i2c: add asynchronous send 2022-06-30 09:21:14 +02:00
trace-events hw/i2c: add asynchronous send 2022-06-30 09:21:14 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
versatile_i2c.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00