kernel: fix build error in flow offload code with CONFIG_NETFILTER=n
[openwrt/openwrt.git] / target / linux / generic / pending-4.14 / 110-ehci_hcd_ignore_oc.patch
1 From: Florian Fainelli <florian@openwrt.org>
2 Subject: USB: EHCI: add ignore_oc flag to disable overcurrent checking
3
4 This patch adds an ignore_oc flag which can be set by EHCI controller
5 not supporting or wanting to disable overcurrent checking. The EHCI
6 platform data in include/linux/usb/ehci_pdriver.h is also augmented to
7 take advantage of this new flag.
8
9 Signed-off-by: Florian Fainelli <florian@openwrt.org>
10 ---
11 drivers/usb/host/ehci-hcd.c | 2 +-
12 drivers/usb/host/ehci-hub.c | 4 ++--
13 drivers/usb/host/ehci-platform.c | 1 +
14 drivers/usb/host/ehci.h | 1 +
15 include/linux/usb/ehci_pdriver.h | 1 +
16 5 files changed, 6 insertions(+), 3 deletions(-)
17
18 --- a/drivers/usb/host/ehci-hcd.c
19 +++ b/drivers/usb/host/ehci-hcd.c
20 @@ -651,7 +651,7 @@ static int ehci_run (struct usb_hcd *hcd
21 "USB %x.%x started, EHCI %x.%02x%s\n",
22 ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
23 temp >> 8, temp & 0xff,
24 - ignore_oc ? ", overcurrent ignored" : "");
25 + (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : "");
26
27 ehci_writel(ehci, INTR_MASK,
28 &ehci->regs->intr_enable); /* Turn On Interrupts */
29 --- a/drivers/usb/host/ehci-hub.c
30 +++ b/drivers/usb/host/ehci-hub.c
31 @@ -646,7 +646,7 @@ ehci_hub_status_data (struct usb_hcd *hc
32 * always set, seem to clear PORT_OCC and PORT_CSC when writing to
33 * PORT_POWER; that's surprising, but maybe within-spec.
34 */
35 - if (!ignore_oc)
36 + if (!ignore_oc && !ehci->ignore_oc)
37 mask = PORT_CSC | PORT_PEC | PORT_OCC;
38 else
39 mask = PORT_CSC | PORT_PEC;
40 @@ -1016,7 +1016,7 @@ int ehci_hub_control(
41 if (temp & PORT_PEC)
42 status |= USB_PORT_STAT_C_ENABLE << 16;
43
44 - if ((temp & PORT_OCC) && !ignore_oc){
45 + if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){
46 status |= USB_PORT_STAT_C_OVERCURRENT << 16;
47
48 /*
49 --- a/drivers/usb/host/ehci-platform.c
50 +++ b/drivers/usb/host/ehci-platform.c
51 @@ -263,6 +263,8 @@ static int ehci_platform_probe(struct pl
52 hcd->has_tt = 1;
53 if (pdata->reset_on_resume)
54 priv->reset_on_resume = true;
55 + if (pdata->ignore_oc)
56 + ehci->ignore_oc = 1;
57
58 #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
59 if (ehci->big_endian_mmio) {
60 --- a/drivers/usb/host/ehci.h
61 +++ b/drivers/usb/host/ehci.h
62 @@ -231,6 +231,7 @@ struct ehci_hcd { /* one per controlle
63 unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */
64 unsigned need_oc_pp_cycle:1; /* MPC834X port power */
65 unsigned imx28_write_fix:1; /* For Freescale i.MX28 */
66 + unsigned ignore_oc:1;
67
68 /* required for usb32 quirk */
69 #define OHCI_CTRL_HCFS (3 << 6)
70 --- a/include/linux/usb/ehci_pdriver.h
71 +++ b/include/linux/usb/ehci_pdriver.h
72 @@ -49,6 +49,7 @@ struct usb_ehci_pdata {
73 unsigned no_io_watchdog:1;
74 unsigned reset_on_resume:1;
75 unsigned dma_mask_64:1;
76 + unsigned ignore_oc:1;
77
78 /* Turn on all power and clocks */
79 int (*power_on)(struct platform_device *pdev);