From cef83663e1d7cc296e6e3bfddab410c70c303e54 Mon Sep 17 00:00:00 2001 From: Keith Short Date: Wed, 15 Sep 2021 15:07:24 -0600 Subject: zephyr: add support for I2C debugging Add support for CONFIG_I2C_DEBUG and CONFIG_I2C_DEBUG_PASSTHRU options to zephyr. BUG=none BRANCH=none TEST=zmake testall TEST=Add CONFIG_PLATFORM_EC_I2C_DEBUG=y on herobrine, verify "i2ctrace" command is available and functional. TEST=Add CONFIG_PLATFORM_EC_I2C_DEBUG_PASSTHRU=y on herobrine, verify I2C passthru messages shown during TCPC firmware sync. Signed-off-by: Keith Short Change-Id: Ic2d9977af4fa707dab4fdaff332fbcc34491c5fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163211 Commit-Queue: Jack Rosenthal Reviewed-by: Jack Rosenthal --- common/i2c_controller.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'common/i2c_controller.c') diff --git a/common/i2c_controller.c b/common/i2c_controller.c index 90aed056ae..dfc3417e88 100644 --- a/common/i2c_controller.c +++ b/common/i2c_controller.c @@ -258,8 +258,15 @@ int i2c_xfer_unlocked(const int port, ccprintf("Ignoring flags from i2c addr_flags: %04x", no_pec_af); - return i2c_transfer(i2c_get_device_for_port(port), msg, + ret = i2c_transfer(i2c_get_device_for_port(port), msg, num_msgs, I2C_STRIP_FLAGS(no_pec_af)); + + if (IS_ENABLED(CONFIG_I2C_DEBUG)) { + i2c_trace_notify(port, addr_flags, out, out_size, + in, in_size); + } + + return ret; #elif defined(CONFIG_I2C_XFER_LARGE_TRANSFER) ret = i2c_xfer_no_retry(port, no_pec_af, out, out_size, in, -- cgit v1.2.1