300-fix-atheros-nics-on-apm82181.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --- a/arch/powerpc/sysdev/ppc4xx_pci.c
  2. +++ b/arch/powerpc/sysdev/ppc4xx_pci.c
  3. @@ -1066,15 +1066,24 @@ static int __init apm821xx_pciex_init_po
  4. u32 val;
  5. /*
  6. - * Do a software reset on PCIe ports.
  7. - * This code is to fix the issue that pci drivers doesn't re-assign
  8. - * bus number for PCIE devices after Uboot
  9. - * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000
  10. - * PT quad port, SAS LSI 1064E)
  11. + * Only reset the PHY when no link is currently established.
  12. + * This is for the Atheros PCIe board which has problems to establish
  13. + * the link (again) after this PHY reset. All other currently tested
  14. + * PCIe boards don't show this problem.
  15. */
  16. -
  17. - mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0);
  18. - mdelay(10);
  19. + val = mfdcri(SDR0, port->sdr_base + PESDRn_LOOP);
  20. + if (!(val & 0x00001000)) {
  21. + /*
  22. + * Do a software reset on PCIe ports.
  23. + * This code is to fix the issue that pci drivers doesn't re-assign
  24. + * bus number for PCIE devices after Uboot
  25. + * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000
  26. + * PT quad port, SAS LSI 1064E)
  27. + */
  28. +
  29. + mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0);
  30. + mdelay(10);
  31. + }
  32. if (port->endpoint)
  33. val = PTYPE_LEGACY_ENDPOINT << 20;
  34. @@ -1091,9 +1100,12 @@ static int __init apm821xx_pciex_init_po
  35. mtdcri(SDR0, PESDR0_460EX_L0DRV, 0x00000130);
  36. mtdcri(SDR0, PESDR0_460EX_L0CLK, 0x00000006);
  37. - mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000);
  38. - mdelay(50);
  39. - mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000);
  40. + val = mfdcri(SDR0, port->sdr_base + PESDRn_LOOP);
  41. + if (!(val & 0x00001000)) {
  42. + mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000);
  43. + mdelay(50);
  44. + mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000);
  45. + }
  46. mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
  47. mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) |