summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@google.com>2023-03-14 21:46:59 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-15 19:46:38 +0000
commitb3eb71c602bb785c0fccd677ae375336dcfa3ecf (patch)
treeec3a7381255e5fa7e02c266a2094052d6409b793
parent579c5e199bdd21c85097d70f9ab5c76c800bce60 (diff)
downloadchrome-ec-b3eb71c602bb785c0fccd677ae375336dcfa3ecf.tar.gz
gpio/i2c: Only use status okay for Zephyr interrupts/named-i2c
Replace calls for DT_FOREACH_CHILD with DT_FOREACH_CHILD_STATUS_OKAY. This makes it possible for variants to disable some interrupts or i2c buses without having to remove the nodes. BRANCH=none BUG=b:272529568,b:273308069 TEST=zmake build rex rex-sans-sensors TEST=zmake compare-builds -a Change-Id: I3bf9034fd3f5e70665598d9e0b503d5e76bc13e4 Signed-off-by: Yuval Peress <peress@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4339256 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/shim/include/i2c/i2c.h4
-rw-r--r--zephyr/shim/src/gpio_int.c6
-rw-r--r--zephyr/shim/src/i2c.c9
3 files changed, 11 insertions, 8 deletions
diff --git a/zephyr/shim/include/i2c/i2c.h b/zephyr/shim/include/i2c/i2c.h
index 31c8a0bd12..160689d2c7 100644
--- a/zephyr/shim/include/i2c/i2c.h
+++ b/zephyr/shim/include/i2c/i2c.h
@@ -173,7 +173,9 @@ BUILD_ASSERT(I2C_PORT_COUNT != 0, "No I2C devices defined");
* I2C_PORT_BATTERY or I2C_PORT_SENSOR) to the unique port numbers created by
* enum i2c_ports_chip above for every I2C port devicetree node.
*/
-enum i2c_ports { DT_FOREACH_CHILD(NAMED_I2C_PORTS_NODE, NAMED_I2C_PORT_COMMA) };
+enum i2c_ports {
+ DT_FOREACH_CHILD_STATUS_OKAY(NAMED_I2C_PORTS_NODE, NAMED_I2C_PORT_COMMA)
+};
/**
* @brief Adaptation of platform/ec's port IDs which map a port/bus to a device.
diff --git a/zephyr/shim/src/gpio_int.c b/zephyr/shim/src/gpio_int.c
index 761e7e7b3c..58b543912c 100644
--- a/zephyr/shim/src/gpio_int.c
+++ b/zephyr/shim/src/gpio_int.c
@@ -52,7 +52,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(cros_ec_gpio_interrupts) == 1,
extern void DT_STRING_TOKEN(id, handler)(enum gpio_signal);
#if DT_HAS_COMPAT_STATUS_OKAY(cros_ec_gpio_interrupts)
-DT_FOREACH_CHILD(DT_IRQ_NODE, INT_HANDLER_DECLARE)
+DT_FOREACH_CHILD_STATUS_OKAY(DT_IRQ_NODE, INT_HANDLER_DECLARE)
#endif
#undef INT_HANDLER_DECLARE
@@ -85,7 +85,7 @@ struct gpio_callback int_cb_data[GPIO_INT_COUNT];
*/
static const struct gpio_int_config gpio_int_data[] = {
- DT_FOREACH_CHILD(DT_IRQ_NODE, INT_CONFIG_FROM_NODE)
+ DT_FOREACH_CHILD_STATUS_OKAY(DT_IRQ_NODE, INT_CONFIG_FROM_NODE)
};
#endif
@@ -107,7 +107,7 @@ static const struct gpio_int_config gpio_int_data[] = {
#if DT_HAS_COMPAT_STATUS_OKAY(cros_ec_gpio_interrupts)
-DT_FOREACH_CHILD(DT_IRQ_NODE, INT_CONFIG_PTR_DECLARE)
+DT_FOREACH_CHILD_STATUS_OKAY(DT_IRQ_NODE, INT_CONFIG_PTR_DECLARE)
#endif
diff --git a/zephyr/shim/src/i2c.c b/zephyr/shim/src/i2c.c
index d893745d64..4a354b9dc9 100644
--- a/zephyr/shim/src/i2c.c
+++ b/zephyr/shim/src/i2c.c
@@ -36,11 +36,12 @@
* Since all the ports will eventually be handled by device tree. This will
* be removed at that point.
*/
-const struct i2c_port_t i2c_ports[] = { DT_FOREACH_CHILD(NAMED_I2C_PORTS_NODE,
- I2C_PORT_INIT) };
+const struct i2c_port_t i2c_ports[] = { DT_FOREACH_CHILD_STATUS_OKAY(
+ NAMED_I2C_PORTS_NODE, I2C_PORT_INIT) };
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-static const int i2c_remote_ports[I2C_PORT_COUNT] = { DT_FOREACH_CHILD(
- NAMED_I2C_PORTS_NODE, INIT_REMOTE_PORTS) };
+static const int i2c_remote_ports[I2C_PORT_COUNT] = {
+ DT_FOREACH_CHILD_STATUS_OKAY(NAMED_I2C_PORTS_NODE, INIT_REMOTE_PORTS)
+};
static const struct device *i2c_devices[I2C_PORT_COUNT] = { I2C_FOREACH_PORT(
INIT_DEV_BINDING) };