From e852d78bc28bb26e6b7ba27cb59ecf8a1ce3f076 Mon Sep 17 00:00:00 2001 From: Scott Date: Fri, 28 Oct 2016 16:38:29 -0700 Subject: [PATCH] anx74xx: Added check for hard reset done bit in IRQ status The check for hard reset complete was missing. Because of this, the USB PD protocol state machine would get stuck in state 36 PD_STATE_HARD_RESET_SEND waiting for the pd_task to be woken following the tx_complete. Instead it would always trip the 100 msec timeout. BRANCH=none BUG=chrome-os-partner:58738 TEST=manual Without this CL, connect to a Guppy TypeC charger and observe: > C0 st3 [101.946607 event set 0x00200000] C0 st15 C0 st3 C0 st6 C0 st36 [102.466846 New chg p0] [102.470376 Ramp reset: st1] [102.470905 CL: p0 s2 i2000 v5000] [103.543623 AC on] After adding the fix for checking hard reset done: > C0 st3 [32.880946 event set 0x00200000] C0 st15 C0 st3 C0 st6 C0 st36 [33.410038 New chg p0] C0 st37 [33.415641 Ramp reset: st1] [33.416160 CL: p0 s2 i2000 v5000] C0 HARD RST TX C0 st5 C0 st36 C0 st37 C0 HARD RST TX C0 st5 [34.489611 AC on] [34.489965 event set 0x00000008] [34.520457 event set 0x00400000] [34.520876 charge_request(8688mV, 4608mA)] C0 st6 [35.419391 Ramp p0 st2 500mA 0mA] Change-Id: I6822983002fa387c85f7e55af5fe1e142c7b88e2 Signed-off-by: Scott Reviewed-on: https://chromium-review.googlesource.com/404878 Commit-Ready: Scott Collyer Tested-by: Scott Collyer Reviewed-by: Kevin K Wong Reviewed-by: Shawn N --- driver/tcpm/anx74xx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c index 073eb92867..c96cab36b0 100644 --- a/driver/tcpm/anx74xx.c +++ b/driver/tcpm/anx74xx.c @@ -612,6 +612,10 @@ static int anx74xx_alert_status(int port, int *alert) /* Clears interrupt bits */ rv |= tcpc_write(port, ANX74XX_REG_IRQ_EXT_SOURCE_1, reg); + /* Check for Hard Reset done bit */ + if (reg & ANX74XX_REG_ALERT_TX_HARD_RESETOK) + *alert |= ANX74XX_REG_ALERT_TX_HARD_RESETOK; + /* Read TCPC Alert register2 */ rv |= tcpc_read(port, ANX74XX_REG_IRQ_EXT_SOURCE_2, ®);