Skip to content

Commit 604a39e

Browse files
Hamish Martingregkh
authored andcommitted
usb: ohci: Default to per-port over-current protection
[ Upstream commit b77d2a0 ] Some integrated OHCI controller hubs do not expose all ports of the hub to pins on the SoC. In some cases the unconnected ports generate spurious over-current events. For example the Broadcom 56060/Ranger 2 SoC contains a nominally 3 port hub but only the first port is wired. Default behaviour for ohci-platform driver is to use global over-current protection mode (AKA "ganged"). This leads to the spurious over-current events affecting all ports in the hub. We now alter the default to use per-port over-current protection. This patch results in the following configuration changes depending on quirks: - For quirk OHCI_QUIRK_SUPERIO no changes. These systems remain set up for ganged power switching and no over-current protection. - For quirk OHCI_QUIRK_AMD756 or OHCI_QUIRK_HUB_POWER power switching remains at none, while over-current protection is now guaranteed to be set to per-port rather than the previous behaviour where it was either none or global over-current protection depending on the value at function entry. Suggested-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz> Link: https://lore.kernel.org/r/20200910212512.16670-1-hamish.martin@alliedtelesis.co.nz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2207041 commit 604a39e

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

drivers/usb/host/ohci-hcd.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -673,20 +673,24 @@ static int ohci_run (struct ohci_hcd *ohci)
673673

674674
/* handle root hub init quirks ... */
675675
val = roothub_a (ohci);
676-
val &= ~(RH_A_PSM | RH_A_OCPM);
676+
/* Configure for per-port over-current protection by default */
677+
val &= ~RH_A_NOCP;
678+
val |= RH_A_OCPM;
677679
if (ohci->flags & OHCI_QUIRK_SUPERIO) {
678-
/* NSC 87560 and maybe others */
680+
/* NSC 87560 and maybe others.
681+
* Ganged power switching, no over-current protection.
682+
*/
679683
val |= RH_A_NOCP;
680-
val &= ~(RH_A_POTPGT | RH_A_NPS);
681-
ohci_writel (ohci, val, &ohci->regs->roothub.a);
684+
val &= ~(RH_A_POTPGT | RH_A_NPS | RH_A_PSM | RH_A_OCPM);
682685
} else if ((ohci->flags & OHCI_QUIRK_AMD756) ||
683686
(ohci->flags & OHCI_QUIRK_HUB_POWER)) {
684687
/* hub power always on; required for AMD-756 and some
685-
* Mac platforms. ganged overcurrent reporting, if any.
688+
* Mac platforms.
686689
*/
687690
val |= RH_A_NPS;
688-
ohci_writel (ohci, val, &ohci->regs->roothub.a);
689691
}
692+
ohci_writel(ohci, val, &ohci->regs->roothub.a);
693+
690694
ohci_writel (ohci, RH_HS_LPSC, &ohci->regs->roothub.status);
691695
ohci_writel (ohci, (val & RH_A_NPS) ? 0 : RH_B_PPCM,
692696
&ohci->regs->roothub.b);

0 commit comments

Comments
 (0)