ixp425pci.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. * IXP PCI Init
  3. * (C) Copyright 2004 eslab.whut.edu.cn
  4. * Yue Hu(huyue_whut@yahoo.com.cn), Ligong Xue(lgxue@hotmail.com)
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #ifndef _IXP425PCI_H
  9. #define _IXP425PCI_H
  10. #define OK 0
  11. #define ERROR -1
  12. struct pci_controller;
  13. extern void pci_ixp_init(struct pci_controller *hose);
  14. /* Mask definitions*/
  15. #define IXP425_PCI_BOTTOM_NIBBLE_OF_LONG_MASK 0x0000000f
  16. #define PCI_NP_CBE_BESL (4)
  17. #define PCI_NP_AD_FUNCSL (8)
  18. /*Register addressing definitions for PCI controller configuration
  19. and status registers*/
  20. #define PCI_CSR_BASE (0xC0000000)
  21. /*
  22. #define PCI_NP_AD_OFFSET (0x00)
  23. #define PCI_NP_CBE_OFFSET (0x04)
  24. #define PCI_NP_WDATA_OFFSET (0x08)
  25. #define PCI_NP_RDATA_OFFSET (0x0C)
  26. #define PCI_CRP_OFFSET (0x10)
  27. #define PCI_CRP_WDATA_OFFSET (0x14)
  28. #define PCI_CRP_RDATA_OFFSET (0x18)
  29. #define PCI_CSR_OFFSET (0x1C)
  30. #define PCI_ISR_OFFSET (0x20)
  31. #define PCI_INTEN_OFFSET (0x24)
  32. #define PCI_DMACTRL_OFFSET (0x28)
  33. #define PCI_AHBMEMBASE_OFFSET (0x2C)
  34. #define PCI_AHBIOBASE_OFFSET (0x30)
  35. #define PCI_PCIMEMBASE_OFFSET (0x34)
  36. #define PCI_AHBDOORBELL_OFFSET (0x38)
  37. #define PCI_PCIDOORBELL_OFFSET (0x3C)
  38. #define PCI_ATPDMA0_AHBADDR (0x40)
  39. #define PCI_ATPDMA0_PCIADDR (0x44)
  40. #define PCI_ATPDMA0_LENADDR (0x48)
  41. #define PCI_ATPDMA1_AHBADDR (0x4C)
  42. #define PCI_ATPDMA1_PCIADDR (0x50)
  43. #define PCI_ATPDMA1_LENADDR (0x54)
  44. #define PCI_PTADMA0_AHBADDR (0x58)
  45. #define PCI_PTADMA0_PCIADDR (0x5C)
  46. #define PCI_PTADMA0_LENADDR (0x60)
  47. #define PCI_PTADMA1_AHBADDR (0x64)
  48. #define PCI_PTADMA1_PCIADDR (0x68)
  49. #define PCI_PTADMA1_LENADDR (0x6C)
  50. */
  51. /*Non prefetch registers bit definitions*/
  52. /*
  53. #define NP_CMD_INTACK (0x0)
  54. #define NP_CMD_SPECIAL (0x1)
  55. #define NP_CMD_IOREAD (0x2)
  56. #define NP_CMD_IOWRITE (0x3)
  57. #define NP_CMD_MEMREAD (0x6)
  58. #define NP_CMD_MEMWRITE (0x7)
  59. #define NP_CMD_CONFIGREAD (0xa)
  60. #define NP_CMD_CONFIGWRITE (0xb)
  61. */
  62. /*Configuration Port register bit definitions*/
  63. #define PCI_CRP_WRITE BIT(16)
  64. /*ISR (Interrupt status) Register bit definitions*/
  65. #define PCI_ISR_PSE BIT(0)
  66. #define PCI_ISR_PFE BIT(1)
  67. #define PCI_ISR_PPE BIT(2)
  68. #define PCI_ISR_AHBE BIT(3)
  69. #define PCI_ISR_APDC BIT(4)
  70. #define PCI_ISR_PADC BIT(5)
  71. #define PCI_ISR_ADB BIT(6)
  72. #define PCI_ISR_PDB BIT(7)
  73. /*INTEN (Interrupt Enable) Register bit definitions*/
  74. #define PCI_INTEN_PSE BIT(0)
  75. #define PCI_INTEN_PFE BIT(1)
  76. #define PCI_INTEN_PPE BIT(2)
  77. #define PCI_INTEN_AHBE BIT(3)
  78. #define PCI_INTEN_APDC BIT(4)
  79. #define PCI_INTEN_PADC BIT(5)
  80. #define PCI_INTEN_ADB BIT(6)
  81. #define PCI_INTEN_PDB BIT(7)
  82. /*PCI configuration regs.*/
  83. #define PCI_CFG_VENDOR_ID 0x00
  84. #define PCI_CFG_DEVICE_ID 0x02
  85. #define PCI_CFG_COMMAND 0x04
  86. #define PCI_CFG_STATUS 0x06
  87. #define PCI_CFG_REVISION 0x08
  88. #define PCI_CFG_PROGRAMMING_IF 0x09
  89. #define PCI_CFG_SUBCLASS 0x0a
  90. #define PCI_CFG_CLASS 0x0b
  91. #define PCI_CFG_CACHE_LINE_SIZE 0x0c
  92. #define PCI_CFG_LATENCY_TIMER 0x0d
  93. #define PCI_CFG_HEADER_TYPE 0x0e
  94. #define PCI_CFG_BIST 0x0f
  95. #define PCI_CFG_BASE_ADDRESS_0 0x10
  96. #define PCI_CFG_BASE_ADDRESS_1 0x14
  97. #define PCI_CFG_BASE_ADDRESS_2 0x18
  98. #define PCI_CFG_BASE_ADDRESS_3 0x1c
  99. #define PCI_CFG_BASE_ADDRESS_4 0x20
  100. #define PCI_CFG_BASE_ADDRESS_5 0x24
  101. #define PCI_CFG_CIS 0x28
  102. #define PCI_CFG_SUB_VENDOR_ID 0x2c
  103. #define PCI_CFG_SUB_SYSTEM_ID 0x2e
  104. #define PCI_CFG_EXPANSION_ROM 0x30
  105. #define PCI_CFG_RESERVED_0 0x34
  106. #define PCI_CFG_RESERVED_1 0x38
  107. #define PCI_CFG_DEV_INT_LINE 0x3c
  108. #define PCI_CFG_DEV_INT_PIN 0x3d
  109. #define PCI_CFG_MIN_GRANT 0x3e
  110. #define PCI_CFG_MAX_LATENCY 0x3f
  111. #define PCI_CFG_SPECIAL_USE 0x41
  112. #define PCI_CFG_MODE 0x43
  113. #define PCI_CMD_IO_ENABLE 0x0001 /* IO access enable */
  114. #define PCI_CMD_MEM_ENABLE 0x0002 /* memory access enable */
  115. #define PCI_CMD_MASTER_ENABLE 0x0004 /* bus master enable */
  116. #define PCI_CMD_MON_ENABLE 0x0008 /* monitor special cycles enable */
  117. #define PCI_CMD_WI_ENABLE 0x0010 /* write and invalidate enable */
  118. #define PCI_CMD_SNOOP_ENABLE 0x0020 /* palette snoop enable */
  119. #define PCI_CMD_PERR_ENABLE 0x0040 /* parity error enable */
  120. #define PCI_CMD_WC_ENABLE 0x0080 /* wait cycle enable */
  121. #define PCI_CMD_SERR_ENABLE 0x0100 /* system error enable */
  122. #define PCI_CMD_FBTB_ENABLE 0x0200 /* fast back to back enable */
  123. /*CSR Register bit definitions*/
  124. #define PCI_CSR_HOST BIT(0)
  125. #define PCI_CSR_ARBEN BIT(1)
  126. #define PCI_CSR_ADS BIT(2)
  127. #define PCI_CSR_PDS BIT(3)
  128. #define PCI_CSR_ABE BIT(4)
  129. #define PCI_CSR_DBT BIT(5)
  130. #define PCI_CSR_ASE BIT(8)
  131. #define PCI_CSR_IC BIT(15)
  132. /*Configuration command bit definitions*/
  133. #define PCI_CFG_CMD_IOAE BIT(0)
  134. #define PCI_CFG_CMD_MAE BIT(1)
  135. #define PCI_CFG_CMD_BME BIT(2)
  136. #define PCI_CFG_CMD_MWIE BIT(4)
  137. #define PCI_CFG_CMD_SER BIT(8)
  138. #define PCI_CFG_CMD_FBBE BIT(9)
  139. #define PCI_CFG_CMD_MDPE BIT(24)
  140. #define PCI_CFG_CMD_STA BIT(27)
  141. #define PCI_CFG_CMD_RTA BIT(28)
  142. #define PCI_CFG_CMD_RMA BIT(29)
  143. #define PCI_CFG_CMD_SSE BIT(30)
  144. #define PCI_CFG_CMD_DPE BIT(31)
  145. /*DMACTRL DMA Control and status Register*/
  146. #define PCI_DMACTRL_APDCEN BIT(0)
  147. #define PCI_DMACTRL_APDC0 BIT(4)
  148. #define PCI_DMACTRL_APDE0 BIT(5)
  149. #define PCI_DMACTRL_APDC1 BIT(6)
  150. #define PCI_DMACTRL_APDE1 BIT(7)
  151. #define PCI_DMACTRL_PADCEN BIT(8)
  152. #define PCI_DMACTRL_PADC0 BIT(12)
  153. #define PCI_DMACTRL_PADE0 BIT(13)
  154. #define PCI_DMACTRL_PADC1 BIT(14)
  155. #define PCI_DMACTRL_PADE1 BIT(15)
  156. #endif