apm821xx: add support for the Netgear Centria N900 WNDR4700/WNDR4720
[openwrt/openwrt.git] / target / linux / apm821xx / patches-4.4 / 802-usb-xhci-force-msi-renesas-xhci.patch
1 From a0dc613140bab907a3d5787a7ae7b0638bf674d0 Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@gmail.com>
3 Date: Thu, 23 Jun 2016 20:28:20 +0200
4 Subject: [PATCH] usb: xhci: force MSI for uPD720201 and
5 uPD720202
6
7 The APM82181 does not support MSI-X. When probed, it will
8 produce a noisy warning.
9
10 ---
11 drivers/usb/host/pci-quirks.c | 362 ++++++++++++++++++++++++++++++++++++++++++
12 1 file changed, 362 insertions(+)
13
14 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
15 index 1c4d89e..555bd3f 100644
16 --- a/drivers/usb/host/xhci-pci.c
17 +++ b/drivers/usb/host/xhci-pci.c
18 @@ -172,7 +172,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
19 }
20 if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
21 pdev->device == 0x0015)
22 - xhci->quirks |= XHCI_RESET_ON_RESUME;
23 + xhci->quirks |= XHCI_RESET_ON_RESUME | XHCI_FORCE_MSI;
24 if (pdev->vendor == PCI_VENDOR_ID_VIA)
25 xhci->quirks |= XHCI_RESET_ON_RESUME;
26
27 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
28 index 9e71c96..27cfcb9 100644
29 --- a/drivers/usb/host/xhci.c
30 +++ b/drivers/usb/host/xhci.c
31 @@ -389,10 +389,14 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
32 free_irq(hcd->irq, hcd);
33 hcd->irq = 0;
34
35 - ret = xhci_setup_msix(xhci);
36 - if (ret)
37 - /* fall back to msi*/
38 + if (xhci->quirks & XHCI_FORCE_MSI) {
39 ret = xhci_setup_msi(xhci);
40 + } else {
41 + ret = xhci_setup_msix(xhci);
42 + if (ret)
43 + /* fall back to msi*/
44 + ret = xhci_setup_msi(xhci);
45 + }
46
47 if (!ret)
48 /* hcd->irq is 0, we have MSI */
49 diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
50 index 6b085aa..514dc3f 100644
51 --- a/drivers/usb/host/xhci.h
52 +++ b/drivers/usb/host/xhci.h
53 @@ -1649,3 +1649,4 @@ struct xhci_hcd {
54 #define XHCI_BROKEN_STREAMS (1 << 19)
55 #define XHCI_PME_STUCK_QUIRK (1 << 20)
56 +#define XHCI_FORCE_MSI (1 << 24)
57 unsigned int num_active_eps;