1
0

953-qca955x-pci-reset-fixes.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. --- a/arch/mips/ath79/common.c
  2. +++ b/arch/mips/ath79/common.c
  3. @@ -153,6 +153,24 @@ void ath79_device_reset_clear(u32 mask)
  4. }
  5. EXPORT_SYMBOL_GPL(ath79_device_reset_clear);
  6. +void ath79_device_reset2_clear(u32 mask)
  7. +{
  8. + unsigned long flags;
  9. + u32 reg;
  10. + u32 t;
  11. +
  12. + if (soc_is_qca955x())
  13. + reg = QCA955X_RESET_REG_RESET2_MODULE;
  14. + else
  15. + panic("Reset register not defined for this SOC");
  16. +
  17. + spin_lock_irqsave(&ath79_device_reset_lock, flags);
  18. + t = ath79_reset_rr(reg);
  19. + ath79_reset_wr(reg, t & ~mask);
  20. + spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
  21. +}
  22. +EXPORT_SYMBOL_GPL(ath79_device_reset2_clear);
  23. +
  24. u32 ath79_device_reset_get(u32 mask)
  25. {
  26. unsigned long flags;
  27. --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  28. +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  29. @@ -411,6 +411,7 @@
  30. #define QCA955X_PLL_CPU_CONFIG_REG 0x00
  31. #define QCA955X_PLL_DDR_CONFIG_REG 0x04
  32. #define QCA955X_PLL_CLK_CTRL_REG 0x08
  33. +#define QCA955X_PLL_PCIE_CONFIG_REG 0x0c
  34. #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28
  35. #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
  36. #define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c
  37. @@ -565,6 +566,7 @@
  38. #define QCA953X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac
  39. #define QCA955X_RESET_REG_RESET_MODULE 0x1c
  40. +#define QCA955X_RESET_REG_RESET2_MODULE 0xc4
  41. #define QCA955X_RESET_REG_BOOTSTRAP 0xb0
  42. #define QCA955X_RESET_REG_EXT_INT_STATUS 0xac
  43. --- a/arch/mips/include/asm/mach-ath79/ath79.h
  44. +++ b/arch/mips/include/asm/mach-ath79/ath79.h
  45. @@ -178,6 +178,7 @@ static inline u32 ath79_reset_rr(unsigne
  46. void ath79_device_reset_set(u32 mask);
  47. void ath79_device_reset_clear(u32 mask);
  48. +void ath79_device_reset2_clear(u32 mask);
  49. u32 ath79_device_reset_get(u32 mask);
  50. void ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3);
  51. --- a/arch/mips/pci/pci-ar724x.c
  52. +++ b/arch/mips/pci/pci-ar724x.c
  53. @@ -335,18 +335,37 @@ static void ar724x_pci_hw_init(struct ar
  54. int wait = 0;
  55. /* deassert PCIe host controller and PCIe PHY reset */
  56. - ath79_device_reset_clear(AR724X_RESET_PCIE);
  57. - ath79_device_reset_clear(AR724X_RESET_PCIE_PHY);
  58. + if (soc_is_qca955x()) {
  59. + ath79_device_reset_clear(QCA955X_RESET_PCIE);
  60. + mdelay(10);
  61. + ath79_device_reset_clear(QCA955X_RESET_PCIE_PHY);
  62. + mdelay(10);
  63. + ath79_device_reset2_clear(QCA955X_RESET_PCIE);
  64. + mdelay(10);
  65. + ath79_device_reset2_clear(QCA955X_RESET_PCIE_PHY);
  66. + mdelay(10);
  67. + } else {
  68. + ath79_device_reset_clear(AR724X_RESET_PCIE);
  69. + ath79_device_reset_clear(AR724X_RESET_PCIE_PHY);
  70. + }
  71. /* remove the reset of the PCIE PLL */
  72. - ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG);
  73. - ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET;
  74. - ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl);
  75. + if (!soc_is_qca955x()) {
  76. + ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG);
  77. + ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET;
  78. + ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl);
  79. + }
  80. /* deassert bypass for the PCIE PLL */
  81. - ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG);
  82. - ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS;
  83. - ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl);
  84. + if (soc_is_qca955x()) {
  85. + ppl = ath79_pll_rr(QCA955X_PLL_PCIE_CONFIG_REG);
  86. + ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS;
  87. + ath79_pll_wr(QCA955X_PLL_PCIE_CONFIG_REG, ppl);
  88. + } else {
  89. + ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG);
  90. + ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS;
  91. + ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl);
  92. + }
  93. /* set PCIE Application Control to ready */
  94. app = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_APP);
  95. @@ -422,8 +441,14 @@ static int ar724x_pci_probe(struct platf
  96. * Do the full PCIE Root Complex Initialization Sequence if the PCIe
  97. * host controller is in reset.
  98. */
  99. - if (ath79_reset_rr(AR724X_RESET_REG_RESET_MODULE) & AR724X_RESET_PCIE)
  100. - ar724x_pci_hw_init(apc);
  101. + if (soc_is_qca955x()) {
  102. + if (ath79_reset_rr(QCA955X_RESET_REG_RESET_MODULE) & QCA955X_RESET_PCIE ||
  103. + ath79_reset_rr(QCA955X_RESET_REG_RESET2_MODULE) & QCA955X_RESET_PCIE)
  104. + ar724x_pci_hw_init(apc);
  105. + } else {
  106. + if (ath79_reset_rr(AR724X_RESET_REG_RESET_MODULE) & AR724X_RESET_PCIE)
  107. + ar724x_pci_hw_init(apc);
  108. + }
  109. apc->link_up = ar724x_pci_check_link(apc);
  110. if (!apc->link_up)