idt77252.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. /*******************************************************************
  2. *
  3. * Copyright (c) 2000 ATecoM GmbH
  4. *
  5. * The author may be reached at ecd@atecom.com.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  13. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  15. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  16. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  17. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  19. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  20. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  21. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. *
  23. * You should have received a copy of the GNU General Public License along
  24. * with this program; if not, write to the Free Software Foundation, Inc.,
  25. * 675 Mass Ave, Cambridge, MA 02139, USA.
  26. *
  27. *******************************************************************/
  28. #ifndef _IDT77252_H
  29. #define _IDT77252_H 1
  30. #include <linux/ptrace.h>
  31. #include <linux/skbuff.h>
  32. #include <linux/workqueue.h>
  33. #include <linux/mutex.h>
  34. /*****************************************************************************/
  35. /* */
  36. /* Makros */
  37. /* */
  38. /*****************************************************************************/
  39. #define VPCI2VC(card, vpi, vci) \
  40. (((vpi) << card->vcibits) | ((vci) & card->vcimask))
  41. /*****************************************************************************/
  42. /* */
  43. /* DEBUGGING definitions */
  44. /* */
  45. /*****************************************************************************/
  46. #define DBG_RAW_CELL 0x00000400
  47. #define DBG_TINY 0x00000200
  48. #define DBG_GENERAL 0x00000100
  49. #define DBG_XGENERAL 0x00000080
  50. #define DBG_INIT 0x00000040
  51. #define DBG_DEINIT 0x00000020
  52. #define DBG_INTERRUPT 0x00000010
  53. #define DBG_OPEN_CONN 0x00000008
  54. #define DBG_CLOSE_CONN 0x00000004
  55. #define DBG_RX_DATA 0x00000002
  56. #define DBG_TX_DATA 0x00000001
  57. #ifdef CONFIG_ATM_IDT77252_DEBUG
  58. #define CPRINTK(args...) do { if (debug & DBG_CLOSE_CONN) printk(args); } while(0)
  59. #define OPRINTK(args...) do { if (debug & DBG_OPEN_CONN) printk(args); } while(0)
  60. #define IPRINTK(args...) do { if (debug & DBG_INIT) printk(args); } while(0)
  61. #define INTPRINTK(args...) do { if (debug & DBG_INTERRUPT) printk(args); } while(0)
  62. #define DIPRINTK(args...) do { if (debug & DBG_DEINIT) printk(args); } while(0)
  63. #define TXPRINTK(args...) do { if (debug & DBG_TX_DATA) printk(args); } while(0)
  64. #define RXPRINTK(args...) do { if (debug & DBG_RX_DATA) printk(args); } while(0)
  65. #define XPRINTK(args...) do { if (debug & DBG_XGENERAL) printk(args); } while(0)
  66. #define DPRINTK(args...) do { if (debug & DBG_GENERAL) printk(args); } while(0)
  67. #define NPRINTK(args...) do { if (debug & DBG_TINY) printk(args); } while(0)
  68. #define RPRINTK(args...) do { if (debug & DBG_RAW_CELL) printk(args); } while(0)
  69. #else
  70. #define CPRINTK(args...) do { } while(0)
  71. #define OPRINTK(args...) do { } while(0)
  72. #define IPRINTK(args...) do { } while(0)
  73. #define INTPRINTK(args...) do { } while(0)
  74. #define DIPRINTK(args...) do { } while(0)
  75. #define TXPRINTK(args...) do { } while(0)
  76. #define RXPRINTK(args...) do { } while(0)
  77. #define XPRINTK(args...) do { } while(0)
  78. #define DPRINTK(args...) do { } while(0)
  79. #define NPRINTK(args...) do { } while(0)
  80. #define RPRINTK(args...) do { } while(0)
  81. #endif
  82. #define SCHED_UBR0 0
  83. #define SCHED_UBR 1
  84. #define SCHED_VBR 2
  85. #define SCHED_ABR 3
  86. #define SCHED_CBR 4
  87. #define SCQFULL_TIMEOUT HZ
  88. /*****************************************************************************/
  89. /* */
  90. /* Free Buffer Queue Layout */
  91. /* */
  92. /*****************************************************************************/
  93. #define SAR_FB_SIZE_0 (2048 - 256)
  94. #define SAR_FB_SIZE_1 (4096 - 256)
  95. #define SAR_FB_SIZE_2 (8192 - 256)
  96. #define SAR_FB_SIZE_3 (16384 - 256)
  97. #define SAR_FBQ0_LOW 4
  98. #define SAR_FBQ0_HIGH 8
  99. #define SAR_FBQ1_LOW 2
  100. #define SAR_FBQ1_HIGH 4
  101. #define SAR_FBQ2_LOW 1
  102. #define SAR_FBQ2_HIGH 2
  103. #define SAR_FBQ3_LOW 1
  104. #define SAR_FBQ3_HIGH 2
  105. #if 0
  106. #define SAR_TST_RESERVED 44 /* Num TST reserved for UBR/ABR/VBR */
  107. #else
  108. #define SAR_TST_RESERVED 0 /* Num TST reserved for UBR/ABR/VBR */
  109. #endif
  110. #define TCT_CBR 0x00000000
  111. #define TCT_UBR 0x00000000
  112. #define TCT_VBR 0x40000000
  113. #define TCT_ABR 0x80000000
  114. #define TCT_TYPE 0xc0000000
  115. #define TCT_RR 0x20000000
  116. #define TCT_LMCR 0x08000000
  117. #define TCT_SCD_MASK 0x0007ffff
  118. #define TCT_TSIF 0x00004000
  119. #define TCT_HALT 0x80000000
  120. #define TCT_IDLE 0x40000000
  121. #define TCT_FLAG_UBR 0x80000000
  122. /*****************************************************************************/
  123. /* */
  124. /* Structure describing an IDT77252 */
  125. /* */
  126. /*****************************************************************************/
  127. struct scqe
  128. {
  129. u32 word_1;
  130. u32 word_2;
  131. u32 word_3;
  132. u32 word_4;
  133. };
  134. #define SCQ_ENTRIES 64
  135. #define SCQ_SIZE (SCQ_ENTRIES * sizeof(struct scqe))
  136. #define SCQ_MASK (SCQ_SIZE - 1)
  137. struct scq_info
  138. {
  139. struct scqe *base;
  140. struct scqe *next;
  141. struct scqe *last;
  142. dma_addr_t paddr;
  143. spinlock_t lock;
  144. atomic_t used;
  145. unsigned long trans_start;
  146. unsigned long scd;
  147. spinlock_t skblock;
  148. struct sk_buff_head transmit;
  149. struct sk_buff_head pending;
  150. };
  151. struct rx_pool {
  152. struct sk_buff_head queue;
  153. unsigned int len;
  154. };
  155. struct aal1 {
  156. unsigned int total;
  157. unsigned int count;
  158. struct sk_buff *data;
  159. unsigned char sequence;
  160. };
  161. struct rate_estimator {
  162. struct timer_list timer;
  163. unsigned int interval;
  164. unsigned int ewma_log;
  165. u64 cells;
  166. u64 last_cells;
  167. long avcps;
  168. u32 cps;
  169. u32 maxcps;
  170. };
  171. struct vc_map {
  172. unsigned int index;
  173. unsigned long flags;
  174. #define VCF_TX 0
  175. #define VCF_RX 1
  176. #define VCF_IDLE 2
  177. #define VCF_RSV 3
  178. unsigned int class;
  179. u8 init_er;
  180. u8 lacr;
  181. u8 max_er;
  182. unsigned int ntste;
  183. spinlock_t lock;
  184. struct atm_vcc *tx_vcc;
  185. struct atm_vcc *rx_vcc;
  186. struct idt77252_dev *card;
  187. struct scq_info *scq; /* To keep track of the SCQ */
  188. struct rate_estimator *estimator;
  189. int scd_index;
  190. union {
  191. struct rx_pool rx_pool;
  192. struct aal1 aal1;
  193. } rcv;
  194. };
  195. /*****************************************************************************/
  196. /* */
  197. /* RCTE - Receive Connection Table Entry */
  198. /* */
  199. /*****************************************************************************/
  200. struct rct_entry
  201. {
  202. u32 word_1;
  203. u32 buffer_handle;
  204. u32 dma_address;
  205. u32 aal5_crc32;
  206. };
  207. /*****************************************************************************/
  208. /* */
  209. /* RSQ - Receive Status Queue */
  210. /* */
  211. /*****************************************************************************/
  212. #define SAR_RSQE_VALID 0x80000000
  213. #define SAR_RSQE_IDLE 0x40000000
  214. #define SAR_RSQE_BUF_MASK 0x00030000
  215. #define SAR_RSQE_BUF_ASGN 0x00008000
  216. #define SAR_RSQE_NZGFC 0x00004000
  217. #define SAR_RSQE_EPDU 0x00002000
  218. #define SAR_RSQE_BUF_CONT 0x00001000
  219. #define SAR_RSQE_EFCIE 0x00000800
  220. #define SAR_RSQE_CLP 0x00000400
  221. #define SAR_RSQE_CRC 0x00000200
  222. #define SAR_RSQE_CELLCNT 0x000001FF
  223. #define RSQSIZE 8192
  224. #define RSQ_NUM_ENTRIES (RSQSIZE / 16)
  225. #define RSQ_ALIGNMENT 8192
  226. struct rsq_entry {
  227. u32 word_1;
  228. u32 word_2;
  229. u32 word_3;
  230. u32 word_4;
  231. };
  232. struct rsq_info {
  233. struct rsq_entry *base;
  234. struct rsq_entry *next;
  235. struct rsq_entry *last;
  236. dma_addr_t paddr;
  237. };
  238. /*****************************************************************************/
  239. /* */
  240. /* TSQ - Transmit Status Queue */
  241. /* */
  242. /*****************************************************************************/
  243. #define SAR_TSQE_INVALID 0x80000000
  244. #define SAR_TSQE_TIMESTAMP 0x00FFFFFF
  245. #define SAR_TSQE_TYPE 0x60000000
  246. #define SAR_TSQE_TYPE_TIMER 0x00000000
  247. #define SAR_TSQE_TYPE_TSR 0x20000000
  248. #define SAR_TSQE_TYPE_IDLE 0x40000000
  249. #define SAR_TSQE_TYPE_TBD_COMP 0x60000000
  250. #define SAR_TSQE_TAG(stat) (((stat) >> 24) & 0x1f)
  251. #define TSQSIZE 8192
  252. #define TSQ_NUM_ENTRIES 1024
  253. #define TSQ_ALIGNMENT 8192
  254. struct tsq_entry
  255. {
  256. u32 word_1;
  257. u32 word_2;
  258. };
  259. struct tsq_info
  260. {
  261. struct tsq_entry *base;
  262. struct tsq_entry *next;
  263. struct tsq_entry *last;
  264. dma_addr_t paddr;
  265. };
  266. struct tst_info
  267. {
  268. struct vc_map *vc;
  269. u32 tste;
  270. };
  271. #define TSTE_MASK 0x601fffff
  272. #define TSTE_OPC_MASK 0x60000000
  273. #define TSTE_OPC_NULL 0x00000000
  274. #define TSTE_OPC_CBR 0x20000000
  275. #define TSTE_OPC_VAR 0x40000000
  276. #define TSTE_OPC_JMP 0x60000000
  277. #define TSTE_PUSH_IDLE 0x01000000
  278. #define TSTE_PUSH_ACTIVE 0x02000000
  279. #define TST_SWITCH_DONE 0
  280. #define TST_SWITCH_PENDING 1
  281. #define TST_SWITCH_WAIT 2
  282. #define FBQ_SHIFT 9
  283. #define FBQ_SIZE (1 << FBQ_SHIFT)
  284. #define FBQ_MASK (FBQ_SIZE - 1)
  285. struct sb_pool
  286. {
  287. unsigned int index;
  288. struct sk_buff *skb[FBQ_SIZE];
  289. };
  290. #define POOL_HANDLE(queue, index) (((queue + 1) << 16) | (index))
  291. #define POOL_QUEUE(handle) (((handle) >> 16) - 1)
  292. #define POOL_INDEX(handle) ((handle) & 0xffff)
  293. struct idt77252_dev
  294. {
  295. struct tsq_info tsq; /* Transmit Status Queue */
  296. struct rsq_info rsq; /* Receive Status Queue */
  297. struct pci_dev *pcidev; /* PCI handle (desriptor) */
  298. struct atm_dev *atmdev; /* ATM device desriptor */
  299. void __iomem *membase; /* SAR's memory base address */
  300. unsigned long srambase; /* SAR's sram base address */
  301. void __iomem *fbq[4]; /* FBQ fill addresses */
  302. struct mutex mutex;
  303. spinlock_t cmd_lock; /* for r/w utility/sram */
  304. unsigned long softstat;
  305. unsigned long flags; /* see blow */
  306. struct work_struct tqueue;
  307. unsigned long tct_base; /* TCT base address in SRAM */
  308. unsigned long rct_base; /* RCT base address in SRAM */
  309. unsigned long rt_base; /* Rate Table base in SRAM */
  310. unsigned long scd_base; /* SCD base address in SRAM */
  311. unsigned long tst[2]; /* TST base address in SRAM */
  312. unsigned long abrst_base; /* ABRST base address in SRAM */
  313. unsigned long fifo_base; /* RX FIFO base in SRAM */
  314. unsigned long irqstat[16];
  315. unsigned int sramsize; /* SAR's sram size */
  316. unsigned int tct_size; /* total TCT entries */
  317. unsigned int rct_size; /* total RCT entries */
  318. unsigned int scd_size; /* length of SCD */
  319. unsigned int tst_size; /* total TST entries */
  320. unsigned int tst_free; /* free TSTEs in TST */
  321. unsigned int abrst_size; /* size of ABRST in words */
  322. unsigned int fifo_size; /* size of RX FIFO in words */
  323. unsigned int vpibits; /* Bits used for VPI index */
  324. unsigned int vcibits; /* Bits used for VCI index */
  325. unsigned int vcimask; /* Mask for VCI index */
  326. unsigned int utopia_pcr; /* Utopia Itf's Cell Rate */
  327. unsigned int link_pcr; /* PHY's Peek Cell Rate */
  328. struct vc_map **vcs; /* Open Connections */
  329. struct vc_map **scd2vc; /* SCD to Connection map */
  330. struct tst_info *soft_tst; /* TST to Connection map */
  331. unsigned int tst_index; /* Current TST in use */
  332. struct timer_list tst_timer;
  333. spinlock_t tst_lock;
  334. unsigned long tst_state;
  335. struct sb_pool sbpool[4]; /* Pool of RX skbuffs */
  336. struct sk_buff *raw_cell_head; /* Pointer to raw cell queue */
  337. u32 *raw_cell_hnd; /* Pointer to RCQ handle */
  338. dma_addr_t raw_cell_paddr;
  339. int index; /* SAR's ID */
  340. int revision; /* chip revision */
  341. char name[16]; /* Device name */
  342. struct idt77252_dev *next;
  343. };
  344. /* definition for flag field above */
  345. #define IDT77252_BIT_INIT 1
  346. #define IDT77252_BIT_INTERRUPT 2
  347. #define ATM_CELL_PAYLOAD 48
  348. #define FREEBUF_ALIGNMENT 16
  349. /*****************************************************************************/
  350. /* */
  351. /* Makros */
  352. /* */
  353. /*****************************************************************************/
  354. #define ALIGN_ADDRESS(addr, alignment) \
  355. ((((u32)(addr)) + (((u32)(alignment))-1)) & ~(((u32)(alignment)) - 1))
  356. /*****************************************************************************/
  357. /* */
  358. /* ABR SAR Network operation Register */
  359. /* */
  360. /*****************************************************************************/
  361. #define SAR_REG_DR0 (card->membase + 0x00)
  362. #define SAR_REG_DR1 (card->membase + 0x04)
  363. #define SAR_REG_DR2 (card->membase + 0x08)
  364. #define SAR_REG_DR3 (card->membase + 0x0C)
  365. #define SAR_REG_CMD (card->membase + 0x10)
  366. #define SAR_REG_CFG (card->membase + 0x14)
  367. #define SAR_REG_STAT (card->membase + 0x18)
  368. #define SAR_REG_RSQB (card->membase + 0x1C)
  369. #define SAR_REG_RSQT (card->membase + 0x20)
  370. #define SAR_REG_RSQH (card->membase + 0x24)
  371. #define SAR_REG_CDC (card->membase + 0x28)
  372. #define SAR_REG_VPEC (card->membase + 0x2C)
  373. #define SAR_REG_ICC (card->membase + 0x30)
  374. #define SAR_REG_RAWCT (card->membase + 0x34)
  375. #define SAR_REG_TMR (card->membase + 0x38)
  376. #define SAR_REG_TSTB (card->membase + 0x3C)
  377. #define SAR_REG_TSQB (card->membase + 0x40)
  378. #define SAR_REG_TSQT (card->membase + 0x44)
  379. #define SAR_REG_TSQH (card->membase + 0x48)
  380. #define SAR_REG_GP (card->membase + 0x4C)
  381. #define SAR_REG_VPM (card->membase + 0x50)
  382. #define SAR_REG_RXFD (card->membase + 0x54)
  383. #define SAR_REG_RXFT (card->membase + 0x58)
  384. #define SAR_REG_RXFH (card->membase + 0x5C)
  385. #define SAR_REG_RAWHND (card->membase + 0x60)
  386. #define SAR_REG_RXSTAT (card->membase + 0x64)
  387. #define SAR_REG_ABRSTD (card->membase + 0x68)
  388. #define SAR_REG_ABRRQ (card->membase + 0x6C)
  389. #define SAR_REG_VBRRQ (card->membase + 0x70)
  390. #define SAR_REG_RTBL (card->membase + 0x74)
  391. #define SAR_REG_MDFCT (card->membase + 0x78)
  392. #define SAR_REG_TXSTAT (card->membase + 0x7C)
  393. #define SAR_REG_TCMDQ (card->membase + 0x80)
  394. #define SAR_REG_IRCP (card->membase + 0x84)
  395. #define SAR_REG_FBQP0 (card->membase + 0x88)
  396. #define SAR_REG_FBQP1 (card->membase + 0x8C)
  397. #define SAR_REG_FBQP2 (card->membase + 0x90)
  398. #define SAR_REG_FBQP3 (card->membase + 0x94)
  399. #define SAR_REG_FBQS0 (card->membase + 0x98)
  400. #define SAR_REG_FBQS1 (card->membase + 0x9C)
  401. #define SAR_REG_FBQS2 (card->membase + 0xA0)
  402. #define SAR_REG_FBQS3 (card->membase + 0xA4)
  403. #define SAR_REG_FBQWP0 (card->membase + 0xA8)
  404. #define SAR_REG_FBQWP1 (card->membase + 0xAC)
  405. #define SAR_REG_FBQWP2 (card->membase + 0xB0)
  406. #define SAR_REG_FBQWP3 (card->membase + 0xB4)
  407. #define SAR_REG_NOW (card->membase + 0xB8)
  408. /*****************************************************************************/
  409. /* */
  410. /* Commands */
  411. /* */
  412. /*****************************************************************************/
  413. #define SAR_CMD_NO_OPERATION 0x00000000
  414. #define SAR_CMD_OPENCLOSE_CONNECTION 0x20000000
  415. #define SAR_CMD_WRITE_SRAM 0x40000000
  416. #define SAR_CMD_READ_SRAM 0x50000000
  417. #define SAR_CMD_READ_UTILITY 0x80000000
  418. #define SAR_CMD_WRITE_UTILITY 0x90000000
  419. #define SAR_CMD_OPEN_CONNECTION (SAR_CMD_OPENCLOSE_CONNECTION | 0x00080000)
  420. #define SAR_CMD_CLOSE_CONNECTION SAR_CMD_OPENCLOSE_CONNECTION
  421. /*****************************************************************************/
  422. /* */
  423. /* Configuration Register bits */
  424. /* */
  425. /*****************************************************************************/
  426. #define SAR_CFG_SWRST 0x80000000 /* Software reset */
  427. #define SAR_CFG_LOOP 0x40000000 /* Internal Loopback */
  428. #define SAR_CFG_RXPTH 0x20000000 /* Receive Path Enable */
  429. #define SAR_CFG_IDLE_CLP 0x10000000 /* SAR set CLP Bits of Null Cells */
  430. #define SAR_CFG_TX_FIFO_SIZE_1 0x04000000 /* TX FIFO Size = 1 cell */
  431. #define SAR_CFG_TX_FIFO_SIZE_2 0x08000000 /* TX FIFO Size = 2 cells */
  432. #define SAR_CFG_TX_FIFO_SIZE_4 0x0C000000 /* TX FIFO Size = 4 cells */
  433. #define SAR_CFG_TX_FIFO_SIZE_9 0x00000000 /* TX FIFO Size = 9 cells (full) */
  434. #define SAR_CFG_NO_IDLE 0x02000000 /* SAR sends no Null Cells */
  435. #define SAR_CFG_RSVD1 0x01000000 /* Reserved */
  436. #define SAR_CFG_RXSTQ_SIZE_2k 0x00000000 /* RX Stat Queue Size = 2048 byte */
  437. #define SAR_CFG_RXSTQ_SIZE_4k 0x00400000 /* RX Stat Queue Size = 4096 byte */
  438. #define SAR_CFG_RXSTQ_SIZE_8k 0x00800000 /* RX Stat Queue Size = 8192 byte */
  439. #define SAR_CFG_RXSTQ_SIZE_R 0x00C00000 /* RX Stat Queue Size = reserved */
  440. #define SAR_CFG_ICAPT 0x00200000 /* accept Invalid Cells */
  441. #define SAR_CFG_IGGFC 0x00100000 /* Ignore GFC */
  442. #define SAR_CFG_VPVCS_0 0x00000000 /* VPI/VCI Select bit range */
  443. #define SAR_CFG_VPVCS_1 0x00040000 /* VPI/VCI Select bit range */
  444. #define SAR_CFG_VPVCS_2 0x00080000 /* VPI/VCI Select bit range */
  445. #define SAR_CFG_VPVCS_8 0x000C0000 /* VPI/VCI Select bit range */
  446. #define SAR_CFG_CNTBL_1k 0x00000000 /* Connection Table Size */
  447. #define SAR_CFG_CNTBL_4k 0x00010000 /* Connection Table Size */
  448. #define SAR_CFG_CNTBL_16k 0x00020000 /* Connection Table Size */
  449. #define SAR_CFG_CNTBL_512 0x00030000 /* Connection Table Size */
  450. #define SAR_CFG_VPECA 0x00008000 /* VPI/VCI Error Cell Accept */
  451. #define SAR_CFG_RXINT_NOINT 0x00000000 /* No Interrupt on PDU received */
  452. #define SAR_CFG_RXINT_NODELAY 0x00001000 /* Interrupt without delay to host*/
  453. #define SAR_CFG_RXINT_256US 0x00002000 /* Interrupt with delay 256 usec */
  454. #define SAR_CFG_RXINT_505US 0x00003000 /* Interrupt with delay 505 usec */
  455. #define SAR_CFG_RXINT_742US 0x00004000 /* Interrupt with delay 742 usec */
  456. #define SAR_CFG_RAWIE 0x00000800 /* Raw Cell Queue Interrupt Enable*/
  457. #define SAR_CFG_RQFIE 0x00000400 /* RSQ Almost Full Int Enable */
  458. #define SAR_CFG_RSVD2 0x00000200 /* Reserved */
  459. #define SAR_CFG_CACHE 0x00000100 /* DMA on Cache Line Boundary */
  460. #define SAR_CFG_TMOIE 0x00000080 /* Timer Roll Over Int Enable */
  461. #define SAR_CFG_FBIE 0x00000040 /* Free Buffer Queue Int Enable */
  462. #define SAR_CFG_TXEN 0x00000020 /* Transmit Operation Enable */
  463. #define SAR_CFG_TXINT 0x00000010 /* Transmit status Int Enable */
  464. #define SAR_CFG_TXUIE 0x00000008 /* Transmit underrun Int Enable */
  465. #define SAR_CFG_UMODE 0x00000004 /* Utopia Mode Select */
  466. #define SAR_CFG_TXSFI 0x00000002 /* Transmit status Full Int Enable*/
  467. #define SAR_CFG_PHYIE 0x00000001 /* PHY Interrupt Enable */
  468. #define SAR_CFG_TX_FIFO_SIZE_MASK 0x0C000000 /* TX FIFO Size Mask */
  469. #define SAR_CFG_RXSTQSIZE_MASK 0x00C00000
  470. #define SAR_CFG_CNTBL_MASK 0x00030000
  471. #define SAR_CFG_RXINT_MASK 0x00007000
  472. /*****************************************************************************/
  473. /* */
  474. /* Status Register bits */
  475. /* */
  476. /*****************************************************************************/
  477. #define SAR_STAT_FRAC_3 0xF0000000 /* Fraction of Free Buffer Queue 3 */
  478. #define SAR_STAT_FRAC_2 0x0F000000 /* Fraction of Free Buffer Queue 2 */
  479. #define SAR_STAT_FRAC_1 0x00F00000 /* Fraction of Free Buffer Queue 1 */
  480. #define SAR_STAT_FRAC_0 0x000F0000 /* Fraction of Free Buffer Queue 0 */
  481. #define SAR_STAT_TSIF 0x00008000 /* Transmit Status Indicator */
  482. #define SAR_STAT_TXICP 0x00004000 /* Transmit Status Indicator */
  483. #define SAR_STAT_RSVD1 0x00002000 /* Reserved */
  484. #define SAR_STAT_TSQF 0x00001000 /* Transmit Status Queue full */
  485. #define SAR_STAT_TMROF 0x00000800 /* Timer overflow */
  486. #define SAR_STAT_PHYI 0x00000400 /* PHY device Interrupt flag */
  487. #define SAR_STAT_CMDBZ 0x00000200 /* ABR SAR Command Busy Flag */
  488. #define SAR_STAT_FBQ3A 0x00000100 /* Free Buffer Queue 3 Attention */
  489. #define SAR_STAT_FBQ2A 0x00000080 /* Free Buffer Queue 2 Attention */
  490. #define SAR_STAT_RSQF 0x00000040 /* Receive Status Queue full */
  491. #define SAR_STAT_EPDU 0x00000020 /* End Of PDU Flag */
  492. #define SAR_STAT_RAWCF 0x00000010 /* Raw Cell Flag */
  493. #define SAR_STAT_FBQ1A 0x00000008 /* Free Buffer Queue 1 Attention */
  494. #define SAR_STAT_FBQ0A 0x00000004 /* Free Buffer Queue 0 Attention */
  495. #define SAR_STAT_RSQAF 0x00000002 /* Receive Status Queue almost full*/
  496. #define SAR_STAT_RSVD2 0x00000001 /* Reserved */
  497. /*****************************************************************************/
  498. /* */
  499. /* General Purpose Register bits */
  500. /* */
  501. /*****************************************************************************/
  502. #define SAR_GP_TXNCC_MASK 0xff000000 /* Transmit Negative Credit Count */
  503. #define SAR_GP_EEDI 0x00010000 /* EEPROM Data In */
  504. #define SAR_GP_BIGE 0x00008000 /* Big Endian Operation */
  505. #define SAR_GP_RM_NORMAL 0x00000000 /* Normal handling of RM cells */
  506. #define SAR_GP_RM_TO_RCQ 0x00002000 /* put RM cells into Raw Cell Queue */
  507. #define SAR_GP_RM_RSVD 0x00004000 /* Reserved */
  508. #define SAR_GP_RM_INHIBIT 0x00006000 /* Inhibit update of Connection tab */
  509. #define SAR_GP_PHY_RESET 0x00000008 /* PHY Reset */
  510. #define SAR_GP_EESCLK 0x00000004 /* EEPROM SCLK */
  511. #define SAR_GP_EECS 0x00000002 /* EEPROM Chip Select */
  512. #define SAR_GP_EEDO 0x00000001 /* EEPROM Data Out */
  513. /*****************************************************************************/
  514. /* */
  515. /* SAR local SRAM layout for 128k work SRAM */
  516. /* */
  517. /*****************************************************************************/
  518. #define SAR_SRAM_SCD_SIZE 12
  519. #define SAR_SRAM_TCT_SIZE 8
  520. #define SAR_SRAM_RCT_SIZE 4
  521. #define SAR_SRAM_TCT_128_BASE 0x00000
  522. #define SAR_SRAM_TCT_128_TOP 0x01fff
  523. #define SAR_SRAM_RCT_128_BASE 0x02000
  524. #define SAR_SRAM_RCT_128_TOP 0x02fff
  525. #define SAR_SRAM_FB0_128_BASE 0x03000
  526. #define SAR_SRAM_FB0_128_TOP 0x033ff
  527. #define SAR_SRAM_FB1_128_BASE 0x03400
  528. #define SAR_SRAM_FB1_128_TOP 0x037ff
  529. #define SAR_SRAM_FB2_128_BASE 0x03800
  530. #define SAR_SRAM_FB2_128_TOP 0x03bff
  531. #define SAR_SRAM_FB3_128_BASE 0x03c00
  532. #define SAR_SRAM_FB3_128_TOP 0x03fff
  533. #define SAR_SRAM_SCD_128_BASE 0x04000
  534. #define SAR_SRAM_SCD_128_TOP 0x07fff
  535. #define SAR_SRAM_TST1_128_BASE 0x08000
  536. #define SAR_SRAM_TST1_128_TOP 0x0bfff
  537. #define SAR_SRAM_TST2_128_BASE 0x0c000
  538. #define SAR_SRAM_TST2_128_TOP 0x0ffff
  539. #define SAR_SRAM_ABRSTD_128_BASE 0x10000
  540. #define SAR_SRAM_ABRSTD_128_TOP 0x13fff
  541. #define SAR_SRAM_RT_128_BASE 0x14000
  542. #define SAR_SRAM_RT_128_TOP 0x15fff
  543. #define SAR_SRAM_FIFO_128_BASE 0x18000
  544. #define SAR_SRAM_FIFO_128_TOP 0x1ffff
  545. /*****************************************************************************/
  546. /* */
  547. /* SAR local SRAM layout for 32k work SRAM */
  548. /* */
  549. /*****************************************************************************/
  550. #define SAR_SRAM_TCT_32_BASE 0x00000
  551. #define SAR_SRAM_TCT_32_TOP 0x00fff
  552. #define SAR_SRAM_RCT_32_BASE 0x01000
  553. #define SAR_SRAM_RCT_32_TOP 0x017ff
  554. #define SAR_SRAM_FB0_32_BASE 0x01800
  555. #define SAR_SRAM_FB0_32_TOP 0x01bff
  556. #define SAR_SRAM_FB1_32_BASE 0x01c00
  557. #define SAR_SRAM_FB1_32_TOP 0x01fff
  558. #define SAR_SRAM_FB2_32_BASE 0x02000
  559. #define SAR_SRAM_FB2_32_TOP 0x023ff
  560. #define SAR_SRAM_FB3_32_BASE 0x02400
  561. #define SAR_SRAM_FB3_32_TOP 0x027ff
  562. #define SAR_SRAM_SCD_32_BASE 0x02800
  563. #define SAR_SRAM_SCD_32_TOP 0x03fff
  564. #define SAR_SRAM_TST1_32_BASE 0x04000
  565. #define SAR_SRAM_TST1_32_TOP 0x04fff
  566. #define SAR_SRAM_TST2_32_BASE 0x05000
  567. #define SAR_SRAM_TST2_32_TOP 0x05fff
  568. #define SAR_SRAM_ABRSTD_32_BASE 0x06000
  569. #define SAR_SRAM_ABRSTD_32_TOP 0x067ff
  570. #define SAR_SRAM_RT_32_BASE 0x06800
  571. #define SAR_SRAM_RT_32_TOP 0x06fff
  572. #define SAR_SRAM_FIFO_32_BASE 0x07000
  573. #define SAR_SRAM_FIFO_32_TOP 0x07fff
  574. /*****************************************************************************/
  575. /* */
  576. /* TSR - Transmit Status Request */
  577. /* */
  578. /*****************************************************************************/
  579. #define SAR_TSR_TYPE_TSR 0x80000000
  580. #define SAR_TSR_TYPE_TBD 0x00000000
  581. #define SAR_TSR_TSIF 0x20000000
  582. #define SAR_TSR_TAG_MASK 0x01F00000
  583. /*****************************************************************************/
  584. /* */
  585. /* TBD - Transmit Buffer Descriptor */
  586. /* */
  587. /*****************************************************************************/
  588. #define SAR_TBD_EPDU 0x40000000
  589. #define SAR_TBD_TSIF 0x20000000
  590. #define SAR_TBD_OAM 0x10000000
  591. #define SAR_TBD_AAL0 0x00000000
  592. #define SAR_TBD_AAL34 0x04000000
  593. #define SAR_TBD_AAL5 0x08000000
  594. #define SAR_TBD_GTSI 0x02000000
  595. #define SAR_TBD_TAG_MASK 0x01F00000
  596. #define SAR_TBD_VPI_MASK 0x0FF00000
  597. #define SAR_TBD_VCI_MASK 0x000FFFF0
  598. #define SAR_TBD_VC_MASK (SAR_TBD_VPI_MASK | SAR_TBD_VCI_MASK)
  599. #define SAR_TBD_VPI_SHIFT 20
  600. #define SAR_TBD_VCI_SHIFT 4
  601. /*****************************************************************************/
  602. /* */
  603. /* RXFD - Receive FIFO Descriptor */
  604. /* */
  605. /*****************************************************************************/
  606. #define SAR_RXFD_SIZE_MASK 0x0F000000
  607. #define SAR_RXFD_SIZE_512 0x00000000 /* 512 words */
  608. #define SAR_RXFD_SIZE_1K 0x01000000 /* 1k words */
  609. #define SAR_RXFD_SIZE_2K 0x02000000 /* 2k words */
  610. #define SAR_RXFD_SIZE_4K 0x03000000 /* 4k words */
  611. #define SAR_RXFD_SIZE_8K 0x04000000 /* 8k words */
  612. #define SAR_RXFD_SIZE_16K 0x05000000 /* 16k words */
  613. #define SAR_RXFD_SIZE_32K 0x06000000 /* 32k words */
  614. #define SAR_RXFD_SIZE_64K 0x07000000 /* 64k words */
  615. #define SAR_RXFD_SIZE_128K 0x08000000 /* 128k words */
  616. #define SAR_RXFD_SIZE_256K 0x09000000 /* 256k words */
  617. #define SAR_RXFD_ADDR_MASK 0x001ffc00
  618. /*****************************************************************************/
  619. /* */
  620. /* ABRSTD - ABR + VBR Schedule Tables */
  621. /* */
  622. /*****************************************************************************/
  623. #define SAR_ABRSTD_SIZE_MASK 0x07000000
  624. #define SAR_ABRSTD_SIZE_512 0x00000000 /* 512 words */
  625. #define SAR_ABRSTD_SIZE_1K 0x01000000 /* 1k words */
  626. #define SAR_ABRSTD_SIZE_2K 0x02000000 /* 2k words */
  627. #define SAR_ABRSTD_SIZE_4K 0x03000000 /* 4k words */
  628. #define SAR_ABRSTD_SIZE_8K 0x04000000 /* 8k words */
  629. #define SAR_ABRSTD_SIZE_16K 0x05000000 /* 16k words */
  630. #define SAR_ABRSTD_ADDR_MASK 0x001ffc00
  631. /*****************************************************************************/
  632. /* */
  633. /* RCTE - Receive Connection Table Entry */
  634. /* */
  635. /*****************************************************************************/
  636. #define SAR_RCTE_IL_MASK 0xE0000000 /* inactivity limit */
  637. #define SAR_RCTE_IC_MASK 0x1C000000 /* inactivity count */
  638. #define SAR_RCTE_RSVD 0x02000000 /* reserved */
  639. #define SAR_RCTE_LCD 0x01000000 /* last cell data */
  640. #define SAR_RCTE_CI_VC 0x00800000 /* EFCI in previous cell of VC */
  641. #define SAR_RCTE_FBP_01 0x00000000 /* 1. cell->FBQ0, others->FBQ1 */
  642. #define SAR_RCTE_FBP_1 0x00200000 /* use FBQ 1 for all cells */
  643. #define SAR_RCTE_FBP_2 0x00400000 /* use FBQ 2 for all cells */
  644. #define SAR_RCTE_FBP_3 0x00600000 /* use FBQ 3 for all cells */
  645. #define SAR_RCTE_NZ_GFC 0x00100000 /* non zero GFC in all cell of VC */
  646. #define SAR_RCTE_CONNECTOPEN 0x00080000 /* VC is open */
  647. #define SAR_RCTE_AAL_MASK 0x00070000 /* mask for AAL type field s.b. */
  648. #define SAR_RCTE_RAWCELLINTEN 0x00008000 /* raw cell interrupt enable */
  649. #define SAR_RCTE_RXCONCELLADDR 0x00004000 /* RX constant cell address */
  650. #define SAR_RCTE_BUFFSTAT_MASK 0x00003000 /* buffer status */
  651. #define SAR_RCTE_EFCI 0x00000800 /* EFCI Congestion flag */
  652. #define SAR_RCTE_CLP 0x00000400 /* Cell Loss Priority flag */
  653. #define SAR_RCTE_CRC 0x00000200 /* Received CRC Error */
  654. #define SAR_RCTE_CELLCNT_MASK 0x000001FF /* cell Count */
  655. #define SAR_RCTE_AAL0 0x00000000 /* AAL types for ALL field */
  656. #define SAR_RCTE_AAL34 0x00010000
  657. #define SAR_RCTE_AAL5 0x00020000
  658. #define SAR_RCTE_RCQ 0x00030000
  659. #define SAR_RCTE_OAM 0x00040000
  660. #define TCMDQ_START 0x01000000
  661. #define TCMDQ_LACR 0x02000000
  662. #define TCMDQ_START_LACR 0x03000000
  663. #define TCMDQ_INIT_ER 0x04000000
  664. #define TCMDQ_HALT 0x05000000
  665. struct idt77252_skb_prv {
  666. struct scqe tbd; /* Transmit Buffer Descriptor */
  667. dma_addr_t paddr; /* DMA handle */
  668. u32 pool; /* sb_pool handle */
  669. };
  670. #define IDT77252_PRV_TBD(skb) \
  671. (((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->tbd)
  672. #define IDT77252_PRV_PADDR(skb) \
  673. (((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->paddr)
  674. #define IDT77252_PRV_POOL(skb) \
  675. (((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->pool)
  676. /*****************************************************************************/
  677. /* */
  678. /* PCI related items */
  679. /* */
  680. /*****************************************************************************/
  681. #ifndef PCI_VENDOR_ID_IDT
  682. #define PCI_VENDOR_ID_IDT 0x111D
  683. #endif /* PCI_VENDOR_ID_IDT */
  684. #ifndef PCI_DEVICE_ID_IDT_IDT77252
  685. #define PCI_DEVICE_ID_IDT_IDT77252 0x0003
  686. #endif /* PCI_DEVICE_ID_IDT_IDT772052 */
  687. #endif /* !(_IDT77252_H) */