summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-10 20:13:25 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-14 20:27:05 +0000
commit57944114bd8f273f1974908db30d3d542b3fd023 (patch)
tree3ed51db6de14e62ab9fe04b52fd6fb26b0991d5e
parenta02472eb1ab1aa0b704d22c0846d9d61776f15fd (diff)
downloadchrome-ec-57944114bd8f273f1974908db30d3d542b3fd023.tar.gz
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 <sjg@chromium.org> Change-Id: I709421be86027e0e6166a7658fe59ba68783cbe7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586614 Reviewed-by: Yuval Peress <peress@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590845
-rw-r--r--zephyr/shim/src/i2c.c9
1 files 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