diff options
author | Simon Glass <sjg@chromium.org> | 2020-12-10 20:13:25 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-11 23:53:19 +0000 |
commit | e9be6c5c1be5649f700e1d839d0cc823a1e5edd7 (patch) | |
tree | 3ed51db6de14e62ab9fe04b52fd6fb26b0991d5e /zephyr | |
parent | ac4f512e60af42efe693e6955c110a7908090e56 (diff) | |
download | chrome-ec-e9be6c5c1be5649f700e1d839d0cc823a1e5edd7.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>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/shim/src/i2c.c | 9 |
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 |