2021-03-24 13:02:56 +00:00
|
|
|
From 2d5ba37461013253d2ff0a3641b727fd32ea97a9 Mon Sep 17 00:00:00 2001
|
2020-02-23 12:20:11 +00:00
|
|
|
From: Florian Fainelli <florian@openwrt.org>
|
2021-03-24 13:02:56 +00:00
|
|
|
Date: Tue, 23 Feb 2021 18:44:53 +0100
|
|
|
|
Subject: [PATCH 1/3] usb: ehci: add spurious flag to disable overcurrent
|
|
|
|
checking
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
2020-02-23 12:20:11 +00:00
|
|
|
|
|
|
|
This patch adds an ignore_oc flag which can be set by EHCI controller
|
|
|
|
not supporting or wanting to disable overcurrent checking. The EHCI
|
|
|
|
platform data in include/linux/usb/ehci_pdriver.h is also augmented to
|
|
|
|
take advantage of this new flag.
|
|
|
|
|
|
|
|
Signed-off-by: Florian Fainelli <florian@openwrt.org>
|
2021-03-24 13:02:56 +00:00
|
|
|
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
|
|
|
Link: https://lore.kernel.org/r/20210223174455.1378-2-noltari@gmail.com
|
|
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
2020-02-23 12:20:11 +00:00
|
|
|
---
|
2021-03-24 13:02:56 +00:00
|
|
|
drivers/usb/host/ehci-hcd.c | 2 +-
|
|
|
|
drivers/usb/host/ehci-hub.c | 4 ++--
|
|
|
|
drivers/usb/host/ehci-platform.c | 2 ++
|
|
|
|
drivers/usb/host/ehci.h | 1 +
|
|
|
|
include/linux/usb/ehci_pdriver.h | 1 +
|
|
|
|
5 files changed, 7 insertions(+), 3 deletions(-)
|
2020-02-23 12:20:11 +00:00
|
|
|
|
|
|
|
--- a/drivers/usb/host/ehci-hcd.c
|
|
|
|
+++ b/drivers/usb/host/ehci-hcd.c
|
kernel: bump 5.4 to 5.4.93
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.
Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800
Compile-tested [*]: ath79/{tiny,generic}, ipq40xx, octeon,
ramips/mt7621, realtek, x86/64
Run-tested [*]: ath79/generic, ipq40xx, octeon, ramips/mt7621
No dmesg regressions, everything functional
Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2021-01-27 14:41:12 +00:00
|
|
|
@@ -651,7 +651,7 @@ static int ehci_run (struct usb_hcd *hcd
|
2020-02-23 12:20:11 +00:00
|
|
|
"USB %x.%x started, EHCI %x.%02x%s\n",
|
|
|
|
((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
|
|
|
|
temp >> 8, temp & 0xff,
|
|
|
|
- ignore_oc ? ", overcurrent ignored" : "");
|
2021-03-24 13:02:56 +00:00
|
|
|
+ (ignore_oc || ehci->spurious_oc) ? ", overcurrent ignored" : "");
|
2020-02-23 12:20:11 +00:00
|
|
|
|
|
|
|
ehci_writel(ehci, INTR_MASK,
|
|
|
|
&ehci->regs->intr_enable); /* Turn On Interrupts */
|
|
|
|
--- a/drivers/usb/host/ehci-hub.c
|
|
|
|
+++ b/drivers/usb/host/ehci-hub.c
|
kernel: bump 5.4 to 5.4.93
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.
Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800
Compile-tested [*]: ath79/{tiny,generic}, ipq40xx, octeon,
ramips/mt7621, realtek, x86/64
Run-tested [*]: ath79/generic, ipq40xx, octeon, ramips/mt7621
No dmesg regressions, everything functional
Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2021-01-27 14:41:12 +00:00
|
|
|
@@ -643,7 +643,7 @@ ehci_hub_status_data (struct usb_hcd *hc
|
2020-02-23 12:20:11 +00:00
|
|
|
* always set, seem to clear PORT_OCC and PORT_CSC when writing to
|
|
|
|
* PORT_POWER; that's surprising, but maybe within-spec.
|
|
|
|
*/
|
|
|
|
- if (!ignore_oc)
|
2021-03-24 13:02:56 +00:00
|
|
|
+ if (!ignore_oc && !ehci->spurious_oc)
|
2020-02-23 12:20:11 +00:00
|
|
|
mask = PORT_CSC | PORT_PEC | PORT_OCC;
|
|
|
|
else
|
|
|
|
mask = PORT_CSC | PORT_PEC;
|
kernel: bump 5.4 to 5.4.93
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.
Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800
Compile-tested [*]: ath79/{tiny,generic}, ipq40xx, octeon,
ramips/mt7621, realtek, x86/64
Run-tested [*]: ath79/generic, ipq40xx, octeon, ramips/mt7621
No dmesg regressions, everything functional
Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2021-01-27 14:41:12 +00:00
|
|
|
@@ -1013,7 +1013,7 @@ int ehci_hub_control(
|
2020-02-23 12:20:11 +00:00
|
|
|
if (temp & PORT_PEC)
|
|
|
|
status |= USB_PORT_STAT_C_ENABLE << 16;
|
|
|
|
|
|
|
|
- if ((temp & PORT_OCC) && !ignore_oc){
|
2021-03-24 13:02:56 +00:00
|
|
|
+ if ((temp & PORT_OCC) && (!ignore_oc && !ehci->spurious_oc)){
|
2020-02-23 12:20:11 +00:00
|
|
|
status |= USB_PORT_STAT_C_OVERCURRENT << 16;
|
|
|
|
|
|
|
|
/*
|
|
|
|
--- a/drivers/usb/host/ehci-platform.c
|
|
|
|
+++ b/drivers/usb/host/ehci-platform.c
|
2020-07-04 13:16:27 +00:00
|
|
|
@@ -319,6 +319,8 @@ static int ehci_platform_probe(struct pl
|
2020-02-23 12:20:11 +00:00
|
|
|
hcd->has_tt = 1;
|
|
|
|
if (pdata->reset_on_resume)
|
|
|
|
priv->reset_on_resume = true;
|
2021-03-24 13:02:56 +00:00
|
|
|
+ if (pdata->spurious_oc)
|
|
|
|
+ ehci->spurious_oc = 1;
|
2020-02-23 12:20:11 +00:00
|
|
|
|
|
|
|
#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
|
|
|
|
if (ehci->big_endian_mmio) {
|
|
|
|
--- a/drivers/usb/host/ehci.h
|
|
|
|
+++ b/drivers/usb/host/ehci.h
|
|
|
|
@@ -218,6 +218,7 @@ struct ehci_hcd { /* one per controlle
|
|
|
|
unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */
|
|
|
|
unsigned need_oc_pp_cycle:1; /* MPC834X port power */
|
|
|
|
unsigned imx28_write_fix:1; /* For Freescale i.MX28 */
|
2021-03-24 13:02:56 +00:00
|
|
|
+ unsigned spurious_oc:1;
|
2020-02-23 12:20:11 +00:00
|
|
|
|
|
|
|
/* required for usb32 quirk */
|
|
|
|
#define OHCI_CTRL_HCFS (3 << 6)
|
|
|
|
--- a/include/linux/usb/ehci_pdriver.h
|
|
|
|
+++ b/include/linux/usb/ehci_pdriver.h
|
|
|
|
@@ -50,6 +50,7 @@ struct usb_ehci_pdata {
|
|
|
|
unsigned no_io_watchdog:1;
|
|
|
|
unsigned reset_on_resume:1;
|
|
|
|
unsigned dma_mask_64:1;
|
2021-03-24 13:02:56 +00:00
|
|
|
+ unsigned spurious_oc:1;
|
2020-02-23 12:20:11 +00:00
|
|
|
|
|
|
|
/* Turn on all power and clocks */
|
|
|
|
int (*power_on)(struct platform_device *pdev);
|