1
0

811-pci_disable_usb_common_quirks.patch 2.8 KB

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