036-MIPS-ath79-add-PCI-controller-registration-code-for-.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. From bc14333054c5ecee4bc7e8760d0ffbb730f32c54 Mon Sep 17 00:00:00 2001
  2. From: Gabor Juhos <[email protected]>
  3. Date: Fri, 15 Feb 2013 13:38:23 +0000
  4. Subject: [PATCH] MIPS: ath79: add PCI controller registration code for the
  5. QCA955X SoCs
  6. commit 0a5f3b1c9f20eb44142e3b37662de15c944f759d upstream.
  7. Add SoC specific PCI IRQ map, and register platform
  8. devices for the two built-in PCIe RCs.
  9. Cc: Rodriguez, Luis <[email protected]>
  10. Cc: Giori, Kathy <[email protected]>
  11. Cc: QCA Linux Team <[email protected]>
  12. Signed-off-by: Gabor Juhos <[email protected]>
  13. Patchwork: http://patchwork.linux-mips.org/patch/4951/
  14. Signed-off-by: John Crispin <[email protected]>
  15. ---
  16. arch/mips/ath79/Kconfig | 2 ++
  17. arch/mips/ath79/pci.c | 36 ++++++++++++++++++++++++
  18. arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 13 +++++++++
  19. 3 files changed, 51 insertions(+)
  20. --- a/arch/mips/ath79/Kconfig
  21. +++ b/arch/mips/ath79/Kconfig
  22. @@ -90,6 +90,8 @@ config SOC_AR934X
  23. config SOC_QCA955X
  24. select USB_ARCH_HAS_EHCI
  25. + select HW_HAS_PCI
  26. + select PCI_AR724X if PCI
  27. def_bool n
  28. config PCI_AR724X
  29. --- a/arch/mips/ath79/pci.c
  30. +++ b/arch/mips/ath79/pci.c
  31. @@ -49,6 +49,21 @@ static const struct ath79_pci_irq ar724x
  32. }
  33. };
  34. +static const struct ath79_pci_irq qca955x_pci_irq_map[] __initconst = {
  35. + {
  36. + .bus = 0,
  37. + .slot = 0,
  38. + .pin = 1,
  39. + .irq = ATH79_PCI_IRQ(0),
  40. + },
  41. + {
  42. + .bus = 1,
  43. + .slot = 0,
  44. + .pin = 1,
  45. + .irq = ATH79_PCI_IRQ(1),
  46. + },
  47. +};
  48. +
  49. int __init pcibios_map_irq(const struct pci_dev *dev, uint8_t slot, uint8_t pin)
  50. {
  51. int irq = -1;
  52. @@ -64,6 +79,9 @@ int __init pcibios_map_irq(const struct
  53. soc_is_ar9344()) {
  54. ath79_pci_irq_map = ar724x_pci_irq_map;
  55. ath79_pci_nr_irqs = ARRAY_SIZE(ar724x_pci_irq_map);
  56. + } else if (soc_is_qca955x()) {
  57. + ath79_pci_irq_map = qca955x_pci_irq_map;
  58. + ath79_pci_nr_irqs = ARRAY_SIZE(qca955x_pci_irq_map);
  59. } else {
  60. pr_crit("pci %s: invalid irq map\n",
  61. pci_name((struct pci_dev *) dev));
  62. @@ -225,6 +243,24 @@ int __init ath79_register_pci(void)
  63. AR724X_PCI_MEM_SIZE,
  64. 0,
  65. ATH79_IP2_IRQ(0));
  66. + } else if (soc_is_qca9558()) {
  67. + pdev = ath79_register_pci_ar724x(0,
  68. + QCA955X_PCI_CFG_BASE0,
  69. + QCA955X_PCI_CTRL_BASE0,
  70. + QCA955X_PCI_CRP_BASE0,
  71. + QCA955X_PCI_MEM_BASE0,
  72. + QCA955X_PCI_MEM_SIZE,
  73. + 0,
  74. + ATH79_IP2_IRQ(0));
  75. +
  76. + pdev = ath79_register_pci_ar724x(1,
  77. + QCA955X_PCI_CFG_BASE1,
  78. + QCA955X_PCI_CTRL_BASE1,
  79. + QCA955X_PCI_CRP_BASE1,
  80. + QCA955X_PCI_MEM_BASE1,
  81. + QCA955X_PCI_MEM_SIZE,
  82. + 1,
  83. + ATH79_IP3_IRQ(2));
  84. } else {
  85. /* No PCI support */
  86. return -ENODEV;
  87. --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  88. +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
  89. @@ -94,6 +94,19 @@
  90. #define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
  91. #define AR934X_SRIF_SIZE 0x1000
  92. +#define QCA955X_PCI_MEM_BASE0 0x10000000
  93. +#define QCA955X_PCI_MEM_BASE1 0x12000000
  94. +#define QCA955X_PCI_MEM_SIZE 0x02000000
  95. +#define QCA955X_PCI_CFG_BASE0 0x14000000
  96. +#define QCA955X_PCI_CFG_BASE1 0x16000000
  97. +#define QCA955X_PCI_CFG_SIZE 0x1000
  98. +#define QCA955X_PCI_CRP_BASE0 (AR71XX_APB_BASE + 0x000c0000)
  99. +#define QCA955X_PCI_CRP_BASE1 (AR71XX_APB_BASE + 0x00250000)
  100. +#define QCA955X_PCI_CRP_SIZE 0x1000
  101. +#define QCA955X_PCI_CTRL_BASE0 (AR71XX_APB_BASE + 0x000f0000)
  102. +#define QCA955X_PCI_CTRL_BASE1 (AR71XX_APB_BASE + 0x00280000)
  103. +#define QCA955X_PCI_CTRL_SIZE 0x100
  104. +
  105. #define QCA955X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
  106. #define QCA955X_WMAC_SIZE 0x20000