diff options
author | Tomasz Michalec <tm@semihalf.com> | 2022-07-05 16:12:16 +0200 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-13 11:19:02 +0000 |
commit | a062b533a068069af8fdea3ea394e99703d7561a (patch) | |
tree | 91c38ee93ab9ac28a49bb1e381c247d29d82e9d8 /zephyr/shim/src/usb_muxes.c | |
parent | 16165094ab108ff584b4d3b381884427c859edac (diff) | |
download | chrome-ec-a062b533a068069af8fdea3ea394e99703d7561a.tar.gz |
zephyr: Support alternative usb_mux_chain config in DTS
Add support for alternative usb_mux configuration from the devicetree.
Alternate USB mux chain is created by adding "cros-ec,usb-mux-chain"
in DTS with alternative-chain property.
To enable alternate configuration, USB_MUX_ENABLE_ALTERNATE_NODE macro
has to be used at runtime.
BUG=b:234482311
TEST=zmake build -a
TEST=./twister -T zephyr/test
BRANCH=none
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: I0ae8889b225800d8741f01f8ea70c5f4f5547065
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3700330
Reviewed-by: Keith Short <keithshort@chromium.org>
Tested-by: Tomasz Michalec <tmichalec@google.com>
Commit-Queue: Tomasz Michalec <tmichalec@google.com>
Diffstat (limited to 'zephyr/shim/src/usb_muxes.c')
-rw-r--r-- | zephyr/shim/src/usb_muxes.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/zephyr/shim/src/usb_muxes.c b/zephyr/shim/src/usb_muxes.c index e85a095db0..d9f14d0c67 100644 --- a/zephyr/shim/src/usb_muxes.c +++ b/zephyr/shim/src/usb_muxes.c @@ -43,7 +43,15 @@ USB_MUX_FOREACH_MUX(USB_MUX_CHECK_ALL_PORTS_ARE_SAME) /** - * Define usb_mux_chain structures e.g. + * Declare all usb_mux_chain structures e.g. + * MAYBE_CONST struct usb_mux_chain + * USB_MUX_chain_port_<port_id>_mux_<position_id>; + */ +USB_MUX_FOREACH_CHAIN_VARGS(USB_MUX_FOREACH_NO_ROOT_MUX, + USB_MUX_CHAIN_STRUCT_DECLARE_OP) + +/** + * Define usb_mux_chain structures for main chain e.g. * * MAYBE_CONST struct usb_mux_chain * USB_MUX_chain_port_<port_id>_mux_<position_id> = { @@ -51,7 +59,7 @@ USB_MUX_FOREACH_MUX(USB_MUX_CHECK_ALL_PORTS_ARE_SAME) * .next = &USB_MUX_chain_port_0_mux_1, * } */ -USB_MUX_FOREACH_CHAIN_VARGS(USB_MUX_FOREACH_NO_ROOT_MUX, +USB_MUX_FOREACH_CHAIN_VARGS(USB_MUX_FOR_MAIN_CHAIN, USB_MUX_FOREACH_NO_ROOT_MUX, USB_MUX_CHAIN_STRUCT_DEFINE_OP) /** @@ -70,8 +78,8 @@ USB_MUX_FOREACH_MUX(USB_MUX_CB_BOARD_SET_DECLARE_IF_EXISTS) * }, * [1] = { ... }, */ -MAYBE_CONST struct usb_mux_chain usb_muxes[] = { USB_MUX_FOREACH_CHAIN( - USB_MUX_DEFINE_ROOT_MUX) }; +MAYBE_CONST struct usb_mux_chain usb_muxes[] = { USB_MUX_FOREACH_CHAIN_VARGS( + USB_MUX_FOR_MAIN_CHAIN, USB_MUX_DEFINE_ROOT_MUX) }; BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT); /** |