diff options
author | Aseda Aboagye <aaboagye@google.com> | 2018-11-05 15:20:45 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-26 04:42:44 -0700 |
commit | 862d00cf9994809711853c1f5261f7b9906ba149 (patch) | |
tree | 9aed051f4102ce002ef11c61b1730b18e8c75e2c /driver | |
parent | f913d50eb1298f8ad1772ddbe3b9a51b35e08f3c (diff) | |
download | chrome-ec-862d00cf9994809711853c1f5261f7b9906ba149.tar.gz |
sn5s330: Add VCONN overcurrent logging.
The TI SN5S330 has VCONN overcurrent protection and will automatically
latch off VCONN if a port overcurrents it. Keeping VCONN latched off is
allowed per the USB Type-C spec. This commit simply logs a message on
the EC console such that it will be easier to tell when it happens.
BUG=none
BRANCH=firmware-nocturne-10984.B
TEST=flash nocturne, plug in a Type-C adapter which overcurrents VCONN,
verify that a console message indicating the overcurrent event is shown.
Change-Id: I22da6e8d43ac7739dc213d5a1f049b98d7ee829d
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/1328321
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1330162
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/ppc/sn5s330.c | 20 | ||||
-rw-r--r-- | driver/ppc/sn5s330.h | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c index c73182ca81..ef63402b6b 100644 --- a/driver/ppc/sn5s330.c +++ b/driver/ppc/sn5s330.c @@ -329,6 +329,12 @@ static int sn5s330_init(int port) } /* + * Unmask the VCONN ILIM interrupt so we can print VCONN overcurrent + * events. + */ + clr_flags(port, SN5S330_INT_MASK_RISE_REG2, SN5S330_VCONN_ILIM); + + /* * Don't proceed with the rest of initialization if we're sysjumping. * We would have already done this before. */ @@ -664,6 +670,20 @@ static void sn5s330_handle_interrupt(int port) write_reg(port, SN5S330_INT_TRIP_RISE_REG3, rise); write_reg(port, SN5S330_INT_TRIP_FALL_REG3, fall); #endif /* CONFIG_USB_PD_VBUS_DETECT_PPC && CONFIG_USB_CHARGER */ + + /* + * VCONN may be latched off due to an overcurrent. Indicate + * when the VCONN overcurrent happens. + */ + read_reg(port, SN5S330_INT_TRIP_RISE_REG2, &rise); + read_reg(port, SN5S330_INT_TRIP_FALL_REG2, &fall); + + if (rise & SN5S330_VCONN_ILIM) + CPRINTS("ppc p%d: VCONN OC!", port); + + /* Clear the interrupt sources. */ + write_reg(port, SN5S330_INT_TRIP_RISE_REG2, rise); + write_reg(port, SN5S330_INT_TRIP_FALL_REG2, fall); } } diff --git a/driver/ppc/sn5s330.h b/driver/ppc/sn5s330.h index 039fbe68e4..c5b16ea73b 100644 --- a/driver/ppc/sn5s330.h +++ b/driver/ppc/sn5s330.h @@ -136,6 +136,14 @@ enum sn5s330_pp_idx { #define SN5S330_ILIM_PP1_MASK (1 << 4) /* + * INT_MASK_RISE/FALL_EDGE2 + * + * The VCONN_ILIM bit indicates an overcurrent condition on VCONN. By default, + * VCONN will be latched off. + */ +#define SN5S330_VCONN_ILIM (1 << 1) + +/* * INT_MASK_RISE/FALL_EDGE_3 * * The VBUS_GOOD bit indicates VBUS has increased beyond a 4.0V threshold. |