From 2d1ab813cba0e2aeb6bc5ce482abcf33340d8f67 Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Tue, 13 Nov 2018 14:53:54 -0700 Subject: ppc/nx20: add more fault condition prints When the PPC detects a fault condition such as a short or reverse current, we should print something to the EC console. BRANCH=none BUG=b:115307099 TEST=build. Couldn't get this to trip on demand though. Change-Id: Ib5298074b08a7d7d0d278258822fb7edf562c7aa Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/1334527 Reviewed-by: Diana Z --- driver/ppc/nx20p348x.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/driver/ppc/nx20p348x.c b/driver/ppc/nx20p348x.c index 18523c196b..8a0d45851e 100644 --- a/driver/ppc/nx20p348x.c +++ b/driver/ppc/nx20p348x.c @@ -227,7 +227,8 @@ static int nx20p348x_init(int port) return rv; /* Mask interrupts for interrupt 1 register */ - mask = ~(NX20P348X_INT1_OC_5VSRC | NX20P348X_INT1_DBEXIT_ERR); + mask = ~(NX20P348X_INT1_OC_5VSRC | NX20P348X_INT1_SC_5VSRC | + NX20P348X_INT1_RCP_5VSRC | NX20P348X_INT1_DBEXIT_ERR); #ifdef CONFIG_USBC_PPC_NX20P3481 /* Unmask Fast Role Swap detect interrupt */ mask &= ~NX20P348X_INT1_FRS_DET; @@ -320,7 +321,7 @@ static void nx20p348x_handle_interrupt(int port) /* Check for 5V OC interrupt */ if (reg & NX20P348X_INT1_OC_5VSRC) { - CPRINTS("C%d: PPC detected overcurrent!", port); + CPRINTS("C%d: PPC detected Vbus overcurrent!", port); /* * TODO (b/69935262): The overcurrent action hasn't * been completed yet, but is required for TI PPC. When that @@ -328,6 +329,14 @@ static void nx20p348x_handle_interrupt(int port) */ } + /* Check for Vbus reverse current protection */ + if (reg & NX20P348X_INT1_RCP_5VSRC) + CPRINTS("C%d: PPC detected Vbus reverse current!", port); + + /* Check for Vbus short protection */ + if (reg & NX20P348X_INT1_SC_5VSRC) + CPRINTS("C%d: PPC Vbus short detected!", port); + #ifdef CONFIG_USBC_PPC_NX20P3481 /* Check for FRS detection */ if (reg & NX20P348X_INT1_FRS_DET) { -- cgit v1.2.1