diff options
author | Tomasz Michalec <tm@semihalf.com> | 2022-04-19 18:44:10 +0200 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-03 14:12:20 +0000 |
commit | c592a640197f88edf6a90a28b3fec35ffe34b582 (patch) | |
tree | 5d9162ac10d0350548fc2d05ea6705313f1ae0ee | |
parent | 391778c18daad8a04529f8891e28ded0dbc1313b (diff) | |
download | chrome-ec-c592a640197f88edf6a90a28b3fec35ffe34b582.tar.gz |
zephyr: Add ANX7483 USB-C mux DTS configuration
Add necessary changes to make it possible to configure an ANX7483 USB-C
mux using a devicetree.
BUG=b:227757117
TEST=zmake testall
BRANCH=none
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: I3ecc3dc66d2269905b19f7b1db44db5d8ca6df3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3593789
Tested-by: Tomasz Michalec <tmichalec@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Tomasz Michalec <tmichalec@google.com>
-rw-r--r-- | zephyr/dts/bindings/usbc/mux/analogix,anx7483.yaml | 26 | ||||
-rw-r--r-- | zephyr/shim/include/usbc/anx7483_usb_mux.h | 22 | ||||
-rw-r--r-- | zephyr/shim/include/usbc/usb_muxes.h | 2 |
3 files changed, 50 insertions, 0 deletions
diff --git a/zephyr/dts/bindings/usbc/mux/analogix,anx7483.yaml b/zephyr/dts/bindings/usbc/mux/analogix,anx7483.yaml new file mode 100644 index 0000000000..9e4716d5d1 --- /dev/null +++ b/zephyr/dts/bindings/usbc/mux/analogix,anx7483.yaml @@ -0,0 +1,26 @@ +# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +description: | + Analogix re-timing MUX + +include: cros-ec,usbc-mux.yaml + +compatible: "analogix,anx7483" + +properties: + port: + type: phandle + required: true + description: phandle to the named i2c port + + i2c-addr-flags: + type: string + required: true + description: I2C address of chip + enum: + - ANX7483_I2C_ADDR0_FLAGS + - ANX7483_I2C_ADDR1_FLAGS + - ANX7483_I2C_ADDR2_FLAGS + - ANX7483_I2C_ADDR3_FLAGS diff --git a/zephyr/shim/include/usbc/anx7483_usb_mux.h b/zephyr/shim/include/usbc/anx7483_usb_mux.h new file mode 100644 index 0000000000..606928b016 --- /dev/null +++ b/zephyr/shim/include/usbc/anx7483_usb_mux.h @@ -0,0 +1,22 @@ +/* Copyright 2022 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __ZEPHYR_SHIM_ANX7483_USB_MUX_H +#define __ZEPHYR_SHIM_ANX7483_USB_MUX_H + +#include "driver/retimer/anx7483_public.h" + +#define ANX7483_USB_MUX_COMPAT analogix_anx7483 + +#define USB_MUX_CONFIG_ANX7483(mux_id, port_id, idx) \ + { \ + USB_MUX_COMMON_FIELDS(mux_id, port_id, idx), \ + .driver = &anx7483_usb_retimer_driver, \ + .i2c_port = I2C_PORT(DT_PHANDLE(mux_id, port)), \ + .i2c_addr_flags = \ + DT_STRING_UPPER_TOKEN(mux_id, i2c_addr_flags), \ + } + +#endif /* __ZEPHYR_SHIM_ANX7483_USB_MUX_H */ diff --git a/zephyr/shim/include/usbc/usb_muxes.h b/zephyr/shim/include/usbc/usb_muxes.h index b3789cd6a1..e56e538a74 100644 --- a/zephyr/shim/include/usbc/usb_muxes.h +++ b/zephyr/shim/include/usbc/usb_muxes.h @@ -9,6 +9,7 @@ #include <zephyr/devicetree.h> #include <zephyr/sys/util_macro.h> #include "usb_mux.h" +#include "usbc/anx7483_usb_mux.h" #include "usbc/it5205_usb_mux.h" #include "usbc/tcpci_usb_mux.h" #include "usbc/tusb1064_usb_mux.h" @@ -19,6 +20,7 @@ * element of list has to have (compatible, config) format. */ #define USB_MUX_DRIVERS \ + (ANX7483_USB_MUX_COMPAT, USB_MUX_CONFIG_ANX7483), \ (IT5205_USB_MUX_COMPAT, USB_MUX_CONFIG_IT5205), \ (PS8XXX_USB_MUX_COMPAT, USB_MUX_CONFIG_TCPCI_TCPM), \ (TCPCI_TCPM_USB_MUX_COMPAT, USB_MUX_CONFIG_TCPCI_TCPM), \ |