From 57944114bd8f273f1974908db30d3d542b3fd023 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 10 Dec 2020 20:13:25 -0700 Subject: zephyr: Update the I2C table Something has happened since this code was written and now it doesn't work. The current code checks the status of each of the named-i2c-ports nodes, which always seems to return 0, then ends up searching for a device called "". Obviously this code did work and should work, but I'm uploading this just because it makes the battery command work for me: On the other hand, I don't think we need to check the status. After all, we are searching for a device by its node label and if the node is disabled it will not have a device anyway. BUG=b:175248556 BRANCH=none TEST=verify with debugging that the i2c_devices[] array is now inited correctly Signed-off-by: Simon Glass Change-Id: I709421be86027e0e6166a7658fe59ba68783cbe7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586614 Reviewed-by: Yuval Peress Signed-off-by: Abe Levkoy Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590845 --- zephyr/shim/src/i2c.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/zephyr/shim/src/i2c.c b/zephyr/shim/src/i2c.c index 1b58459af9..ddd73e27f1 100644 --- a/zephyr/shim/src/i2c.c +++ b/zephyr/shim/src/i2c.c @@ -8,18 +8,13 @@ #include "i2c.h" #include "i2c/i2c.h" -/* Shorthand for getting the device binding for a given devicetree label. */ -#define BINDING_FOR(label) \ - device_get_binding( \ - COND_CODE_1(DT_NODE_HAS_STATUS(DT_NODELABEL(label), okay), \ - (DT_LABEL(DT_NODELABEL(label))), (""))) - /* * Initialize device bindings in i2c_devices. * This macro should be called from within DT_FOREACH_CHILD. */ #define INIT_DEV_BINDING(id) \ - i2c_devices[I2C_PORT(id)] = BINDING_FOR(id); + i2c_devices[I2C_PORT(id)] = device_get_binding( \ + DT_PROP_BY_PHANDLE(id, i2c_port, label)); /* * Long term we will not need these, for now they're needed to get things to -- cgit v1.2.1