summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorRong Chang <rongchang@chromium.org>2017-05-11 17:10:49 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-13 02:51:44 -0800
commitd6c836b4dacdce0f3279ac56d92e7cfd92fdf967 (patch)
tree199909af723b2a0e8154da250e0a635a8b5df5c7 /driver
parent7866056f7f40592817d544954a8ba2132b834334 (diff)
downloadchrome-ec-d6c836b4dacdce0f3279ac56d92e7cfd92fdf967.tar.gz
pi3usb9281: sync USB switch hardware control with switch state
When sysjump to another image, if USB switch state and HW switch control are not sychronized, the switch can be left in open state. This CL resets USB switch on init to close USB. BRANCH=oak BUG=b:36234142 TEST=manual plug BC1.2 charger, sysjump to another EC image and unplug the chager. check pi3usb9281 control register(02h) bit2 == 1. Change-Id: Iaadfaf51064ed1508271e974b9caf88b96bbe008 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/502835 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/bc12/pi3usb9281.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/driver/bc12/pi3usb9281.c b/driver/bc12/pi3usb9281.c
index d89021e53c..b99be31d18 100644
--- a/driver/bc12/pi3usb9281.c
+++ b/driver/bc12/pi3usb9281.c
@@ -41,6 +41,8 @@
static int usb_switch_state[CONFIG_USB_PD_PORT_COUNT];
static struct mutex usb_switch_lock[CONFIG_USB_PD_PORT_COUNT];
+static int pi3usb9281_reset(int port);
+
static void select_chip(int port)
{
struct pi3usb9281_config *chip = &pi3usb9281_chips[port];
@@ -146,6 +148,7 @@ void pi3usb9281_init(int port)
if (dev_id != PI3USB9281_DEV_ID && dev_id != PI3USB9281_DEV_ID_A)
CPRINTS("PI3USB9281 invalid ID 0x%02x", dev_id);
+ pi3usb9281_reset(port);
pi3usb9281_set_interrupt_mask(port, 0xff);
pi3usb9281_enable_interrupts(port);
}