diff options
author | Jett Rink <jettrink@chromium.org> | 2018-05-18 09:14:17 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-05-22 21:57:16 -0700 |
commit | 11bd4c0f4d11357ab830982d7dec164813c886dd (patch) | |
tree | 0ae0482ed383cfea5cd83d8d46224a944559b019 | |
parent | 4f27014532e308f8bb6652c8956c75bc6f0b19e2 (diff) | |
download | chrome-ec-11bd4c0f4d11357ab830982d7dec164813c886dd.tar.gz |
bip: enabled PPC interrupts
Need to enable PPC interrupts, otherwise system doesn't work correctly
include USB 2.0 not working (since the BC1.2 chip won't be powered after
the Vbus change)
BRANCH=none
BUG=b:79886742
TEST=USB 2.0 works on insertion on C0 on bip
Change-Id: I227dcfac22128389c3d3ab3efdddd045141dff7e
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1066221
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r-- | baseboard/octopus/baseboard.c | 34 | ||||
-rw-r--r-- | baseboard/octopus/variant_usbc_ec_tcpcs.c | 9 | ||||
-rw-r--r-- | baseboard/octopus/variant_usbc_standalone_tcpcs.c | 33 |
3 files changed, 45 insertions, 31 deletions
diff --git a/baseboard/octopus/baseboard.c b/baseboard/octopus/baseboard.c index 6bc0436473..cd14adb6d3 100644 --- a/baseboard/octopus/baseboard.c +++ b/baseboard/octopus/baseboard.c @@ -16,6 +16,7 @@ #include "power.h" #include "system.h" #include "task.h" +#include "usb_mux.h" #include "usbc_ppc.h" #include "util.h" @@ -177,7 +178,38 @@ void chipset_do_shutdown(void) } /******************************************************************************/ -/* Charger/PD functions */ +/* Power Delivery and charing functions */ + +void baseboard_tcpc_init(void) +{ + int count = 0; + int port; + + /* Wait for disconnected battery to wake up */ + while (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED) { + usleep(100 * MSEC); + /* Give up waiting after more than 1 second */ + if (++count > 10) { + ccprintf("Battery still disconnected > 1 second!\n"); + break; + } + } + + /* Only reset TCPC if not sysjump */ + if (!system_jumped_to_this_image()) + board_reset_pd_mcu(); + + /* + * Initialize HPD to low; after sysjump SOC needs to see + * HPD pulse to enable video path + */ + for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { + const struct usb_mux *mux = &usb_muxes[port]; + + mux->hpd_update(port, 0, 0); + } +} +DECLARE_HOOK(HOOK_INIT, baseboard_tcpc_init, HOOK_PRIO_INIT_I2C + 1); int board_set_active_charge_port(int port) { diff --git a/baseboard/octopus/variant_usbc_ec_tcpcs.c b/baseboard/octopus/variant_usbc_ec_tcpcs.c index 87f7aead3f..20296b63f6 100644 --- a/baseboard/octopus/variant_usbc_ec_tcpcs.c +++ b/baseboard/octopus/variant_usbc_ec_tcpcs.c @@ -95,6 +95,15 @@ const unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); /******************************************************************************/ /* Power Delivery and charing functions */ +void variant_tcpc_init(void) +{ + /* Enable PPC interrupts. */ + gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL); + gpio_enable_interrupt(GPIO_USB_C1_PD_INT_ODL); +} +/* Called after the baseboard_tcpc_init (via +2) */ +DECLARE_HOOK(HOOK_INIT, variant_tcpc_init, HOOK_PRIO_INIT_I2C + 2); + uint16_t tcpc_get_alert_status(void) { /* diff --git a/baseboard/octopus/variant_usbc_standalone_tcpcs.c b/baseboard/octopus/variant_usbc_standalone_tcpcs.c index d2de025394..095bcb76c7 100644 --- a/baseboard/octopus/variant_usbc_standalone_tcpcs.c +++ b/baseboard/octopus/variant_usbc_standalone_tcpcs.c @@ -79,26 +79,8 @@ const unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips); /******************************************************************************/ /* Power Delivery and charing functions */ -void board_tcpc_init(void) +void variant_tcpc_init(void) { - int count = 0; - int port; - - /* Wait for disconnected battery to wake up */ - while (battery_hw_present() == BP_YES && - battery_is_present() == BP_NO) { - usleep(100 * MSEC); - /* Give up waiting after 1 second */ - if (++count > 10) { - ccprintf("TCPC_init: 1 second w/no battery\n"); - break; - } - } - - /* Only reset TCPC if not sysjump */ - if (!system_jumped_to_this_image()) - board_reset_pd_mcu(); - /* Enable PPC interrupts. */ gpio_enable_interrupt(GPIO_USB_PD_C0_INT_L); gpio_enable_interrupt(GPIO_USB_PD_C1_INT_L); @@ -106,18 +88,9 @@ void board_tcpc_init(void) /* Enable TCPC interrupts. */ gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL); gpio_enable_interrupt(GPIO_USB_C1_PD_INT_ODL); - - /* - * Initialize HPD to low; after sysjump SOC needs to see - * HPD pulse to enable video path - */ - for (port = 0; port < CONFIG_USB_PD_PORT_COUNT; port++) { - const struct usb_mux *mux = &usb_muxes[port]; - - mux->hpd_update(port, 0, 0); - } } -DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1); +/* Called after the baseboard_tcpc_init (via +2) */ +DECLARE_HOOK(HOOK_INIT, variant_tcpc_init, HOOK_PRIO_INIT_I2C + 2); uint16_t tcpc_get_alert_status(void) { |