summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2022-04-21 17:23:51 +0200
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-03 14:12:51 +0000
commit03bff63345be6a2f52f5f031ed4f724d7fd01794 (patch)
treef86b1bbc4fe08cfb08a9fb719b07689f11f5d2c2
parent2b80d1c6d28573030c115f8219801fdd4e9cd2d2 (diff)
downloadchrome-ec-03bff63345be6a2f52f5f031ed4f724d7fd01794.tar.gz
zephyr: move Brya USB mux configuration into the DTS
Move the Brya board USB mux configuration into the devicetree. BUG=b:229411952 TEST=zmake testall BRANCH=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I4a388caca7833391b76bb4261b64f30cf3b26ecc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3607990 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Sam Hurst <shurst@google.com>
-rw-r--r--board/brya/usbc_config.c12
-rw-r--r--zephyr/projects/brya/usbc.dts18
2 files changed, 27 insertions, 3 deletions
diff --git a/board/brya/usbc_config.c b/board/brya/usbc_config.c
index 6f6ae0d84f..eb72412423 100644
--- a/board/brya/usbc_config.c
+++ b/board/brya/usbc_config.c
@@ -125,6 +125,7 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
+#ifndef CONFIG_ZEPHYR
/* USBC mux configuration - Alder Lake includes internal mux */
static const struct usb_mux usbc0_tcss_usb_mux = {
.usb_port = USBC_PORT_C0,
@@ -175,7 +176,6 @@ const struct usb_mux usb_muxes[] = {
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
-#ifndef CONFIG_ZEPHYR
/* BC1.2 charger detect configuration */
const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
[USBC_PORT_C0] = {
@@ -286,16 +286,22 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
if (get_board_id() == 1)
rst_signal = IOEX_ID_1_USB_C0_RT_RST_ODL;
else
-#endif /* !CONFIG_ZEPHYR */
rst_signal = IOEX_USB_C0_RT_RST_ODL;
+#else
+ /* On Zephyr use bb_controls generated from DTS */
+ rst_signal = bb_controls[me->usb_port].retimer_rst_gpio;
+#endif /* !CONFIG_ZEPHYR */
} else if (me->usb_port == USBC_PORT_C2) {
/* TODO: explore how to handle board id in zephyr*/
#ifndef CONFIG_ZEPHYR
if (get_board_id() == 1)
rst_signal = IOEX_ID_1_USB_C2_RT_RST_ODL;
else
-#endif /* !CONFIG_ZEPHYR */
rst_signal = IOEX_USB_C2_RT_RST_ODL;
+#else
+ /* On Zephyr use bb_controls generated from DTS */
+ rst_signal = bb_controls[me->usb_port].retimer_rst_gpio;
+#endif /* !CONFIG_ZEPHYR */
} else {
return EC_ERROR_INVAL;
}
diff --git a/zephyr/projects/brya/usbc.dts b/zephyr/projects/brya/usbc.dts
index 04e2702306..181acd837e 100644
--- a/zephyr/projects/brya/usbc.dts
+++ b/zephyr/projects/brya/usbc.dts
@@ -34,6 +34,7 @@
status = "okay";
port = <&i2c_charger>;
};
+ usb-muxes = <&usb_c0_bb_retimer &virtual_mux_c0>;
};
port0-muxes {
usb_c0_bb_retimer: jhl8040r-c0 {
@@ -43,6 +44,9 @@
int-pin = <&usb_c0_rt_int_odl>;
reset-pin = <&usb_c0_rt_rst_odl>;
};
+ virtual_mux_c0: virtual-mux-c0 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
};
port1@1 {
@@ -65,6 +69,16 @@
TCPC_FLAGS_CONTROL_VCONN |
TCPC_FLAGS_CONTROL_FRS)>;
};
+ usb-muxes = <&virtual_mux_c1 &tcpci_mux_c1>;
+ };
+ port1-muxes {
+ tcpci_mux_c1: tcpci-mux-c1 {
+ compatible = "cros-ec,usbc-mux-tcpci";
+ hpd-update = "ps8xxx_tcpc_update_hpd_status";
+ };
+ virtual_mux_c1: virtual-mux-c1 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
};
port2@2 {
@@ -84,6 +98,7 @@
i2c-addr-flags = "NCT38XX_I2C_ADDR2_1_FLAGS";
tcpc-flags = <(TCPC_FLAGS_TCPCI_REV2_0)>;
};
+ usb-muxes = <&usb_c2_bb_retimer &virtual_mux_c2>;
};
port2-muxes {
usb_c2_bb_retimer: jhl8040r-c2 {
@@ -93,6 +108,9 @@
int-pin = <&usb_c2_rt_int_odl>;
reset-pin = <&usb_c2_rt_rst_odl>;
};
+ virtual_mux_c2: virtual-mux-c2 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
};
};
};