aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS10
-rw-r--r--drivers/usb/dwc2/core.c14
-rw-r--r--drivers/usb/dwc2/platform.c8
-rw-r--r--drivers/usb/dwc3/gadget.c1
-rw-r--r--drivers/usb/host/xhci-ext-caps.h4
-rw-r--r--drivers/usb/host/xhci-mtk-sch.c16
-rw-r--r--drivers/usb/host/xhci-mtk.c23
-rw-r--r--drivers/usb/host/xhci-pci.c56
-rw-r--r--drivers/usb/host/xhci-plat.c3
-rw-r--r--drivers/usb/host/xhci-ring.c10
-rw-r--r--drivers/usb/host/xhci.c4
-rw-r--r--drivers/usb/host/xhci.h1
-rw-r--r--drivers/usb/musb/ux500.c7
-rw-r--r--drivers/usb/phy/phy-msm-usb.c37
-rw-r--r--drivers/usb/phy/phy-mxs-usb.c2
15 files changed, 131 insertions, 65 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 02a94eb64b52..7f1fa4ff300a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3450,7 +3450,7 @@ S: Maintained
3450F: drivers/usb/dwc2/ 3450F: drivers/usb/dwc2/
3451 3451
3452DESIGNWARE USB3 DRD IP DRIVER 3452DESIGNWARE USB3 DRD IP DRIVER
3453M: Felipe Balbi <balbi@ti.com> 3453M: Felipe Balbi <balbi@kernel.org>
3454L: linux-usb@vger.kernel.org 3454L: linux-usb@vger.kernel.org
3455L: linux-omap@vger.kernel.org 3455L: linux-omap@vger.kernel.org
3456T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 3456T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
@@ -7362,7 +7362,7 @@ F: drivers/tty/isicom.c
7362F: include/linux/isicom.h 7362F: include/linux/isicom.h
7363 7363
7364MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER 7364MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
7365M: Felipe Balbi <balbi@ti.com> 7365M: Felipe Balbi <balbi@kernel.org>
7366L: linux-usb@vger.kernel.org 7366L: linux-usb@vger.kernel.org
7367T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 7367T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
7368S: Maintained 7368S: Maintained
@@ -7931,7 +7931,7 @@ F: drivers/media/platform/omap3isp/
7931F: drivers/staging/media/omap4iss/ 7931F: drivers/staging/media/omap4iss/
7932 7932
7933OMAP USB SUPPORT 7933OMAP USB SUPPORT
7934M: Felipe Balbi <balbi@ti.com> 7934M: Felipe Balbi <balbi@kernel.org>
7935L: linux-usb@vger.kernel.org 7935L: linux-usb@vger.kernel.org
7936L: linux-omap@vger.kernel.org 7936L: linux-omap@vger.kernel.org
7937T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 7937T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
@@ -11314,7 +11314,7 @@ F: Documentation/usb/ehci.txt
11314F: drivers/usb/host/ehci* 11314F: drivers/usb/host/ehci*
11315 11315
11316USB GADGET/PERIPHERAL SUBSYSTEM 11316USB GADGET/PERIPHERAL SUBSYSTEM
11317M: Felipe Balbi <balbi@ti.com> 11317M: Felipe Balbi <balbi@kernel.org>
11318L: linux-usb@vger.kernel.org 11318L: linux-usb@vger.kernel.org
11319W: http://www.linux-usb.org/gadget 11319W: http://www.linux-usb.org/gadget
11320T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 11320T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
@@ -11390,7 +11390,7 @@ S: Maintained
11390F: drivers/net/usb/pegasus.* 11390F: drivers/net/usb/pegasus.*
11391 11391
11392USB PHY LAYER 11392USB PHY LAYER
11393M: Felipe Balbi <balbi@ti.com> 11393M: Felipe Balbi <balbi@kernel.org>
11394L: linux-usb@vger.kernel.org 11394L: linux-usb@vger.kernel.org
11395T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 11395T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
11396S: Maintained 11396S: Maintained
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index 39a0fa8a4c0a..e991d55914db 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -572,12 +572,6 @@ static bool dwc2_force_mode(struct dwc2_hsotg *hsotg, bool host)
572 set = host ? GUSBCFG_FORCEHOSTMODE : GUSBCFG_FORCEDEVMODE; 572 set = host ? GUSBCFG_FORCEHOSTMODE : GUSBCFG_FORCEDEVMODE;
573 clear = host ? GUSBCFG_FORCEDEVMODE : GUSBCFG_FORCEHOSTMODE; 573 clear = host ? GUSBCFG_FORCEDEVMODE : GUSBCFG_FORCEHOSTMODE;
574 574
575 /*
576 * If the force mode bit is already set, don't set it.
577 */
578 if ((gusbcfg & set) && !(gusbcfg & clear))
579 return false;
580
581 gusbcfg &= ~clear; 575 gusbcfg &= ~clear;
582 gusbcfg |= set; 576 gusbcfg |= set;
583 dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG); 577 dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
@@ -3278,9 +3272,6 @@ static void dwc2_get_dev_hwparams(struct dwc2_hsotg *hsotg)
3278/** 3272/**
3279 * During device initialization, read various hardware configuration 3273 * During device initialization, read various hardware configuration
3280 * registers and interpret the contents. 3274 * registers and interpret the contents.
3281 *
3282 * This should be called during driver probe. It will perform a core
3283 * soft reset in order to get the reset values of the parameters.
3284 */ 3275 */
3285int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) 3276int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
3286{ 3277{
@@ -3288,7 +3279,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
3288 unsigned width; 3279 unsigned width;
3289 u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4; 3280 u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4;
3290 u32 grxfsiz; 3281 u32 grxfsiz;
3291 int retval;
3292 3282
3293 /* 3283 /*
3294 * Attempt to ensure this device is really a DWC_otg Controller. 3284 * Attempt to ensure this device is really a DWC_otg Controller.
@@ -3308,10 +3298,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
3308 hw->snpsid >> 12 & 0xf, hw->snpsid >> 8 & 0xf, 3298 hw->snpsid >> 12 & 0xf, hw->snpsid >> 8 & 0xf,
3309 hw->snpsid >> 4 & 0xf, hw->snpsid & 0xf, hw->snpsid); 3299 hw->snpsid >> 4 & 0xf, hw->snpsid & 0xf, hw->snpsid);
3310 3300
3311 retval = dwc2_core_reset(hsotg);
3312 if (retval)
3313 return retval;
3314
3315 hwcfg1 = dwc2_readl(hsotg->regs + GHWCFG1); 3301 hwcfg1 = dwc2_readl(hsotg->regs + GHWCFG1);
3316 hwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2); 3302 hwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2);
3317 hwcfg3 = dwc2_readl(hsotg->regs + GHWCFG3); 3303 hwcfg3 = dwc2_readl(hsotg->regs + GHWCFG3);
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 510f787434b3..690b9fd98b55 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -530,7 +530,13 @@ static int dwc2_driver_probe(struct platform_device *dev)
530 if (retval) 530 if (retval)
531 return retval; 531 return retval;
532 532
533 /* Reset the controller and detect hardware config values */ 533 /*
534 * Reset before dwc2_get_hwparams() then it could get power-on real
535 * reset value form registers.
536 */
537 dwc2_core_reset_and_force_dr_mode(hsotg);
538
539 /* Detect config values from hardware */
534 retval = dwc2_get_hwparams(hsotg); 540 retval = dwc2_get_hwparams(hsotg);
535 if (retval) 541 if (retval)
536 goto error; 542 goto error;
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index af023a81a0b0..7d1dd82a95ac 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2789,6 +2789,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)
2789 dwc->gadget.speed = USB_SPEED_UNKNOWN; 2789 dwc->gadget.speed = USB_SPEED_UNKNOWN;
2790 dwc->gadget.sg_supported = true; 2790 dwc->gadget.sg_supported = true;
2791 dwc->gadget.name = "dwc3-gadget"; 2791 dwc->gadget.name = "dwc3-gadget";
2792 dwc->gadget.is_otg = dwc->dr_mode == USB_DR_MODE_OTG;
2792 2793
2793 /* 2794 /*
2794 * FIXME We might be setting max_speed to <SUPER, however versions 2795 * FIXME We might be setting max_speed to <SUPER, however versions
diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h
index 04ce6b156b35..e0244fb3903d 100644
--- a/drivers/usb/host/xhci-ext-caps.h
+++ b/drivers/usb/host/xhci-ext-caps.h
@@ -112,12 +112,16 @@ static inline int xhci_find_next_ext_cap(void __iomem *base, u32 start, int id)
112 offset = start; 112 offset = start;
113 if (!start || start == XHCI_HCC_PARAMS_OFFSET) { 113 if (!start || start == XHCI_HCC_PARAMS_OFFSET) {
114 val = readl(base + XHCI_HCC_PARAMS_OFFSET); 114 val = readl(base + XHCI_HCC_PARAMS_OFFSET);
115 if (val == ~0)
116 return 0;
115 offset = XHCI_HCC_EXT_CAPS(val) << 2; 117 offset = XHCI_HCC_EXT_CAPS(val) << 2;
116 if (!offset) 118 if (!offset)
117 return 0; 119 return 0;
118 }; 120 };
119 do { 121 do {
120 val = readl(base + offset); 122 val = readl(base + offset);
123 if (val == ~0)
124 return 0;
121 if (XHCI_EXT_CAPS_ID(val) == id && offset != start) 125 if (XHCI_EXT_CAPS_ID(val) == id && offset != start)
122 return offset; 126 return offset;
123 127
diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index c30de7c39f44..73f763c4f5f5 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -275,8 +275,9 @@ static bool need_bw_sch(struct usb_host_endpoint *ep,
275 return false; 275 return false;
276 276
277 /* 277 /*
278 * for LS & FS periodic endpoints which its device don't attach 278 * for LS & FS periodic endpoints which its device is not behind
279 * to TT are also ignored, root-hub will schedule them directly 279 * a TT are also ignored, root-hub will schedule them directly,
280 * but need set @bpkts field of endpoint context to 1.
280 */ 281 */
281 if (is_fs_or_ls(speed) && !has_tt) 282 if (is_fs_or_ls(speed) && !has_tt)
282 return false; 283 return false;
@@ -339,8 +340,17 @@ int xhci_mtk_add_ep_quirk(struct usb_hcd *hcd, struct usb_device *udev,
339 GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc)), 340 GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc)),
340 usb_endpoint_dir_in(&ep->desc), ep); 341 usb_endpoint_dir_in(&ep->desc), ep);
341 342
342 if (!need_bw_sch(ep, udev->speed, slot_ctx->tt_info & TT_SLOT)) 343 if (!need_bw_sch(ep, udev->speed, slot_ctx->tt_info & TT_SLOT)) {
344 /*
345 * set @bpkts to 1 if it is LS or FS periodic endpoint, and its
346 * device does not connected through an external HS hub
347 */
348 if (usb_endpoint_xfer_int(&ep->desc)
349 || usb_endpoint_xfer_isoc(&ep->desc))
350 ep_ctx->reserved[0] |= cpu_to_le32(EP_BPKTS(1));
351
343 return 0; 352 return 0;
353 }
344 354
345 bw_index = get_bw_index(xhci, udev, ep); 355 bw_index = get_bw_index(xhci, udev, ep);
346 sch_bw = &sch_array[bw_index]; 356 sch_bw = &sch_array[bw_index];
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index c9ab6a44c34a..9532f5aef71b 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -696,9 +696,24 @@ static int xhci_mtk_remove(struct platform_device *dev)
696} 696}
697 697
698#ifdef CONFIG_PM_SLEEP 698#ifdef CONFIG_PM_SLEEP
699/*
700 * if ip sleep fails, and all clocks are disabled, access register will hang
701 * AHB bus, so stop polling roothubs to avoid regs access on bus suspend.
702 * and no need to check whether ip sleep failed or not; this will cause SPM
703 * to wake up system immediately after system suspend complete if ip sleep
704 * fails, it is what we wanted.
705 */
699static int xhci_mtk_suspend(struct device *dev) 706static int xhci_mtk_suspend(struct device *dev)
700{ 707{
701 struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev); 708 struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
709 struct usb_hcd *hcd = mtk->hcd;
710 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
711
712 xhci_dbg(xhci, "%s: stop port polling\n", __func__);
713 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
714 del_timer_sync(&hcd->rh_timer);
715 clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
716 del_timer_sync(&xhci->shared_hcd->rh_timer);
702 717
703 xhci_mtk_host_disable(mtk); 718 xhci_mtk_host_disable(mtk);
704 xhci_mtk_phy_power_off(mtk); 719 xhci_mtk_phy_power_off(mtk);
@@ -710,11 +725,19 @@ static int xhci_mtk_suspend(struct device *dev)
710static int xhci_mtk_resume(struct device *dev) 725static int xhci_mtk_resume(struct device *dev)
711{ 726{
712 struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev); 727 struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
728 struct usb_hcd *hcd = mtk->hcd;
729 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
713 730
714 usb_wakeup_disable(mtk); 731 usb_wakeup_disable(mtk);
715 xhci_mtk_clks_enable(mtk); 732 xhci_mtk_clks_enable(mtk);
716 xhci_mtk_phy_power_on(mtk); 733 xhci_mtk_phy_power_on(mtk);
717 xhci_mtk_host_enable(mtk); 734 xhci_mtk_host_enable(mtk);
735
736 xhci_dbg(xhci, "%s: restart port polling\n", __func__);
737 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
738 usb_hcd_poll_rh_status(hcd);
739 set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
740 usb_hcd_poll_rh_status(xhci->shared_hcd);
718 return 0; 741 return 0;
719} 742}
720 743
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 58c43ed7ff3b..f0640b7a1c42 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -28,7 +28,9 @@
28#include "xhci.h" 28#include "xhci.h"
29#include "xhci-trace.h" 29#include "xhci-trace.h"
30 30
31#define PORT2_SSIC_CONFIG_REG2 0x883c 31#define SSIC_PORT_NUM 2
32#define SSIC_PORT_CFG2 0x880c
33#define SSIC_PORT_CFG2_OFFSET 0x30
32#define PROG_DONE (1 << 30) 34#define PROG_DONE (1 << 30)
33#define SSIC_PORT_UNUSED (1 << 31) 35#define SSIC_PORT_UNUSED (1 << 31)
34 36
@@ -45,6 +47,7 @@
45#define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5 47#define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5
46#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f 48#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f
47#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f 49#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f
50#define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8
48 51
49static const char hcd_name[] = "xhci_hcd"; 52static const char hcd_name[] = "xhci_hcd";
50 53
@@ -151,9 +154,14 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
151 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 154 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
152 (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || 155 (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
153 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || 156 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
154 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI)) { 157 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
158 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI)) {
155 xhci->quirks |= XHCI_PME_STUCK_QUIRK; 159 xhci->quirks |= XHCI_PME_STUCK_QUIRK;
156 } 160 }
161 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
162 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) {
163 xhci->quirks |= XHCI_SSIC_PORT_UNUSED;
164 }
157 if (pdev->vendor == PCI_VENDOR_ID_ETRON && 165 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
158 pdev->device == PCI_DEVICE_ID_EJ168) { 166 pdev->device == PCI_DEVICE_ID_EJ168) {
159 xhci->quirks |= XHCI_RESET_ON_RESUME; 167 xhci->quirks |= XHCI_RESET_ON_RESUME;
@@ -312,22 +320,20 @@ static void xhci_pci_remove(struct pci_dev *dev)
312 * SSIC PORT need to be marked as "unused" before putting xHCI 320 * SSIC PORT need to be marked as "unused" before putting xHCI
313 * into D3. After D3 exit, the SSIC port need to be marked as "used". 321 * into D3. After D3 exit, the SSIC port need to be marked as "used".
314 * Without this change, xHCI might not enter D3 state. 322 * Without this change, xHCI might not enter D3 state.
315 * Make sure PME works on some Intel xHCI controllers by writing 1 to clear
316 * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4
317 */ 323 */
318static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend) 324static void xhci_ssic_port_unused_quirk(struct usb_hcd *hcd, bool suspend)
319{ 325{
320 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 326 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
321 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
322 u32 val; 327 u32 val;
323 void __iomem *reg; 328 void __iomem *reg;
329 int i;
324 330
325 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 331 for (i = 0; i < SSIC_PORT_NUM; i++) {
326 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI) { 332 reg = (void __iomem *) xhci->cap_regs +
327 333 SSIC_PORT_CFG2 +
328 reg = (void __iomem *) xhci->cap_regs + PORT2_SSIC_CONFIG_REG2; 334 i * SSIC_PORT_CFG2_OFFSET;
329 335
330 /* Notify SSIC that SSIC profile programming is not done */ 336 /* Notify SSIC that SSIC profile programming is not done. */
331 val = readl(reg) & ~PROG_DONE; 337 val = readl(reg) & ~PROG_DONE;
332 writel(val, reg); 338 writel(val, reg);
333 339
@@ -344,6 +350,17 @@ static void xhci_pme_quirk(struct usb_hcd *hcd, bool suspend)
344 writel(val, reg); 350 writel(val, reg);
345 readl(reg); 351 readl(reg);
346 } 352 }
353}
354
355/*
356 * Make sure PME works on some Intel xHCI controllers by writing 1 to clear
357 * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4
358 */
359static void xhci_pme_quirk(struct usb_hcd *hcd)
360{
361 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
362 void __iomem *reg;
363 u32 val;
347 364
348 reg = (void __iomem *) xhci->cap_regs + 0x80a4; 365 reg = (void __iomem *) xhci->cap_regs + 0x80a4;
349 val = readl(reg); 366 val = readl(reg);
@@ -355,6 +372,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
355{ 372{
356 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 373 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
357 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 374 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
375 int ret;
358 376
359 /* 377 /*
360 * Systems with the TI redriver that loses port status change events 378 * Systems with the TI redriver that loses port status change events
@@ -364,9 +382,16 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
364 pdev->no_d3cold = true; 382 pdev->no_d3cold = true;
365 383
366 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) 384 if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
367 xhci_pme_quirk(hcd, true); 385 xhci_pme_quirk(hcd);
386
387 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED)
388 xhci_ssic_port_unused_quirk(hcd, true);
368 389
369 return xhci_suspend(xhci, do_wakeup); 390 ret = xhci_suspend(xhci, do_wakeup);
391 if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED))
392 xhci_ssic_port_unused_quirk(hcd, false);
393
394 return ret;
370} 395}
371 396
372static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) 397static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
@@ -396,8 +421,11 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
396 if (pdev->vendor == PCI_VENDOR_ID_INTEL) 421 if (pdev->vendor == PCI_VENDOR_ID_INTEL)
397 usb_enable_intel_xhci_ports(pdev); 422 usb_enable_intel_xhci_ports(pdev);
398 423
424 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED)
425 xhci_ssic_port_unused_quirk(hcd, false);
426
399 if (xhci->quirks & XHCI_PME_STUCK_QUIRK) 427 if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
400 xhci_pme_quirk(hcd, false); 428 xhci_pme_quirk(hcd);
401 429
402 retval = xhci_resume(xhci, hibernated); 430 retval = xhci_resume(xhci, hibernated);
403 return retval; 431 return retval;
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 770b6b088797..d39d6bf1d090 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -184,7 +184,8 @@ static int xhci_plat_probe(struct platform_device *pdev)
184 struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); 184 struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
185 185
186 /* Just copy data for now */ 186 /* Just copy data for now */
187 *priv = *priv_match; 187 if (priv_match)
188 *priv = *priv_match;
188 } 189 }
189 190
190 if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_MARVELL_ARMADA)) { 191 if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_MARVELL_ARMADA)) {
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index f1c21c40b4a6..3915657e6078 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2193,10 +2193,6 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
2193 } 2193 }
2194 /* Fast path - was this the last TRB in the TD for this URB? */ 2194 /* Fast path - was this the last TRB in the TD for this URB? */
2195 } else if (event_trb == td->last_trb) { 2195 } else if (event_trb == td->last_trb) {
2196 if (td->urb_length_set && trb_comp_code == COMP_SHORT_TX)
2197 return finish_td(xhci, td, event_trb, event, ep,
2198 status, false);
2199
2200 if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { 2196 if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
2201 td->urb->actual_length = 2197 td->urb->actual_length =
2202 td->urb->transfer_buffer_length - 2198 td->urb->transfer_buffer_length -
@@ -2248,12 +2244,6 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
2248 td->urb->actual_length += 2244 td->urb->actual_length +=
2249 TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) - 2245 TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) -
2250 EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); 2246 EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));
2251
2252 if (trb_comp_code == COMP_SHORT_TX) {
2253 xhci_dbg(xhci, "mid bulk/intr SP, wait for last TRB event\n");
2254 td->urb_length_set = true;
2255 return 0;
2256 }
2257 } 2247 }
2258 2248
2259 return finish_td(xhci, td, event_trb, event, ep, status, false); 2249 return finish_td(xhci, td, event_trb, event, ep, status, false);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 26a44c0e969e..0c8087d3c313 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1554,7 +1554,9 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
1554 xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, 1554 xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
1555 "HW died, freeing TD."); 1555 "HW died, freeing TD.");
1556 urb_priv = urb->hcpriv; 1556 urb_priv = urb->hcpriv;
1557 for (i = urb_priv->td_cnt; i < urb_priv->length; i++) { 1557 for (i = urb_priv->td_cnt;
1558 i < urb_priv->length && xhci->devs[urb->dev->slot_id];
1559 i++) {
1558 td = urb_priv->td[i]; 1560 td = urb_priv->td[i];
1559 if (!list_empty(&td->td_list)) 1561 if (!list_empty(&td->td_list))
1560 list_del_init(&td->td_list); 1562 list_del_init(&td->td_list);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 9be7348872ba..cc651383ce5a 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1631,6 +1631,7 @@ struct xhci_hcd {
1631#define XHCI_BROKEN_STREAMS (1 << 19) 1631#define XHCI_BROKEN_STREAMS (1 << 19)
1632#define XHCI_PME_STUCK_QUIRK (1 << 20) 1632#define XHCI_PME_STUCK_QUIRK (1 << 20)
1633#define XHCI_MTK_HOST (1 << 21) 1633#define XHCI_MTK_HOST (1 << 21)
1634#define XHCI_SSIC_PORT_UNUSED (1 << 22)
1634 unsigned int num_active_eps; 1635 unsigned int num_active_eps;
1635 unsigned int limit_active_eps; 1636 unsigned int limit_active_eps;
1636 /* There are two roothubs to keep track of bus suspend info for */ 1637 /* There are two roothubs to keep track of bus suspend info for */
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index b2685e75a683..3eaa4ba6867d 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -348,7 +348,9 @@ static int ux500_suspend(struct device *dev)
348 struct ux500_glue *glue = dev_get_drvdata(dev); 348 struct ux500_glue *glue = dev_get_drvdata(dev);
349 struct musb *musb = glue_to_musb(glue); 349 struct musb *musb = glue_to_musb(glue);
350 350
351 usb_phy_set_suspend(musb->xceiv, 1); 351 if (musb)
352 usb_phy_set_suspend(musb->xceiv, 1);
353
352 clk_disable_unprepare(glue->clk); 354 clk_disable_unprepare(glue->clk);
353 355
354 return 0; 356 return 0;
@@ -366,7 +368,8 @@ static int ux500_resume(struct device *dev)
366 return ret; 368 return ret;
367 } 369 }
368 370
369 usb_phy_set_suspend(musb->xceiv, 0); 371 if (musb)
372 usb_phy_set_suspend(musb->xceiv, 0);
370 373
371 return 0; 374 return 0;
372} 375}
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 0d19a6d61a71..970a30e155cb 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1599,6 +1599,8 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
1599 &motg->id.nb); 1599 &motg->id.nb);
1600 if (ret < 0) { 1600 if (ret < 0) {
1601 dev_err(&pdev->dev, "register ID notifier failed\n"); 1601 dev_err(&pdev->dev, "register ID notifier failed\n");
1602 extcon_unregister_notifier(motg->vbus.extcon,
1603 EXTCON_USB, &motg->vbus.nb);
1602 return ret; 1604 return ret;
1603 } 1605 }
1604 1606
@@ -1660,15 +1662,6 @@ static int msm_otg_probe(struct platform_device *pdev)
1660 if (!motg) 1662 if (!motg)
1661 return -ENOMEM; 1663 return -ENOMEM;
1662 1664
1663 pdata = dev_get_platdata(&pdev->dev);
1664 if (!pdata) {
1665 if (!np)
1666 return -ENXIO;
1667 ret = msm_otg_read_dt(pdev, motg);
1668 if (ret)
1669 return ret;
1670 }
1671
1672 motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), 1665 motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
1673 GFP_KERNEL); 1666 GFP_KERNEL);
1674 if (!motg->phy.otg) 1667 if (!motg->phy.otg)
@@ -1710,6 +1703,15 @@ static int msm_otg_probe(struct platform_device *pdev)
1710 if (!motg->regs) 1703 if (!motg->regs)
1711 return -ENOMEM; 1704 return -ENOMEM;
1712 1705
1706 pdata = dev_get_platdata(&pdev->dev);
1707 if (!pdata) {
1708 if (!np)
1709 return -ENXIO;
1710 ret = msm_otg_read_dt(pdev, motg);
1711 if (ret)
1712 return ret;
1713 }
1714
1713 /* 1715 /*
1714 * NOTE: The PHYs can be multiplexed between the chipidea controller 1716 * NOTE: The PHYs can be multiplexed between the chipidea controller
1715 * and the dwc3 controller, using a single bit. It is important that 1717 * and the dwc3 controller, using a single bit. It is important that
@@ -1717,8 +1719,10 @@ static int msm_otg_probe(struct platform_device *pdev)
1717 */ 1719 */
1718 if (motg->phy_number) { 1720 if (motg->phy_number) {
1719 phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4); 1721 phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4);
1720 if (!phy_select) 1722 if (!phy_select) {
1721 return -ENOMEM; 1723 ret = -ENOMEM;
1724 goto unregister_extcon;
1725 }
1722 /* Enable second PHY with the OTG port */ 1726 /* Enable second PHY with the OTG port */
1723 writel(0x1, phy_select); 1727 writel(0x1, phy_select);
1724 } 1728 }
@@ -1728,7 +1732,8 @@ static int msm_otg_probe(struct platform_device *pdev)
1728 motg->irq = platform_get_irq(pdev, 0); 1732 motg->irq = platform_get_irq(pdev, 0);
1729 if (motg->irq < 0) { 1733 if (motg->irq < 0) {
1730 dev_err(&pdev->dev, "platform_get_irq failed\n"); 1734 dev_err(&pdev->dev, "platform_get_irq failed\n");
1731 return motg->irq; 1735 ret = motg->irq;
1736 goto unregister_extcon;
1732 } 1737 }
1733 1738
1734 regs[0].supply = "vddcx"; 1739 regs[0].supply = "vddcx";
@@ -1737,7 +1742,7 @@ static int msm_otg_probe(struct platform_device *pdev)
1737 1742
1738 ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs); 1743 ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs);
1739 if (ret) 1744 if (ret)
1740 return ret; 1745 goto unregister_extcon;
1741 1746
1742 motg->vddcx = regs[0].consumer; 1747 motg->vddcx = regs[0].consumer;
1743 motg->v3p3 = regs[1].consumer; 1748 motg->v3p3 = regs[1].consumer;
@@ -1834,6 +1839,12 @@ disable_clks:
1834 clk_disable_unprepare(motg->clk); 1839 clk_disable_unprepare(motg->clk);
1835 if (!IS_ERR(motg->core_clk)) 1840 if (!IS_ERR(motg->core_clk))
1836 clk_disable_unprepare(motg->core_clk); 1841 clk_disable_unprepare(motg->core_clk);
1842unregister_extcon:
1843 extcon_unregister_notifier(motg->id.extcon,
1844 EXTCON_USB_HOST, &motg->id.nb);
1845 extcon_unregister_notifier(motg->vbus.extcon,
1846 EXTCON_USB, &motg->vbus.nb);
1847
1837 return ret; 1848 return ret;
1838} 1849}
1839 1850
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index c2936dc48ca7..00bfea01be65 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -220,7 +220,7 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
220/* Return true if the vbus is there */ 220/* Return true if the vbus is there */
221static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy) 221static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy)
222{ 222{
223 unsigned int vbus_value; 223 unsigned int vbus_value = 0;
224 224
225 if (!mxs_phy->regmap_anatop) 225 if (!mxs_phy->regmap_anatop)
226 return false; 226 return false;