midway.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /* drivers/atm/midway.h - Efficient Networks Midway (SAR) description */
  2. /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
  3. #ifndef DRIVERS_ATM_MIDWAY_H
  4. #define DRIVERS_ATM_MIDWAY_H
  5. #define NR_VCI 1024 /* number of VCIs */
  6. #define NR_VCI_LD 10 /* log2(NR_VCI) */
  7. #define NR_DMA_RX 512 /* RX DMA queue entries */
  8. #define NR_DMA_TX 512 /* TX DMA queue entries */
  9. #define NR_SERVICE NR_VCI /* service list size */
  10. #define NR_CHAN 8 /* number of TX channels */
  11. #define TS_CLOCK 25000000 /* traffic shaper clock (cell/sec) */
  12. #define MAP_MAX_SIZE 0x00400000 /* memory window for max config */
  13. #define EPROM_SIZE 0x00010000
  14. #define MEM_VALID 0xffc00000 /* mask base address with this */
  15. #define PHY_BASE 0x00020000 /* offset of PHY register are */
  16. #define REG_BASE 0x00040000 /* offset of Midway register area */
  17. #define RAM_BASE 0x00200000 /* offset of RAM area */
  18. #define RAM_INCREMENT 0x00020000 /* probe for RAM every 128kB */
  19. #define MID_VCI_BASE RAM_BASE
  20. #define MID_DMA_RX_BASE (MID_VCI_BASE+NR_VCI*16)
  21. #define MID_DMA_TX_BASE (MID_DMA_RX_BASE+NR_DMA_RX*8)
  22. #define MID_SERVICE_BASE (MID_DMA_TX_BASE+NR_DMA_TX*8)
  23. #define MID_FREE_BASE (MID_SERVICE_BASE+NR_SERVICE*4)
  24. #define MAC_LEN 6 /* atm.h */
  25. #define MID_MIN_BUF_SIZE (1024) /* 1 kB is minimum */
  26. #define MID_MAX_BUF_SIZE (128*1024) /* 128 kB is maximum */
  27. #define RX_DESCR_SIZE 1 /* RX PDU descr is 1 longword */
  28. #define TX_DESCR_SIZE 2 /* TX PDU descr is 2 longwords */
  29. #define AAL5_TRAILER (ATM_AAL5_TRAILER/4) /* AAL5 trailer is 2 longwords */
  30. #define TX_GAP 8 /* TX buffer gap (words) */
  31. /*
  32. * Midway Reset/ID
  33. *
  34. * All values read-only. Writing to this register resets Midway chip.
  35. */
  36. #define MID_RES_ID_MCON 0x00 /* Midway Reset/ID */
  37. #define MID_ID 0xf0000000 /* Midway version */
  38. #define MID_SHIFT 24
  39. #define MID_MOTHER_ID 0x00000700 /* mother board id */
  40. #define MID_MOTHER_SHIFT 8
  41. #define MID_CON_TI 0x00000080 /* 0: normal ctrl; 1: SABRE */
  42. #define MID_CON_SUNI 0x00000040 /* 0: UTOPIA; 1: SUNI */
  43. #define MID_CON_V6 0x00000020 /* 0: non-pipel UTOPIA (required iff
  44. !CON_SUNI; 1: UTOPIA */
  45. #define DAUGTHER_ID 0x0000001f /* daugther board id */
  46. /*
  47. * Interrupt Status Acknowledge, Interrupt Status & Interrupt Enable
  48. */
  49. #define MID_ISA 0x01 /* Interrupt Status Acknowledge */
  50. #define MID_IS 0x02 /* Interrupt Status */
  51. #define MID_IE 0x03 /* Interrupt Enable */
  52. #define MID_TX_COMPLETE_7 0x00010000 /* channel N completed a PDU */
  53. #define MID_TX_COMPLETE_6 0x00008000 /* transmission */
  54. #define MID_TX_COMPLETE_5 0x00004000
  55. #define MID_TX_COMPLETE_4 0x00002000
  56. #define MID_TX_COMPLETE_3 0x00001000
  57. #define MID_TX_COMPLETE_2 0x00000800
  58. #define MID_TX_COMPLETE_1 0x00000400
  59. #define MID_TX_COMPLETE_0 0x00000200
  60. #define MID_TX_COMPLETE 0x0001fe00 /* any TX */
  61. #define MID_TX_DMA_OVFL 0x00000100 /* DMA to adapter overflow */
  62. #define MID_TX_IDENT_MISM 0x00000080 /* TX: ident mismatch => halted */
  63. #define MID_DMA_LERR_ACK 0x00000040 /* LERR - SBus ? */
  64. #define MID_DMA_ERR_ACK 0x00000020 /* DMA error */
  65. #define MID_RX_DMA_COMPLETE 0x00000010 /* DMA to host done */
  66. #define MID_TX_DMA_COMPLETE 0x00000008 /* DMA from host done */
  67. #define MID_SERVICE 0x00000004 /* something in service list */
  68. #define MID_SUNI_INT 0x00000002 /* interrupt from SUNI */
  69. #define MID_STAT_OVFL 0x00000001 /* statistics overflow */
  70. /*
  71. * Master Control/Status
  72. */
  73. #define MID_MC_S 0x04
  74. #define MID_INT_SELECT 0x000001C0 /* Interrupt level (000: off) */
  75. #define MID_INT_SEL_SHIFT 6
  76. #define MID_TX_LOCK_MODE 0x00000020 /* 0: streaming; 1: TX ovfl->lock */
  77. #define MID_DMA_ENABLE 0x00000010 /* R: 0: disable; 1: enable
  78. W: 0: no change; 1: enable */
  79. #define MID_TX_ENABLE 0x00000008 /* R: 0: TX disabled; 1: enabled
  80. W: 0: no change; 1: enable */
  81. #define MID_RX_ENABLE 0x00000004 /* like TX */
  82. #define MID_WAIT_1MS 0x00000002 /* R: 0: timer not running; 1: running
  83. W: 0: no change; 1: no interrupts
  84. for 1 ms */
  85. #define MID_WAIT_500US 0x00000001 /* like WAIT_1MS, but 0.5 ms */
  86. /*
  87. * Statistics
  88. *
  89. * Cleared when reading.
  90. */
  91. #define MID_STAT 0x05
  92. #define MID_VCI_TRASH 0xFFFF0000 /* trashed cells because of VCI mode */
  93. #define MID_VCI_TRASH_SHIFT 16
  94. #define MID_OVFL_TRASH 0x0000FFFF /* trashed cells because of overflow */
  95. /*
  96. * Address registers
  97. */
  98. #define MID_SERV_WRITE 0x06 /* free pos in service area (R, 10 bits) */
  99. #define MID_DMA_ADDR 0x07 /* virtual DMA address (R, 32 bits) */
  100. #define MID_DMA_WR_RX 0x08 /* (RW, 9 bits) */
  101. #define MID_DMA_RD_RX 0x09
  102. #define MID_DMA_WR_TX 0x0A
  103. #define MID_DMA_RD_TX 0x0B
  104. /*
  105. * Transmit Place Registers (0x10+4*channel)
  106. */
  107. #define MID_TX_PLACE(c) (0x10+4*(c))
  108. #define MID_SIZE 0x00003800 /* size, N*256 x 32 bit */
  109. #define MID_SIZE_SHIFT 11
  110. #define MID_LOCATION 0x000007FF /* location in adapter memory (word) */
  111. #define MID_LOC_SKIP 8 /* 8 bits of location are always zero
  112. (applies to all uses of location) */
  113. /*
  114. * Transmit ReadPtr Registers (0x11+4*channel)
  115. */
  116. #define MID_TX_RDPTR(c) (0x11+4*(c))
  117. #define MID_READ_PTR 0x00007FFF /* next word for PHY */
  118. /*
  119. * Transmit DescrStart Registers (0x12+4*channel)
  120. */
  121. #define MID_TX_DESCRSTART(c) (0x12+4*(c))
  122. #define MID_DESCR_START 0x00007FFF /* seg buffer being DMAed */
  123. #define ENI155_MAGIC 0xa54b872d
  124. struct midway_eprom {
  125. unsigned char mac[MAC_LEN],inv_mac[MAC_LEN];
  126. unsigned char pad[36];
  127. u32 serial,inv_serial;
  128. u32 magic,inv_magic;
  129. };
  130. /*
  131. * VCI table entry
  132. */
  133. #define MID_VCI_IN_SERVICE 0x00000001 /* set if VCI is currently in
  134. service list */
  135. #define MID_VCI_SIZE 0x00038000 /* reassembly buffer size,
  136. 2*<size> kB */
  137. #define MID_VCI_SIZE_SHIFT 15
  138. #define MID_VCI_LOCATION 0x1ffc0000 /* buffer location */
  139. #define MID_VCI_LOCATION_SHIFT 18
  140. #define MID_VCI_PTI_MODE 0x20000000 /* 0: trash, 1: preserve */
  141. #define MID_VCI_MODE 0xc0000000
  142. #define MID_VCI_MODE_SHIFT 30
  143. #define MID_VCI_READ 0x00007fff
  144. #define MID_VCI_READ_SHIFT 0
  145. #define MID_VCI_DESCR 0x7fff0000
  146. #define MID_VCI_DESCR_SHIFT 16
  147. #define MID_VCI_COUNT 0x000007ff
  148. #define MID_VCI_COUNT_SHIFT 0
  149. #define MID_VCI_STATE 0x0000c000
  150. #define MID_VCI_STATE_SHIFT 14
  151. #define MID_VCI_WRITE 0x7fff0000
  152. #define MID_VCI_WRITE_SHIFT 16
  153. #define MID_MODE_TRASH 0
  154. #define MID_MODE_RAW 1
  155. #define MID_MODE_AAL5 2
  156. /*
  157. * Reassembly buffer descriptor
  158. */
  159. #define MID_RED_COUNT 0x000007ff
  160. #define MID_RED_CRC_ERR 0x00000800
  161. #define MID_RED_T 0x00001000
  162. #define MID_RED_CE 0x00010000
  163. #define MID_RED_CLP 0x01000000
  164. #define MID_RED_IDEN 0xfe000000
  165. #define MID_RED_SHIFT 25
  166. #define MID_RED_RX_ID 0x1b /* constant identifier */
  167. /*
  168. * Segmentation buffer descriptor
  169. */
  170. #define MID_SEG_COUNT MID_RED_COUNT
  171. #define MID_SEG_RATE 0x01f80000
  172. #define MID_SEG_RATE_SHIFT 19
  173. #define MID_SEG_PR 0x06000000
  174. #define MID_SEG_PR_SHIFT 25
  175. #define MID_SEG_AAL5 0x08000000
  176. #define MID_SEG_ID 0xf0000000
  177. #define MID_SEG_ID_SHIFT 28
  178. #define MID_SEG_MAX_RATE 63
  179. #define MID_SEG_CLP 0x00000001
  180. #define MID_SEG_PTI 0x0000000e
  181. #define MID_SEG_PTI_SHIFT 1
  182. #define MID_SEG_VCI 0x00003ff0
  183. #define MID_SEG_VCI_SHIFT 4
  184. #define MID_SEG_TX_ID 0xb /* constant identifier */
  185. /*
  186. * DMA entry
  187. */
  188. #define MID_DMA_COUNT 0xffff0000
  189. #define MID_DMA_COUNT_SHIFT 16
  190. #define MID_DMA_END 0x00000020
  191. #define MID_DMA_TYPE 0x0000000f
  192. #define MID_DT_JK 0x3
  193. #define MID_DT_WORD 0x0
  194. #define MID_DT_2W 0x7
  195. #define MID_DT_4W 0x4
  196. #define MID_DT_8W 0x5
  197. #define MID_DT_16W 0x6
  198. #define MID_DT_2WM 0xf
  199. #define MID_DT_4WM 0xc
  200. #define MID_DT_8WM 0xd
  201. #define MID_DT_16WM 0xe
  202. /* only for RX*/
  203. #define MID_DMA_VCI 0x0000ffc0
  204. #define MID_DMA_VCI_SHIFT 6
  205. /* only for TX */
  206. #define MID_DMA_CHAN 0x000001c0
  207. #define MID_DMA_CHAN_SHIFT 6
  208. #define MID_DT_BYTE 0x1
  209. #define MID_DT_HWORD 0x2
  210. #endif