diff options
author | Simon Glass <sjg@chromium.org> | 2020-12-04 11:13:42 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-05 02:48:13 +0000 |
commit | 8483283989e7d6080b1d757cf5309a97efd2950d (patch) | |
tree | 9b268c8f22fe8df8f02800580b64267a6e7ec273 /zephyr/shim/include/i2c | |
parent | b06ad2df42bd9c3c48e06df0645b526a1fc454e7 (diff) | |
download | chrome-ec-8483283989e7d6080b1d757cf5309a97efd2950d.tar.gz |
zephyr: Sort the options a bit
We have quite a few options already and plan to add more. Sort them to
make it easier to see what is there.
The I2C enum isn't really connected with the basic CONFIG munging done
in config_chip.h so move it to i2c.h instead.
Fix the 'keybaord' typo while we are here.
BRANCH=none
BUG=none
TEST=build and boot on volteer
Change-Id: Id03fe44ff859736f1e2f86231ca1e8d9dc4c50af
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575198
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr/shim/include/i2c')
-rw-r--r-- | zephyr/shim/include/i2c/i2c.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/zephyr/shim/include/i2c/i2c.h b/zephyr/shim/include/i2c/i2c.h index 289f8b753e..2ac31c06bf 100644 --- a/zephyr/shim/include/i2c/i2c.h +++ b/zephyr/shim/include/i2c/i2c.h @@ -9,6 +9,23 @@ #include <device.h> #include <devicetree.h> +#ifdef CONFIG_PLATFORM_EC_I2C +/* + * Define the i2c_ports enum for Ztests only right now. In full builds this + * will clash with the definitions in config_chip-npcx7.h. Once we've migrated + * away from platform/ec/chip/... files we can remove this guard. + */ +#if defined(CONFIG_ZTEST) && DT_NODE_EXISTS(DT_PATH(named_i2c_ports)) +#define I2C_PORT(id) DT_CAT(I2C_, id) +#define I2C_PORT_WITH_COMMA(id) I2C_PORT(id), +enum i2c_ports { +DT_FOREACH_CHILD(DT_PATH(named_i2c_ports), I2C_PORT_WITH_COMMA) +I2C_PORT_COUNT +}; +#define NAMED_I2C(name) I2C_PORT(DT_PATH(named_i2c_ports, name)) +#endif /* CONFIG_ZTEST && named_i2c_ports */ +#endif /* CONFIG_PLATFORM_EC_I2C */ + /** * @brief Adaptation of platform/ec's port IDs which map a port/bus to a device. * |