18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* drivers/atm/firestream.h - FireStream 155 (MB86697) and 38c2ecf20Sopenharmony_ci * FireStream 50 (MB86695) device driver 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci/* Written & (C) 2000 by R.E.Wolff@BitWizard.nl 78c2ecf20Sopenharmony_ci * Copied snippets from zatm.c by Werner Almesberger, EPFL LRC/ICA 88c2ecf20Sopenharmony_ci * and ambassador.c Copyright (C) 1995-1999 Madge Networks Ltd 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* 128c2ecf20Sopenharmony_ci*/ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/*********************************************************************** 168c2ecf20Sopenharmony_ci * first the defines for the chip. * 178c2ecf20Sopenharmony_ci ***********************************************************************/ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/********************* General chip parameters. ************************/ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define FS_NR_FREE_POOLS 8 238c2ecf20Sopenharmony_ci#define FS_NR_RX_QUEUES 4 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/********************* queues and queue access macros ******************/ 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* A queue entry. */ 308c2ecf20Sopenharmony_cistruct FS_QENTRY { 318c2ecf20Sopenharmony_ci u32 cmd; 328c2ecf20Sopenharmony_ci u32 p0, p1, p2; 338c2ecf20Sopenharmony_ci}; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* A freepool entry. */ 378c2ecf20Sopenharmony_cistruct FS_BPENTRY { 388c2ecf20Sopenharmony_ci u32 flags; 398c2ecf20Sopenharmony_ci u32 next; 408c2ecf20Sopenharmony_ci u32 bsa; 418c2ecf20Sopenharmony_ci u32 aal_bufsize; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci /* The hardware doesn't look at this, but we need the SKB somewhere... */ 448c2ecf20Sopenharmony_ci struct sk_buff *skb; 458c2ecf20Sopenharmony_ci struct freepool *fp; 468c2ecf20Sopenharmony_ci struct fs_dev *dev; 478c2ecf20Sopenharmony_ci}; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define STATUS_CODE(qe) ((qe->cmd >> 22) & 0x3f) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci/* OFFSETS against the base of a QUEUE... */ 548c2ecf20Sopenharmony_ci#define QSA 0x00 558c2ecf20Sopenharmony_ci#define QEA 0x04 568c2ecf20Sopenharmony_ci#define QRP 0x08 578c2ecf20Sopenharmony_ci#define QWP 0x0c 588c2ecf20Sopenharmony_ci#define QCNF 0x10 /* Only for Release queues! */ 598c2ecf20Sopenharmony_ci/* Not for the transmit pending queue. */ 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* OFFSETS against the base of a FREE POOL... */ 638c2ecf20Sopenharmony_ci#define FPCNF 0x00 648c2ecf20Sopenharmony_ci#define FPSA 0x04 658c2ecf20Sopenharmony_ci#define FPEA 0x08 668c2ecf20Sopenharmony_ci#define FPCNT 0x0c 678c2ecf20Sopenharmony_ci#define FPCTU 0x10 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define Q_SA(b) (b + QSA ) 708c2ecf20Sopenharmony_ci#define Q_EA(b) (b + QEA ) 718c2ecf20Sopenharmony_ci#define Q_RP(b) (b + QRP ) 728c2ecf20Sopenharmony_ci#define Q_WP(b) (b + QWP ) 738c2ecf20Sopenharmony_ci#define Q_CNF(b) (b + QCNF) 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define FP_CNF(b) (b + FPCNF) 768c2ecf20Sopenharmony_ci#define FP_SA(b) (b + FPSA) 778c2ecf20Sopenharmony_ci#define FP_EA(b) (b + FPEA) 788c2ecf20Sopenharmony_ci#define FP_CNT(b) (b + FPCNT) 798c2ecf20Sopenharmony_ci#define FP_CTU(b) (b + FPCTU) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci/* bits in a queue register. */ 828c2ecf20Sopenharmony_ci#define Q_FULL 0x1 838c2ecf20Sopenharmony_ci#define Q_EMPTY 0x2 848c2ecf20Sopenharmony_ci#define Q_INCWRAP 0x4 858c2ecf20Sopenharmony_ci#define Q_ADDR_MASK 0xfffffff0 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci/* bits in a FreePool config register */ 888c2ecf20Sopenharmony_ci#define RBFP_RBS (0x1 << 16) 898c2ecf20Sopenharmony_ci#define RBFP_RBSVAL (0x1 << 15) 908c2ecf20Sopenharmony_ci#define RBFP_CME (0x1 << 12) 918c2ecf20Sopenharmony_ci#define RBFP_DLP (0x1 << 11) 928c2ecf20Sopenharmony_ci#define RBFP_BFPWT (0x1 << 0) 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* FireStream commands. */ 988c2ecf20Sopenharmony_ci#define QE_CMD_NULL (0x00 << 22) 998c2ecf20Sopenharmony_ci#define QE_CMD_REG_RD (0x01 << 22) 1008c2ecf20Sopenharmony_ci#define QE_CMD_REG_RDM (0x02 << 22) 1018c2ecf20Sopenharmony_ci#define QE_CMD_REG_WR (0x03 << 22) 1028c2ecf20Sopenharmony_ci#define QE_CMD_REG_WRM (0x04 << 22) 1038c2ecf20Sopenharmony_ci#define QE_CMD_CONFIG_TX (0x05 << 22) 1048c2ecf20Sopenharmony_ci#define QE_CMD_CONFIG_RX (0x06 << 22) 1058c2ecf20Sopenharmony_ci#define QE_CMD_PRP_RD (0x07 << 22) 1068c2ecf20Sopenharmony_ci#define QE_CMD_PRP_RDM (0x2a << 22) 1078c2ecf20Sopenharmony_ci#define QE_CMD_PRP_WR (0x09 << 22) 1088c2ecf20Sopenharmony_ci#define QE_CMD_PRP_WRM (0x2b << 22) 1098c2ecf20Sopenharmony_ci#define QE_CMD_RX_EN (0x0a << 22) 1108c2ecf20Sopenharmony_ci#define QE_CMD_RX_PURGE (0x0b << 22) 1118c2ecf20Sopenharmony_ci#define QE_CMD_RX_PURGE_INH (0x0c << 22) 1128c2ecf20Sopenharmony_ci#define QE_CMD_TX_EN (0x0d << 22) 1138c2ecf20Sopenharmony_ci#define QE_CMD_TX_PURGE (0x0e << 22) 1148c2ecf20Sopenharmony_ci#define QE_CMD_TX_PURGE_INH (0x0f << 22) 1158c2ecf20Sopenharmony_ci#define QE_CMD_RST_CG (0x10 << 22) 1168c2ecf20Sopenharmony_ci#define QE_CMD_SET_CG (0x11 << 22) 1178c2ecf20Sopenharmony_ci#define QE_CMD_RST_CLP (0x12 << 22) 1188c2ecf20Sopenharmony_ci#define QE_CMD_SET_CLP (0x13 << 22) 1198c2ecf20Sopenharmony_ci#define QE_CMD_OVERRIDE (0x14 << 22) 1208c2ecf20Sopenharmony_ci#define QE_CMD_ADD_BFP (0x15 << 22) 1218c2ecf20Sopenharmony_ci#define QE_CMD_DUMP_TX (0x16 << 22) 1228c2ecf20Sopenharmony_ci#define QE_CMD_DUMP_RX (0x17 << 22) 1238c2ecf20Sopenharmony_ci#define QE_CMD_LRAM_RD (0x18 << 22) 1248c2ecf20Sopenharmony_ci#define QE_CMD_LRAM_RDM (0x28 << 22) 1258c2ecf20Sopenharmony_ci#define QE_CMD_LRAM_WR (0x19 << 22) 1268c2ecf20Sopenharmony_ci#define QE_CMD_LRAM_WRM (0x29 << 22) 1278c2ecf20Sopenharmony_ci#define QE_CMD_LRAM_BSET (0x1a << 22) 1288c2ecf20Sopenharmony_ci#define QE_CMD_LRAM_BCLR (0x1b << 22) 1298c2ecf20Sopenharmony_ci#define QE_CMD_CONFIG_SEGM (0x1c << 22) 1308c2ecf20Sopenharmony_ci#define QE_CMD_READ_SEGM (0x1d << 22) 1318c2ecf20Sopenharmony_ci#define QE_CMD_CONFIG_ROUT (0x1e << 22) 1328c2ecf20Sopenharmony_ci#define QE_CMD_READ_ROUT (0x1f << 22) 1338c2ecf20Sopenharmony_ci#define QE_CMD_CONFIG_TM (0x20 << 22) 1348c2ecf20Sopenharmony_ci#define QE_CMD_READ_TM (0x21 << 22) 1358c2ecf20Sopenharmony_ci#define QE_CMD_CONFIG_TXBM (0x22 << 22) 1368c2ecf20Sopenharmony_ci#define QE_CMD_READ_TXBM (0x23 << 22) 1378c2ecf20Sopenharmony_ci#define QE_CMD_CONFIG_RXBM (0x24 << 22) 1388c2ecf20Sopenharmony_ci#define QE_CMD_READ_RXBM (0x25 << 22) 1398c2ecf20Sopenharmony_ci#define QE_CMD_CONFIG_REAS (0x26 << 22) 1408c2ecf20Sopenharmony_ci#define QE_CMD_READ_REAS (0x27 << 22) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define QE_TRANSMIT_DE (0x0 << 30) 1438c2ecf20Sopenharmony_ci#define QE_CMD_LINKED (0x1 << 30) 1448c2ecf20Sopenharmony_ci#define QE_CMD_IMM (0x2 << 30) 1458c2ecf20Sopenharmony_ci#define QE_CMD_IMM_INQ (0x3 << 30) 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci#define TD_EPI (0x1 << 27) 1488c2ecf20Sopenharmony_ci#define TD_COMMAND (0x1 << 28) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define TD_DATA (0x0 << 29) 1518c2ecf20Sopenharmony_ci#define TD_RM_CELL (0x1 << 29) 1528c2ecf20Sopenharmony_ci#define TD_OAM_CELL (0x2 << 29) 1538c2ecf20Sopenharmony_ci#define TD_OAM_CELL_SEGMENT (0x3 << 29) 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci#define TD_BPI (0x1 << 20) 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci#define FP_FLAGS_EPI (0x1 << 27) 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#define TX_PQ(i) (0x00 + (i) * 0x10) 1618c2ecf20Sopenharmony_ci#define TXB_RQ (0x20) 1628c2ecf20Sopenharmony_ci#define ST_Q (0x48) 1638c2ecf20Sopenharmony_ci#define RXB_FP(i) (0x90 + (i) * 0x14) 1648c2ecf20Sopenharmony_ci#define RXB_RQ(i) (0x134 + (i) * 0x14) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci#define TXQ_HP 0 1688c2ecf20Sopenharmony_ci#define TXQ_LP 1 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci/* Phew. You don't want to know how many revisions these simple queue 1718c2ecf20Sopenharmony_ci * address macros went through before I got them nice and compact as 1728c2ecf20Sopenharmony_ci * they are now. -- REW 1738c2ecf20Sopenharmony_ci */ 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci/* And now for something completely different: 1778c2ecf20Sopenharmony_ci * The rest of the registers... */ 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci#define CMDR0 0x34 1818c2ecf20Sopenharmony_ci#define CMDR1 0x38 1828c2ecf20Sopenharmony_ci#define CMDR2 0x3c 1838c2ecf20Sopenharmony_ci#define CMDR3 0x40 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define SARMODE0 0x5c 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_0 (0x0 << 0) 1898c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_1k (0x1 << 0) 1908c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_2k (0x2 << 0) 1918c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_4k (0x3 << 0) 1928c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_8k (0x4 << 0) 1938c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_16k (0x5 << 0) 1948c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_32k (0x6 << 0) 1958c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_64k (0x7 << 0) 1968c2ecf20Sopenharmony_ci#define SARMODE0_TXVCS_32 (0x8 << 0) 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_0 (0x0 << 4) 1998c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_512 (0x1 << 4) 2008c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_1k (0x2 << 4) 2018c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_2k (0x3 << 4) 2028c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_4k (0x4 << 4) 2038c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_8k (0x5 << 4) 2048c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_16k (0x6 << 4) 2058c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_32k (0x7 << 4) 2068c2ecf20Sopenharmony_ci#define SARMODE0_ABRVCS_32 (0x9 << 4) /* The others are "8", this one really has to 2078c2ecf20Sopenharmony_ci be 9. Tell me you don't believe me. -- REW */ 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_0 (0x0 << 8) 2108c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_1k (0x1 << 8) 2118c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_2k (0x2 << 8) 2128c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_4k (0x3 << 8) 2138c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_8k (0x4 << 8) 2148c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_16k (0x5 << 8) 2158c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_32k (0x6 << 8) 2168c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_64k (0x7 << 8) 2178c2ecf20Sopenharmony_ci#define SARMODE0_RXVCS_32 (0x8 << 8) 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define SARMODE0_CALSUP_1 (0x0 << 12) 2208c2ecf20Sopenharmony_ci#define SARMODE0_CALSUP_2 (0x1 << 12) 2218c2ecf20Sopenharmony_ci#define SARMODE0_CALSUP_3 (0x2 << 12) 2228c2ecf20Sopenharmony_ci#define SARMODE0_CALSUP_4 (0x3 << 12) 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci#define SARMODE0_PRPWT_FS50_0 (0x0 << 14) 2258c2ecf20Sopenharmony_ci#define SARMODE0_PRPWT_FS50_2 (0x1 << 14) 2268c2ecf20Sopenharmony_ci#define SARMODE0_PRPWT_FS50_5 (0x2 << 14) 2278c2ecf20Sopenharmony_ci#define SARMODE0_PRPWT_FS50_11 (0x3 << 14) 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci#define SARMODE0_PRPWT_FS155_0 (0x0 << 14) 2308c2ecf20Sopenharmony_ci#define SARMODE0_PRPWT_FS155_1 (0x1 << 14) 2318c2ecf20Sopenharmony_ci#define SARMODE0_PRPWT_FS155_2 (0x2 << 14) 2328c2ecf20Sopenharmony_ci#define SARMODE0_PRPWT_FS155_3 (0x3 << 14) 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci#define SARMODE0_SRTS0 (0x1 << 23) 2358c2ecf20Sopenharmony_ci#define SARMODE0_SRTS1 (0x1 << 24) 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci#define SARMODE0_RUN (0x1 << 25) 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci#define SARMODE0_UNLOCK (0x1 << 26) 2408c2ecf20Sopenharmony_ci#define SARMODE0_CWRE (0x1 << 27) 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci#define SARMODE0_INTMODE_READCLEAR (0x0 << 28) 2448c2ecf20Sopenharmony_ci#define SARMODE0_INTMODE_READNOCLEAR (0x1 << 28) 2458c2ecf20Sopenharmony_ci#define SARMODE0_INTMODE_READNOCLEARINHIBIT (0x2 << 28) 2468c2ecf20Sopenharmony_ci#define SARMODE0_INTMODE_READCLEARINHIBIT (0x3 << 28) /* Tell me you don't believe me. */ 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci#define SARMODE0_GINT (0x1 << 30) 2498c2ecf20Sopenharmony_ci#define SARMODE0_SHADEN (0x1 << 31) 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci#define SARMODE1 0x60 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci#define SARMODE1_TRTL_SHIFT 0 /* Program to 0 */ 2568c2ecf20Sopenharmony_ci#define SARMODE1_RRTL_SHIFT 4 /* Program to 0 */ 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci#define SARMODE1_TAGM (0x1 << 8) /* Program to 0 */ 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci#define SARMODE1_HECM0 (0x1 << 9) 2618c2ecf20Sopenharmony_ci#define SARMODE1_HECM1 (0x1 << 10) 2628c2ecf20Sopenharmony_ci#define SARMODE1_HECM2 (0x1 << 11) 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci#define SARMODE1_GFCE (0x1 << 14) 2658c2ecf20Sopenharmony_ci#define SARMODE1_GFCR (0x1 << 15) 2668c2ecf20Sopenharmony_ci#define SARMODE1_PMS (0x1 << 18) 2678c2ecf20Sopenharmony_ci#define SARMODE1_GPRI (0x1 << 19) 2688c2ecf20Sopenharmony_ci#define SARMODE1_GPAS (0x1 << 20) 2698c2ecf20Sopenharmony_ci#define SARMODE1_GVAS (0x1 << 21) 2708c2ecf20Sopenharmony_ci#define SARMODE1_GNAM (0x1 << 22) 2718c2ecf20Sopenharmony_ci#define SARMODE1_GPLEN (0x1 << 23) 2728c2ecf20Sopenharmony_ci#define SARMODE1_DUMPE (0x1 << 24) 2738c2ecf20Sopenharmony_ci#define SARMODE1_OAMCRC (0x1 << 25) 2748c2ecf20Sopenharmony_ci#define SARMODE1_DCOAM (0x1 << 26) 2758c2ecf20Sopenharmony_ci#define SARMODE1_DCRM (0x1 << 27) 2768c2ecf20Sopenharmony_ci#define SARMODE1_TSTLP (0x1 << 28) 2778c2ecf20Sopenharmony_ci#define SARMODE1_DEFHEC (0x1 << 29) 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci#define ISR 0x64 2818c2ecf20Sopenharmony_ci#define IUSR 0x68 2828c2ecf20Sopenharmony_ci#define IMR 0x6c 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci#define ISR_LPCO (0x1 << 0) 2858c2ecf20Sopenharmony_ci#define ISR_DPCO (0x1 << 1) 2868c2ecf20Sopenharmony_ci#define ISR_RBRQ0_W (0x1 << 2) 2878c2ecf20Sopenharmony_ci#define ISR_RBRQ1_W (0x1 << 3) 2888c2ecf20Sopenharmony_ci#define ISR_RBRQ2_W (0x1 << 4) 2898c2ecf20Sopenharmony_ci#define ISR_RBRQ3_W (0x1 << 5) 2908c2ecf20Sopenharmony_ci#define ISR_RBRQ0_NF (0x1 << 6) 2918c2ecf20Sopenharmony_ci#define ISR_RBRQ1_NF (0x1 << 7) 2928c2ecf20Sopenharmony_ci#define ISR_RBRQ2_NF (0x1 << 8) 2938c2ecf20Sopenharmony_ci#define ISR_RBRQ3_NF (0x1 << 9) 2948c2ecf20Sopenharmony_ci#define ISR_BFP_SC (0x1 << 10) 2958c2ecf20Sopenharmony_ci#define ISR_INIT (0x1 << 11) 2968c2ecf20Sopenharmony_ci#define ISR_INIT_ERR (0x1 << 12) /* Documented as "reserved" */ 2978c2ecf20Sopenharmony_ci#define ISR_USCEO (0x1 << 13) 2988c2ecf20Sopenharmony_ci#define ISR_UPEC0 (0x1 << 14) 2998c2ecf20Sopenharmony_ci#define ISR_VPFCO (0x1 << 15) 3008c2ecf20Sopenharmony_ci#define ISR_CRCCO (0x1 << 16) 3018c2ecf20Sopenharmony_ci#define ISR_HECO (0x1 << 17) 3028c2ecf20Sopenharmony_ci#define ISR_TBRQ_W (0x1 << 18) 3038c2ecf20Sopenharmony_ci#define ISR_TBRQ_NF (0x1 << 19) 3048c2ecf20Sopenharmony_ci#define ISR_CTPQ_E (0x1 << 20) 3058c2ecf20Sopenharmony_ci#define ISR_GFC_C0 (0x1 << 21) 3068c2ecf20Sopenharmony_ci#define ISR_PCI_FTL (0x1 << 22) 3078c2ecf20Sopenharmony_ci#define ISR_CSQ_W (0x1 << 23) 3088c2ecf20Sopenharmony_ci#define ISR_CSQ_NF (0x1 << 24) 3098c2ecf20Sopenharmony_ci#define ISR_EXT_INT (0x1 << 25) 3108c2ecf20Sopenharmony_ci#define ISR_RXDMA_S (0x1 << 26) 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci#define TMCONF 0x78 3148c2ecf20Sopenharmony_ci/* Bits? */ 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci#define CALPRESCALE 0x7c 3188c2ecf20Sopenharmony_ci/* Bits? */ 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci#define CELLOSCONF 0x84 3218c2ecf20Sopenharmony_ci#define CELLOSCONF_COTS (0x1 << 28) 3228c2ecf20Sopenharmony_ci#define CELLOSCONF_CEN (0x1 << 27) 3238c2ecf20Sopenharmony_ci#define CELLOSCONF_SC8 (0x3 << 24) 3248c2ecf20Sopenharmony_ci#define CELLOSCONF_SC4 (0x2 << 24) 3258c2ecf20Sopenharmony_ci#define CELLOSCONF_SC2 (0x1 << 24) 3268c2ecf20Sopenharmony_ci#define CELLOSCONF_SC1 (0x0 << 24) 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci#define CELLOSCONF_COBS (0x1 << 16) 3298c2ecf20Sopenharmony_ci#define CELLOSCONF_COPK (0x1 << 8) 3308c2ecf20Sopenharmony_ci#define CELLOSCONF_COST (0x1 << 0) 3318c2ecf20Sopenharmony_ci/* Bits? */ 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci#define RAS0 0x1bc 3348c2ecf20Sopenharmony_ci#define RAS0_DCD_XHLT (0x1 << 31) 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci#define RAS0_VPSEL (0x1 << 16) 3378c2ecf20Sopenharmony_ci#define RAS0_VCSEL (0x1 << 0) 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_ci#define RAS1 0x1c0 3408c2ecf20Sopenharmony_ci#define RAS1_UTREG (0x1 << 5) 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci#define DMAMR 0x1cc 3448c2ecf20Sopenharmony_ci#define DMAMR_TX_MODE_FULL (0x0 << 0) 3458c2ecf20Sopenharmony_ci#define DMAMR_TX_MODE_PART (0x1 << 0) 3468c2ecf20Sopenharmony_ci#define DMAMR_TX_MODE_NONE (0x2 << 0) /* And 3 */ 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci#define RAS2 0x280 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ci#define RAS2_NNI (0x1 << 0) 3538c2ecf20Sopenharmony_ci#define RAS2_USEL (0x1 << 1) 3548c2ecf20Sopenharmony_ci#define RAS2_UBS (0x1 << 2) 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_cistruct fs_transmit_config { 3598c2ecf20Sopenharmony_ci u32 flags; 3608c2ecf20Sopenharmony_ci u32 atm_hdr; 3618c2ecf20Sopenharmony_ci u32 TMC[4]; 3628c2ecf20Sopenharmony_ci u32 spec; 3638c2ecf20Sopenharmony_ci u32 rtag[3]; 3648c2ecf20Sopenharmony_ci}; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci#define TC_FLAGS_AAL5 (0x0 << 29) 3678c2ecf20Sopenharmony_ci#define TC_FLAGS_TRANSPARENT_PAYLOAD (0x1 << 29) 3688c2ecf20Sopenharmony_ci#define TC_FLAGS_TRANSPARENT_CELL (0x2 << 29) 3698c2ecf20Sopenharmony_ci#define TC_FLAGS_STREAMING (0x1 << 28) 3708c2ecf20Sopenharmony_ci#define TC_FLAGS_PACKET (0x0) 3718c2ecf20Sopenharmony_ci#define TC_FLAGS_TYPE_ABR (0x0 << 22) 3728c2ecf20Sopenharmony_ci#define TC_FLAGS_TYPE_CBR (0x1 << 22) 3738c2ecf20Sopenharmony_ci#define TC_FLAGS_TYPE_VBR (0x2 << 22) 3748c2ecf20Sopenharmony_ci#define TC_FLAGS_TYPE_UBR (0x3 << 22) 3758c2ecf20Sopenharmony_ci#define TC_FLAGS_CAL0 (0x0 << 20) 3768c2ecf20Sopenharmony_ci#define TC_FLAGS_CAL1 (0x1 << 20) 3778c2ecf20Sopenharmony_ci#define TC_FLAGS_CAL2 (0x2 << 20) 3788c2ecf20Sopenharmony_ci#define TC_FLAGS_CAL3 (0x3 << 20) 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci#define RC_FLAGS_NAM (0x1 << 13) 3828c2ecf20Sopenharmony_ci#define RC_FLAGS_RXBM_PSB (0x0 << 14) 3838c2ecf20Sopenharmony_ci#define RC_FLAGS_RXBM_CIF (0x1 << 14) 3848c2ecf20Sopenharmony_ci#define RC_FLAGS_RXBM_PMB (0x2 << 14) 3858c2ecf20Sopenharmony_ci#define RC_FLAGS_RXBM_STR (0x4 << 14) 3868c2ecf20Sopenharmony_ci#define RC_FLAGS_RXBM_SAF (0x6 << 14) 3878c2ecf20Sopenharmony_ci#define RC_FLAGS_RXBM_POS (0x6 << 14) 3888c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS (0x1 << 17) 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP (0x1 << 17) 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP0 (0x0 << 17) 3938c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP1 (0x1 << 17) 3948c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP2 (0x2 << 17) 3958c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP3 (0x3 << 17) 3968c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP4 (0x4 << 17) 3978c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP5 (0x5 << 17) 3988c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP6 (0x6 << 17) 3998c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP7 (0x7 << 17) 4008c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP01 (0x8 << 17) 4018c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP23 (0x9 << 17) 4028c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP45 (0xa << 17) 4038c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP67 (0xb << 17) 4048c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP07 (0xc << 17) 4058c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP27 (0xd << 17) 4068c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPS_BFP47 (0xe << 17) 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci#define RC_FLAGS_BFPP (0x1 << 21) 4098c2ecf20Sopenharmony_ci#define RC_FLAGS_TEVC (0x1 << 22) 4108c2ecf20Sopenharmony_ci#define RC_FLAGS_TEP (0x1 << 23) 4118c2ecf20Sopenharmony_ci#define RC_FLAGS_AAL5 (0x0 << 24) 4128c2ecf20Sopenharmony_ci#define RC_FLAGS_TRANSP (0x1 << 24) 4138c2ecf20Sopenharmony_ci#define RC_FLAGS_TRANSC (0x2 << 24) 4148c2ecf20Sopenharmony_ci#define RC_FLAGS_ML (0x1 << 27) 4158c2ecf20Sopenharmony_ci#define RC_FLAGS_TRBRM (0x1 << 28) 4168c2ecf20Sopenharmony_ci#define RC_FLAGS_PRI (0x1 << 29) 4178c2ecf20Sopenharmony_ci#define RC_FLAGS_HOAM (0x1 << 30) 4188c2ecf20Sopenharmony_ci#define RC_FLAGS_CRC10 (0x1 << 31) 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci#define RAC 0x1c8 4228c2ecf20Sopenharmony_ci#define RAM 0x1c4 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci/************************************************************************ 4278c2ecf20Sopenharmony_ci * Then the datastructures that the DRIVER uses. * 4288c2ecf20Sopenharmony_ci ************************************************************************/ 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_ci#define TXQ_NENTRIES 32 4318c2ecf20Sopenharmony_ci#define RXRQ_NENTRIES 1024 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_cistruct fs_vcc { 4358c2ecf20Sopenharmony_ci int channo; 4368c2ecf20Sopenharmony_ci wait_queue_head_t close_wait; 4378c2ecf20Sopenharmony_ci struct sk_buff *last_skb; 4388c2ecf20Sopenharmony_ci}; 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_cistruct queue { 4428c2ecf20Sopenharmony_ci struct FS_QENTRY *sa, *ea; 4438c2ecf20Sopenharmony_ci int offset; 4448c2ecf20Sopenharmony_ci}; 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_cistruct freepool { 4478c2ecf20Sopenharmony_ci int offset; 4488c2ecf20Sopenharmony_ci int bufsize; 4498c2ecf20Sopenharmony_ci int nr_buffers; 4508c2ecf20Sopenharmony_ci int n; 4518c2ecf20Sopenharmony_ci}; 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_cistruct fs_dev { 4558c2ecf20Sopenharmony_ci struct fs_dev *next; /* other FS devices */ 4568c2ecf20Sopenharmony_ci int flags; 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_ci unsigned char irq; /* IRQ */ 4598c2ecf20Sopenharmony_ci struct pci_dev *pci_dev; /* PCI stuff */ 4608c2ecf20Sopenharmony_ci struct atm_dev *atm_dev; 4618c2ecf20Sopenharmony_ci struct timer_list timer; 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci unsigned long hw_base; /* mem base address */ 4648c2ecf20Sopenharmony_ci void __iomem *base; /* Mapping of base address */ 4658c2ecf20Sopenharmony_ci int channo; 4668c2ecf20Sopenharmony_ci unsigned long channel_mask; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci struct queue hp_txq, lp_txq, tx_relq, st_q; 4698c2ecf20Sopenharmony_ci struct freepool rx_fp[FS_NR_FREE_POOLS]; 4708c2ecf20Sopenharmony_ci struct queue rx_rq[FS_NR_RX_QUEUES]; 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci int nchannels; 4738c2ecf20Sopenharmony_ci struct atm_vcc **atm_vccs; 4748c2ecf20Sopenharmony_ci void *tx_inuse; 4758c2ecf20Sopenharmony_ci int ntxpckts; 4768c2ecf20Sopenharmony_ci}; 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_ci 4818c2ecf20Sopenharmony_ci/* Number of channesl that the FS50 supports. */ 4828c2ecf20Sopenharmony_ci#define FS50_CHANNEL_BITS 5 4838c2ecf20Sopenharmony_ci#define FS50_NR_CHANNELS (1 << FS50_CHANNEL_BITS) 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci#define FS_DEV(atm_dev) ((struct fs_dev *) (atm_dev)->dev_data) 4878c2ecf20Sopenharmony_ci#define FS_VCC(atm_vcc) ((struct fs_vcc *) (atm_vcc)->dev_data) 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ci#define FS_IS50 0x1 4918c2ecf20Sopenharmony_ci#define FS_IS155 0x2 4928c2ecf20Sopenharmony_ci 4938c2ecf20Sopenharmony_ci#define IS_FS50(dev) (dev->flags & FS_IS50) 4948c2ecf20Sopenharmony_ci#define IS_FS155(dev) (dev->flags & FS_IS155) 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci/* Within limits this is user-configurable. */ 4978c2ecf20Sopenharmony_ci/* Note: Currently the sum (10 -> 1k channels) is hardcoded in the driver. */ 4988c2ecf20Sopenharmony_ci#define FS155_VPI_BITS 4 4998c2ecf20Sopenharmony_ci#define FS155_VCI_BITS 6 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_ci#define FS155_CHANNEL_BITS (FS155_VPI_BITS + FS155_VCI_BITS) 5028c2ecf20Sopenharmony_ci#define FS155_NR_CHANNELS (1 << FS155_CHANNEL_BITS) 503