summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hamer <marcel@solidxs.se>2021-04-27 14:21:18 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-19 10:08:30 +0200
commit04904d90a71a6121152a95fc908323807e947e70 (patch)
tree4b42012a1fa8f34f405948697e2f216bef73eff0
parentf78e2c36609b61151b1945c7393facbff3dd1ad6 (diff)
downloadlinux-04904d90a71a6121152a95fc908323807e947e70.tar.gz
linux-04904d90a71a6121152a95fc908323807e947e70.tar.bz2
linux-04904d90a71a6121152a95fc908323807e947e70.zip
usb: dwc3: omap: improve extcon initialization
commit e17b02d4970913233d543c79c9c66e72cac05bdd upstream. When extcon is used in combination with dwc3, it is assumed that the dwc3 registers are untouched and as such are only configured if VBUS is valid or ID is tied to ground. In case VBUS is not valid or ID is floating, the registers are not configured as such during driver initialization, causing a wrong default state during boot. If the registers are not in a default state, because they are for instance touched by a boot loader, this can cause for a kernel error. Signed-off-by: Marcel Hamer <marcel@solidxs.se> Link: https://lore.kernel.org/r/20210427122118.1948340-1-marcel@solidxs.se Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 8c3de2d258bf..e8acad49a53a 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -437,8 +437,13 @@ static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
if (extcon_get_state(edev, EXTCON_USB) == true)
dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
+ else
+ dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF);
+
if (extcon_get_state(edev, EXTCON_USB_HOST) == true)
dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
+ else
+ dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_FLOAT);
omap->edev = edev;
}