ramips: fix cd-poll sd card remove randomly
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-4.9 / 110-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 @@ -651,7 +651,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 @@ -638,7 +638,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 @@ -1008,7 +1008,7 @@ 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 @@ -259,6 +259,8 @@ static int ehci_platform_probe(struct pl
55 hcd->has_tt = 1;
56 if (pdata->reset_on_resume)
57 priv->reset_on_resume = true;
58 + if (pdata->ignore_oc)
59 + ehci->ignore_oc = 1;
60
61 #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
62 if (ehci->big_endian_mmio) {
63 --- a/drivers/usb/host/ehci.h
64 +++ b/drivers/usb/host/ehci.h
65 @@ -230,6 +230,7 @@ struct ehci_hcd { /* one per controlle
66 unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */
67 unsigned need_oc_pp_cycle:1; /* MPC834X port power */
68 unsigned imx28_write_fix:1; /* For Freescale i.MX28 */
69 + unsigned ignore_oc:1;
70
71 /* required for usb32 quirk */
72 #define OHCI_CTRL_HCFS (3 << 6)
73 --- a/include/linux/usb/ehci_pdriver.h
74 +++ b/include/linux/usb/ehci_pdriver.h
75 @@ -49,6 +49,7 @@ struct usb_ehci_pdata {
76 unsigned no_io_watchdog:1;
77 unsigned reset_on_resume:1;
78 unsigned dma_mask_64:1;
79 + unsigned ignore_oc:1;
80
81 /* Turn on all power and clocks */
82 int (*power_on)(struct platform_device *pdev);