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>
This commit is contained in:
Simon Glass 2020-12-10 20:13:25 -07:00 committed by Commit Bot
parent ac4f512e60
commit e9be6c5c1b
1 changed files with 2 additions and 7 deletions

View File

@ -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