You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/include/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>
2 years ago
..
arm_sbcon_i2c.h Clean up header guards that don't match their file name 3 years ago
aspeed_i2c.h hw/i2c/aspeed: Fix old reg slave receive 2 years ago
bitbang_i2c.h hw/i2c/bitbang_i2c: Use in-place rather than malloc'd bitbang_i2c_interface struct 5 years ago
i2c.h hw/i2c: add asynchronous send 2 years ago
i2c_mux_pca954x.h Clean up ill-advised or unusual header guards 3 years ago
imx_i2c.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 4 years ago
microbit_i2c.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 4 years ago
npcm7xx_smbus.h hw/i2c: Implement NPCM7XX SMBus Module FIFO Mode 4 years ago
pm_smbus.h Include exec/memory.h slightly less 5 years ago
pmbus_device.h hw/i2c/pmbus: Add idle state to return 0xff's 2 years ago
ppc4xx_i2c.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 4 years ago
smbus_eeprom.h smbus: Fix spd_data_generate() error API violation 5 years ago
smbus_master.h i2c: Split smbus into parts 6 years ago
smbus_slave.h qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 4 years ago