diff options
author | Wai-Hong Tam <waihong@google.com> | 2019-06-14 13:38:01 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-18 15:22:42 +0000 |
commit | e467b21013cf120ce9167bfb6b6e61ccfa258129 (patch) | |
tree | 9bd52ce3d6cc0a2bfe3902cb97c1c8194f10057d /board/servo_v4 | |
parent | 3a44908beda662eb7bdf5a7b877c7dadbc8b6d50 (diff) | |
download | chrome-ec-e467b21013cf120ce9167bfb6b6e61ccfa258129.tar.gz |
servo_v4: Enable VBUS detection interrupts to wake PD tasks fast enough
It fixes a hard reset issue.
After a hard reset, the PD state goes to SNK_HARD_RESET_RECOVER state
and waits for the VBUS "off" and then back "on" again. When the VBUS
goes back to "on", it then transits to SNK_DISCOVERY state that
replies the Source_Cap message. In order to make the VBUS detection
fast enough, these interrupts are needed to wake the PD tasks up;
otherwise, it missed the Source_Cap message
BUG=b:134701032
BRANCH=servo
TEST=Made servo v4 as sink and issued Hard_Reset on either DUT or servo.
2019-06-14 13:55:04 > cc snk
2019-06-14 13:55:06 cc: on
2019-06-14 13:55:06 dts mode: off
2019-06-14 13:55:06 chg mode: off
2019-06-14 13:55:06 chg allowed: off
2019-06-14 13:55:06 > C1 st3 SNK_DISCONNECTED_DEBOUNCE
2019-06-14 13:55:06 C1 st5 SNK_DISCOVERY
2019-06-14 13:55:06 C1 Req [1] 5000mV 3000mA
2019-06-14 13:55:06 C1 st6 SNK_REQUESTED
2019-06-14 13:55:06 C1 st7 SNK_TRANSITION
2019-06-14 13:55:06 C1 st8 SNK_READY
2019-06-14 13:55:07
2019-06-14 13:55:07 > pd 1 hard
2019-06-14 13:55:16 C1 st34 HARD_RESET_SEND
2019-06-14 13:55:16 > C1 st35 HARD_RESET_EXECUTE
2019-06-14 13:55:16 C1 HARD RST TX
2019-06-14 13:55:16 C1 st4 SNK_HARD_RESET_RECOVER
2019-06-14 13:55:16 Repeat msg_id[0] port[1]
2019-06-14 13:55:16 Repeat msg_id[0] port[1]
2019-06-14 13:55:16 Repeat msg_id[0] port[1]
2019-06-14 13:55:16 C1 st5 SNK_DISCOVERY
2019-06-14 13:55:16 Repeat msg_id[0] port[1]
2019-06-14 13:55:16 C1 HARD RST RX
2019-06-14 13:55:16 C1 st4 SNK_HARD_RESET_RECOVER
2019-06-14 13:55:17 C1 st5 SNK_DISCOVERY
2019-06-14 13:55:17 C1 Req [1] 5000mV 3000mA
2019-06-14 13:55:17 C1 st6 SNK_REQUESTED
2019-06-14 13:55:17 C1 st7 SNK_TRANSITION
2019-06-14 13:55:18 C1 st8 SNK_READY
2019-06-14 13:55:18 C1 Req [1] 5000mV 3000mA
2019-06-14 13:55:18 C1 st6 SNK_REQUESTED
2019-06-14 13:55:18 C1 st7 SNK_TRANSITION
2019-06-14 13:55:18 C1 st8 SNK_READY
Issued "pd 0 hard" on DUT:
2019-06-14 13:56:07 > C1 HARD RST RX
2019-06-14 13:56:11 C1 st4 SNK_HARD_RESET_RECOVER
2019-06-14 13:56:12 C1 st5 SNK_DISCOVERY
2019-06-14 13:56:12 C1 Req [1] 5000mV 3000mA
2019-06-14 13:56:12 C1 st6 SNK_REQUESTED
2019-06-14 13:56:12 C1 st7 SNK_TRANSITION
2019-06-14 13:56:12 C1 st8 SNK_READY
Change-Id: I0cc80515df8044ec07fa6795d3723aca2a3dc0ef
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660125
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/servo_v4')
-rw-r--r-- | board/servo_v4/board.c | 18 | ||||
-rw-r--r-- | board/servo_v4/gpio.inc | 6 |
2 files changed, 21 insertions, 3 deletions
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c index d0e1bd08be..405c90c7aa 100644 --- a/board/servo_v4/board.c +++ b/board/servo_v4/board.c @@ -29,6 +29,20 @@ #include "usb-stream.h" #include "util.h" +/****************************************************************************** + * GPIO interrupt handlers. + */ + +static void vbus0_evt(enum gpio_signal signal) +{ + task_wake(TASK_ID_PD_C0); +} + +static void vbus1_evt(enum gpio_signal signal) +{ + task_wake(TASK_ID_PD_C1); +} + #include "gpio_list.h" #define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args) @@ -439,6 +453,10 @@ static void board_init(void) */ pd_set_max_voltage(PD_MIN_MV); + /* Enable VBUS detection to wake PD tasks fast enough */ + gpio_enable_interrupt(GPIO_USB_DET_PP_CHG); + gpio_enable_interrupt(GPIO_USB_DET_PP_DUT); + hook_call_deferred(&ccd_measure_sbu_data, 1000 * MSEC); } diff --git a/board/servo_v4/gpio.inc b/board/servo_v4/gpio.inc index b0d8f124f1..f087c633ca 100644 --- a/board/servo_v4/gpio.inc +++ b/board/servo_v4/gpio.inc @@ -5,6 +5,9 @@ * found in the LICENSE file. */ +GPIO_INT(USB_DET_PP_CHG, PIN(C, 13), GPIO_INT_BOTH, vbus0_evt) +GPIO_INT(USB_DET_PP_DUT, PIN(C, 12), GPIO_INT_BOTH, vbus1_evt) + /* Outputs */ GPIO(DUT_CHG_EN, PIN(A, 10), GPIO_OUT_LOW) GPIO(HOST_OR_CHG_CTL, PIN(A, 13), GPIO_OUT_HIGH) @@ -36,9 +39,6 @@ GPIO(USB_CHG_CC2_PD, PIN(A, 4), GPIO_ANALOG) GPIO(USB_DUT_CC1_PD, PIN(A, 0), GPIO_ANALOG) GPIO(USB_DUT_CC2_PD, PIN(A, 5), GPIO_ANALOG) -GPIO(USB_DET_PP_DUT, PIN(C, 12), GPIO_INPUT) -GPIO(USB_DET_PP_CHG, PIN(C, 13), GPIO_INPUT) - GPIO(USB_CHG_CC1_TX_DATA, PIN(B, 4), GPIO_INPUT) GPIO(USB_CHG_CC2_TX_DATA, PIN(A, 6), GPIO_INPUT) GPIO(USB_DUT_CC1_TX_DATA, PIN(B, 14), GPIO_INPUT) |