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 /board/ampton | |
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 'board/ampton')
-rw-r--r-- | board/ampton/board.c | 20 | ||||
-rw-r--r-- | board/ampton/board.h | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/board/ampton/board.c b/board/ampton/board.c index df151c8918..4f1f0880df 100644 --- a/board/ampton/board.c +++ b/board/ampton/board.c @@ -66,13 +66,14 @@ int ppc_get_alert_status(int port) #define USB_PD_PORT_ITE_0 0 #define USB_PD_PORT_ITE_1 1 -static int tune_mux(int port); +static int tune_mux(const struct usb_mux *me); -struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { +const struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { [USB_PD_PORT_ITE_0] = { /* Use PS8751 as mux only */ - .port_addr = MUX_PORT_AND_ADDR( - I2C_PORT_USBC0, PS8751_I2C_ADDR1_FLAGS), + .usb_port = USB_PD_PORT_ITE_0, + .i2c_port = I2C_PORT_USBC0, + .i2c_addr_flags = PS8751_I2C_ADDR1_FLAGS, .flags = USB_MUX_FLAG_NOT_TCPC, .driver = &ps8xxx_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -80,8 +81,9 @@ struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { }, [USB_PD_PORT_ITE_1] = { /* Use PS8751 as mux only */ - .port_addr = MUX_PORT_AND_ADDR( - I2C_PORT_USBC1, PS8751_I2C_ADDR1_FLAGS), + .usb_port = USB_PD_PORT_ITE_1, + .i2c_port = I2C_PORT_USBC1, + .i2c_addr_flags = PS8751_I2C_ADDR1_FLAGS, .flags = USB_MUX_FLAG_NOT_TCPC, .driver = &ps8xxx_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, @@ -92,12 +94,12 @@ struct usb_mux ampton_usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { /* Some external monitors can't display content normally (eg. ViewSonic VX2880). * We need to turn the mux for monitors to function normally. */ -static int tune_mux(int port) +static int tune_mux(const struct usb_mux *me) { /* Auto EQ disabled, compensate for channel lost up to 3.6dB */ - mux_write(port, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98); + mux_write(me, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98); /* DP output swing adjustment +15% */ - mux_write(port, PS8XXX_REG_MUX_DP_OUTPUT_CONFIGURATION, 0xc0); + mux_write(me, PS8XXX_REG_MUX_DP_OUTPUT_CONFIGURATION, 0xc0); return EC_SUCCESS; } diff --git a/board/ampton/board.h b/board/ampton/board.h index 96b135d774..0420bc5ccf 100644 --- a/board/ampton/board.h +++ b/board/ampton/board.h @@ -58,6 +58,8 @@ #undef CONFIG_UART_TX_BUF_SIZE #define CONFIG_UART_TX_BUF_SIZE 4096 +#define CONFIG_USB_MUX_RUNTIME_CONFIG + #ifndef __ASSEMBLER__ #include "gpio_signal.h" |