0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From d0ff7a1bcfe886cab1a237895b08ac51ecfe10e7 Mon Sep 17 00:00:00 2001
  2. From: Tim Harvey <[email protected]>
  3. Date: Wed, 10 Apr 2019 08:00:47 -0700
  4. Subject: [PATCH 04/12] PCI: add quirk for Gateworks PLX PEX860x switch with
  5. GPIO PERST#
  6. Gateworks boards use PLX PEX860x switches where downstream ports
  7. have their PERST# driven from the PEX GPIO.
  8. Signed-off-by: Tim Harvey <[email protected]>
  9. ---
  10. drivers/pci/quirks.c | 32 ++++++++++++++++++++++++++++++++
  11. 1 file changed, 32 insertions(+)
  12. --- a/drivers/pci/quirks.c
  13. +++ b/drivers/pci/quirks.c
  14. @@ -25,6 +25,7 @@
  15. #include <linux/ktime.h>
  16. #include <linux/mm.h>
  17. #include <linux/nvme.h>
  18. +#include <linux/of.h>
  19. #include <linux/platform_data/x86/apple.h>
  20. #include <linux/pm_runtime.h>
  21. #include <linux/suspend.h>
  22. @@ -5856,3 +5857,34 @@ static void nvidia_ion_ahci_fixup(struct
  23. pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING;
  24. }
  25. DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup);
  26. +
  27. +#ifdef CONFIG_PCI_HOST_THUNDER_PEM
  28. +/*
  29. + * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High
  30. + * as they are used for slots1-7 PERST#
  31. + */
  32. +static void newport_pciesw_early_fixup(struct pci_dev *dev)
  33. +{
  34. + u32 dw;
  35. +
  36. + if (!of_machine_is_compatible("gw,newport"))
  37. + return;
  38. +
  39. + if (dev->devfn != 0)
  40. + return;
  41. +
  42. + dev_info(&dev->dev, "de-asserting PERST#\n");
  43. + pci_read_config_dword(dev, 0x62c, &dw);
  44. + dw |= 0xaaa8; /* GPIO1-7 outputs */
  45. + pci_write_config_dword(dev, 0x62c, dw);
  46. +
  47. + pci_read_config_dword(dev, 0x644, &dw);
  48. + dw |= 0xfe; /* GPIO1-7 output high */
  49. + pci_write_config_dword(dev, 0x644, dw);
  50. +
  51. + msleep(100);
  52. +}
  53. +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, newport_pciesw_early_fixup);
  54. +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, newport_pciesw_early_fixup);
  55. +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, newport_pciesw_early_fixup);
  56. +#endif /* CONFIG_PCI_HOST_THUNDER_PEM */