diff options
Diffstat (limited to 'baseboard/grunt')
-rw-r--r-- | baseboard/grunt/baseboard.c | 18 | ||||
-rw-r--r-- | baseboard/grunt/usb_pd_policy.c | 4 |
2 files changed, 9 insertions, 13 deletions
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c index 5ab7dc8d53..82bf063bf9 100644 --- a/baseboard/grunt/baseboard.c +++ b/baseboard/grunt/baseboard.c @@ -135,8 +135,6 @@ void tcpc_alert_event(enum gpio_signal signal) void board_tcpc_init(void) { - int port; - /* Only reset TCPC if not sysjump */ if (!system_jumped_to_this_image()) board_reset_pd_mcu(); @@ -157,11 +155,8 @@ void board_tcpc_init(void) * Initialize HPD to low; after sysjump SOC needs to see * HPD pulse to enable video path */ - for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++) { - const struct usb_mux *mux = &usb_muxes[port]; - - mux->hpd_update(port, 0, 0); - } + for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port) + usb_mux_hpd_update(port, 0, 0); } DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1); @@ -280,28 +275,31 @@ void board_reset_pd_mcu(void) static uint32_t sku_id; -static int ps8751_tune_mux(int port) +static int ps8751_tune_mux(const struct usb_mux *me) { /* Tune USB mux registers for treeya's port 1 Rx measurement */ if ((sku_id >= 0xa0) && (sku_id <= 0xaf)) - mux_write(port, PS8XXX_REG_MUX_USB_C2SS_EQ, 0x40); + mux_write(me, PS8XXX_REG_MUX_USB_C2SS_EQ, 0x40); return EC_SUCCESS; } -struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { +const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { #ifdef VARIANT_GRUNT_TCPC_0_ANX3429 [USB_PD_PORT_ANX74XX] = { + .usb_port = USB_PD_PORT_ANX74XX, .driver = &anx74xx_tcpm_usb_mux_driver, .hpd_update = &anx74xx_tcpc_update_hpd_status, }, #elif defined(VARIANT_GRUNT_TCPC_0_ANX3447) [USB_PD_PORT_ANX74XX] = { + .usb_port = USB_PD_PORT_ANX74XX, .driver = &anx7447_usb_mux_driver, .hpd_update = &anx7447_tcpc_update_hpd_status, }, #endif [USB_PD_PORT_PS8751] = { + .usb_port = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, .board_init = &ps8751_tune_mux, diff --git a/baseboard/grunt/usb_pd_policy.c b/baseboard/grunt/usb_pd_policy.c index 4edee5f232..0d2e41b64a 100644 --- a/baseboard/grunt/usb_pd_policy.c +++ b/baseboard/grunt/usb_pd_policy.c @@ -129,8 +129,6 @@ __override int svdm_dp_config(int port, uint32_t *payload) #define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD) __override void svdm_dp_post_config(int port) { - const struct usb_mux * const mux = &usb_muxes[port]; - /* Connect the SBU and USB lines to the connector. */ ppc_set_sbu(port, 1); usb_mux_set(port, svdm_dp_mux_mode(port), USB_SWITCH_CONNECT, @@ -144,7 +142,7 @@ __override void svdm_dp_post_config(int port) /* set the minimum time delay (2ms) for the next HPD IRQ */ svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL; - mux->hpd_update(port, 1, 0); + usb_mux_hpd_update(port, 1, 0); } #endif /* CONFIG_USB_PD_ALT_MODE_DFP */ |