msp_pci.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /*
  2. * Copyright (c) 2000-2006 PMC-Sierra INC.
  3. *
  4. * This program is free software; you can redistribute it
  5. * and/or modify it under the terms of the GNU General
  6. * Public License as published by the Free Software
  7. * Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be
  11. * useful, but WITHOUT ANY WARRANTY; without even the implied
  12. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. * PURPOSE. See the GNU General Public License for more
  14. * details.
  15. *
  16. * You should have received a copy of the GNU General Public
  17. * License along with this program; if not, write to the Free
  18. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
  19. * 02139, USA.
  20. *
  21. * PMC-SIERRA INC. DISCLAIMS ANY LIABILITY OF ANY KIND
  22. * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
  23. * SOFTWARE.
  24. */
  25. #ifndef _MSP_PCI_H_
  26. #define _MSP_PCI_H_
  27. #define MSP_HAS_PCI(ID) (((u32)(ID) <= 0x4236) && ((u32)(ID) >= 0x4220))
  28. /*
  29. * It is convenient to program the OATRAN register so that
  30. * Athena virtual address space and PCI address space are
  31. * the same. This is not a requirement, just a convenience.
  32. *
  33. * The only hard restrictions on the value of OATRAN is that
  34. * OATRAN must not be programmed to allow translated memory
  35. * addresses to fall within the lowest 512MB of
  36. * PCI address space. This region is hardcoded
  37. * for use as Athena PCI Host Controller target
  38. * access memory space to the Athena's SDRAM.
  39. *
  40. * Note that OATRAN applies only to memory accesses, not
  41. * to I/O accesses.
  42. *
  43. * To program OATRAN to make Athena virtual address space
  44. * and PCI address space have the same values, OATRAN
  45. * is to be programmed to 0xB8000000. The top seven
  46. * bits of the value mimic the seven bits clipped off
  47. * by the PCI Host controller.
  48. *
  49. * With OATRAN at the said value, when the CPU does
  50. * an access to its virtual address at, say 0xB900_5000,
  51. * the address appearing on the PCI bus will be
  52. * 0xB900_5000.
  53. * - Michael Penner
  54. */
  55. #define MSP_PCI_OATRAN 0xB8000000UL
  56. #define MSP_PCI_SPACE_BASE (MSP_PCI_OATRAN + 0x1002000UL)
  57. #define MSP_PCI_SPACE_SIZE (0x3000000UL - 0x2000)
  58. #define MSP_PCI_SPACE_END \
  59. (MSP_PCI_SPACE_BASE + MSP_PCI_SPACE_SIZE - 1)
  60. #define MSP_PCI_IOSPACE_BASE (MSP_PCI_OATRAN + 0x1001000UL)
  61. #define MSP_PCI_IOSPACE_SIZE 0x1000
  62. #define MSP_PCI_IOSPACE_END \
  63. (MSP_PCI_IOSPACE_BASE + MSP_PCI_IOSPACE_SIZE - 1)
  64. /* IRQ for PCI status interrupts */
  65. #define PCI_STAT_IRQ 20
  66. #define QFLUSH_REG_1 0xB7F40000
  67. typedef volatile unsigned int pcireg;
  68. typedef void * volatile ppcireg;
  69. struct pci_block_copy
  70. {
  71. pcireg unused1; /* +0x00 */
  72. pcireg unused2; /* +0x04 */
  73. ppcireg unused3; /* +0x08 */
  74. ppcireg unused4; /* +0x0C */
  75. pcireg unused5; /* +0x10 */
  76. pcireg unused6; /* +0x14 */
  77. pcireg unused7; /* +0x18 */
  78. ppcireg unused8; /* +0x1C */
  79. ppcireg unused9; /* +0x20 */
  80. pcireg unusedA; /* +0x24 */
  81. ppcireg unusedB; /* +0x28 */
  82. ppcireg unusedC; /* +0x2C */
  83. };
  84. enum
  85. {
  86. config_device_vendor, /* 0 */
  87. config_status_command, /* 1 */
  88. config_class_revision, /* 2 */
  89. config_BIST_header_latency_cache, /* 3 */
  90. config_BAR0, /* 4 */
  91. config_BAR1, /* 5 */
  92. config_BAR2, /* 6 */
  93. config_not_used7, /* 7 */
  94. config_not_used8, /* 8 */
  95. config_not_used9, /* 9 */
  96. config_CIS, /* 10 */
  97. config_subsystem, /* 11 */
  98. config_not_used12, /* 12 */
  99. config_capabilities, /* 13 */
  100. config_not_used14, /* 14 */
  101. config_lat_grant_irq, /* 15 */
  102. config_message_control,/* 16 */
  103. config_message_addr, /* 17 */
  104. config_message_data, /* 18 */
  105. config_VPD_addr, /* 19 */
  106. config_VPD_data, /* 20 */
  107. config_maxregs /* 21 - number of registers */
  108. };
  109. struct msp_pci_regs
  110. {
  111. pcireg hop_unused_00; /* +0x00 */
  112. pcireg hop_unused_04; /* +0x04 */
  113. pcireg hop_unused_08; /* +0x08 */
  114. pcireg hop_unused_0C; /* +0x0C */
  115. pcireg hop_unused_10; /* +0x10 */
  116. pcireg hop_unused_14; /* +0x14 */
  117. pcireg hop_unused_18; /* +0x18 */
  118. pcireg hop_unused_1C; /* +0x1C */
  119. pcireg hop_unused_20; /* +0x20 */
  120. pcireg hop_unused_24; /* +0x24 */
  121. pcireg hop_unused_28; /* +0x28 */
  122. pcireg hop_unused_2C; /* +0x2C */
  123. pcireg hop_unused_30; /* +0x30 */
  124. pcireg hop_unused_34; /* +0x34 */
  125. pcireg if_control; /* +0x38 */
  126. pcireg oatran; /* +0x3C */
  127. pcireg reset_ctl; /* +0x40 */
  128. pcireg config_addr; /* +0x44 */
  129. pcireg hop_unused_48; /* +0x48 */
  130. pcireg msg_signaled_int_status; /* +0x4C */
  131. pcireg msg_signaled_int_mask; /* +0x50 */
  132. pcireg if_status; /* +0x54 */
  133. pcireg if_mask; /* +0x58 */
  134. pcireg hop_unused_5C; /* +0x5C */
  135. pcireg hop_unused_60; /* +0x60 */
  136. pcireg hop_unused_64; /* +0x64 */
  137. pcireg hop_unused_68; /* +0x68 */
  138. pcireg hop_unused_6C; /* +0x6C */
  139. pcireg hop_unused_70; /* +0x70 */
  140. struct pci_block_copy pci_bc[2] __attribute__((aligned(64)));
  141. pcireg error_hdr1; /* +0xE0 */
  142. pcireg error_hdr2; /* +0xE4 */
  143. pcireg config[config_maxregs] __attribute__((aligned(256)));
  144. };
  145. #define BPCI_CFGADDR_BUSNUM_SHF 16
  146. #define BPCI_CFGADDR_FUNCTNUM_SHF 8
  147. #define BPCI_CFGADDR_REGNUM_SHF 2
  148. #define BPCI_CFGADDR_ENABLE (1<<31)
  149. #define BPCI_IFCONTROL_RTO (1<<20) /* Retry timeout */
  150. #define BPCI_IFCONTROL_HCE (1<<16) /* Host configuration enable */
  151. #define BPCI_IFCONTROL_CTO_SHF 12 /* Shift count for CTO bits */
  152. #define BPCI_IFCONTROL_SE (1<<5) /* Enable exceptions on errors */
  153. #define BPCI_IFCONTROL_BIST (1<<4) /* Use BIST in per. mode */
  154. #define BPCI_IFCONTROL_CAP (1<<3) /* Enable capabilities */
  155. #define BPCI_IFCONTROL_MMC_SHF 0 /* Shift count for MMC bits */
  156. #define BPCI_IFSTATUS_MGT (1<<8) /* Master Grant timeout */
  157. #define BPCI_IFSTATUS_MTT (1<<9) /* Master TRDY timeout */
  158. #define BPCI_IFSTATUS_MRT (1<<10) /* Master retry timeout */
  159. #define BPCI_IFSTATUS_BC0F (1<<13) /* Block copy 0 fault */
  160. #define BPCI_IFSTATUS_BC1F (1<<14) /* Block copy 1 fault */
  161. #define BPCI_IFSTATUS_PCIU (1<<15) /* PCI unable to respond */
  162. #define BPCI_IFSTATUS_BSIZ (1<<16) /* PCI access with illegal size */
  163. #define BPCI_IFSTATUS_BADD (1<<17) /* PCI access with illegal addr */
  164. #define BPCI_IFSTATUS_RTO (1<<18) /* Retry time out */
  165. #define BPCI_IFSTATUS_SER (1<<19) /* System error */
  166. #define BPCI_IFSTATUS_PER (1<<20) /* Parity error */
  167. #define BPCI_IFSTATUS_LCA (1<<21) /* Local CPU abort */
  168. #define BPCI_IFSTATUS_MEM (1<<22) /* Memory prot. violation */
  169. #define BPCI_IFSTATUS_ARB (1<<23) /* Arbiter timed out */
  170. #define BPCI_IFSTATUS_STA (1<<27) /* Signaled target abort */
  171. #define BPCI_IFSTATUS_TA (1<<28) /* Target abort */
  172. #define BPCI_IFSTATUS_MA (1<<29) /* Master abort */
  173. #define BPCI_IFSTATUS_PEI (1<<30) /* Parity error as initiator */
  174. #define BPCI_IFSTATUS_PET (1<<31) /* Parity error as target */
  175. #define BPCI_RESETCTL_PR (1<<0) /* True if reset asserted */
  176. #define BPCI_RESETCTL_RT (1<<4) /* Release time */
  177. #define BPCI_RESETCTL_CT (1<<8) /* Config time */
  178. #define BPCI_RESETCTL_PE (1<<12) /* PCI enabled */
  179. #define BPCI_RESETCTL_HM (1<<13) /* PCI host mode */
  180. #define BPCI_RESETCTL_RI (1<<14) /* PCI reset in */
  181. extern struct msp_pci_regs msp_pci_regs
  182. __attribute__((section(".register")));
  183. extern unsigned long msp_pci_config_space
  184. __attribute__((section(".register")));
  185. #endif /* !_MSP_PCI_H_ */