diff options
author | Edward Hill <ecgh@chromium.org> | 2018-02-08 11:52:50 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-02-09 16:07:10 -0800 |
commit | c1252e71caec72f53ec4443f7cdbe95d682b3dcc (patch) | |
tree | 98621e581f242339211c83e7ade6bcd09e3d3d79 /driver/ppc/sn5s330.c | |
parent | 01cee655ab1eb2cf5271a1d578074a3252430ea0 (diff) | |
download | chrome-ec-c1252e71caec72f53ec4443f7cdbe95d682b3dcc.tar.gz |
sn5s330: Disable vSafe0V interrupts
Turn off vSafe0V interrupts. They were not being handled or
cleared causing the interrupt line to be stuck low after
unplugging a USB device.
Also don't use read-modify-write for INT_STATUS_REG4 since
this would clear the dead battery mode bit before it has
been checked.
BUG=b:73076662
BRANCH=none
TEST=unplug USB device, see USB_C1_SWCTL_INT_ODL=1
TEST=USB2 mouse can be connected multiple times, PPC VBUS
detection works, BC1.2 chip turns on and off correctly
(USB_C1_BC12_VBUS_ON_L).
Change-Id: I96980ee330dd6e5f98e447e5e87f11dd60768a5d
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/909549
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/ppc/sn5s330.c')
-rw-r--r-- | driver/ppc/sn5s330.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c index 90f90528ef..25fa7ae022 100644 --- a/driver/ppc/sn5s330.c +++ b/driver/ppc/sn5s330.c @@ -309,14 +309,12 @@ static int sn5s330_init(int port) if (system_jumped_to_this_image()) return EC_SUCCESS; - /* Clear the digital reset bit. */ - status = i2c_read8(i2c_port, i2c_addr, SN5S330_INT_STATUS_REG4, - ®val); - if (status) { - CPRINTS("Failed to read INT_STATUS_REG4!"); - return status; - } - regval |= SN5S330_DIG_RES; + /* + * Clear the digital reset bit, and mask off and clear vSafe0V + * interrupts. Leave the dead battery mode bit unchanged since it + * is checked below. + */ + regval = SN5S330_DIG_RES | SN5S330_VSAFE0V_MASK; status = i2c_write8(i2c_port, i2c_addr, SN5S330_INT_STATUS_REG4, regval); if (status) { @@ -409,9 +407,12 @@ static int sn5s330_init(int port) } if (regval & SN5S330_DB_BOOT) { - /* Clear the bit. */ + /* + * Clear the bit by writing 1 and keep vSafe0V_MASK + * unchanged. + */ i2c_write8(i2c_port, i2c_addr, SN5S330_INT_STATUS_REG4, - SN5S330_DB_BOOT); + regval); /* Turn on PP2 FET. */ status = sn5s330_pp_fet_enable(port, SN5S330_PP2, 1); |