tx4927pcic.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * include/asm-mips/txx9/tx4927pcic.h
  3. * TX4927 PCI controller definitions.
  4. *
  5. * This file is subject to the terms and conditions of the GNU General Public
  6. * License. See the file "COPYING" in the main directory of this archive
  7. * for more details.
  8. */
  9. #ifndef __ASM_TXX9_TX4927PCIC_H
  10. #define __ASM_TXX9_TX4927PCIC_H
  11. #include <linux/pci.h>
  12. #include <linux/irqreturn.h>
  13. struct tx4927_pcic_reg {
  14. u32 pciid;
  15. u32 pcistatus;
  16. u32 pciccrev;
  17. u32 pcicfg1;
  18. u32 p2gm0plbase; /* +10 */
  19. u32 p2gm0pubase;
  20. u32 p2gm1plbase;
  21. u32 p2gm1pubase;
  22. u32 p2gm2pbase; /* +20 */
  23. u32 p2giopbase;
  24. u32 unused0;
  25. u32 pcisid;
  26. u32 unused1; /* +30 */
  27. u32 pcicapptr;
  28. u32 unused2;
  29. u32 pcicfg2;
  30. u32 g2ptocnt; /* +40 */
  31. u32 unused3[15];
  32. u32 g2pstatus; /* +80 */
  33. u32 g2pmask;
  34. u32 pcisstatus;
  35. u32 pcimask;
  36. u32 p2gcfg; /* +90 */
  37. u32 p2gstatus;
  38. u32 p2gmask;
  39. u32 p2gccmd;
  40. u32 unused4[24]; /* +a0 */
  41. u32 pbareqport; /* +100 */
  42. u32 pbacfg;
  43. u32 pbastatus;
  44. u32 pbamask;
  45. u32 pbabm; /* +110 */
  46. u32 pbacreq;
  47. u32 pbacgnt;
  48. u32 pbacstate;
  49. u64 g2pmgbase[3]; /* +120 */
  50. u64 g2piogbase;
  51. u32 g2pmmask[3]; /* +140 */
  52. u32 g2piomask;
  53. u64 g2pmpbase[3]; /* +150 */
  54. u64 g2piopbase;
  55. u32 pciccfg; /* +170 */
  56. u32 pcicstatus;
  57. u32 pcicmask;
  58. u32 unused5;
  59. u64 p2gmgbase[3]; /* +180 */
  60. u64 p2giogbase;
  61. u32 g2pcfgadrs; /* +1a0 */
  62. u32 g2pcfgdata;
  63. u32 unused6[8];
  64. u32 g2pintack;
  65. u32 g2pspc;
  66. u32 unused7[12]; /* +1d0 */
  67. u64 pdmca; /* +200 */
  68. u64 pdmga;
  69. u64 pdmpa;
  70. u64 pdmctr;
  71. u64 pdmcfg; /* +220 */
  72. u64 pdmsts;
  73. };
  74. /* bits for PCICMD */
  75. /* see PCI_COMMAND_XXX in linux/pci_regs.h */
  76. /* bits for PCISTAT */
  77. /* see PCI_STATUS_XXX in linux/pci_regs.h */
  78. /* bits for IOBA/MBA */
  79. /* see PCI_BASE_ADDRESS_XXX in linux/pci_regs.h */
  80. /* bits for G2PSTATUS/G2PMASK */
  81. #define TX4927_PCIC_G2PSTATUS_ALL 0x00000003
  82. #define TX4927_PCIC_G2PSTATUS_TTOE 0x00000002
  83. #define TX4927_PCIC_G2PSTATUS_RTOE 0x00000001
  84. /* bits for PCIMASK (see also PCI_STATUS_XXX in linux/pci_regs.h */
  85. #define TX4927_PCIC_PCISTATUS_ALL 0x0000f900
  86. /* bits for PBACFG */
  87. #define TX4927_PCIC_PBACFG_FIXPA 0x00000008
  88. #define TX4927_PCIC_PBACFG_RPBA 0x00000004
  89. #define TX4927_PCIC_PBACFG_PBAEN 0x00000002
  90. #define TX4927_PCIC_PBACFG_BMCEN 0x00000001
  91. /* bits for PBASTATUS/PBAMASK */
  92. #define TX4927_PCIC_PBASTATUS_ALL 0x00000001
  93. #define TX4927_PCIC_PBASTATUS_BM 0x00000001
  94. /* bits for G2PMnGBASE */
  95. #define TX4927_PCIC_G2PMnGBASE_BSDIS 0x0000002000000000ULL
  96. #define TX4927_PCIC_G2PMnGBASE_ECHG 0x0000001000000000ULL
  97. /* bits for G2PIOGBASE */
  98. #define TX4927_PCIC_G2PIOGBASE_BSDIS 0x0000002000000000ULL
  99. #define TX4927_PCIC_G2PIOGBASE_ECHG 0x0000001000000000ULL
  100. /* bits for PCICSTATUS/PCICMASK */
  101. #define TX4927_PCIC_PCICSTATUS_ALL 0x000007b8
  102. #define TX4927_PCIC_PCICSTATUS_PME 0x00000400
  103. #define TX4927_PCIC_PCICSTATUS_TLB 0x00000200
  104. #define TX4927_PCIC_PCICSTATUS_NIB 0x00000100
  105. #define TX4927_PCIC_PCICSTATUS_ZIB 0x00000080
  106. #define TX4927_PCIC_PCICSTATUS_PERR 0x00000020
  107. #define TX4927_PCIC_PCICSTATUS_SERR 0x00000010
  108. #define TX4927_PCIC_PCICSTATUS_GBE 0x00000008
  109. #define TX4927_PCIC_PCICSTATUS_IWB 0x00000002
  110. #define TX4927_PCIC_PCICSTATUS_E2PDONE 0x00000001
  111. /* bits for PCICCFG */
  112. #define TX4927_PCIC_PCICCFG_GBWC_MASK 0x0fff0000
  113. #define TX4927_PCIC_PCICCFG_HRST 0x00000800
  114. #define TX4927_PCIC_PCICCFG_SRST 0x00000400
  115. #define TX4927_PCIC_PCICCFG_IRBER 0x00000200
  116. #define TX4927_PCIC_PCICCFG_G2PMEN(ch) (0x00000100>>(ch))
  117. #define TX4927_PCIC_PCICCFG_G2PM0EN 0x00000100
  118. #define TX4927_PCIC_PCICCFG_G2PM1EN 0x00000080
  119. #define TX4927_PCIC_PCICCFG_G2PM2EN 0x00000040
  120. #define TX4927_PCIC_PCICCFG_G2PIOEN 0x00000020
  121. #define TX4927_PCIC_PCICCFG_TCAR 0x00000010
  122. #define TX4927_PCIC_PCICCFG_ICAEN 0x00000008
  123. /* bits for P2GMnGBASE */
  124. #define TX4927_PCIC_P2GMnGBASE_TMEMEN 0x0000004000000000ULL
  125. #define TX4927_PCIC_P2GMnGBASE_TBSDIS 0x0000002000000000ULL
  126. #define TX4927_PCIC_P2GMnGBASE_TECHG 0x0000001000000000ULL
  127. /* bits for P2GIOGBASE */
  128. #define TX4927_PCIC_P2GIOGBASE_TIOEN 0x0000004000000000ULL
  129. #define TX4927_PCIC_P2GIOGBASE_TBSDIS 0x0000002000000000ULL
  130. #define TX4927_PCIC_P2GIOGBASE_TECHG 0x0000001000000000ULL
  131. #define TX4927_PCIC_IDSEL_AD_TO_SLOT(ad) ((ad) - 11)
  132. #define TX4927_PCIC_MAX_DEVNU TX4927_PCIC_IDSEL_AD_TO_SLOT(32)
  133. /* bits for PDMCFG */
  134. #define TX4927_PCIC_PDMCFG_RSTFIFO 0x00200000
  135. #define TX4927_PCIC_PDMCFG_EXFER 0x00100000
  136. #define TX4927_PCIC_PDMCFG_REQDLY_MASK 0x00003800
  137. #define TX4927_PCIC_PDMCFG_REQDLY_NONE (0 << 11)
  138. #define TX4927_PCIC_PDMCFG_REQDLY_16 (1 << 11)
  139. #define TX4927_PCIC_PDMCFG_REQDLY_32 (2 << 11)
  140. #define TX4927_PCIC_PDMCFG_REQDLY_64 (3 << 11)
  141. #define TX4927_PCIC_PDMCFG_REQDLY_128 (4 << 11)
  142. #define TX4927_PCIC_PDMCFG_REQDLY_256 (5 << 11)
  143. #define TX4927_PCIC_PDMCFG_REQDLY_512 (6 << 11)
  144. #define TX4927_PCIC_PDMCFG_REQDLY_1024 (7 << 11)
  145. #define TX4927_PCIC_PDMCFG_ERRIE 0x00000400
  146. #define TX4927_PCIC_PDMCFG_NCCMPIE 0x00000200
  147. #define TX4927_PCIC_PDMCFG_NTCMPIE 0x00000100
  148. #define TX4927_PCIC_PDMCFG_CHNEN 0x00000080
  149. #define TX4927_PCIC_PDMCFG_XFRACT 0x00000040
  150. #define TX4927_PCIC_PDMCFG_BSWAP 0x00000020
  151. #define TX4927_PCIC_PDMCFG_XFRSIZE_MASK 0x0000000c
  152. #define TX4927_PCIC_PDMCFG_XFRSIZE_1DW 0x00000000
  153. #define TX4927_PCIC_PDMCFG_XFRSIZE_1QW 0x00000004
  154. #define TX4927_PCIC_PDMCFG_XFRSIZE_4QW 0x00000008
  155. #define TX4927_PCIC_PDMCFG_XFRDIRC 0x00000002
  156. #define TX4927_PCIC_PDMCFG_CHRST 0x00000001
  157. /* bits for PDMSTS */
  158. #define TX4927_PCIC_PDMSTS_REQCNT_MASK 0x3f000000
  159. #define TX4927_PCIC_PDMSTS_FIFOCNT_MASK 0x00f00000
  160. #define TX4927_PCIC_PDMSTS_FIFOWP_MASK 0x000c0000
  161. #define TX4927_PCIC_PDMSTS_FIFORP_MASK 0x00030000
  162. #define TX4927_PCIC_PDMSTS_ERRINT 0x00000800
  163. #define TX4927_PCIC_PDMSTS_DONEINT 0x00000400
  164. #define TX4927_PCIC_PDMSTS_CHNEN 0x00000200
  165. #define TX4927_PCIC_PDMSTS_XFRACT 0x00000100
  166. #define TX4927_PCIC_PDMSTS_ACCMP 0x00000080
  167. #define TX4927_PCIC_PDMSTS_NCCMP 0x00000040
  168. #define TX4927_PCIC_PDMSTS_NTCMP 0x00000020
  169. #define TX4927_PCIC_PDMSTS_CFGERR 0x00000008
  170. #define TX4927_PCIC_PDMSTS_PCIERR 0x00000004
  171. #define TX4927_PCIC_PDMSTS_CHNERR 0x00000002
  172. #define TX4927_PCIC_PDMSTS_DATAERR 0x00000001
  173. #define TX4927_PCIC_PDMSTS_ALL_CMP 0x000000e0
  174. #define TX4927_PCIC_PDMSTS_ALL_ERR 0x0000000f
  175. struct tx4927_pcic_reg __iomem *get_tx4927_pcicptr(
  176. struct pci_controller *channel);
  177. void tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
  178. struct pci_controller *channel, int extarb);
  179. void tx4927_report_pcic_status(void);
  180. char *tx4927_pcibios_setup(char *str);
  181. void tx4927_dump_pcic_settings(void);
  182. irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id);
  183. #endif /* __ASM_TXX9_TX4927PCIC_H */