summaryrefslogtreecommitdiff
path: root/zephyr/shim/include/usbc/anx7452_usb_mux.h
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2023-04-13 17:59:46 +0800
committerEric Yilun Lin <yllin@google.com>2023-04-13 10:01:21 +0000
commit017e8c8b9803e5f421522183ce3c4bad5c5236e5 (patch)
tree2b26885b6e0caf5bf54fc5c882044c3f6a5b9630 /zephyr/shim/include/usbc/anx7452_usb_mux.h
parent846964eb47c50aea47ab05af1b2ad7aeed8369ba (diff)
parentfd4151fe81b041c480db9c265fb24e84aa6ef4dc (diff)
downloadchrome-ec-017e8c8b9803e5f421522183ce3c4bad5c5236e5.tar.gz
Merge remote-tracking branch cros/main into firmware-corsola-15194.B-mainfirmware-corsola-15194.B-main
Generated by: util/update_release_branch.py -r -z --board corsla --relevant_paths_file util/corsola-relevant-paths.txt firmware-corsola-15194.B-main Relevant changes: git log --oneline 846964eb47..fd4151fe81 -- zephyr/program/corsla common/charge_state_v2.c common/dps.c common/mkbp_* common/usb_charger.c common/usb_common.c common/usbc/*_pd_* common/usbc/dp_alt_mode.c common/usbc/usb_pe_drp_sm.c common/usbc/usb_prl_sm.c common/usbc/usb_sm.c common/usbc/usb_tc_drp_acc_trysrc_sm.c driver/battery/smart.c driver/bc12/pi3usb9201.* driver/charger/isl923x.* driver/charger/rt949* driver/ppc/nx20p348x.* driver/ppc/rt1718s.* driver/ppc/syv682x.* driver/tcpm/anx7447.* driver/tcpm/rt1718s.* driver/tcpm/tcpci.* driver/usb_mux/it5205.* driver/usb_mux/ps8743.* power/mt8186.c zephyr/boards/arm/npcx9/* zephyr/boards/riscv/it8xxx2/* zephyr/drivers/* zephyr/program/corsola/* zephyr/shim/* util/getversion.sh fd4151fe81 zephyr: Kconfig: add FLASH_PSTATE_BANK / FLASH_PSTATE_LOCKED d18304f138 voltorb: remove debug options and features for FW QUAL 57ed659cb9 USB-PD: Update EC_CMD_TYPEC_STATUS for EPR d14883b6fd RAA489110: Add RAA489110 driver e06fe77101 binman: Add binman nodelabel and use it 48cde011ac retimer: Add driver for ANX7452 retimer BRANCH=None BUG=none TEST=`make -j buildall` Cq-Depend: chromium:4421692 Force-Relevant-Builds: all Change-Id: I2d7a5d8c6dbfc9d8c13cde3b9e1fcc06ae782067 Signed-off-by: Eric Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'zephyr/shim/include/usbc/anx7452_usb_mux.h')
-rw-r--r--zephyr/shim/include/usbc/anx7452_usb_mux.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/zephyr/shim/include/usbc/anx7452_usb_mux.h b/zephyr/shim/include/usbc/anx7452_usb_mux.h
new file mode 100644
index 0000000000..1b3cdbcc8e
--- /dev/null
+++ b/zephyr/shim/include/usbc/anx7452_usb_mux.h
@@ -0,0 +1,41 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __ZEPHYR_SHIM_ANX7452_USB_MUX_H
+#define __ZEPHYR_SHIM_ANX7452_USB_MUX_H
+
+#include "driver/retimer/anx7452_public.h"
+
+#define ANX7452_USB_MUX_COMPAT analogix_anx7452
+
+#define ANX7452_USB_EN_GPIO(mux_id) GPIO_SIGNAL(DT_PHANDLE(mux_id, usb_en_pin))
+
+#define ANX7452_DP_EN_GPIO(mux_id) \
+ COND_CODE_1(DT_NODE_HAS_PROP(mux_id, dp_en_pin), \
+ (GPIO_SIGNAL(DT_PHANDLE(mux_id, dp_en_pin))), \
+ (GPIO_UNIMPLEMENTED))
+
+#define ANX7452_CONTROLS_CONFIG(mux_id) \
+ { \
+ .usb_enable_gpio = ANX7452_USB_EN_GPIO(mux_id), \
+ .dp_enable_gpio = ANX7452_DP_EN_GPIO(mux_id), \
+ }
+
+#define USB_MUX_ANX7452_CONTROL_ARRAY(mux_id) \
+ [USB_MUX_PORT(mux_id)] = ANX7452_CONTROLS_CONFIG(mux_id),
+
+#define USB_MUX_ANX7452_CONTROLS_ARRAY \
+ DT_FOREACH_STATUS_OKAY(ANX7452_USB_MUX_COMPAT, \
+ USB_MUX_ANX7452_CONTROL_ARRAY)
+
+#define USB_MUX_CONFIG_ANX7452(mux_id) \
+ { \
+ USB_MUX_COMMON_FIELDS(mux_id), \
+ .driver = &anx7452_usb_retimer_driver, \
+ .i2c_port = I2C_PORT_BY_DEV(mux_id), \
+ .i2c_addr_flags = DT_REG_ADDR(mux_id), \
+ }
+
+#endif /* __ZEPHYR_SHIM_ANX7452_USB_MUX_H */