ramips: fix cd-poll sd card remove randomly
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-4.9 / 811-pci_disable_usb_common_quirks.patch
1
2 --- a/drivers/usb/host/pci-quirks.c
3 +++ b/drivers/usb/host/pci-quirks.c
4 @@ -106,6 +106,8 @@ struct amd_chipset_type {
5 u8 rev;
6 };
7
8 +#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
9 +
10 static struct amd_chipset_info {
11 struct pci_dev *nb_dev;
12 struct pci_dev *smbus_dev;
13 @@ -503,6 +505,10 @@ void usb_amd_dev_put(void)
14 }
15 EXPORT_SYMBOL_GPL(usb_amd_dev_put);
16
17 +#endif /* CONFIG_PCI_DISABLE_COMMON_QUIRKS */
18 +
19 +#if IS_ENABLED(CONFIG_USB_UHCI_HCD)
20 +
21 /*
22 * Make sure the controller is completely inactive, unable to
23 * generate interrupts or do DMA.
24 @@ -582,8 +588,17 @@ reset_needed:
25 uhci_reset_hc(pdev, base);
26 return 1;
27 }
28 +#else
29 +int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base)
30 +{
31 + return 0;
32 +}
33 +
34 +#endif
35 EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc);
36
37 +#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
38 +
39 static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
40 {
41 u16 cmd;
42 @@ -1150,3 +1165,4 @@ static void quirk_usb_early_handoff(stru
43 }
44 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
45 PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff);
46 +#endif
47 --- a/drivers/usb/host/pci-quirks.h
48 +++ b/drivers/usb/host/pci-quirks.h
49 @@ -4,6 +4,9 @@
50 #ifdef CONFIG_PCI
51 void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
52 int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
53 +#endif /* CONFIG_PCI */
54 +
55 +#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS)
56 int usb_amd_find_chipset_info(void);
57 int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev);
58 bool usb_amd_hang_symptom_quirk(void);
59 @@ -17,12 +20,25 @@ void usb_disable_xhci_ports(struct pci_d
60 void sb800_prefetch(struct device *dev, int on);
61 #else
62 struct pci_dev;
63 +static inline int usb_amd_find_chipset_info(void)
64 +{
65 + return 0;
66 +}
67 +static inline bool usb_amd_hang_symptom_quirk(void)
68 +{
69 + return false;
70 +}
71 +static inline bool usb_amd_prefetch_quirk(void)
72 +{
73 + return false;
74 +}
75 static inline void usb_amd_quirk_pll_disable(void) {}
76 static inline void usb_amd_quirk_pll_enable(void) {}
77 static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
78 static inline void usb_amd_dev_put(void) {}
79 static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
80 static inline void sb800_prefetch(struct device *dev, int on) {}
81 -#endif /* CONFIG_PCI */
82 +static inline void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) {}
83 +#endif
84
85 #endif /* __LINUX_USB_PCI_QUIRKS_H */
86 --- a/include/linux/usb/hcd.h
87 +++ b/include/linux/usb/hcd.h
88 @@ -461,7 +461,14 @@ extern int usb_hcd_pci_probe(struct pci_
89 extern void usb_hcd_pci_remove(struct pci_dev *dev);
90 extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
91
92 +#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
93 extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
94 +#else
95 +static inline int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev)
96 +{
97 + return 0;
98 +}
99 +#endif
100
101 #ifdef CONFIG_PM
102 extern const struct dev_pm_ops usb_hcd_pci_pm_ops;