diff options
author | Denis Brockus <dbrockus@chromium.org> | 2020-02-21 14:21:05 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-28 22:47:11 +0000 |
commit | 9c194fd057558a1dfadee419e92aca31953a86fc (patch) | |
tree | 001ae7c162a4152312a180574ae58e19a3763eb8 /baseboard/intelrvp | |
parent | ab35b456ad8c52f336ea793b17155cfc796c4e44 (diff) | |
download | chrome-ec-9c194fd057558a1dfadee419e92aca31953a86fc.tar.gz |
usb_mux: retimer: mux as chained mux and retimer
This makes retimers appear as generic muxes. By allowing a
chain of muxes they can be stacked up to the new configurations
that zork requires and will continue to work as they did before
on configurations that only have a single mux.
The code used to have two different arrays, 1) muxes and 2)
retimers. On one of the zork configurations the processor
MUX stopped being the primary mux and the retimer took its
place. In a different configuration of that same platform
it left the primary and secondary alone but the mux_set
FLIP operation had to be ignored. Since the same
interfaces needed to be available for both it stopped making
sense to have two different structures and two different
methods of handling them. This consolodates the two into
one.
The platforms that do not have retimers, this change will
not make any difference. For platforms like zork, it will
remove the retimers and make them chained muxes. So
testing on trembyle makes sense to verify,
BUG=b:147593660
BRANCH=none
TEST=verify USB still works on trembyle
Change-Id: I286cf1e302f9bd3dd7e81098ec08514a2a009fe3
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2066794
Commit-Queue: Jett Rink <jettrink@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'baseboard/intelrvp')
-rw-r--r-- | baseboard/intelrvp/retimer.c | 15 | ||||
-rw-r--r-- | baseboard/intelrvp/usb_mux.c | 44 |
2 files changed, 40 insertions, 19 deletions
diff --git a/baseboard/intelrvp/retimer.c b/baseboard/intelrvp/retimer.c index a444806062..0397057641 100644 --- a/baseboard/intelrvp/retimer.c +++ b/baseboard/intelrvp/retimer.c @@ -29,19 +29,4 @@ const struct bb_usb_control bb_controls[] = { }; BUILD_ASSERT(ARRAY_SIZE(bb_controls) == CONFIG_USB_PD_PORT_MAX_COUNT); -struct usb_retimer usb_retimers[] = { - [TYPE_C_PORT_0] = { - .driver = &bb_usb_retimer, - .i2c_port = I2C_PORT0_BB_RETIMER, - .i2c_addr_flags = I2C_PORT0_BB_RETIMER_ADDR, - }, -#ifdef HAS_TASK_PD_C1 - [TYPE_C_PORT_1] = { - .driver = &bb_usb_retimer, - .i2c_port = I2C_PORT1_BB_RETIMER, - .i2c_addr_flags = I2C_PORT1_BB_RETIMER_ADDR, - }, -#endif /* HAS_TASK_PD_C1 */ -}; -BUILD_ASSERT(ARRAY_SIZE(usb_retimers) == CONFIG_USB_PD_PORT_MAX_COUNT); #endif /* CONFIG_USBC_RETIMER_INTEL_BB */ diff --git a/baseboard/intelrvp/usb_mux.c b/baseboard/intelrvp/usb_mux.c index 2dee2bf759..644ae1735c 100644 --- a/baseboard/intelrvp/usb_mux.c +++ b/baseboard/intelrvp/usb_mux.c @@ -7,20 +7,46 @@ #include "common.h" #include "anx7440.h" +#include "bb_retimer.h" #include "timer.h" #include "usb_mux.h" +#ifdef CONFIG_USBC_RETIMER_INTEL_BB +struct usb_mux usbc0_retimer = { + .usb_port = TYPE_C_PORT_0, + .driver = &bb_usb_retimer, + .i2c_port = I2C_PORT0_BB_RETIMER, + .i2c_addr_flags = I2C_PORT0_BB_RETIMER_ADDR, +}; +#ifdef HAS_TASK_PD_C1 +struct usb_mux usbc1_retimer = { + .usb_port = TYPE_C_PORT_1, + .driver = &bb_usb_retimer, + .i2c_port = I2C_PORT1_BB_RETIMER, + .i2c_addr_flags = I2C_PORT1_BB_RETIMER_ADDR, +}; +#endif /* HAS_TASK_PD_C1 */ +#endif + /* USB muxes Configuration */ #ifdef CONFIG_USB_MUX_VIRTUAL -struct usb_mux usb_muxes[] = { +const struct usb_mux usb_muxes[] = { [TYPE_C_PORT_0] = { + .usb_port = TYPE_C_PORT_0, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, +#ifdef CONFIG_USBC_RETIMER_INTEL_BB + .next_mux = &usbc0_retimer, +#endif }, #ifdef HAS_TASK_PD_C1 [TYPE_C_PORT_1] = { + .usb_port = TYPE_C_PORT_1, .driver = &virtual_usb_mux_driver, .hpd_update = &virtual_hpd_update, +#ifdef CONFIG_USBC_RETIMER_INTEL_BB + .next_mux = &usbc1_retimer, +#endif }, #endif /* HAS_TASK_PD_C1 */ }; @@ -28,15 +54,25 @@ BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT); #endif /* CONFIG_USB_MUX_VIRTUAL */ #ifdef CONFIG_USB_MUX_ANX7440 -struct usb_mux usb_muxes[] = { +const struct usb_mux usb_muxes[] = { [TYPE_C_PORT_0] = { - .port_addr = I2C_ADDR_USB_MUX0_FLAGS, + .usb_port = TYPE_C_PORT_0, + .i2c_port = I2C_PORT_USB_MUX, + .i2c_addr_flags = I2C_ADDR_USB_MUX0_FLAGS, .driver = &anx7440_usb_mux_driver, +#ifdef CONFIG_USBC_RETIMER_INTEL_BB + .next_mux = &usbc0_retimer, +#endif }, #ifdef HAS_TASK_PD_C1 [TYPE_C_PORT_1] = { - .port_addr = I2C_ADDR_USB_MUX1_FLAGS, + .usb_port = TYPE_C_PORT_1, + .i2c_port = I2C_PORT_USB_MUX, + .i2c_addr_flags = I2C_ADDR_USB_MUX1_FLAGS, .driver = &anx7440_usb_mux_driver, +#ifdef CONFIG_USBC_RETIMER_INTEL_BB + .next_mux = &usbc1_retimer, +#endif }, #endif /* HAS_TASK_PD_C1 */ }; |