On 31/3/22 18:57, Klaus Jensen wrote:
From: Klaus Jensen <k.jen...@samsung.com>

Add slave mode functionality for the Aspeed I2C controller. This is
implemented by creating an Aspeed I2C Slave device that attaches to the
bus.

This i2c slave device only implements the asynchronous version of
i2c_send() and the event callback.

Signed-off-by: Klaus Jensen <k.jen...@samsung.com>
---
  hw/i2c/aspeed_i2c.c         | 95 +++++++++++++++++++++++++++++++++----
  hw/i2c/trace-events         |  2 +-
  hw/misc/meson.build         |  2 +
  include/hw/i2c/aspeed_i2c.h |  8 ++++
  4 files changed, 97 insertions(+), 10 deletions(-)

@@ -558,14 +565,19 @@ static void aspeed_i2c_bus_write(void *opaque, hwaddr 
offset,
              bus->controller->intr_status &= ~(1 << bus->id);
              qemu_irq_lower(aic->bus_get_irq(bus));
          }
-        if (handle_rx && (bus->cmd & (I2CD_M_RX_CMD | I2CD_M_S_RX_CMD_LAST))) {
-            aspeed_i2c_handle_rx_cmd(bus);
-            aspeed_i2c_bus_raise_interrupt(bus);
+
+        if (handle_rx) {
+            if (bus->cmd & (I2CD_M_RX_CMD | I2CD_M_S_RX_CMD_LAST)) {
+                aspeed_i2c_handle_rx_cmd(bus);
+                aspeed_i2c_bus_raise_interrupt(bus);

Eventually split this hunk into a separate patch to have better readability.

+            }
          }

diff --git a/hw/misc/meson.build b/hw/misc/meson.build
index 6fb69612e064..c1c1abea41dd 100644
--- a/hw/misc/meson.build
+++ b/hw/misc/meson.build
@@ -122,6 +122,8 @@ softmmu_ss.add(when: 'CONFIG_NRF51_SOC', if_true: 
files('nrf51_rng.c'))
softmmu_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_ahb_apb_pnp.c')) +softmmu_ss.add(when: 'CONFIG_I2C', if_true: files('i2c-echo.c'))

This change belongs to the next patch.

Reply via email to