diff options
author | Keith Short <keithshort@chromium.org> | 2022-03-15 13:45:33 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-03-16 00:48:53 +0000 |
commit | c07ccd305631fab82edf31c7dfe47884ae7f2cf0 (patch) | |
tree | 1c9849337d004737c10c32ee2d4a1fbfe4b622d3 | |
parent | 2e34608dccb49c11da3aca8fddaf7247ba3cb54f (diff) | |
download | chrome-ec-c07ccd305631fab82edf31c7dfe47884ae7f2cf0.tar.gz |
zephyr: Fix checks for GPIO flags used in the devicetree
The EC application uses some GPIO flags that are not exposed by Zephyr
upstream to devicetree files. The EC application duplicates these flags
so the default GPIO pin state can be set in a central location.
Verify that all duplicated flags match the expected value.
BUG=b:224821728
BRANCH=none
TEST=zmake testall
TEST=verify Herobrine boots the AP
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I1f307337aafb76e09eced8c85aaf8e7e57672e73
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3526270
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r-- | include/gpio.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/include/gpio.h b/include/gpio.h index 341727ce73..16d0086d5e 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -22,17 +22,35 @@ #ifdef CONFIG_ZEPHYR #include <drivers/gpio.h> +/* + * Some flag definitions are duplicated by our private devicetree binding + * in zephyr/include/dt-bindings/gpio_defines.h. + * + * Validate that these definitions haven't changed. + */ /* Validate that Zephyr's definition are the same for overlapping defines */ -#if GPIO_OPEN_DRAIN != (BIT(1) | BIT(2)) -#error GPIO_OPEN_DRAIN values are not the same! -#elif GPIO_PULL_UP != BIT(4) -#error GPIO_PULL_UP values are not the same! -#elif GPIO_PULL_DOWN != BIT(5) -#error GPIO_PULL_DOWN values are not the same! -#elif GPIO_INPUT != BIT(8) +#if BIT(8) != GPIO_INPUT #error GPIO_INPUT values are not the same! -#elif GPIO_OUTPUT != BIT(9) +#elif BIT(9) != GPIO_OUTPUT #error GPIO_OUTPUT values are not the same! +#elif BIT(10) != GPIO_OUTPUT_INIT_LOW +#error GPIO_OUTPUT_INIT_LOW values are not the same! +#elif BIT(11) != GPIO_OUTPUT_INIT_HIGH +#error GPIO_OUTPUT_INIT_HIGH values are not the same! +#elif BIT(13) != GPIO_INT_DISABLE +#error GPIO_INT_DISABLE values are not the same! +#elif BIT(14) != GPIO_INT_ENABLE +#error GPIO_INT_ENABLE values are not the same! +#elif BIT(15) != GPIO_INT_LEVELS_LOGICAL +#error GPIO_INT_LEVELS_LOGICAL values are not the same! +#elif BIT(16) != GPIO_INT_EDGE +#error GPIO_INT_EDGE values are not the same! +#elif BIT(17) != GPIO_INT_LOW_0 +#error GPIO_INT_LOW_0 values are not the same! +#elif BIT(18) != GPIO_INT_HIGH_1 +#error GPIO_INT_HIGH_1 values are not the same! +#elif BIT(19) != GPIO_INT_DEBOUNCE +#error GPIO_INT_DEBOUNCE values are not the same! #endif /* Otherwise define overlapping GPIO_ flags ourselves */ |