mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user