OSDN Git Service

hw/i2c: add match method for device search
authorPatrick Venture <venture@google.com>
Mon, 12 Apr 2021 19:45:20 +0000 (12:45 -0700)
committerCorey Minyard <cminyard@mvista.com>
Thu, 15 Apr 2021 12:10:06 +0000 (07:10 -0500)
commit513ca82d8982463aca98aa01dcf584e0b4fc0982
tree6653797e4ea6b778f9a10f73926ebc2415a424b4
parentb98ec6896ee88f1dcdd7098af25bcb6ee0fc50f0
hw/i2c: add match method for device search

At the start of an i2c transaction, the i2c bus searches its list of
children to identify which devices correspond to the address (or
broadcast).  Now the I2CSlave device has a method "match" that
encapsulates the lookup behavior. This allows the behavior to be changed
to support devices, such as i2c muxes.

Tested: A BMC firmware was booted to userspace and i2c devices were
detected.

Signed-off-by: Patrick Venture <venture@google.com>
Reviewed-by: Hao Wu <wuhaotsh@google.com>
Message-Id: <20210412194522.664594-3-venture@google.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
hw/i2c/core.c
include/hw/i2c/i2c.h