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