diff options
author | Fabio Baltieri <fabiobaltieri@google.com> | 2021-01-19 13:56:56 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-20 00:52:26 +0000 |
commit | c4cb760a69240672a4e28342eee646b4948b64a6 (patch) | |
tree | 6c71d6115bf9b6c521c7c16b9315d79d368a67ad /zephyr | |
parent | 6980d49dbf1468b98c997f7ed0389078fcc08569 (diff) | |
download | chrome-ec-c4cb760a69240672a4e28342eee646b4948b64a6.tar.gz |
zephyr: gpio: use nodelabel named gpios
Defines a NAMED_GPIO_NODELABEL macro to get a named-gpio enum value from
a named-gpio phandle and use it to redefine the jhl8040r pins from the
i2c node rather than pointing at the named-gpio node directly.
BUG=b:176505554
TEST=build and check generated files
BRANCH=none
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change-Id: I9f92e1ad0b98bc3fc142dd90625aaaa9b79f114e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637645
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/projects/volteer/include/gpio_map.h | 6 | ||||
-rw-r--r-- | zephyr/shim/include/zephyr_gpio_signal.h | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/zephyr/projects/volteer/include/gpio_map.h b/zephyr/projects/volteer/include/gpio_map.h index cda57386a8..d125ccc5fa 100644 --- a/zephyr/projects/volteer/include/gpio_map.h +++ b/zephyr/projects/volteer/include/gpio_map.h @@ -63,11 +63,13 @@ /* USB and USBC Signals */ #define GPIO_EN_PP5000_USBA NAMED_GPIO(en_pp5000_usba) -#define GPIO_USB_C1_RT_RST_ODL NAMED_GPIO(usb_c1_rt_rst_odl_boardid_0) +#define GPIO_USB_C1_RT_RST_ODL \ + NAMED_GPIO_NODELABEL(usb_c1_bb_retimer, reset_gpios) /* Don't have a load switch for retimer */ /* TODO(b/176559881): How to do unimplemented GPIOs? */ -#define GPIO_USB_C1_LS_EN NAMED_GPIO(unused_gpio41) +#define GPIO_USB_C1_LS_EN \ + NAMED_GPIO_NODELABEL(usb_c1_bb_retimer, ls_en_gpios) #define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL diff --git a/zephyr/shim/include/zephyr_gpio_signal.h b/zephyr/shim/include/zephyr_gpio_signal.h index a6a55b59d9..f727b5e680 100644 --- a/zephyr/shim/include/zephyr_gpio_signal.h +++ b/zephyr/shim/include/zephyr_gpio_signal.h @@ -31,6 +31,15 @@ BUILD_ASSERT(GPIO_COUNT < GPIO_LIMIT); */ #define NAMED_GPIO(name) GPIO_SIGNAL(DT_PATH(named_gpios, name)) +/** @brief Obtain a named gpio enum from a label and property + * + * Obtains a valid enum gpio_signal that can be used with platform/ec gpio API + * from the property of a labeled node. The property has to point to a + * named_gpios node. + */ +#define NAMED_GPIO_NODELABEL(label, prop) \ + GPIO_SIGNAL(DT_PHANDLE(DT_NODELABEL(label), prop)) + /* * While we don't support IO expanders at the moment, multiple * platform/ec headers (e.g., espi.h) require some of these constants |