kernel: disable more pci quirks to save space on platforms that don't need them
[openwrt.git] / target / linux / generic / patches-3.6 / 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 @@ -79,6 +79,8 @@
5  #define USB_INTEL_USB3_PSSEN   0xD8
6  #define USB_INTEL_USB3PRM      0xDC
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 @@ -353,6 +355,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 @@ -434,6 +440,10 @@ reset_needed:
25  }
26  EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc);
27  
28 +#endif
29 +
30 +#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
31 +
32  static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
33  {
34         u16 cmd;
35 @@ -971,3 +981,4 @@ static void __devinit quirk_usb_early_ha
36  }
37  DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
38                         PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff);
39 +#endif
40 --- a/drivers/usb/host/pci-quirks.h
41 +++ b/drivers/usb/host/pci-quirks.h
42 @@ -4,18 +4,26 @@
43  #ifdef CONFIG_PCI
44  void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
45  int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
46 +bool usb_is_intel_switchable_xhci(struct pci_dev *pdev);
47 +void usb_enable_xhci_ports(struct pci_dev *xhci_pdev);
48 +void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
49 +#else
50 +static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
51 +#endif  /* CONFIG_PCI */
52 +
53 +#if defined(CONFIG_PCI) && !defined(CONFIG_PCI_DISABLE_COMMON_QUIRKS)
54  int usb_amd_find_chipset_info(void);
55  void usb_amd_dev_put(void);
56  void usb_amd_quirk_pll_disable(void);
57  void usb_amd_quirk_pll_enable(void);
58 -bool usb_is_intel_switchable_xhci(struct pci_dev *pdev);
59 -void usb_enable_xhci_ports(struct pci_dev *xhci_pdev);
60 -void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
61  #else
62 +static inline int usb_amd_find_chipset_info(void)
63 +{
64 +       return 0;
65 +}
66  static inline void usb_amd_quirk_pll_disable(void) {}
67  static inline void usb_amd_quirk_pll_enable(void) {}
68  static inline void usb_amd_dev_put(void) {}
69 -static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
70 -#endif  /* CONFIG_PCI */
71 +#endif
72  
73  #endif  /*  __LINUX_USB_PCI_QUIRKS_H  */