18c2ecf20Sopenharmony_ci/****************************************************************************** 28c2ecf20Sopenharmony_ci Device driver for Interphase ATM PCI adapter cards 38c2ecf20Sopenharmony_ci Author: Peter Wang <pwang@iphase.com> 48c2ecf20Sopenharmony_ci Interphase Corporation <www.iphase.com> 58c2ecf20Sopenharmony_ci Version: 1.0 68c2ecf20Sopenharmony_ci iphase.h: This is the header file for iphase.c. 78c2ecf20Sopenharmony_ci******************************************************************************* 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci This software may be used and distributed according to the terms 108c2ecf20Sopenharmony_ci of the GNU General Public License (GPL), incorporated herein by reference. 118c2ecf20Sopenharmony_ci Drivers based on this skeleton fall under the GPL and must retain 128c2ecf20Sopenharmony_ci the authorship (implicit copyright) notice. 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci This program is distributed in the hope that it will be useful, but 158c2ecf20Sopenharmony_ci WITHOUT ANY WARRANTY; without even the implied warranty of 168c2ecf20Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 178c2ecf20Sopenharmony_ci General Public License for more details. 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci Modified from an incomplete driver for Interphase 5575 1KVC 1M card which 208c2ecf20Sopenharmony_ci was originally written by Monalisa Agrawal at UNH. Now this driver 218c2ecf20Sopenharmony_ci supports a variety of varients of Interphase ATM PCI (i)Chip adapter 228c2ecf20Sopenharmony_ci card family (See www.iphase.com/products/ClassSheet.cfm?ClassID=ATM) 238c2ecf20Sopenharmony_ci in terms of PHY type, the size of control memory and the size of 248c2ecf20Sopenharmony_ci packet memory. The following are the change log and history: 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci Bugfix the Mona's UBR driver. 278c2ecf20Sopenharmony_ci Modify the basic memory allocation and dma logic. 288c2ecf20Sopenharmony_ci Port the driver to the latest kernel from 2.0.46. 298c2ecf20Sopenharmony_ci Complete the ABR logic of the driver, and added the ABR work- 308c2ecf20Sopenharmony_ci around for the hardware anormalies. 318c2ecf20Sopenharmony_ci Add the CBR support. 328c2ecf20Sopenharmony_ci Add the flow control logic to the driver to allow rate-limit VC. 338c2ecf20Sopenharmony_ci Add 4K VC support to the board with 512K control memory. 348c2ecf20Sopenharmony_ci Add the support of all the variants of the Interphase ATM PCI 358c2ecf20Sopenharmony_ci (i)Chip adapter cards including x575 (155M OC3 and UTP155), x525 368c2ecf20Sopenharmony_ci (25M UTP25) and x531 (DS3 and E3). 378c2ecf20Sopenharmony_ci Add SMP support. 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci Support and updates available at: ftp://ftp.iphase.com/pub/atm 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci*******************************************************************************/ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#ifndef IPHASE_H 448c2ecf20Sopenharmony_ci#define IPHASE_H 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/************************ IADBG DEFINE *********************************/ 488c2ecf20Sopenharmony_ci/* IADebugFlag Bit Map */ 498c2ecf20Sopenharmony_ci#define IF_IADBG_INIT_ADAPTER 0x00000001 // init adapter info 508c2ecf20Sopenharmony_ci#define IF_IADBG_TX 0x00000002 // debug TX 518c2ecf20Sopenharmony_ci#define IF_IADBG_RX 0x00000004 // debug RX 528c2ecf20Sopenharmony_ci#define IF_IADBG_QUERY_INFO 0x00000008 // debug Request call 538c2ecf20Sopenharmony_ci#define IF_IADBG_SHUTDOWN 0x00000010 // debug shutdown event 548c2ecf20Sopenharmony_ci#define IF_IADBG_INTR 0x00000020 // debug interrupt DPC 558c2ecf20Sopenharmony_ci#define IF_IADBG_TXPKT 0x00000040 // debug TX PKT 568c2ecf20Sopenharmony_ci#define IF_IADBG_RXPKT 0x00000080 // debug RX PKT 578c2ecf20Sopenharmony_ci#define IF_IADBG_ERR 0x00000100 // debug system error 588c2ecf20Sopenharmony_ci#define IF_IADBG_EVENT 0x00000200 // debug event 598c2ecf20Sopenharmony_ci#define IF_IADBG_DIS_INTR 0x00001000 // debug disable interrupt 608c2ecf20Sopenharmony_ci#define IF_IADBG_EN_INTR 0x00002000 // debug enable interrupt 618c2ecf20Sopenharmony_ci#define IF_IADBG_LOUD 0x00004000 // debugging info 628c2ecf20Sopenharmony_ci#define IF_IADBG_VERY_LOUD 0x00008000 // excessive debugging info 638c2ecf20Sopenharmony_ci#define IF_IADBG_CBR 0x00100000 // 648c2ecf20Sopenharmony_ci#define IF_IADBG_UBR 0x00200000 // 658c2ecf20Sopenharmony_ci#define IF_IADBG_ABR 0x00400000 // 668c2ecf20Sopenharmony_ci#define IF_IADBG_DESC 0x01000000 // 678c2ecf20Sopenharmony_ci#define IF_IADBG_SUNI_STAT 0x02000000 // suni statistics 688c2ecf20Sopenharmony_ci#define IF_IADBG_RESET 0x04000000 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#define IF_IADBG(f) if (IADebugFlag & (f)) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#ifdef CONFIG_ATM_IA_DEBUG /* Debug build */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define IF_LOUD(A) IF_IADBG(IF_IADBG_LOUD) { A } 758c2ecf20Sopenharmony_ci#define IF_ERR(A) IF_IADBG(IF_IADBG_ERR) { A } 768c2ecf20Sopenharmony_ci#define IF_VERY_LOUD(A) IF_IADBG( IF_IADBG_VERY_LOUD ) { A } 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define IF_INIT_ADAPTER(A) IF_IADBG( IF_IADBG_INIT_ADAPTER ) { A } 798c2ecf20Sopenharmony_ci#define IF_INIT(A) IF_IADBG( IF_IADBG_INIT_ADAPTER ) { A } 808c2ecf20Sopenharmony_ci#define IF_SUNI_STAT(A) IF_IADBG( IF_IADBG_SUNI_STAT ) { A } 818c2ecf20Sopenharmony_ci#define IF_QUERY_INFO(A) IF_IADBG( IF_IADBG_QUERY_INFO ) { A } 828c2ecf20Sopenharmony_ci#define IF_COPY_OVER(A) IF_IADBG( IF_IADBG_COPY_OVER ) { A } 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define IF_INTR(A) IF_IADBG( IF_IADBG_INTR ) { A } 858c2ecf20Sopenharmony_ci#define IF_DIS_INTR(A) IF_IADBG( IF_IADBG_DIS_INTR ) { A } 868c2ecf20Sopenharmony_ci#define IF_EN_INTR(A) IF_IADBG( IF_IADBG_EN_INTR ) { A } 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci#define IF_TX(A) IF_IADBG( IF_IADBG_TX ) { A } 898c2ecf20Sopenharmony_ci#define IF_RX(A) IF_IADBG( IF_IADBG_RX ) { A } 908c2ecf20Sopenharmony_ci#define IF_TXPKT(A) IF_IADBG( IF_IADBG_TXPKT ) { A } 918c2ecf20Sopenharmony_ci#define IF_RXPKT(A) IF_IADBG( IF_IADBG_RXPKT ) { A } 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define IF_SHUTDOWN(A) IF_IADBG(IF_IADBG_SHUTDOWN) { A } 948c2ecf20Sopenharmony_ci#define IF_CBR(A) IF_IADBG( IF_IADBG_CBR ) { A } 958c2ecf20Sopenharmony_ci#define IF_UBR(A) IF_IADBG( IF_IADBG_UBR ) { A } 968c2ecf20Sopenharmony_ci#define IF_ABR(A) IF_IADBG( IF_IADBG_ABR ) { A } 978c2ecf20Sopenharmony_ci#define IF_EVENT(A) IF_IADBG( IF_IADBG_EVENT) { A } 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#else /* free build */ 1008c2ecf20Sopenharmony_ci#define IF_LOUD(A) 1018c2ecf20Sopenharmony_ci#define IF_VERY_LOUD(A) 1028c2ecf20Sopenharmony_ci#define IF_INIT_ADAPTER(A) 1038c2ecf20Sopenharmony_ci#define IF_INIT(A) 1048c2ecf20Sopenharmony_ci#define IF_SUNI_STAT(A) 1058c2ecf20Sopenharmony_ci#define IF_PVC_CHKPKT(A) 1068c2ecf20Sopenharmony_ci#define IF_QUERY_INFO(A) 1078c2ecf20Sopenharmony_ci#define IF_COPY_OVER(A) 1088c2ecf20Sopenharmony_ci#define IF_HANG(A) 1098c2ecf20Sopenharmony_ci#define IF_INTR(A) 1108c2ecf20Sopenharmony_ci#define IF_DIS_INTR(A) 1118c2ecf20Sopenharmony_ci#define IF_EN_INTR(A) 1128c2ecf20Sopenharmony_ci#define IF_TX(A) 1138c2ecf20Sopenharmony_ci#define IF_RX(A) 1148c2ecf20Sopenharmony_ci#define IF_TXDEBUG(A) 1158c2ecf20Sopenharmony_ci#define IF_VC(A) 1168c2ecf20Sopenharmony_ci#define IF_ERR(A) 1178c2ecf20Sopenharmony_ci#define IF_CBR(A) 1188c2ecf20Sopenharmony_ci#define IF_UBR(A) 1198c2ecf20Sopenharmony_ci#define IF_ABR(A) 1208c2ecf20Sopenharmony_ci#define IF_SHUTDOWN(A) 1218c2ecf20Sopenharmony_ci#define DbgPrint(A) 1228c2ecf20Sopenharmony_ci#define IF_EVENT(A) 1238c2ecf20Sopenharmony_ci#define IF_TXPKT(A) 1248c2ecf20Sopenharmony_ci#define IF_RXPKT(A) 1258c2ecf20Sopenharmony_ci#endif /* CONFIG_ATM_IA_DEBUG */ 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define isprint(a) ((a >=' ')&&(a <= '~')) 1288c2ecf20Sopenharmony_ci#define ATM_DESC(skb) (skb->protocol) 1298c2ecf20Sopenharmony_ci#define IA_SKB_STATE(skb) (skb->protocol) 1308c2ecf20Sopenharmony_ci#define IA_DLED 1 1318c2ecf20Sopenharmony_ci#define IA_TX_DONE 2 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci/* iadbg defines */ 1348c2ecf20Sopenharmony_ci#define IA_CMD 0x7749 1358c2ecf20Sopenharmony_citypedef struct { 1368c2ecf20Sopenharmony_ci int cmd; 1378c2ecf20Sopenharmony_ci int sub_cmd; 1388c2ecf20Sopenharmony_ci int len; 1398c2ecf20Sopenharmony_ci u32 maddr; 1408c2ecf20Sopenharmony_ci int status; 1418c2ecf20Sopenharmony_ci void __user *buf; 1428c2ecf20Sopenharmony_ci} IA_CMDBUF, *PIA_CMDBUF; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci/* cmds */ 1458c2ecf20Sopenharmony_ci#define MEMDUMP 0x01 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci/* sub_cmds */ 1488c2ecf20Sopenharmony_ci#define MEMDUMP_SEGREG 0x2 1498c2ecf20Sopenharmony_ci#define MEMDUMP_DEV 0x1 1508c2ecf20Sopenharmony_ci#define MEMDUMP_REASSREG 0x3 1518c2ecf20Sopenharmony_ci#define MEMDUMP_FFL 0x4 1528c2ecf20Sopenharmony_ci#define READ_REG 0x5 1538c2ecf20Sopenharmony_ci#define WAKE_DBG_WAIT 0x6 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci/************************ IADBG DEFINE END ***************************/ 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci#define Boolean(x) ((x) ? 1 : 0) 1588c2ecf20Sopenharmony_ci#define NR_VCI 1024 /* number of VCIs */ 1598c2ecf20Sopenharmony_ci#define NR_VCI_LD 10 /* log2(NR_VCI) */ 1608c2ecf20Sopenharmony_ci#define NR_VCI_4K 4096 /* number of VCIs */ 1618c2ecf20Sopenharmony_ci#define NR_VCI_4K_LD 12 /* log2(NR_VCI) */ 1628c2ecf20Sopenharmony_ci#define MEM_VALID 0xfffffff0 /* mask base address with this */ 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci#ifndef PCI_VENDOR_ID_IPHASE 1658c2ecf20Sopenharmony_ci#define PCI_VENDOR_ID_IPHASE 0x107e 1668c2ecf20Sopenharmony_ci#endif 1678c2ecf20Sopenharmony_ci#ifndef PCI_DEVICE_ID_IPHASE_5575 1688c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IPHASE_5575 0x0008 1698c2ecf20Sopenharmony_ci#endif 1708c2ecf20Sopenharmony_ci#define DEV_LABEL "ia" 1718c2ecf20Sopenharmony_ci#define PCR 207692 1728c2ecf20Sopenharmony_ci#define ICR 100000 1738c2ecf20Sopenharmony_ci#define MCR 0 1748c2ecf20Sopenharmony_ci#define TBE 1000 1758c2ecf20Sopenharmony_ci#define FRTT 1 1768c2ecf20Sopenharmony_ci#define RIF 2 1778c2ecf20Sopenharmony_ci#define RDF 4 1788c2ecf20Sopenharmony_ci#define NRMCODE 5 /* 0 - 7 */ 1798c2ecf20Sopenharmony_ci#define TRMCODE 3 /* 0 - 7 */ 1808c2ecf20Sopenharmony_ci#define CDFCODE 6 1818c2ecf20Sopenharmony_ci#define ATDFCODE 2 /* 0 - 15 */ 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci/*---------------------- Packet/Cell Memory ------------------------*/ 1848c2ecf20Sopenharmony_ci#define TX_PACKET_RAM 0x00000 /* start of Trasnmit Packet memory - 0 */ 1858c2ecf20Sopenharmony_ci#define DFL_TX_BUF_SZ 10240 /* 10 K buffers */ 1868c2ecf20Sopenharmony_ci#define DFL_TX_BUFFERS 50 /* number of packet buffers for Tx 1878c2ecf20Sopenharmony_ci - descriptor 0 unused */ 1888c2ecf20Sopenharmony_ci#define REASS_RAM_SIZE 0x10000 /* for 64K 1K VC board */ 1898c2ecf20Sopenharmony_ci#define RX_PACKET_RAM 0x80000 /* start of Receive Packet memory - 512K */ 1908c2ecf20Sopenharmony_ci#define DFL_RX_BUF_SZ 10240 /* 10k buffers */ 1918c2ecf20Sopenharmony_ci#define DFL_RX_BUFFERS 50 /* number of packet buffers for Rx 1928c2ecf20Sopenharmony_ci - descriptor 0 unused */ 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_cistruct cpcs_trailer 1958c2ecf20Sopenharmony_ci{ 1968c2ecf20Sopenharmony_ci u_short control; 1978c2ecf20Sopenharmony_ci u_short length; 1988c2ecf20Sopenharmony_ci u_int crc32; 1998c2ecf20Sopenharmony_ci}; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_cistruct cpcs_trailer_desc 2028c2ecf20Sopenharmony_ci{ 2038c2ecf20Sopenharmony_ci struct cpcs_trailer *cpcs; 2048c2ecf20Sopenharmony_ci dma_addr_t dma_addr; 2058c2ecf20Sopenharmony_ci}; 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_cistruct ia_vcc 2088c2ecf20Sopenharmony_ci{ 2098c2ecf20Sopenharmony_ci int rxing; 2108c2ecf20Sopenharmony_ci int txing; 2118c2ecf20Sopenharmony_ci int NumCbrEntry; 2128c2ecf20Sopenharmony_ci u32 pcr; 2138c2ecf20Sopenharmony_ci u32 saved_tx_quota; 2148c2ecf20Sopenharmony_ci int flow_inc; 2158c2ecf20Sopenharmony_ci struct sk_buff_head txing_skb; 2168c2ecf20Sopenharmony_ci int ltimeout; 2178c2ecf20Sopenharmony_ci u8 vc_desc_cnt; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci}; 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_cistruct abr_vc_table 2228c2ecf20Sopenharmony_ci{ 2238c2ecf20Sopenharmony_ci u_char status; 2248c2ecf20Sopenharmony_ci u_char rdf; 2258c2ecf20Sopenharmony_ci u_short air; 2268c2ecf20Sopenharmony_ci u_int res[3]; 2278c2ecf20Sopenharmony_ci u_int req_rm_cell_data1; 2288c2ecf20Sopenharmony_ci u_int req_rm_cell_data2; 2298c2ecf20Sopenharmony_ci u_int add_rm_cell_data1; 2308c2ecf20Sopenharmony_ci u_int add_rm_cell_data2; 2318c2ecf20Sopenharmony_ci}; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci/* 32 byte entries */ 2348c2ecf20Sopenharmony_cistruct main_vc 2358c2ecf20Sopenharmony_ci{ 2368c2ecf20Sopenharmony_ci u_short type; 2378c2ecf20Sopenharmony_ci#define ABR 0x8000 2388c2ecf20Sopenharmony_ci#define UBR 0xc000 2398c2ecf20Sopenharmony_ci#define CBR 0x0000 2408c2ecf20Sopenharmony_ci /* ABR fields */ 2418c2ecf20Sopenharmony_ci u_short nrm; 2428c2ecf20Sopenharmony_ci u_short trm; 2438c2ecf20Sopenharmony_ci u_short rm_timestamp_hi; 2448c2ecf20Sopenharmony_ci u_short rm_timestamp_lo:8, 2458c2ecf20Sopenharmony_ci crm:8; 2468c2ecf20Sopenharmony_ci u_short remainder; /* ABR and UBR fields - last 10 bits*/ 2478c2ecf20Sopenharmony_ci u_short next_vc_sched; 2488c2ecf20Sopenharmony_ci u_short present_desc; /* all classes */ 2498c2ecf20Sopenharmony_ci u_short last_cell_slot; /* ABR and UBR */ 2508c2ecf20Sopenharmony_ci u_short pcr; 2518c2ecf20Sopenharmony_ci u_short fraction; 2528c2ecf20Sopenharmony_ci u_short icr; 2538c2ecf20Sopenharmony_ci u_short atdf; 2548c2ecf20Sopenharmony_ci u_short mcr; 2558c2ecf20Sopenharmony_ci u_short acr; 2568c2ecf20Sopenharmony_ci u_short unack:8, 2578c2ecf20Sopenharmony_ci status:8; /* all classes */ 2588c2ecf20Sopenharmony_ci#define UIOLI 0x80 2598c2ecf20Sopenharmony_ci#define CRC_APPEND 0x40 /* for status field - CRC-32 append */ 2608c2ecf20Sopenharmony_ci#define ABR_STATE 0x02 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci}; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci/* 8 byte entries */ 2668c2ecf20Sopenharmony_cistruct ext_vc 2678c2ecf20Sopenharmony_ci{ 2688c2ecf20Sopenharmony_ci u_short atm_hdr1; 2698c2ecf20Sopenharmony_ci u_short atm_hdr2; 2708c2ecf20Sopenharmony_ci u_short last_desc; 2718c2ecf20Sopenharmony_ci u_short out_of_rate_link; /* reserved for UBR and CBR */ 2728c2ecf20Sopenharmony_ci}; 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci#define DLE_ENTRIES 256 2768c2ecf20Sopenharmony_ci#define DMA_INT_ENABLE 0x0002 /* use for both Tx and Rx */ 2778c2ecf20Sopenharmony_ci#define TX_DLE_PSI 0x0001 2788c2ecf20Sopenharmony_ci#define DLE_TOTAL_SIZE (sizeof(struct dle)*DLE_ENTRIES) 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci/* Descriptor List Entries (DLE) */ 2818c2ecf20Sopenharmony_cistruct dle 2828c2ecf20Sopenharmony_ci{ 2838c2ecf20Sopenharmony_ci u32 sys_pkt_addr; 2848c2ecf20Sopenharmony_ci u32 local_pkt_addr; 2858c2ecf20Sopenharmony_ci u32 bytes; 2868c2ecf20Sopenharmony_ci u16 prq_wr_ptr_data; 2878c2ecf20Sopenharmony_ci u16 mode; 2888c2ecf20Sopenharmony_ci}; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_cistruct dle_q 2918c2ecf20Sopenharmony_ci{ 2928c2ecf20Sopenharmony_ci struct dle *start; 2938c2ecf20Sopenharmony_ci struct dle *end; 2948c2ecf20Sopenharmony_ci struct dle *read; 2958c2ecf20Sopenharmony_ci struct dle *write; 2968c2ecf20Sopenharmony_ci}; 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_cistruct free_desc_q 2998c2ecf20Sopenharmony_ci{ 3008c2ecf20Sopenharmony_ci int desc; /* Descriptor number */ 3018c2ecf20Sopenharmony_ci struct free_desc_q *next; 3028c2ecf20Sopenharmony_ci}; 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_cistruct tx_buf_desc { 3058c2ecf20Sopenharmony_ci unsigned short desc_mode; 3068c2ecf20Sopenharmony_ci unsigned short vc_index; 3078c2ecf20Sopenharmony_ci unsigned short res1; /* reserved field */ 3088c2ecf20Sopenharmony_ci unsigned short bytes; 3098c2ecf20Sopenharmony_ci unsigned short buf_start_hi; 3108c2ecf20Sopenharmony_ci unsigned short buf_start_lo; 3118c2ecf20Sopenharmony_ci unsigned short res2[10]; /* reserved field */ 3128c2ecf20Sopenharmony_ci}; 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_cistruct rx_buf_desc { 3168c2ecf20Sopenharmony_ci unsigned short desc_mode; 3178c2ecf20Sopenharmony_ci unsigned short vc_index; 3188c2ecf20Sopenharmony_ci unsigned short vpi; 3198c2ecf20Sopenharmony_ci unsigned short bytes; 3208c2ecf20Sopenharmony_ci unsigned short buf_start_hi; 3218c2ecf20Sopenharmony_ci unsigned short buf_start_lo; 3228c2ecf20Sopenharmony_ci unsigned short dma_start_hi; 3238c2ecf20Sopenharmony_ci unsigned short dma_start_lo; 3248c2ecf20Sopenharmony_ci unsigned short crc_upper; 3258c2ecf20Sopenharmony_ci unsigned short crc_lower; 3268c2ecf20Sopenharmony_ci unsigned short res:8, timeout:8; 3278c2ecf20Sopenharmony_ci unsigned short res2[5]; /* reserved field */ 3288c2ecf20Sopenharmony_ci}; 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci/*--------SAR stuff ---------------------*/ 3318c2ecf20Sopenharmony_ci 3328c2ecf20Sopenharmony_ci#define EPROM_SIZE 0x40000 /* says 64K in the docs ??? */ 3338c2ecf20Sopenharmony_ci#define MAC1_LEN 4 3348c2ecf20Sopenharmony_ci#define MAC2_LEN 2 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci/*------------ PCI Memory Space Map, 128K SAR memory ----------------*/ 3378c2ecf20Sopenharmony_ci#define IPHASE5575_PCI_CONFIG_REG_BASE 0x0000 3388c2ecf20Sopenharmony_ci#define IPHASE5575_BUS_CONTROL_REG_BASE 0x1000 /* offsets 0x00 - 0x3c */ 3398c2ecf20Sopenharmony_ci#define IPHASE5575_FRAG_CONTROL_REG_BASE 0x2000 3408c2ecf20Sopenharmony_ci#define IPHASE5575_REASS_CONTROL_REG_BASE 0x3000 3418c2ecf20Sopenharmony_ci#define IPHASE5575_DMA_CONTROL_REG_BASE 0x4000 3428c2ecf20Sopenharmony_ci#define IPHASE5575_FRONT_END_REG_BASE IPHASE5575_DMA_CONTROL_REG_BASE 3438c2ecf20Sopenharmony_ci#define IPHASE5575_FRAG_CONTROL_RAM_BASE 0x10000 3448c2ecf20Sopenharmony_ci#define IPHASE5575_REASS_CONTROL_RAM_BASE 0x20000 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci/*------------ Bus interface control registers -----------------*/ 3478c2ecf20Sopenharmony_ci#define IPHASE5575_BUS_CONTROL_REG 0x00 3488c2ecf20Sopenharmony_ci#define IPHASE5575_BUS_STATUS_REG 0x01 /* actual offset 0x04 */ 3498c2ecf20Sopenharmony_ci#define IPHASE5575_MAC1 0x02 3508c2ecf20Sopenharmony_ci#define IPHASE5575_REV 0x03 3518c2ecf20Sopenharmony_ci#define IPHASE5575_MAC2 0x03 /*actual offset 0x0e-reg 0x0c*/ 3528c2ecf20Sopenharmony_ci#define IPHASE5575_EXT_RESET 0x04 3538c2ecf20Sopenharmony_ci#define IPHASE5575_INT_RESET 0x05 /* addr 1c ?? reg 0x06 */ 3548c2ecf20Sopenharmony_ci#define IPHASE5575_PCI_ADDR_PAGE 0x07 /* reg 0x08, 0x09 ?? */ 3558c2ecf20Sopenharmony_ci#define IPHASE5575_EEPROM_ACCESS 0x0a /* actual offset 0x28 */ 3568c2ecf20Sopenharmony_ci#define IPHASE5575_CELL_FIFO_QUEUE_SZ 0x0b 3578c2ecf20Sopenharmony_ci#define IPHASE5575_CELL_FIFO_MARK_STATE 0x0c 3588c2ecf20Sopenharmony_ci#define IPHASE5575_CELL_FIFO_READ_PTR 0x0d 3598c2ecf20Sopenharmony_ci#define IPHASE5575_CELL_FIFO_WRITE_PTR 0x0e 3608c2ecf20Sopenharmony_ci#define IPHASE5575_CELL_FIFO_CELLS_AVL 0x0f /* actual offset 0x3c */ 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci/* Bus Interface Control Register bits */ 3638c2ecf20Sopenharmony_ci#define CTRL_FE_RST 0x80000000 3648c2ecf20Sopenharmony_ci#define CTRL_LED 0x40000000 3658c2ecf20Sopenharmony_ci#define CTRL_25MBPHY 0x10000000 3668c2ecf20Sopenharmony_ci#define CTRL_ENCMBMEM 0x08000000 3678c2ecf20Sopenharmony_ci#define CTRL_ENOFFSEG 0x01000000 3688c2ecf20Sopenharmony_ci#define CTRL_ERRMASK 0x00400000 3698c2ecf20Sopenharmony_ci#define CTRL_DLETMASK 0x00100000 3708c2ecf20Sopenharmony_ci#define CTRL_DLERMASK 0x00080000 3718c2ecf20Sopenharmony_ci#define CTRL_FEMASK 0x00040000 3728c2ecf20Sopenharmony_ci#define CTRL_SEGMASK 0x00020000 3738c2ecf20Sopenharmony_ci#define CTRL_REASSMASK 0x00010000 3748c2ecf20Sopenharmony_ci#define CTRL_CSPREEMPT 0x00002000 3758c2ecf20Sopenharmony_ci#define CTRL_B128 0x00000200 3768c2ecf20Sopenharmony_ci#define CTRL_B64 0x00000100 3778c2ecf20Sopenharmony_ci#define CTRL_B48 0x00000080 3788c2ecf20Sopenharmony_ci#define CTRL_B32 0x00000040 3798c2ecf20Sopenharmony_ci#define CTRL_B16 0x00000020 3808c2ecf20Sopenharmony_ci#define CTRL_B8 0x00000010 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci/* Bus Interface Status Register bits */ 3838c2ecf20Sopenharmony_ci#define STAT_CMEMSIZ 0xc0000000 3848c2ecf20Sopenharmony_ci#define STAT_ADPARCK 0x20000000 3858c2ecf20Sopenharmony_ci#define STAT_RESVD 0x1fffff80 3868c2ecf20Sopenharmony_ci#define STAT_ERRINT 0x00000040 3878c2ecf20Sopenharmony_ci#define STAT_MARKINT 0x00000020 3888c2ecf20Sopenharmony_ci#define STAT_DLETINT 0x00000010 3898c2ecf20Sopenharmony_ci#define STAT_DLERINT 0x00000008 3908c2ecf20Sopenharmony_ci#define STAT_FEINT 0x00000004 3918c2ecf20Sopenharmony_ci#define STAT_SEGINT 0x00000002 3928c2ecf20Sopenharmony_ci#define STAT_REASSINT 0x00000001 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci/*--------------- Segmentation control registers -----------------*/ 3968c2ecf20Sopenharmony_ci/* The segmentation registers are 16 bits access and the addresses 3978c2ecf20Sopenharmony_ci are defined as such so the addresses are the actual "offsets" */ 3988c2ecf20Sopenharmony_ci#define IDLEHEADHI 0x00 3998c2ecf20Sopenharmony_ci#define IDLEHEADLO 0x01 4008c2ecf20Sopenharmony_ci#define MAXRATE 0x02 4018c2ecf20Sopenharmony_ci/* Values for MAXRATE register for 155Mbps and 25.6 Mbps operation */ 4028c2ecf20Sopenharmony_ci#define RATE155 0x64b1 // 16 bits float format 4038c2ecf20Sopenharmony_ci#define MAX_ATM_155 352768 // Cells/second p.118 4048c2ecf20Sopenharmony_ci#define RATE25 0x5f9d 4058c2ecf20Sopenharmony_ci 4068c2ecf20Sopenharmony_ci#define STPARMS 0x03 4078c2ecf20Sopenharmony_ci#define STPARMS_1K 0x008c 4088c2ecf20Sopenharmony_ci#define STPARMS_2K 0x0049 4098c2ecf20Sopenharmony_ci#define STPARMS_4K 0x0026 4108c2ecf20Sopenharmony_ci#define COMP_EN 0x4000 4118c2ecf20Sopenharmony_ci#define CBR_EN 0x2000 4128c2ecf20Sopenharmony_ci#define ABR_EN 0x0800 4138c2ecf20Sopenharmony_ci#define UBR_EN 0x0400 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_ci#define ABRUBR_ARB 0x04 4168c2ecf20Sopenharmony_ci#define RM_TYPE 0x05 4178c2ecf20Sopenharmony_ci/*Value for RM_TYPE register for ATM Forum Traffic Mangement4.0 support*/ 4188c2ecf20Sopenharmony_ci#define RM_TYPE_4_0 0x0100 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci#define SEG_COMMAND_REG 0x17 4218c2ecf20Sopenharmony_ci/* Values for the command register */ 4228c2ecf20Sopenharmony_ci#define RESET_SEG 0x0055 4238c2ecf20Sopenharmony_ci#define RESET_SEG_STATE 0x00aa 4248c2ecf20Sopenharmony_ci#define RESET_TX_CELL_CTR 0x00cc 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci#define CBR_PTR_BASE 0x20 4278c2ecf20Sopenharmony_ci#define ABR_SBPTR_BASE 0x22 4288c2ecf20Sopenharmony_ci#define UBR_SBPTR_BASE 0x23 4298c2ecf20Sopenharmony_ci#define ABRWQ_BASE 0x26 4308c2ecf20Sopenharmony_ci#define UBRWQ_BASE 0x27 4318c2ecf20Sopenharmony_ci#define VCT_BASE 0x28 4328c2ecf20Sopenharmony_ci#define VCTE_BASE 0x29 4338c2ecf20Sopenharmony_ci#define CBR_TAB_BEG 0x2c 4348c2ecf20Sopenharmony_ci#define CBR_TAB_END 0x2d 4358c2ecf20Sopenharmony_ci#define PRQ_ST_ADR 0x30 4368c2ecf20Sopenharmony_ci#define PRQ_ED_ADR 0x31 4378c2ecf20Sopenharmony_ci#define PRQ_RD_PTR 0x32 4388c2ecf20Sopenharmony_ci#define PRQ_WR_PTR 0x33 4398c2ecf20Sopenharmony_ci#define TCQ_ST_ADR 0x34 4408c2ecf20Sopenharmony_ci#define TCQ_ED_ADR 0x35 4418c2ecf20Sopenharmony_ci#define TCQ_RD_PTR 0x36 4428c2ecf20Sopenharmony_ci#define TCQ_WR_PTR 0x37 4438c2ecf20Sopenharmony_ci#define SEG_QUEUE_BASE 0x40 4448c2ecf20Sopenharmony_ci#define SEG_DESC_BASE 0x41 4458c2ecf20Sopenharmony_ci#define MODE_REG_0 0x45 4468c2ecf20Sopenharmony_ci#define T_ONLINE 0x0002 /* (i)chipSAR is online */ 4478c2ecf20Sopenharmony_ci 4488c2ecf20Sopenharmony_ci#define MODE_REG_1 0x46 4498c2ecf20Sopenharmony_ci#define MODE_REG_1_VAL 0x0400 /*for propoer device operation*/ 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_ci#define SEG_INTR_STATUS_REG 0x47 4528c2ecf20Sopenharmony_ci#define SEG_MASK_REG 0x48 4538c2ecf20Sopenharmony_ci#define TRANSMIT_DONE 0x0200 4548c2ecf20Sopenharmony_ci#define TCQ_NOT_EMPTY 0x1000 /* this can be used for both the interrupt 4558c2ecf20Sopenharmony_ci status registers as well as the mask register */ 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci#define CELL_CTR_HIGH_AUTO 0x49 4588c2ecf20Sopenharmony_ci#define CELL_CTR_HIGH_NOAUTO 0xc9 4598c2ecf20Sopenharmony_ci#define CELL_CTR_LO_AUTO 0x4a 4608c2ecf20Sopenharmony_ci#define CELL_CTR_LO_NOAUTO 0xca 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_ci/* Diagnostic registers */ 4638c2ecf20Sopenharmony_ci#define NEXTDESC 0x59 4648c2ecf20Sopenharmony_ci#define NEXTVC 0x5a 4658c2ecf20Sopenharmony_ci#define PSLOTCNT 0x5d 4668c2ecf20Sopenharmony_ci#define NEWDN 0x6a 4678c2ecf20Sopenharmony_ci#define NEWVC 0x6b 4688c2ecf20Sopenharmony_ci#define SBPTR 0x6c 4698c2ecf20Sopenharmony_ci#define ABRWQ_WRPTR 0x6f 4708c2ecf20Sopenharmony_ci#define ABRWQ_RDPTR 0x70 4718c2ecf20Sopenharmony_ci#define UBRWQ_WRPTR 0x71 4728c2ecf20Sopenharmony_ci#define UBRWQ_RDPTR 0x72 4738c2ecf20Sopenharmony_ci#define CBR_VC 0x73 4748c2ecf20Sopenharmony_ci#define ABR_SBVC 0x75 4758c2ecf20Sopenharmony_ci#define UBR_SBVC 0x76 4768c2ecf20Sopenharmony_ci#define ABRNEXTLINK 0x78 4778c2ecf20Sopenharmony_ci#define UBRNEXTLINK 0x79 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_ci/*----------------- Reassembly control registers ---------------------*/ 4818c2ecf20Sopenharmony_ci/* The reassembly registers are 16 bits access and the addresses 4828c2ecf20Sopenharmony_ci are defined as such so the addresses are the actual "offsets" */ 4838c2ecf20Sopenharmony_ci#define MODE_REG 0x00 4848c2ecf20Sopenharmony_ci#define R_ONLINE 0x0002 /* (i)chip is online */ 4858c2ecf20Sopenharmony_ci#define IGN_RAW_FL 0x0004 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_ci#define PROTOCOL_ID 0x01 4888c2ecf20Sopenharmony_ci#define REASS_MASK_REG 0x02 4898c2ecf20Sopenharmony_ci#define REASS_INTR_STATUS_REG 0x03 4908c2ecf20Sopenharmony_ci/* Interrupt Status register bits */ 4918c2ecf20Sopenharmony_ci#define RX_PKT_CTR_OF 0x8000 4928c2ecf20Sopenharmony_ci#define RX_ERR_CTR_OF 0x4000 4938c2ecf20Sopenharmony_ci#define RX_CELL_CTR_OF 0x1000 4948c2ecf20Sopenharmony_ci#define RX_FREEQ_EMPT 0x0200 4958c2ecf20Sopenharmony_ci#define RX_EXCPQ_FL 0x0080 4968c2ecf20Sopenharmony_ci#define RX_RAWQ_FL 0x0010 4978c2ecf20Sopenharmony_ci#define RX_EXCP_RCVD 0x0008 4988c2ecf20Sopenharmony_ci#define RX_PKT_RCVD 0x0004 4998c2ecf20Sopenharmony_ci#define RX_RAW_RCVD 0x0001 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_ci#define DRP_PKT_CNTR 0x04 5028c2ecf20Sopenharmony_ci#define ERR_CNTR 0x05 5038c2ecf20Sopenharmony_ci#define RAW_BASE_ADR 0x08 5048c2ecf20Sopenharmony_ci#define CELL_CTR0 0x0c 5058c2ecf20Sopenharmony_ci#define CELL_CTR1 0x0d 5068c2ecf20Sopenharmony_ci#define REASS_COMMAND_REG 0x0f 5078c2ecf20Sopenharmony_ci/* Values for command register */ 5088c2ecf20Sopenharmony_ci#define RESET_REASS 0x0055 5098c2ecf20Sopenharmony_ci#define RESET_REASS_STATE 0x00aa 5108c2ecf20Sopenharmony_ci#define RESET_DRP_PKT_CNTR 0x00f1 5118c2ecf20Sopenharmony_ci#define RESET_ERR_CNTR 0x00f2 5128c2ecf20Sopenharmony_ci#define RESET_CELL_CNTR 0x00f8 5138c2ecf20Sopenharmony_ci#define RESET_REASS_ALL_REGS 0x00ff 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_ci#define REASS_DESC_BASE 0x10 5168c2ecf20Sopenharmony_ci#define VC_LKUP_BASE 0x11 5178c2ecf20Sopenharmony_ci#define REASS_TABLE_BASE 0x12 5188c2ecf20Sopenharmony_ci#define REASS_QUEUE_BASE 0x13 5198c2ecf20Sopenharmony_ci#define PKT_TM_CNT 0x16 5208c2ecf20Sopenharmony_ci#define TMOUT_RANGE 0x17 5218c2ecf20Sopenharmony_ci#define INTRVL_CNTR 0x18 5228c2ecf20Sopenharmony_ci#define TMOUT_INDX 0x19 5238c2ecf20Sopenharmony_ci#define VP_LKUP_BASE 0x1c 5248c2ecf20Sopenharmony_ci#define VP_FILTER 0x1d 5258c2ecf20Sopenharmony_ci#define ABR_LKUP_BASE 0x1e 5268c2ecf20Sopenharmony_ci#define FREEQ_ST_ADR 0x24 5278c2ecf20Sopenharmony_ci#define FREEQ_ED_ADR 0x25 5288c2ecf20Sopenharmony_ci#define FREEQ_RD_PTR 0x26 5298c2ecf20Sopenharmony_ci#define FREEQ_WR_PTR 0x27 5308c2ecf20Sopenharmony_ci#define PCQ_ST_ADR 0x28 5318c2ecf20Sopenharmony_ci#define PCQ_ED_ADR 0x29 5328c2ecf20Sopenharmony_ci#define PCQ_RD_PTR 0x2a 5338c2ecf20Sopenharmony_ci#define PCQ_WR_PTR 0x2b 5348c2ecf20Sopenharmony_ci#define EXCP_Q_ST_ADR 0x2c 5358c2ecf20Sopenharmony_ci#define EXCP_Q_ED_ADR 0x2d 5368c2ecf20Sopenharmony_ci#define EXCP_Q_RD_PTR 0x2e 5378c2ecf20Sopenharmony_ci#define EXCP_Q_WR_PTR 0x2f 5388c2ecf20Sopenharmony_ci#define CC_FIFO_ST_ADR 0x34 5398c2ecf20Sopenharmony_ci#define CC_FIFO_ED_ADR 0x35 5408c2ecf20Sopenharmony_ci#define CC_FIFO_RD_PTR 0x36 5418c2ecf20Sopenharmony_ci#define CC_FIFO_WR_PTR 0x37 5428c2ecf20Sopenharmony_ci#define STATE_REG 0x38 5438c2ecf20Sopenharmony_ci#define BUF_SIZE 0x42 5448c2ecf20Sopenharmony_ci#define XTRA_RM_OFFSET 0x44 5458c2ecf20Sopenharmony_ci#define DRP_PKT_CNTR_NC 0x84 5468c2ecf20Sopenharmony_ci#define ERR_CNTR_NC 0x85 5478c2ecf20Sopenharmony_ci#define CELL_CNTR0_NC 0x8c 5488c2ecf20Sopenharmony_ci#define CELL_CNTR1_NC 0x8d 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci/* State Register bits */ 5518c2ecf20Sopenharmony_ci#define EXCPQ_EMPTY 0x0040 5528c2ecf20Sopenharmony_ci#define PCQ_EMPTY 0x0010 5538c2ecf20Sopenharmony_ci#define FREEQ_EMPTY 0x0004 5548c2ecf20Sopenharmony_ci 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_ci/*----------------- Front End registers/ DMA control --------------*/ 5578c2ecf20Sopenharmony_ci/* There is a lot of documentation error regarding these offsets ??? 5588c2ecf20Sopenharmony_ci eg:- 2 offsets given 800, a00 for rx counter 5598c2ecf20Sopenharmony_ci similarly many others 5608c2ecf20Sopenharmony_ci Remember again that the offsets are to be 4*register number, so 5618c2ecf20Sopenharmony_ci correct the #defines here 5628c2ecf20Sopenharmony_ci*/ 5638c2ecf20Sopenharmony_ci#define IPHASE5575_TX_COUNTER 0x200 /* offset - 0x800 */ 5648c2ecf20Sopenharmony_ci#define IPHASE5575_RX_COUNTER 0x280 /* offset - 0xa00 */ 5658c2ecf20Sopenharmony_ci#define IPHASE5575_TX_LIST_ADDR 0x300 /* offset - 0xc00 */ 5668c2ecf20Sopenharmony_ci#define IPHASE5575_RX_LIST_ADDR 0x380 /* offset - 0xe00 */ 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_ci/*--------------------------- RAM ---------------------------*/ 5698c2ecf20Sopenharmony_ci/* These memory maps are actually offsets from the segmentation and reassembly RAM base addresses */ 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci/* Segmentation Control Memory map */ 5728c2ecf20Sopenharmony_ci#define TX_DESC_BASE 0x0000 /* Buffer Decriptor Table */ 5738c2ecf20Sopenharmony_ci#define TX_COMP_Q 0x1000 /* Transmit Complete Queue */ 5748c2ecf20Sopenharmony_ci#define PKT_RDY_Q 0x1400 /* Packet Ready Queue */ 5758c2ecf20Sopenharmony_ci#define CBR_SCHED_TABLE 0x1800 /* CBR Table */ 5768c2ecf20Sopenharmony_ci#define UBR_SCHED_TABLE 0x3000 /* UBR Table */ 5778c2ecf20Sopenharmony_ci#define UBR_WAIT_Q 0x4000 /* UBR Wait Queue */ 5788c2ecf20Sopenharmony_ci#define ABR_SCHED_TABLE 0x5000 /* ABR Table */ 5798c2ecf20Sopenharmony_ci#define ABR_WAIT_Q 0x5800 /* ABR Wait Queue */ 5808c2ecf20Sopenharmony_ci#define EXT_VC_TABLE 0x6000 /* Extended VC Table */ 5818c2ecf20Sopenharmony_ci#define MAIN_VC_TABLE 0x8000 /* Main VC Table */ 5828c2ecf20Sopenharmony_ci#define SCHEDSZ 1024 /* ABR and UBR Scheduling Table size */ 5838c2ecf20Sopenharmony_ci#define TX_DESC_TABLE_SZ 128 /* Number of entries in the Transmit 5848c2ecf20Sopenharmony_ci Buffer Descriptor Table */ 5858c2ecf20Sopenharmony_ci 5868c2ecf20Sopenharmony_ci/* These are used as table offsets in Descriptor Table address generation */ 5878c2ecf20Sopenharmony_ci#define DESC_MODE 0x0 5888c2ecf20Sopenharmony_ci#define VC_INDEX 0x1 5898c2ecf20Sopenharmony_ci#define BYTE_CNT 0x3 5908c2ecf20Sopenharmony_ci#define PKT_START_HI 0x4 5918c2ecf20Sopenharmony_ci#define PKT_START_LO 0x5 5928c2ecf20Sopenharmony_ci 5938c2ecf20Sopenharmony_ci/* Descriptor Mode Word Bits */ 5948c2ecf20Sopenharmony_ci#define EOM_EN 0x0800 5958c2ecf20Sopenharmony_ci#define AAL5 0x0100 5968c2ecf20Sopenharmony_ci#define APP_CRC32 0x0400 5978c2ecf20Sopenharmony_ci#define CMPL_INT 0x1000 5988c2ecf20Sopenharmony_ci 5998c2ecf20Sopenharmony_ci#define TABLE_ADDRESS(db, dn, to) \ 6008c2ecf20Sopenharmony_ci (((unsigned long)(db & 0x04)) << 16) | (dn << 5) | (to << 1) 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_ci/* Reassembly Control Memory Map */ 6038c2ecf20Sopenharmony_ci#define RX_DESC_BASE 0x0000 /* Buffer Descriptor Table */ 6048c2ecf20Sopenharmony_ci#define VP_TABLE 0x5c00 /* VP Table */ 6058c2ecf20Sopenharmony_ci#define EXCEPTION_Q 0x5e00 /* Exception Queue */ 6068c2ecf20Sopenharmony_ci#define FREE_BUF_DESC_Q 0x6000 /* Free Buffer Descriptor Queue */ 6078c2ecf20Sopenharmony_ci#define PKT_COMP_Q 0x6800 /* Packet Complete Queue */ 6088c2ecf20Sopenharmony_ci#define REASS_TABLE 0x7000 /* Reassembly Table */ 6098c2ecf20Sopenharmony_ci#define RX_VC_TABLE 0x7800 /* VC Table */ 6108c2ecf20Sopenharmony_ci#define ABR_VC_TABLE 0x8000 /* ABR VC Table */ 6118c2ecf20Sopenharmony_ci#define RX_DESC_TABLE_SZ 736 /* Number of entries in the Receive 6128c2ecf20Sopenharmony_ci Buffer Descriptor Table */ 6138c2ecf20Sopenharmony_ci#define VP_TABLE_SZ 256 /* Number of entries in VPTable */ 6148c2ecf20Sopenharmony_ci#define RX_VC_TABLE_SZ 1024 /* Number of entries in VC Table */ 6158c2ecf20Sopenharmony_ci#define REASS_TABLE_SZ 1024 /* Number of entries in Reassembly Table */ 6168c2ecf20Sopenharmony_ci /* Buffer Descriptor Table */ 6178c2ecf20Sopenharmony_ci#define RX_ACT 0x8000 6188c2ecf20Sopenharmony_ci#define RX_VPVC 0x4000 6198c2ecf20Sopenharmony_ci#define RX_CNG 0x0040 6208c2ecf20Sopenharmony_ci#define RX_CER 0x0008 6218c2ecf20Sopenharmony_ci#define RX_PTE 0x0004 6228c2ecf20Sopenharmony_ci#define RX_OFL 0x0002 6238c2ecf20Sopenharmony_ci#define NUM_RX_EXCP 32 6248c2ecf20Sopenharmony_ci 6258c2ecf20Sopenharmony_ci/* Reassembly Table */ 6268c2ecf20Sopenharmony_ci#define NO_AAL5_PKT 0x0000 6278c2ecf20Sopenharmony_ci#define AAL5_PKT_REASSEMBLED 0x4000 6288c2ecf20Sopenharmony_ci#define AAL5_PKT_TERMINATED 0x8000 6298c2ecf20Sopenharmony_ci#define RAW_PKT 0xc000 6308c2ecf20Sopenharmony_ci#define REASS_ABR 0x2000 6318c2ecf20Sopenharmony_ci 6328c2ecf20Sopenharmony_ci/*-------------------- Base Registers --------------------*/ 6338c2ecf20Sopenharmony_ci#define REG_BASE IPHASE5575_BUS_CONTROL_REG_BASE 6348c2ecf20Sopenharmony_ci#define RAM_BASE IPHASE5575_FRAG_CONTROL_RAM_BASE 6358c2ecf20Sopenharmony_ci#define PHY_BASE IPHASE5575_FRONT_END_REG_BASE 6368c2ecf20Sopenharmony_ci#define SEG_BASE IPHASE5575_FRAG_CONTROL_REG_BASE 6378c2ecf20Sopenharmony_ci#define REASS_BASE IPHASE5575_REASS_CONTROL_REG_BASE 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_citypedef volatile u_int ffreg_t; 6408c2ecf20Sopenharmony_citypedef u_int rreg_t; 6418c2ecf20Sopenharmony_ci 6428c2ecf20Sopenharmony_citypedef struct _ffredn_t { 6438c2ecf20Sopenharmony_ci ffreg_t idlehead_high; /* Idle cell header (high) */ 6448c2ecf20Sopenharmony_ci ffreg_t idlehead_low; /* Idle cell header (low) */ 6458c2ecf20Sopenharmony_ci ffreg_t maxrate; /* Maximum rate */ 6468c2ecf20Sopenharmony_ci ffreg_t stparms; /* Traffic Management Parameters */ 6478c2ecf20Sopenharmony_ci ffreg_t abrubr_abr; /* ABRUBR Priority Byte 1, TCR Byte 0 */ 6488c2ecf20Sopenharmony_ci ffreg_t rm_type; /* */ 6498c2ecf20Sopenharmony_ci u_int filler5[0x17 - 0x06]; 6508c2ecf20Sopenharmony_ci ffreg_t cmd_reg; /* Command register */ 6518c2ecf20Sopenharmony_ci u_int filler18[0x20 - 0x18]; 6528c2ecf20Sopenharmony_ci ffreg_t cbr_base; /* CBR Pointer Base */ 6538c2ecf20Sopenharmony_ci ffreg_t vbr_base; /* VBR Pointer Base */ 6548c2ecf20Sopenharmony_ci ffreg_t abr_base; /* ABR Pointer Base */ 6558c2ecf20Sopenharmony_ci ffreg_t ubr_base; /* UBR Pointer Base */ 6568c2ecf20Sopenharmony_ci u_int filler24; 6578c2ecf20Sopenharmony_ci ffreg_t vbrwq_base; /* VBR Wait Queue Base */ 6588c2ecf20Sopenharmony_ci ffreg_t abrwq_base; /* ABR Wait Queue Base */ 6598c2ecf20Sopenharmony_ci ffreg_t ubrwq_base; /* UBR Wait Queue Base */ 6608c2ecf20Sopenharmony_ci ffreg_t vct_base; /* Main VC Table Base */ 6618c2ecf20Sopenharmony_ci ffreg_t vcte_base; /* Extended Main VC Table Base */ 6628c2ecf20Sopenharmony_ci u_int filler2a[0x2C - 0x2A]; 6638c2ecf20Sopenharmony_ci ffreg_t cbr_tab_beg; /* CBR Table Begin */ 6648c2ecf20Sopenharmony_ci ffreg_t cbr_tab_end; /* CBR Table End */ 6658c2ecf20Sopenharmony_ci ffreg_t cbr_pointer; /* CBR Pointer */ 6668c2ecf20Sopenharmony_ci u_int filler2f[0x30 - 0x2F]; 6678c2ecf20Sopenharmony_ci ffreg_t prq_st_adr; /* Packet Ready Queue Start Address */ 6688c2ecf20Sopenharmony_ci ffreg_t prq_ed_adr; /* Packet Ready Queue End Address */ 6698c2ecf20Sopenharmony_ci ffreg_t prq_rd_ptr; /* Packet Ready Queue read pointer */ 6708c2ecf20Sopenharmony_ci ffreg_t prq_wr_ptr; /* Packet Ready Queue write pointer */ 6718c2ecf20Sopenharmony_ci ffreg_t tcq_st_adr; /* Transmit Complete Queue Start Address*/ 6728c2ecf20Sopenharmony_ci ffreg_t tcq_ed_adr; /* Transmit Complete Queue End Address */ 6738c2ecf20Sopenharmony_ci ffreg_t tcq_rd_ptr; /* Transmit Complete Queue read pointer */ 6748c2ecf20Sopenharmony_ci ffreg_t tcq_wr_ptr; /* Transmit Complete Queue write pointer*/ 6758c2ecf20Sopenharmony_ci u_int filler38[0x40 - 0x38]; 6768c2ecf20Sopenharmony_ci ffreg_t queue_base; /* Base address for PRQ and TCQ */ 6778c2ecf20Sopenharmony_ci ffreg_t desc_base; /* Base address of descriptor table */ 6788c2ecf20Sopenharmony_ci u_int filler42[0x45 - 0x42]; 6798c2ecf20Sopenharmony_ci ffreg_t mode_reg_0; /* Mode register 0 */ 6808c2ecf20Sopenharmony_ci ffreg_t mode_reg_1; /* Mode register 1 */ 6818c2ecf20Sopenharmony_ci ffreg_t intr_status_reg;/* Interrupt Status register */ 6828c2ecf20Sopenharmony_ci ffreg_t mask_reg; /* Mask Register */ 6838c2ecf20Sopenharmony_ci ffreg_t cell_ctr_high1; /* Total cell transfer count (high) */ 6848c2ecf20Sopenharmony_ci ffreg_t cell_ctr_lo1; /* Total cell transfer count (low) */ 6858c2ecf20Sopenharmony_ci ffreg_t state_reg; /* Status register */ 6868c2ecf20Sopenharmony_ci u_int filler4c[0x58 - 0x4c]; 6878c2ecf20Sopenharmony_ci ffreg_t curr_desc_num; /* Contains the current descriptor num */ 6888c2ecf20Sopenharmony_ci ffreg_t next_desc; /* Next descriptor */ 6898c2ecf20Sopenharmony_ci ffreg_t next_vc; /* Next VC */ 6908c2ecf20Sopenharmony_ci u_int filler5b[0x5d - 0x5b]; 6918c2ecf20Sopenharmony_ci ffreg_t present_slot_cnt;/* Present slot count */ 6928c2ecf20Sopenharmony_ci u_int filler5e[0x6a - 0x5e]; 6938c2ecf20Sopenharmony_ci ffreg_t new_desc_num; /* New descriptor number */ 6948c2ecf20Sopenharmony_ci ffreg_t new_vc; /* New VC */ 6958c2ecf20Sopenharmony_ci ffreg_t sched_tbl_ptr; /* Schedule table pointer */ 6968c2ecf20Sopenharmony_ci ffreg_t vbrwq_wptr; /* VBR wait queue write pointer */ 6978c2ecf20Sopenharmony_ci ffreg_t vbrwq_rptr; /* VBR wait queue read pointer */ 6988c2ecf20Sopenharmony_ci ffreg_t abrwq_wptr; /* ABR wait queue write pointer */ 6998c2ecf20Sopenharmony_ci ffreg_t abrwq_rptr; /* ABR wait queue read pointer */ 7008c2ecf20Sopenharmony_ci ffreg_t ubrwq_wptr; /* UBR wait queue write pointer */ 7018c2ecf20Sopenharmony_ci ffreg_t ubrwq_rptr; /* UBR wait queue read pointer */ 7028c2ecf20Sopenharmony_ci ffreg_t cbr_vc; /* CBR VC */ 7038c2ecf20Sopenharmony_ci ffreg_t vbr_sb_vc; /* VBR SB VC */ 7048c2ecf20Sopenharmony_ci ffreg_t abr_sb_vc; /* ABR SB VC */ 7058c2ecf20Sopenharmony_ci ffreg_t ubr_sb_vc; /* UBR SB VC */ 7068c2ecf20Sopenharmony_ci ffreg_t vbr_next_link; /* VBR next link */ 7078c2ecf20Sopenharmony_ci ffreg_t abr_next_link; /* ABR next link */ 7088c2ecf20Sopenharmony_ci ffreg_t ubr_next_link; /* UBR next link */ 7098c2ecf20Sopenharmony_ci u_int filler7a[0x7c-0x7a]; 7108c2ecf20Sopenharmony_ci ffreg_t out_rate_head; /* Out of rate head */ 7118c2ecf20Sopenharmony_ci u_int filler7d[0xca-0x7d]; /* pad out to full address space */ 7128c2ecf20Sopenharmony_ci ffreg_t cell_ctr_high1_nc;/* Total cell transfer count (high) */ 7138c2ecf20Sopenharmony_ci ffreg_t cell_ctr_lo1_nc;/* Total cell transfer count (low) */ 7148c2ecf20Sopenharmony_ci u_int fillercc[0x100-0xcc]; /* pad out to full address space */ 7158c2ecf20Sopenharmony_ci} ffredn_t; 7168c2ecf20Sopenharmony_ci 7178c2ecf20Sopenharmony_citypedef struct _rfredn_t { 7188c2ecf20Sopenharmony_ci rreg_t mode_reg_0; /* Mode register 0 */ 7198c2ecf20Sopenharmony_ci rreg_t protocol_id; /* Protocol ID */ 7208c2ecf20Sopenharmony_ci rreg_t mask_reg; /* Mask Register */ 7218c2ecf20Sopenharmony_ci rreg_t intr_status_reg;/* Interrupt status register */ 7228c2ecf20Sopenharmony_ci rreg_t drp_pkt_cntr; /* Dropped packet cntr (clear on read) */ 7238c2ecf20Sopenharmony_ci rreg_t err_cntr; /* Error Counter (cleared on read) */ 7248c2ecf20Sopenharmony_ci u_int filler6[0x08 - 0x06]; 7258c2ecf20Sopenharmony_ci rreg_t raw_base_adr; /* Base addr for raw cell Q */ 7268c2ecf20Sopenharmony_ci u_int filler2[0x0c - 0x09]; 7278c2ecf20Sopenharmony_ci rreg_t cell_ctr0; /* Cell Counter 0 (cleared when read) */ 7288c2ecf20Sopenharmony_ci rreg_t cell_ctr1; /* Cell Counter 1 (cleared when read) */ 7298c2ecf20Sopenharmony_ci u_int filler3[0x0f - 0x0e]; 7308c2ecf20Sopenharmony_ci rreg_t cmd_reg; /* Command register */ 7318c2ecf20Sopenharmony_ci rreg_t desc_base; /* Base address for description table */ 7328c2ecf20Sopenharmony_ci rreg_t vc_lkup_base; /* Base address for VC lookup table */ 7338c2ecf20Sopenharmony_ci rreg_t reass_base; /* Base address for reassembler table */ 7348c2ecf20Sopenharmony_ci rreg_t queue_base; /* Base address for Communication queue */ 7358c2ecf20Sopenharmony_ci u_int filler14[0x16 - 0x14]; 7368c2ecf20Sopenharmony_ci rreg_t pkt_tm_cnt; /* Packet Timeout and count register */ 7378c2ecf20Sopenharmony_ci rreg_t tmout_range; /* Range of reassembley IDs for timeout */ 7388c2ecf20Sopenharmony_ci rreg_t intrvl_cntr; /* Packet aging interval counter */ 7398c2ecf20Sopenharmony_ci rreg_t tmout_indx; /* index of pkt being tested for aging */ 7408c2ecf20Sopenharmony_ci u_int filler1a[0x1c - 0x1a]; 7418c2ecf20Sopenharmony_ci rreg_t vp_lkup_base; /* Base address for VP lookup table */ 7428c2ecf20Sopenharmony_ci rreg_t vp_filter; /* VP filter register */ 7438c2ecf20Sopenharmony_ci rreg_t abr_lkup_base; /* Base address of ABR VC Table */ 7448c2ecf20Sopenharmony_ci u_int filler1f[0x24 - 0x1f]; 7458c2ecf20Sopenharmony_ci rreg_t fdq_st_adr; /* Free desc queue start address */ 7468c2ecf20Sopenharmony_ci rreg_t fdq_ed_adr; /* Free desc queue end address */ 7478c2ecf20Sopenharmony_ci rreg_t fdq_rd_ptr; /* Free desc queue read pointer */ 7488c2ecf20Sopenharmony_ci rreg_t fdq_wr_ptr; /* Free desc queue write pointer */ 7498c2ecf20Sopenharmony_ci rreg_t pcq_st_adr; /* Packet Complete queue start address */ 7508c2ecf20Sopenharmony_ci rreg_t pcq_ed_adr; /* Packet Complete queue end address */ 7518c2ecf20Sopenharmony_ci rreg_t pcq_rd_ptr; /* Packet Complete queue read pointer */ 7528c2ecf20Sopenharmony_ci rreg_t pcq_wr_ptr; /* Packet Complete queue write pointer */ 7538c2ecf20Sopenharmony_ci rreg_t excp_st_adr; /* Exception queue start address */ 7548c2ecf20Sopenharmony_ci rreg_t excp_ed_adr; /* Exception queue end address */ 7558c2ecf20Sopenharmony_ci rreg_t excp_rd_ptr; /* Exception queue read pointer */ 7568c2ecf20Sopenharmony_ci rreg_t excp_wr_ptr; /* Exception queue write pointer */ 7578c2ecf20Sopenharmony_ci u_int filler30[0x34 - 0x30]; 7588c2ecf20Sopenharmony_ci rreg_t raw_st_adr; /* Raw Cell start address */ 7598c2ecf20Sopenharmony_ci rreg_t raw_ed_adr; /* Raw Cell end address */ 7608c2ecf20Sopenharmony_ci rreg_t raw_rd_ptr; /* Raw Cell read pointer */ 7618c2ecf20Sopenharmony_ci rreg_t raw_wr_ptr; /* Raw Cell write pointer */ 7628c2ecf20Sopenharmony_ci rreg_t state_reg; /* State Register */ 7638c2ecf20Sopenharmony_ci u_int filler39[0x42 - 0x39]; 7648c2ecf20Sopenharmony_ci rreg_t buf_size; /* Buffer size */ 7658c2ecf20Sopenharmony_ci u_int filler43; 7668c2ecf20Sopenharmony_ci rreg_t xtra_rm_offset; /* Offset of the additional turnaround RM */ 7678c2ecf20Sopenharmony_ci u_int filler45[0x84 - 0x45]; 7688c2ecf20Sopenharmony_ci rreg_t drp_pkt_cntr_nc;/* Dropped Packet cntr, Not clear on rd */ 7698c2ecf20Sopenharmony_ci rreg_t err_cntr_nc; /* Error Counter, Not clear on read */ 7708c2ecf20Sopenharmony_ci u_int filler86[0x8c - 0x86]; 7718c2ecf20Sopenharmony_ci rreg_t cell_ctr0_nc; /* Cell Counter 0, Not clear on read */ 7728c2ecf20Sopenharmony_ci rreg_t cell_ctr1_nc; /* Cell Counter 1, Not clear on read */ 7738c2ecf20Sopenharmony_ci u_int filler8e[0x100-0x8e]; /* pad out to full address space */ 7748c2ecf20Sopenharmony_ci} rfredn_t; 7758c2ecf20Sopenharmony_ci 7768c2ecf20Sopenharmony_citypedef struct { 7778c2ecf20Sopenharmony_ci /* Atlantic */ 7788c2ecf20Sopenharmony_ci ffredn_t ffredn; /* F FRED */ 7798c2ecf20Sopenharmony_ci rfredn_t rfredn; /* R FRED */ 7808c2ecf20Sopenharmony_ci} ia_regs_t; 7818c2ecf20Sopenharmony_ci 7828c2ecf20Sopenharmony_citypedef struct { 7838c2ecf20Sopenharmony_ci u_short f_vc_type; /* VC type */ 7848c2ecf20Sopenharmony_ci u_short f_nrm; /* Nrm */ 7858c2ecf20Sopenharmony_ci u_short f_nrmexp; /* Nrm Exp */ 7868c2ecf20Sopenharmony_ci u_short reserved6; /* */ 7878c2ecf20Sopenharmony_ci u_short f_crm; /* Crm */ 7888c2ecf20Sopenharmony_ci u_short reserved10; /* Reserved */ 7898c2ecf20Sopenharmony_ci u_short reserved12; /* Reserved */ 7908c2ecf20Sopenharmony_ci u_short reserved14; /* Reserved */ 7918c2ecf20Sopenharmony_ci u_short last_cell_slot; /* last_cell_slot_count */ 7928c2ecf20Sopenharmony_ci u_short f_pcr; /* Peak Cell Rate */ 7938c2ecf20Sopenharmony_ci u_short fraction; /* fraction */ 7948c2ecf20Sopenharmony_ci u_short f_icr; /* Initial Cell Rate */ 7958c2ecf20Sopenharmony_ci u_short f_cdf; /* */ 7968c2ecf20Sopenharmony_ci u_short f_mcr; /* Minimum Cell Rate */ 7978c2ecf20Sopenharmony_ci u_short f_acr; /* Allowed Cell Rate */ 7988c2ecf20Sopenharmony_ci u_short f_status; /* */ 7998c2ecf20Sopenharmony_ci} f_vc_abr_entry; 8008c2ecf20Sopenharmony_ci 8018c2ecf20Sopenharmony_citypedef struct { 8028c2ecf20Sopenharmony_ci u_short r_status_rdf; /* status + RDF */ 8038c2ecf20Sopenharmony_ci u_short r_air; /* AIR */ 8048c2ecf20Sopenharmony_ci u_short reserved4[14]; /* Reserved */ 8058c2ecf20Sopenharmony_ci} r_vc_abr_entry; 8068c2ecf20Sopenharmony_ci 8078c2ecf20Sopenharmony_ci#define MRM 3 8088c2ecf20Sopenharmony_ci 8098c2ecf20Sopenharmony_citypedef struct srv_cls_param { 8108c2ecf20Sopenharmony_ci u32 class_type; /* CBR/VBR/ABR/UBR; use the enum above */ 8118c2ecf20Sopenharmony_ci u32 pcr; /* Peak Cell Rate (24-bit) */ 8128c2ecf20Sopenharmony_ci /* VBR parameters */ 8138c2ecf20Sopenharmony_ci u32 scr; /* sustainable cell rate */ 8148c2ecf20Sopenharmony_ci u32 max_burst_size; /* ?? cell rate or data rate */ 8158c2ecf20Sopenharmony_ci 8168c2ecf20Sopenharmony_ci /* ABR only UNI 4.0 Parameters */ 8178c2ecf20Sopenharmony_ci u32 mcr; /* Min Cell Rate (24-bit) */ 8188c2ecf20Sopenharmony_ci u32 icr; /* Initial Cell Rate (24-bit) */ 8198c2ecf20Sopenharmony_ci u32 tbe; /* Transient Buffer Exposure (24-bit) */ 8208c2ecf20Sopenharmony_ci u32 frtt; /* Fixed Round Trip Time (24-bit) */ 8218c2ecf20Sopenharmony_ci 8228c2ecf20Sopenharmony_ci#if 0 /* Additional Parameters of TM 4.0 */ 8238c2ecf20Sopenharmony_cibits 31 30 29 28 27-25 24-22 21-19 18-9 8248c2ecf20Sopenharmony_ci----------------------------------------------------------------------------- 8258c2ecf20Sopenharmony_ci| NRM present | TRM prsnt | CDF prsnt | ADTF prsnt | NRM | TRM | CDF | ADTF | 8268c2ecf20Sopenharmony_ci----------------------------------------------------------------------------- 8278c2ecf20Sopenharmony_ci#endif /* 0 */ 8288c2ecf20Sopenharmony_ci 8298c2ecf20Sopenharmony_ci u8 nrm; /* Max # of Cells for each forward RM 8308c2ecf20Sopenharmony_ci cell (3-bit) */ 8318c2ecf20Sopenharmony_ci u8 trm; /* Time between forward RM cells (3-bit) */ 8328c2ecf20Sopenharmony_ci u16 adtf; /* ACR Decrease Time Factor (10-bit) */ 8338c2ecf20Sopenharmony_ci u8 cdf; /* Cutoff Decrease Factor (3-bit) */ 8348c2ecf20Sopenharmony_ci u8 rif; /* Rate Increment Factor (4-bit) */ 8358c2ecf20Sopenharmony_ci u8 rdf; /* Rate Decrease Factor (4-bit) */ 8368c2ecf20Sopenharmony_ci u8 reserved; /* 8 bits to keep structure word aligned */ 8378c2ecf20Sopenharmony_ci} srv_cls_param_t; 8388c2ecf20Sopenharmony_ci 8398c2ecf20Sopenharmony_cistruct testTable_t { 8408c2ecf20Sopenharmony_ci u16 lastTime; 8418c2ecf20Sopenharmony_ci u16 fract; 8428c2ecf20Sopenharmony_ci u8 vc_status; 8438c2ecf20Sopenharmony_ci}; 8448c2ecf20Sopenharmony_ci 8458c2ecf20Sopenharmony_citypedef struct { 8468c2ecf20Sopenharmony_ci u16 vci; 8478c2ecf20Sopenharmony_ci u16 error; 8488c2ecf20Sopenharmony_ci} RX_ERROR_Q; 8498c2ecf20Sopenharmony_ci 8508c2ecf20Sopenharmony_citypedef struct { 8518c2ecf20Sopenharmony_ci u8 active: 1; 8528c2ecf20Sopenharmony_ci u8 abr: 1; 8538c2ecf20Sopenharmony_ci u8 ubr: 1; 8548c2ecf20Sopenharmony_ci u8 cnt: 5; 8558c2ecf20Sopenharmony_ci#define VC_ACTIVE 0x01 8568c2ecf20Sopenharmony_ci#define VC_ABR 0x02 8578c2ecf20Sopenharmony_ci#define VC_UBR 0x04 8588c2ecf20Sopenharmony_ci} vcstatus_t; 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_cistruct ia_rfL_t { 8618c2ecf20Sopenharmony_ci u32 fdq_st; /* Free desc queue start address */ 8628c2ecf20Sopenharmony_ci u32 fdq_ed; /* Free desc queue end address */ 8638c2ecf20Sopenharmony_ci u32 fdq_rd; /* Free desc queue read pointer */ 8648c2ecf20Sopenharmony_ci u32 fdq_wr; /* Free desc queue write pointer */ 8658c2ecf20Sopenharmony_ci u32 pcq_st; /* Packet Complete queue start address */ 8668c2ecf20Sopenharmony_ci u32 pcq_ed; /* Packet Complete queue end address */ 8678c2ecf20Sopenharmony_ci u32 pcq_rd; /* Packet Complete queue read pointer */ 8688c2ecf20Sopenharmony_ci u32 pcq_wr; /* Packet Complete queue write pointer */ 8698c2ecf20Sopenharmony_ci}; 8708c2ecf20Sopenharmony_ci 8718c2ecf20Sopenharmony_cistruct ia_ffL_t { 8728c2ecf20Sopenharmony_ci u32 prq_st; /* Packet Ready Queue Start Address */ 8738c2ecf20Sopenharmony_ci u32 prq_ed; /* Packet Ready Queue End Address */ 8748c2ecf20Sopenharmony_ci u32 prq_wr; /* Packet Ready Queue write pointer */ 8758c2ecf20Sopenharmony_ci u32 tcq_st; /* Transmit Complete Queue Start Address*/ 8768c2ecf20Sopenharmony_ci u32 tcq_ed; /* Transmit Complete Queue End Address */ 8778c2ecf20Sopenharmony_ci u32 tcq_rd; /* Transmit Complete Queue read pointer */ 8788c2ecf20Sopenharmony_ci}; 8798c2ecf20Sopenharmony_ci 8808c2ecf20Sopenharmony_cistruct desc_tbl_t { 8818c2ecf20Sopenharmony_ci u32 timestamp; 8828c2ecf20Sopenharmony_ci struct ia_vcc *iavcc; 8838c2ecf20Sopenharmony_ci struct sk_buff *txskb; 8848c2ecf20Sopenharmony_ci}; 8858c2ecf20Sopenharmony_ci 8868c2ecf20Sopenharmony_citypedef struct ia_rtn_q { 8878c2ecf20Sopenharmony_ci struct desc_tbl_t data; 8888c2ecf20Sopenharmony_ci struct ia_rtn_q *next, *tail; 8898c2ecf20Sopenharmony_ci} IARTN_Q; 8908c2ecf20Sopenharmony_ci 8918c2ecf20Sopenharmony_ci#define SUNI_LOSV 0x04 8928c2ecf20Sopenharmony_cienum ia_suni { 8938c2ecf20Sopenharmony_ci SUNI_MASTER_RESET = 0x000, /* SUNI Master Reset and Identity */ 8948c2ecf20Sopenharmony_ci SUNI_MASTER_CONFIG = 0x004, /* SUNI Master Configuration */ 8958c2ecf20Sopenharmony_ci SUNI_MASTER_INTR_STAT = 0x008, /* SUNI Master Interrupt Status */ 8968c2ecf20Sopenharmony_ci SUNI_RESERVED1 = 0x00c, /* Reserved */ 8978c2ecf20Sopenharmony_ci SUNI_MASTER_CLK_MONITOR = 0x010, /* SUNI Master Clock Monitor */ 8988c2ecf20Sopenharmony_ci SUNI_MASTER_CONTROL = 0x014, /* SUNI Master Clock Monitor */ 8998c2ecf20Sopenharmony_ci /* Reserved (10) */ 9008c2ecf20Sopenharmony_ci SUNI_RSOP_CONTROL = 0x040, /* RSOP Control/Interrupt Enable */ 9018c2ecf20Sopenharmony_ci SUNI_RSOP_STATUS = 0x044, /* RSOP Status/Interrupt States */ 9028c2ecf20Sopenharmony_ci SUNI_RSOP_SECTION_BIP8L = 0x048, /* RSOP Section BIP-8 LSB */ 9038c2ecf20Sopenharmony_ci SUNI_RSOP_SECTION_BIP8M = 0x04c, /* RSOP Section BIP-8 MSB */ 9048c2ecf20Sopenharmony_ci 9058c2ecf20Sopenharmony_ci SUNI_TSOP_CONTROL = 0x050, /* TSOP Control */ 9068c2ecf20Sopenharmony_ci SUNI_TSOP_DIAG = 0x054, /* TSOP Disgnostics */ 9078c2ecf20Sopenharmony_ci /* Reserved (2) */ 9088c2ecf20Sopenharmony_ci SUNI_RLOP_CS = 0x060, /* RLOP Control/Status */ 9098c2ecf20Sopenharmony_ci SUNI_RLOP_INTR = 0x064, /* RLOP Interrupt Enable/Status */ 9108c2ecf20Sopenharmony_ci SUNI_RLOP_LINE_BIP24L = 0x068, /* RLOP Line BIP-24 LSB */ 9118c2ecf20Sopenharmony_ci SUNI_RLOP_LINE_BIP24 = 0x06c, /* RLOP Line BIP-24 */ 9128c2ecf20Sopenharmony_ci SUNI_RLOP_LINE_BIP24M = 0x070, /* RLOP Line BIP-24 MSB */ 9138c2ecf20Sopenharmony_ci SUNI_RLOP_LINE_FEBEL = 0x074, /* RLOP Line FEBE LSB */ 9148c2ecf20Sopenharmony_ci SUNI_RLOP_LINE_FEBE = 0x078, /* RLOP Line FEBE */ 9158c2ecf20Sopenharmony_ci SUNI_RLOP_LINE_FEBEM = 0x07c, /* RLOP Line FEBE MSB */ 9168c2ecf20Sopenharmony_ci 9178c2ecf20Sopenharmony_ci SUNI_TLOP_CONTROL = 0x080, /* TLOP Control */ 9188c2ecf20Sopenharmony_ci SUNI_TLOP_DISG = 0x084, /* TLOP Disgnostics */ 9198c2ecf20Sopenharmony_ci /* Reserved (14) */ 9208c2ecf20Sopenharmony_ci SUNI_RPOP_CS = 0x0c0, /* RPOP Status/Control */ 9218c2ecf20Sopenharmony_ci SUNI_RPOP_INTR = 0x0c4, /* RPOP Interrupt/Status */ 9228c2ecf20Sopenharmony_ci SUNI_RPOP_RESERVED = 0x0c8, /* RPOP Reserved */ 9238c2ecf20Sopenharmony_ci SUNI_RPOP_INTR_ENA = 0x0cc, /* RPOP Interrupt Enable */ 9248c2ecf20Sopenharmony_ci /* Reserved (3) */ 9258c2ecf20Sopenharmony_ci SUNI_RPOP_PATH_SIG = 0x0dc, /* RPOP Path Signal Label */ 9268c2ecf20Sopenharmony_ci SUNI_RPOP_BIP8L = 0x0e0, /* RPOP Path BIP-8 LSB */ 9278c2ecf20Sopenharmony_ci SUNI_RPOP_BIP8M = 0x0e4, /* RPOP Path BIP-8 MSB */ 9288c2ecf20Sopenharmony_ci SUNI_RPOP_FEBEL = 0x0e8, /* RPOP Path FEBE LSB */ 9298c2ecf20Sopenharmony_ci SUNI_RPOP_FEBEM = 0x0ec, /* RPOP Path FEBE MSB */ 9308c2ecf20Sopenharmony_ci /* Reserved (4) */ 9318c2ecf20Sopenharmony_ci SUNI_TPOP_CNTRL_DAIG = 0x100, /* TPOP Control/Disgnostics */ 9328c2ecf20Sopenharmony_ci SUNI_TPOP_POINTER_CTRL = 0x104, /* TPOP Pointer Control */ 9338c2ecf20Sopenharmony_ci SUNI_TPOP_SOURCER_CTRL = 0x108, /* TPOP Source Control */ 9348c2ecf20Sopenharmony_ci /* Reserved (2) */ 9358c2ecf20Sopenharmony_ci SUNI_TPOP_ARB_PRTL = 0x114, /* TPOP Arbitrary Pointer LSB */ 9368c2ecf20Sopenharmony_ci SUNI_TPOP_ARB_PRTM = 0x118, /* TPOP Arbitrary Pointer MSB */ 9378c2ecf20Sopenharmony_ci SUNI_TPOP_RESERVED2 = 0x11c, /* TPOP Reserved */ 9388c2ecf20Sopenharmony_ci SUNI_TPOP_PATH_SIG = 0x120, /* TPOP Path Signal Lable */ 9398c2ecf20Sopenharmony_ci SUNI_TPOP_PATH_STATUS = 0x124, /* TPOP Path Status */ 9408c2ecf20Sopenharmony_ci /* Reserved (6) */ 9418c2ecf20Sopenharmony_ci SUNI_RACP_CS = 0x140, /* RACP Control/Status */ 9428c2ecf20Sopenharmony_ci SUNI_RACP_INTR = 0x144, /* RACP Interrupt Enable/Status */ 9438c2ecf20Sopenharmony_ci SUNI_RACP_HDR_PATTERN = 0x148, /* RACP Match Header Pattern */ 9448c2ecf20Sopenharmony_ci SUNI_RACP_HDR_MASK = 0x14c, /* RACP Match Header Mask */ 9458c2ecf20Sopenharmony_ci SUNI_RACP_CORR_HCS = 0x150, /* RACP Correctable HCS Error Count */ 9468c2ecf20Sopenharmony_ci SUNI_RACP_UNCORR_HCS = 0x154, /* RACP Uncorrectable HCS Err Count */ 9478c2ecf20Sopenharmony_ci /* Reserved (10) */ 9488c2ecf20Sopenharmony_ci SUNI_TACP_CONTROL = 0x180, /* TACP Control */ 9498c2ecf20Sopenharmony_ci SUNI_TACP_IDLE_HDR_PAT = 0x184, /* TACP Idle Cell Header Pattern */ 9508c2ecf20Sopenharmony_ci SUNI_TACP_IDLE_PAY_PAY = 0x188, /* TACP Idle Cell Payld Octet Patrn */ 9518c2ecf20Sopenharmony_ci /* Reserved (5) */ 9528c2ecf20Sopenharmony_ci /* Reserved (24) */ 9538c2ecf20Sopenharmony_ci /* FIXME: unused but name conflicts. 9548c2ecf20Sopenharmony_ci * SUNI_MASTER_TEST = 0x200, SUNI Master Test */ 9558c2ecf20Sopenharmony_ci SUNI_RESERVED_TEST = 0x204 /* SUNI Reserved for Test */ 9568c2ecf20Sopenharmony_ci}; 9578c2ecf20Sopenharmony_ci 9588c2ecf20Sopenharmony_citypedef struct _SUNI_STATS_ 9598c2ecf20Sopenharmony_ci{ 9608c2ecf20Sopenharmony_ci u32 valid; // 1 = oc3 PHY card 9618c2ecf20Sopenharmony_ci u32 carrier_detect; // GPIN input 9628c2ecf20Sopenharmony_ci // RSOP: receive section overhead processor 9638c2ecf20Sopenharmony_ci u16 rsop_oof_state; // 1 = out of frame 9648c2ecf20Sopenharmony_ci u16 rsop_lof_state; // 1 = loss of frame 9658c2ecf20Sopenharmony_ci u16 rsop_los_state; // 1 = loss of signal 9668c2ecf20Sopenharmony_ci u32 rsop_los_count; // loss of signal count 9678c2ecf20Sopenharmony_ci u32 rsop_bse_count; // section BIP-8 error count 9688c2ecf20Sopenharmony_ci // RLOP: receive line overhead processor 9698c2ecf20Sopenharmony_ci u16 rlop_ferf_state; // 1 = far end receive failure 9708c2ecf20Sopenharmony_ci u16 rlop_lais_state; // 1 = line AIS 9718c2ecf20Sopenharmony_ci u32 rlop_lbe_count; // BIP-24 count 9728c2ecf20Sopenharmony_ci u32 rlop_febe_count; // FEBE count; 9738c2ecf20Sopenharmony_ci // RPOP: receive path overhead processor 9748c2ecf20Sopenharmony_ci u16 rpop_lop_state; // 1 = LOP 9758c2ecf20Sopenharmony_ci u16 rpop_pais_state; // 1 = path AIS 9768c2ecf20Sopenharmony_ci u16 rpop_pyel_state; // 1 = path yellow alert 9778c2ecf20Sopenharmony_ci u32 rpop_bip_count; // path BIP-8 error count 9788c2ecf20Sopenharmony_ci u32 rpop_febe_count; // path FEBE error count 9798c2ecf20Sopenharmony_ci u16 rpop_psig; // path signal label value 9808c2ecf20Sopenharmony_ci // RACP: receive ATM cell processor 9818c2ecf20Sopenharmony_ci u16 racp_hp_state; // hunt/presync state 9828c2ecf20Sopenharmony_ci u32 racp_fu_count; // FIFO underrun count 9838c2ecf20Sopenharmony_ci u32 racp_fo_count; // FIFO overrun count 9848c2ecf20Sopenharmony_ci u32 racp_chcs_count; // correctable HCS error count 9858c2ecf20Sopenharmony_ci u32 racp_uchcs_count; // uncorrectable HCS error count 9868c2ecf20Sopenharmony_ci} IA_SUNI_STATS; 9878c2ecf20Sopenharmony_ci 9888c2ecf20Sopenharmony_citypedef struct iadev_priv { 9898c2ecf20Sopenharmony_ci /*-----base pointers into (i)chipSAR+ address space */ 9908c2ecf20Sopenharmony_ci u32 __iomem *phy; /* Base pointer into phy (SUNI). */ 9918c2ecf20Sopenharmony_ci u32 __iomem *dma; /* Base pointer into DMA control registers. */ 9928c2ecf20Sopenharmony_ci u32 __iomem *reg; /* Base pointer to SAR registers. */ 9938c2ecf20Sopenharmony_ci u32 __iomem *seg_reg; /* base pointer to segmentation engine 9948c2ecf20Sopenharmony_ci internal registers */ 9958c2ecf20Sopenharmony_ci u32 __iomem *reass_reg; /* base pointer to reassemble engine 9968c2ecf20Sopenharmony_ci internal registers */ 9978c2ecf20Sopenharmony_ci u32 __iomem *ram; /* base pointer to SAR RAM */ 9988c2ecf20Sopenharmony_ci void __iomem *seg_ram; 9998c2ecf20Sopenharmony_ci void __iomem *reass_ram; 10008c2ecf20Sopenharmony_ci struct dle_q tx_dle_q; 10018c2ecf20Sopenharmony_ci struct free_desc_q *tx_free_desc_qhead; 10028c2ecf20Sopenharmony_ci struct sk_buff_head tx_dma_q, tx_backlog; 10038c2ecf20Sopenharmony_ci spinlock_t tx_lock; 10048c2ecf20Sopenharmony_ci IARTN_Q tx_return_q; 10058c2ecf20Sopenharmony_ci u32 close_pending; 10068c2ecf20Sopenharmony_ci wait_queue_head_t close_wait; 10078c2ecf20Sopenharmony_ci wait_queue_head_t timeout_wait; 10088c2ecf20Sopenharmony_ci struct cpcs_trailer_desc *tx_buf; 10098c2ecf20Sopenharmony_ci u16 num_tx_desc, tx_buf_sz, rate_limit; 10108c2ecf20Sopenharmony_ci u32 tx_cell_cnt, tx_pkt_cnt; 10118c2ecf20Sopenharmony_ci void __iomem *MAIN_VC_TABLE_ADDR, *EXT_VC_TABLE_ADDR, *ABR_SCHED_TABLE_ADDR; 10128c2ecf20Sopenharmony_ci struct dle_q rx_dle_q; 10138c2ecf20Sopenharmony_ci struct free_desc_q *rx_free_desc_qhead; 10148c2ecf20Sopenharmony_ci struct sk_buff_head rx_dma_q; 10158c2ecf20Sopenharmony_ci spinlock_t rx_lock; 10168c2ecf20Sopenharmony_ci struct atm_vcc **rx_open; /* list of all open VCs */ 10178c2ecf20Sopenharmony_ci u16 num_rx_desc, rx_buf_sz, rxing; 10188c2ecf20Sopenharmony_ci u32 rx_pkt_ram, rx_tmp_cnt; 10198c2ecf20Sopenharmony_ci unsigned long rx_tmp_jif; 10208c2ecf20Sopenharmony_ci void __iomem *RX_DESC_BASE_ADDR; 10218c2ecf20Sopenharmony_ci u32 drop_rxpkt, drop_rxcell, rx_cell_cnt, rx_pkt_cnt; 10228c2ecf20Sopenharmony_ci struct atm_dev *next_board; /* other iphase devices */ 10238c2ecf20Sopenharmony_ci struct pci_dev *pci; 10248c2ecf20Sopenharmony_ci int mem; 10258c2ecf20Sopenharmony_ci unsigned int real_base; /* real and virtual base address */ 10268c2ecf20Sopenharmony_ci void __iomem *base; 10278c2ecf20Sopenharmony_ci unsigned int pci_map_size; /*pci map size of board */ 10288c2ecf20Sopenharmony_ci unsigned char irq; 10298c2ecf20Sopenharmony_ci unsigned char bus; 10308c2ecf20Sopenharmony_ci unsigned char dev_fn; 10318c2ecf20Sopenharmony_ci u_short phy_type; 10328c2ecf20Sopenharmony_ci u_short num_vc, memSize, memType; 10338c2ecf20Sopenharmony_ci struct ia_ffL_t ffL; 10348c2ecf20Sopenharmony_ci struct ia_rfL_t rfL; 10358c2ecf20Sopenharmony_ci /* Suni stat */ 10368c2ecf20Sopenharmony_ci // IA_SUNI_STATS suni_stats; 10378c2ecf20Sopenharmony_ci unsigned char carrier_detect; 10388c2ecf20Sopenharmony_ci /* CBR related */ 10398c2ecf20Sopenharmony_ci // transmit DMA & Receive 10408c2ecf20Sopenharmony_ci unsigned int tx_dma_cnt; // number of elements on dma queue 10418c2ecf20Sopenharmony_ci unsigned int rx_dma_cnt; // number of elements on rx dma queue 10428c2ecf20Sopenharmony_ci unsigned int NumEnabledCBR; // number of CBR VCI's enabled. CBR 10438c2ecf20Sopenharmony_ci // receive MARK for Cell FIFO 10448c2ecf20Sopenharmony_ci unsigned int rx_mark_cnt; // number of elements on mark queue 10458c2ecf20Sopenharmony_ci unsigned int CbrTotEntries; // Total CBR Entries in Scheduling Table. 10468c2ecf20Sopenharmony_ci unsigned int CbrRemEntries; // Remaining CBR Entries in Scheduling Table. 10478c2ecf20Sopenharmony_ci unsigned int CbrEntryPt; // CBR Sched Table Entry Point. 10488c2ecf20Sopenharmony_ci unsigned int Granularity; // CBR Granularity given Table Size. 10498c2ecf20Sopenharmony_ci /* ABR related */ 10508c2ecf20Sopenharmony_ci unsigned int sum_mcr, sum_cbr, LineRate; 10518c2ecf20Sopenharmony_ci unsigned int n_abr; 10528c2ecf20Sopenharmony_ci struct desc_tbl_t *desc_tbl; 10538c2ecf20Sopenharmony_ci u_short host_tcq_wr; 10548c2ecf20Sopenharmony_ci struct testTable_t **testTable; 10558c2ecf20Sopenharmony_ci dma_addr_t tx_dle_dma; 10568c2ecf20Sopenharmony_ci dma_addr_t rx_dle_dma; 10578c2ecf20Sopenharmony_ci} IADEV; 10588c2ecf20Sopenharmony_ci 10598c2ecf20Sopenharmony_ci 10608c2ecf20Sopenharmony_ci#define INPH_IA_DEV(d) ((IADEV *) (d)->dev_data) 10618c2ecf20Sopenharmony_ci#define INPH_IA_VCC(v) ((struct ia_vcc *) (v)->dev_data) 10628c2ecf20Sopenharmony_ci 10638c2ecf20Sopenharmony_ci/******************* IDT77105 25MB/s PHY DEFINE *****************************/ 10648c2ecf20Sopenharmony_cienum ia_mb25 { 10658c2ecf20Sopenharmony_ci MB25_MASTER_CTRL = 0x00, /* Master control */ 10668c2ecf20Sopenharmony_ci MB25_INTR_STATUS = 0x04, /* Interrupt status */ 10678c2ecf20Sopenharmony_ci MB25_DIAG_CONTROL = 0x08, /* Diagnostic control */ 10688c2ecf20Sopenharmony_ci MB25_LED_HEC = 0x0c, /* LED driver and HEC status/control */ 10698c2ecf20Sopenharmony_ci MB25_LOW_BYTE_COUNTER = 0x10, 10708c2ecf20Sopenharmony_ci MB25_HIGH_BYTE_COUNTER = 0x14 10718c2ecf20Sopenharmony_ci}; 10728c2ecf20Sopenharmony_ci 10738c2ecf20Sopenharmony_ci/* 10748c2ecf20Sopenharmony_ci * Master Control 10758c2ecf20Sopenharmony_ci */ 10768c2ecf20Sopenharmony_ci#define MB25_MC_UPLO 0x80 /* UPLO */ 10778c2ecf20Sopenharmony_ci#define MB25_MC_DREC 0x40 /* Discard receive cell errors */ 10788c2ecf20Sopenharmony_ci#define MB25_MC_ECEIO 0x20 /* Enable Cell Error Interrupts Only */ 10798c2ecf20Sopenharmony_ci#define MB25_MC_TDPC 0x10 /* Transmit data parity check */ 10808c2ecf20Sopenharmony_ci#define MB25_MC_DRIC 0x08 /* Discard receive idle cells */ 10818c2ecf20Sopenharmony_ci#define MB25_MC_HALTTX 0x04 /* Halt Tx */ 10828c2ecf20Sopenharmony_ci#define MB25_MC_UMS 0x02 /* UTOPIA mode select */ 10838c2ecf20Sopenharmony_ci#define MB25_MC_ENABLED 0x01 /* Enable interrupt */ 10848c2ecf20Sopenharmony_ci 10858c2ecf20Sopenharmony_ci/* 10868c2ecf20Sopenharmony_ci * Interrupt Status 10878c2ecf20Sopenharmony_ci */ 10888c2ecf20Sopenharmony_ci#define MB25_IS_GSB 0x40 /* GOOD Symbol Bit */ 10898c2ecf20Sopenharmony_ci#define MB25_IS_HECECR 0x20 /* HEC error cell received */ 10908c2ecf20Sopenharmony_ci#define MB25_IS_SCR 0x10 /* "Short Cell" Received */ 10918c2ecf20Sopenharmony_ci#define MB25_IS_TPE 0x08 /* Trnamsit Parity Error */ 10928c2ecf20Sopenharmony_ci#define MB25_IS_RSCC 0x04 /* Receive Signal Condition change */ 10938c2ecf20Sopenharmony_ci#define MB25_IS_RCSE 0x02 /* Received Cell Symbol Error */ 10948c2ecf20Sopenharmony_ci#define MB25_IS_RFIFOO 0x01 /* Received FIFO Overrun */ 10958c2ecf20Sopenharmony_ci 10968c2ecf20Sopenharmony_ci/* 10978c2ecf20Sopenharmony_ci * Diagnostic Control 10988c2ecf20Sopenharmony_ci */ 10998c2ecf20Sopenharmony_ci#define MB25_DC_FTXCD 0x80 /* Force TxClav deassert */ 11008c2ecf20Sopenharmony_ci#define MB25_DC_RXCOS 0x40 /* RxClav operation select */ 11018c2ecf20Sopenharmony_ci#define MB25_DC_ECEIO 0x20 /* Single/Multi-PHY config select */ 11028c2ecf20Sopenharmony_ci#define MB25_DC_RLFLUSH 0x10 /* Clear receive FIFO */ 11038c2ecf20Sopenharmony_ci#define MB25_DC_IXPE 0x08 /* Insert xmit payload error */ 11048c2ecf20Sopenharmony_ci#define MB25_DC_IXHECE 0x04 /* Insert Xmit HEC Error */ 11058c2ecf20Sopenharmony_ci#define MB25_DC_LB_MASK 0x03 /* Loopback control mask */ 11068c2ecf20Sopenharmony_ci 11078c2ecf20Sopenharmony_ci#define MB25_DC_LL 0x03 /* Line Loopback */ 11088c2ecf20Sopenharmony_ci#define MB25_DC_PL 0x02 /* PHY Loopback */ 11098c2ecf20Sopenharmony_ci#define MB25_DC_NM 0x00 11108c2ecf20Sopenharmony_ci 11118c2ecf20Sopenharmony_ci#define FE_MASK 0x00F0 11128c2ecf20Sopenharmony_ci#define FE_MULTI_MODE 0x0000 11138c2ecf20Sopenharmony_ci#define FE_SINGLE_MODE 0x0010 11148c2ecf20Sopenharmony_ci#define FE_UTP_OPTION 0x0020 11158c2ecf20Sopenharmony_ci#define FE_25MBIT_PHY 0x0040 11168c2ecf20Sopenharmony_ci#define FE_DS3_PHY 0x0080 /* DS3 */ 11178c2ecf20Sopenharmony_ci#define FE_E3_PHY 0x0090 /* E3 */ 11188c2ecf20Sopenharmony_ci 11198c2ecf20Sopenharmony_ci/*********************** SUNI_PM7345 PHY DEFINE HERE *********************/ 11208c2ecf20Sopenharmony_cienum suni_pm7345 { 11218c2ecf20Sopenharmony_ci SUNI_CONFIG = 0x000, /* SUNI Configuration */ 11228c2ecf20Sopenharmony_ci SUNI_INTR_ENBL = 0x004, /* SUNI Interrupt Enable */ 11238c2ecf20Sopenharmony_ci SUNI_INTR_STAT = 0x008, /* SUNI Interrupt Status */ 11248c2ecf20Sopenharmony_ci SUNI_CONTROL = 0x00c, /* SUNI Control */ 11258c2ecf20Sopenharmony_ci SUNI_ID_RESET = 0x010, /* SUNI Reset and Identity */ 11268c2ecf20Sopenharmony_ci SUNI_DATA_LINK_CTRL = 0x014, 11278c2ecf20Sopenharmony_ci SUNI_RBOC_CONF_INTR_ENBL = 0x018, 11288c2ecf20Sopenharmony_ci SUNI_RBOC_STAT = 0x01c, 11298c2ecf20Sopenharmony_ci SUNI_DS3_FRM_CFG = 0x020, 11308c2ecf20Sopenharmony_ci SUNI_DS3_FRM_INTR_ENBL = 0x024, 11318c2ecf20Sopenharmony_ci SUNI_DS3_FRM_INTR_STAT = 0x028, 11328c2ecf20Sopenharmony_ci SUNI_DS3_FRM_STAT = 0x02c, 11338c2ecf20Sopenharmony_ci SUNI_RFDL_CFG = 0x030, 11348c2ecf20Sopenharmony_ci SUNI_RFDL_ENBL_STAT = 0x034, 11358c2ecf20Sopenharmony_ci SUNI_RFDL_STAT = 0x038, 11368c2ecf20Sopenharmony_ci SUNI_RFDL_DATA = 0x03c, 11378c2ecf20Sopenharmony_ci SUNI_PMON_CHNG = 0x040, 11388c2ecf20Sopenharmony_ci SUNI_PMON_INTR_ENBL_STAT = 0x044, 11398c2ecf20Sopenharmony_ci /* SUNI_RESERVED1 (0x13 - 0x11) */ 11408c2ecf20Sopenharmony_ci SUNI_PMON_LCV_EVT_CNT_LSB = 0x050, 11418c2ecf20Sopenharmony_ci SUNI_PMON_LCV_EVT_CNT_MSB = 0x054, 11428c2ecf20Sopenharmony_ci SUNI_PMON_FBE_EVT_CNT_LSB = 0x058, 11438c2ecf20Sopenharmony_ci SUNI_PMON_FBE_EVT_CNT_MSB = 0x05c, 11448c2ecf20Sopenharmony_ci SUNI_PMON_SEZ_DET_CNT_LSB = 0x060, 11458c2ecf20Sopenharmony_ci SUNI_PMON_SEZ_DET_CNT_MSB = 0x064, 11468c2ecf20Sopenharmony_ci SUNI_PMON_PE_EVT_CNT_LSB = 0x068, 11478c2ecf20Sopenharmony_ci SUNI_PMON_PE_EVT_CNT_MSB = 0x06c, 11488c2ecf20Sopenharmony_ci SUNI_PMON_PPE_EVT_CNT_LSB = 0x070, 11498c2ecf20Sopenharmony_ci SUNI_PMON_PPE_EVT_CNT_MSB = 0x074, 11508c2ecf20Sopenharmony_ci SUNI_PMON_FEBE_EVT_CNT_LSB = 0x078, 11518c2ecf20Sopenharmony_ci SUNI_PMON_FEBE_EVT_CNT_MSB = 0x07c, 11528c2ecf20Sopenharmony_ci SUNI_DS3_TRAN_CFG = 0x080, 11538c2ecf20Sopenharmony_ci SUNI_DS3_TRAN_DIAG = 0x084, 11548c2ecf20Sopenharmony_ci /* SUNI_RESERVED2 (0x23 - 0x21) */ 11558c2ecf20Sopenharmony_ci SUNI_XFDL_CFG = 0x090, 11568c2ecf20Sopenharmony_ci SUNI_XFDL_INTR_ST = 0x094, 11578c2ecf20Sopenharmony_ci SUNI_XFDL_XMIT_DATA = 0x098, 11588c2ecf20Sopenharmony_ci SUNI_XBOC_CODE = 0x09c, 11598c2ecf20Sopenharmony_ci SUNI_SPLR_CFG = 0x0a0, 11608c2ecf20Sopenharmony_ci SUNI_SPLR_INTR_EN = 0x0a4, 11618c2ecf20Sopenharmony_ci SUNI_SPLR_INTR_ST = 0x0a8, 11628c2ecf20Sopenharmony_ci SUNI_SPLR_STATUS = 0x0ac, 11638c2ecf20Sopenharmony_ci SUNI_SPLT_CFG = 0x0b0, 11648c2ecf20Sopenharmony_ci SUNI_SPLT_CNTL = 0x0b4, 11658c2ecf20Sopenharmony_ci SUNI_SPLT_DIAG_G1 = 0x0b8, 11668c2ecf20Sopenharmony_ci SUNI_SPLT_F1 = 0x0bc, 11678c2ecf20Sopenharmony_ci SUNI_CPPM_LOC_METERS = 0x0c0, 11688c2ecf20Sopenharmony_ci SUNI_CPPM_CHG_OF_CPPM_PERF_METR = 0x0c4, 11698c2ecf20Sopenharmony_ci SUNI_CPPM_B1_ERR_CNT_LSB = 0x0c8, 11708c2ecf20Sopenharmony_ci SUNI_CPPM_B1_ERR_CNT_MSB = 0x0cc, 11718c2ecf20Sopenharmony_ci SUNI_CPPM_FRAMING_ERR_CNT_LSB = 0x0d0, 11728c2ecf20Sopenharmony_ci SUNI_CPPM_FRAMING_ERR_CNT_MSB = 0x0d4, 11738c2ecf20Sopenharmony_ci SUNI_CPPM_FEBE_CNT_LSB = 0x0d8, 11748c2ecf20Sopenharmony_ci SUNI_CPPM_FEBE_CNT_MSB = 0x0dc, 11758c2ecf20Sopenharmony_ci SUNI_CPPM_HCS_ERR_CNT_LSB = 0x0e0, 11768c2ecf20Sopenharmony_ci SUNI_CPPM_HCS_ERR_CNT_MSB = 0x0e4, 11778c2ecf20Sopenharmony_ci SUNI_CPPM_IDLE_UN_CELL_CNT_LSB = 0x0e8, 11788c2ecf20Sopenharmony_ci SUNI_CPPM_IDLE_UN_CELL_CNT_MSB = 0x0ec, 11798c2ecf20Sopenharmony_ci SUNI_CPPM_RCV_CELL_CNT_LSB = 0x0f0, 11808c2ecf20Sopenharmony_ci SUNI_CPPM_RCV_CELL_CNT_MSB = 0x0f4, 11818c2ecf20Sopenharmony_ci SUNI_CPPM_XMIT_CELL_CNT_LSB = 0x0f8, 11828c2ecf20Sopenharmony_ci SUNI_CPPM_XMIT_CELL_CNT_MSB = 0x0fc, 11838c2ecf20Sopenharmony_ci SUNI_RXCP_CTRL = 0x100, 11848c2ecf20Sopenharmony_ci SUNI_RXCP_FCTRL = 0x104, 11858c2ecf20Sopenharmony_ci SUNI_RXCP_INTR_EN_STS = 0x108, 11868c2ecf20Sopenharmony_ci SUNI_RXCP_IDLE_PAT_H1 = 0x10c, 11878c2ecf20Sopenharmony_ci SUNI_RXCP_IDLE_PAT_H2 = 0x110, 11888c2ecf20Sopenharmony_ci SUNI_RXCP_IDLE_PAT_H3 = 0x114, 11898c2ecf20Sopenharmony_ci SUNI_RXCP_IDLE_PAT_H4 = 0x118, 11908c2ecf20Sopenharmony_ci SUNI_RXCP_IDLE_MASK_H1 = 0x11c, 11918c2ecf20Sopenharmony_ci SUNI_RXCP_IDLE_MASK_H2 = 0x120, 11928c2ecf20Sopenharmony_ci SUNI_RXCP_IDLE_MASK_H3 = 0x124, 11938c2ecf20Sopenharmony_ci SUNI_RXCP_IDLE_MASK_H4 = 0x128, 11948c2ecf20Sopenharmony_ci SUNI_RXCP_CELL_PAT_H1 = 0x12c, 11958c2ecf20Sopenharmony_ci SUNI_RXCP_CELL_PAT_H2 = 0x130, 11968c2ecf20Sopenharmony_ci SUNI_RXCP_CELL_PAT_H3 = 0x134, 11978c2ecf20Sopenharmony_ci SUNI_RXCP_CELL_PAT_H4 = 0x138, 11988c2ecf20Sopenharmony_ci SUNI_RXCP_CELL_MASK_H1 = 0x13c, 11998c2ecf20Sopenharmony_ci SUNI_RXCP_CELL_MASK_H2 = 0x140, 12008c2ecf20Sopenharmony_ci SUNI_RXCP_CELL_MASK_H3 = 0x144, 12018c2ecf20Sopenharmony_ci SUNI_RXCP_CELL_MASK_H4 = 0x148, 12028c2ecf20Sopenharmony_ci SUNI_RXCP_HCS_CS = 0x14c, 12038c2ecf20Sopenharmony_ci SUNI_RXCP_LCD_CNT_THRESHOLD = 0x150, 12048c2ecf20Sopenharmony_ci /* SUNI_RESERVED3 (0x57 - 0x54) */ 12058c2ecf20Sopenharmony_ci SUNI_TXCP_CTRL = 0x160, 12068c2ecf20Sopenharmony_ci SUNI_TXCP_INTR_EN_STS = 0x164, 12078c2ecf20Sopenharmony_ci SUNI_TXCP_IDLE_PAT_H1 = 0x168, 12088c2ecf20Sopenharmony_ci SUNI_TXCP_IDLE_PAT_H2 = 0x16c, 12098c2ecf20Sopenharmony_ci SUNI_TXCP_IDLE_PAT_H3 = 0x170, 12108c2ecf20Sopenharmony_ci SUNI_TXCP_IDLE_PAT_H4 = 0x174, 12118c2ecf20Sopenharmony_ci SUNI_TXCP_IDLE_PAT_H5 = 0x178, 12128c2ecf20Sopenharmony_ci SUNI_TXCP_IDLE_PAYLOAD = 0x17c, 12138c2ecf20Sopenharmony_ci SUNI_E3_FRM_FRAM_OPTIONS = 0x180, 12148c2ecf20Sopenharmony_ci SUNI_E3_FRM_MAINT_OPTIONS = 0x184, 12158c2ecf20Sopenharmony_ci SUNI_E3_FRM_FRAM_INTR_ENBL = 0x188, 12168c2ecf20Sopenharmony_ci SUNI_E3_FRM_FRAM_INTR_IND_STAT = 0x18c, 12178c2ecf20Sopenharmony_ci SUNI_E3_FRM_MAINT_INTR_ENBL = 0x190, 12188c2ecf20Sopenharmony_ci SUNI_E3_FRM_MAINT_INTR_IND = 0x194, 12198c2ecf20Sopenharmony_ci SUNI_E3_FRM_MAINT_STAT = 0x198, 12208c2ecf20Sopenharmony_ci SUNI_RESERVED4 = 0x19c, 12218c2ecf20Sopenharmony_ci SUNI_E3_TRAN_FRAM_OPTIONS = 0x1a0, 12228c2ecf20Sopenharmony_ci SUNI_E3_TRAN_STAT_DIAG_OPTIONS = 0x1a4, 12238c2ecf20Sopenharmony_ci SUNI_E3_TRAN_BIP_8_ERR_MASK = 0x1a8, 12248c2ecf20Sopenharmony_ci SUNI_E3_TRAN_MAINT_ADAPT_OPTS = 0x1ac, 12258c2ecf20Sopenharmony_ci SUNI_TTB_CTRL = 0x1b0, 12268c2ecf20Sopenharmony_ci SUNI_TTB_TRAIL_TRACE_ID_STAT = 0x1b4, 12278c2ecf20Sopenharmony_ci SUNI_TTB_IND_ADDR = 0x1b8, 12288c2ecf20Sopenharmony_ci SUNI_TTB_IND_DATA = 0x1bc, 12298c2ecf20Sopenharmony_ci SUNI_TTB_EXP_PAYLOAD_TYPE = 0x1c0, 12308c2ecf20Sopenharmony_ci SUNI_TTB_PAYLOAD_TYPE_CTRL_STAT = 0x1c4, 12318c2ecf20Sopenharmony_ci /* SUNI_PAD5 (0x7f - 0x71) */ 12328c2ecf20Sopenharmony_ci SUNI_MASTER_TEST = 0x200, 12338c2ecf20Sopenharmony_ci /* SUNI_PAD6 (0xff - 0x80) */ 12348c2ecf20Sopenharmony_ci}; 12358c2ecf20Sopenharmony_ci 12368c2ecf20Sopenharmony_ci#define SUNI_PM7345_T suni_pm7345_t 12378c2ecf20Sopenharmony_ci#define SUNI_PM7345 0x20 /* Suni chip type */ 12388c2ecf20Sopenharmony_ci#define SUNI_PM5346 0x30 /* Suni chip type */ 12398c2ecf20Sopenharmony_ci/* 12408c2ecf20Sopenharmony_ci * SUNI_PM7345 Configuration 12418c2ecf20Sopenharmony_ci */ 12428c2ecf20Sopenharmony_ci#define SUNI_PM7345_CLB 0x01 /* Cell loopback */ 12438c2ecf20Sopenharmony_ci#define SUNI_PM7345_PLB 0x02 /* Payload loopback */ 12448c2ecf20Sopenharmony_ci#define SUNI_PM7345_DLB 0x04 /* Diagnostic loopback */ 12458c2ecf20Sopenharmony_ci#define SUNI_PM7345_LLB 0x80 /* Line loopback */ 12468c2ecf20Sopenharmony_ci#define SUNI_PM7345_E3ENBL 0x40 /* E3 enable bit */ 12478c2ecf20Sopenharmony_ci#define SUNI_PM7345_LOOPT 0x10 /* LOOPT enable bit */ 12488c2ecf20Sopenharmony_ci#define SUNI_PM7345_FIFOBP 0x20 /* FIFO bypass */ 12498c2ecf20Sopenharmony_ci#define SUNI_PM7345_FRMRBP 0x08 /* Framer bypass */ 12508c2ecf20Sopenharmony_ci/* 12518c2ecf20Sopenharmony_ci * DS3 FRMR Interrupt Enable 12528c2ecf20Sopenharmony_ci */ 12538c2ecf20Sopenharmony_ci#define SUNI_DS3_COFAE 0x80 /* Enable change of frame align */ 12548c2ecf20Sopenharmony_ci#define SUNI_DS3_REDE 0x40 /* Enable DS3 RED state intr */ 12558c2ecf20Sopenharmony_ci#define SUNI_DS3_CBITE 0x20 /* Enable Appl ID channel intr */ 12568c2ecf20Sopenharmony_ci#define SUNI_DS3_FERFE 0x10 /* Enable Far End Receive Failure intr*/ 12578c2ecf20Sopenharmony_ci#define SUNI_DS3_IDLE 0x08 /* Enable Idle signal intr */ 12588c2ecf20Sopenharmony_ci#define SUNI_DS3_AISE 0x04 /* Enable Alarm Indication signal intr*/ 12598c2ecf20Sopenharmony_ci#define SUNI_DS3_OOFE 0x02 /* Enable Out of frame intr */ 12608c2ecf20Sopenharmony_ci#define SUNI_DS3_LOSE 0x01 /* Enable Loss of signal intr */ 12618c2ecf20Sopenharmony_ci 12628c2ecf20Sopenharmony_ci/* 12638c2ecf20Sopenharmony_ci * DS3 FRMR Status 12648c2ecf20Sopenharmony_ci */ 12658c2ecf20Sopenharmony_ci#define SUNI_DS3_ACE 0x80 /* Additional Configuration Reg */ 12668c2ecf20Sopenharmony_ci#define SUNI_DS3_REDV 0x40 /* DS3 RED state */ 12678c2ecf20Sopenharmony_ci#define SUNI_DS3_CBITV 0x20 /* Application ID channel state */ 12688c2ecf20Sopenharmony_ci#define SUNI_DS3_FERFV 0x10 /* Far End Receive Failure state*/ 12698c2ecf20Sopenharmony_ci#define SUNI_DS3_IDLV 0x08 /* Idle signal state */ 12708c2ecf20Sopenharmony_ci#define SUNI_DS3_AISV 0x04 /* Alarm Indication signal state*/ 12718c2ecf20Sopenharmony_ci#define SUNI_DS3_OOFV 0x02 /* Out of frame state */ 12728c2ecf20Sopenharmony_ci#define SUNI_DS3_LOSV 0x01 /* Loss of signal state */ 12738c2ecf20Sopenharmony_ci 12748c2ecf20Sopenharmony_ci/* 12758c2ecf20Sopenharmony_ci * E3 FRMR Interrupt/Status 12768c2ecf20Sopenharmony_ci */ 12778c2ecf20Sopenharmony_ci#define SUNI_E3_CZDI 0x40 /* Consecutive Zeros indicator */ 12788c2ecf20Sopenharmony_ci#define SUNI_E3_LOSI 0x20 /* Loss of signal intr status */ 12798c2ecf20Sopenharmony_ci#define SUNI_E3_LCVI 0x10 /* Line code violation intr */ 12808c2ecf20Sopenharmony_ci#define SUNI_E3_COFAI 0x08 /* Change of frame align intr */ 12818c2ecf20Sopenharmony_ci#define SUNI_E3_OOFI 0x04 /* Out of frame intr status */ 12828c2ecf20Sopenharmony_ci#define SUNI_E3_LOS 0x02 /* Loss of signal state */ 12838c2ecf20Sopenharmony_ci#define SUNI_E3_OOF 0x01 /* Out of frame state */ 12848c2ecf20Sopenharmony_ci 12858c2ecf20Sopenharmony_ci/* 12868c2ecf20Sopenharmony_ci * E3 FRMR Maintenance Status 12878c2ecf20Sopenharmony_ci */ 12888c2ecf20Sopenharmony_ci#define SUNI_E3_AISD 0x80 /* Alarm Indication signal state*/ 12898c2ecf20Sopenharmony_ci#define SUNI_E3_FERF_RAI 0x40 /* FERF/RAI indicator */ 12908c2ecf20Sopenharmony_ci#define SUNI_E3_FEBE 0x20 /* Far End Block Error indicator*/ 12918c2ecf20Sopenharmony_ci 12928c2ecf20Sopenharmony_ci/* 12938c2ecf20Sopenharmony_ci * RXCP Control/Status 12948c2ecf20Sopenharmony_ci */ 12958c2ecf20Sopenharmony_ci#define SUNI_DS3_HCSPASS 0x80 /* Pass cell with HEC errors */ 12968c2ecf20Sopenharmony_ci#define SUNI_DS3_HCSDQDB 0x40 /* Control octets in HCS calc */ 12978c2ecf20Sopenharmony_ci#define SUNI_DS3_HCSADD 0x20 /* Add coset poly */ 12988c2ecf20Sopenharmony_ci#define SUNI_DS3_HCK 0x10 /* Control FIFO data path integ chk*/ 12998c2ecf20Sopenharmony_ci#define SUNI_DS3_BLOCK 0x08 /* Enable cell filtering */ 13008c2ecf20Sopenharmony_ci#define SUNI_DS3_DSCR 0x04 /* Disable payload descrambling */ 13018c2ecf20Sopenharmony_ci#define SUNI_DS3_OOCDV 0x02 /* Cell delineation state */ 13028c2ecf20Sopenharmony_ci#define SUNI_DS3_FIFORST 0x01 /* Cell FIFO reset */ 13038c2ecf20Sopenharmony_ci 13048c2ecf20Sopenharmony_ci/* 13058c2ecf20Sopenharmony_ci * RXCP Interrupt Enable/Status 13068c2ecf20Sopenharmony_ci */ 13078c2ecf20Sopenharmony_ci#define SUNI_DS3_OOCDE 0x80 /* Intr enable, change in CDS */ 13088c2ecf20Sopenharmony_ci#define SUNI_DS3_HCSE 0x40 /* Intr enable, corr HCS errors */ 13098c2ecf20Sopenharmony_ci#define SUNI_DS3_FIFOE 0x20 /* Intr enable, unco HCS errors */ 13108c2ecf20Sopenharmony_ci#define SUNI_DS3_OOCDI 0x10 /* SYNC state */ 13118c2ecf20Sopenharmony_ci#define SUNI_DS3_UHCSI 0x08 /* Uncorr. HCS errors detected */ 13128c2ecf20Sopenharmony_ci#define SUNI_DS3_COCAI 0x04 /* Corr. HCS errors detected */ 13138c2ecf20Sopenharmony_ci#define SUNI_DS3_FOVRI 0x02 /* FIFO overrun */ 13148c2ecf20Sopenharmony_ci#define SUNI_DS3_FUDRI 0x01 /* FIFO underrun */ 13158c2ecf20Sopenharmony_ci 13168c2ecf20Sopenharmony_ci///////////////////SUNI_PM7345 PHY DEFINE END ///////////////////////////// 13178c2ecf20Sopenharmony_ci 13188c2ecf20Sopenharmony_ci/* ia_eeprom define*/ 13198c2ecf20Sopenharmony_ci#define MEM_SIZE_MASK 0x000F /* mask of 4 bits defining memory size*/ 13208c2ecf20Sopenharmony_ci#define MEM_SIZE_128K 0x0000 /* board has 128k buffer */ 13218c2ecf20Sopenharmony_ci#define MEM_SIZE_512K 0x0001 /* board has 512K of buffer */ 13228c2ecf20Sopenharmony_ci#define MEM_SIZE_1M 0x0002 /* board has 1M of buffer */ 13238c2ecf20Sopenharmony_ci /* 0x3 to 0xF are reserved for future */ 13248c2ecf20Sopenharmony_ci 13258c2ecf20Sopenharmony_ci#define FE_MASK 0x00F0 /* mask of 4 bits defining FE type */ 13268c2ecf20Sopenharmony_ci#define FE_MULTI_MODE 0x0000 /* 155 MBit multimode fiber */ 13278c2ecf20Sopenharmony_ci#define FE_SINGLE_MODE 0x0010 /* 155 MBit single mode laser */ 13288c2ecf20Sopenharmony_ci#define FE_UTP_OPTION 0x0020 /* 155 MBit UTP front end */ 13298c2ecf20Sopenharmony_ci 13308c2ecf20Sopenharmony_ci#define NOVRAM_SIZE 64 13318c2ecf20Sopenharmony_ci#define CMD_LEN 10 13328c2ecf20Sopenharmony_ci 13338c2ecf20Sopenharmony_ci/*********** 13348c2ecf20Sopenharmony_ci * 13358c2ecf20Sopenharmony_ci * Switches and defines for header files. 13368c2ecf20Sopenharmony_ci * 13378c2ecf20Sopenharmony_ci * The following defines are used to turn on and off 13388c2ecf20Sopenharmony_ci * various options in the header files. Primarily useful 13398c2ecf20Sopenharmony_ci * for debugging. 13408c2ecf20Sopenharmony_ci * 13418c2ecf20Sopenharmony_ci ***********/ 13428c2ecf20Sopenharmony_ci 13438c2ecf20Sopenharmony_ci/* 13448c2ecf20Sopenharmony_ci * a list of the commands that can be sent to the NOVRAM 13458c2ecf20Sopenharmony_ci */ 13468c2ecf20Sopenharmony_ci 13478c2ecf20Sopenharmony_ci#define EXTEND 0x100 13488c2ecf20Sopenharmony_ci#define IAWRITE 0x140 13498c2ecf20Sopenharmony_ci#define IAREAD 0x180 13508c2ecf20Sopenharmony_ci#define ERASE 0x1c0 13518c2ecf20Sopenharmony_ci 13528c2ecf20Sopenharmony_ci#define EWDS 0x00 13538c2ecf20Sopenharmony_ci#define WRAL 0x10 13548c2ecf20Sopenharmony_ci#define ERAL 0x20 13558c2ecf20Sopenharmony_ci#define EWEN 0x30 13568c2ecf20Sopenharmony_ci 13578c2ecf20Sopenharmony_ci/* 13588c2ecf20Sopenharmony_ci * these bits duplicate the hw_flip.h register settings 13598c2ecf20Sopenharmony_ci * note: how the data in / out bits are defined in the flipper specification 13608c2ecf20Sopenharmony_ci */ 13618c2ecf20Sopenharmony_ci 13628c2ecf20Sopenharmony_ci#define NVCE 0x02 13638c2ecf20Sopenharmony_ci#define NVSK 0x01 13648c2ecf20Sopenharmony_ci#define NVDO 0x08 13658c2ecf20Sopenharmony_ci#define NVDI 0x04 13668c2ecf20Sopenharmony_ci/*********************** 13678c2ecf20Sopenharmony_ci * 13688c2ecf20Sopenharmony_ci * This define ands the value and the current config register and puts 13698c2ecf20Sopenharmony_ci * the result in the config register 13708c2ecf20Sopenharmony_ci * 13718c2ecf20Sopenharmony_ci ***********************/ 13728c2ecf20Sopenharmony_ci 13738c2ecf20Sopenharmony_ci#define CFG_AND(val) { \ 13748c2ecf20Sopenharmony_ci u32 t; \ 13758c2ecf20Sopenharmony_ci t = readl(iadev->reg+IPHASE5575_EEPROM_ACCESS); \ 13768c2ecf20Sopenharmony_ci t &= (val); \ 13778c2ecf20Sopenharmony_ci writel(t, iadev->reg+IPHASE5575_EEPROM_ACCESS); \ 13788c2ecf20Sopenharmony_ci } 13798c2ecf20Sopenharmony_ci 13808c2ecf20Sopenharmony_ci/*********************** 13818c2ecf20Sopenharmony_ci * 13828c2ecf20Sopenharmony_ci * This define ors the value and the current config register and puts 13838c2ecf20Sopenharmony_ci * the result in the config register 13848c2ecf20Sopenharmony_ci * 13858c2ecf20Sopenharmony_ci ***********************/ 13868c2ecf20Sopenharmony_ci 13878c2ecf20Sopenharmony_ci#define CFG_OR(val) { \ 13888c2ecf20Sopenharmony_ci u32 t; \ 13898c2ecf20Sopenharmony_ci t = readl(iadev->reg+IPHASE5575_EEPROM_ACCESS); \ 13908c2ecf20Sopenharmony_ci t |= (val); \ 13918c2ecf20Sopenharmony_ci writel(t, iadev->reg+IPHASE5575_EEPROM_ACCESS); \ 13928c2ecf20Sopenharmony_ci } 13938c2ecf20Sopenharmony_ci 13948c2ecf20Sopenharmony_ci/*********************** 13958c2ecf20Sopenharmony_ci * 13968c2ecf20Sopenharmony_ci * Send a command to the NOVRAM, the command is in cmd. 13978c2ecf20Sopenharmony_ci * 13988c2ecf20Sopenharmony_ci * clear CE and SK. Then assert CE. 13998c2ecf20Sopenharmony_ci * Clock each of the command bits out in the correct order with SK 14008c2ecf20Sopenharmony_ci * exit with CE still asserted 14018c2ecf20Sopenharmony_ci * 14028c2ecf20Sopenharmony_ci ***********************/ 14038c2ecf20Sopenharmony_ci 14048c2ecf20Sopenharmony_ci#define NVRAM_CMD(cmd) { \ 14058c2ecf20Sopenharmony_ci int i; \ 14068c2ecf20Sopenharmony_ci u_short c = cmd; \ 14078c2ecf20Sopenharmony_ci CFG_AND(~(NVCE|NVSK)); \ 14088c2ecf20Sopenharmony_ci CFG_OR(NVCE); \ 14098c2ecf20Sopenharmony_ci for (i=0; i<CMD_LEN; i++) { \ 14108c2ecf20Sopenharmony_ci NVRAM_CLKOUT((c & (1 << (CMD_LEN - 1))) ? 1 : 0); \ 14118c2ecf20Sopenharmony_ci c <<= 1; \ 14128c2ecf20Sopenharmony_ci } \ 14138c2ecf20Sopenharmony_ci } 14148c2ecf20Sopenharmony_ci 14158c2ecf20Sopenharmony_ci/*********************** 14168c2ecf20Sopenharmony_ci * 14178c2ecf20Sopenharmony_ci * clear the CE, this must be used after each command is complete 14188c2ecf20Sopenharmony_ci * 14198c2ecf20Sopenharmony_ci ***********************/ 14208c2ecf20Sopenharmony_ci 14218c2ecf20Sopenharmony_ci#define NVRAM_CLR_CE {CFG_AND(~NVCE)} 14228c2ecf20Sopenharmony_ci 14238c2ecf20Sopenharmony_ci/*********************** 14248c2ecf20Sopenharmony_ci * 14258c2ecf20Sopenharmony_ci * clock the data bit in bitval out to the NOVRAM. The bitval must be 14268c2ecf20Sopenharmony_ci * a 1 or 0, or the clockout operation is undefined 14278c2ecf20Sopenharmony_ci * 14288c2ecf20Sopenharmony_ci ***********************/ 14298c2ecf20Sopenharmony_ci 14308c2ecf20Sopenharmony_ci#define NVRAM_CLKOUT(bitval) { \ 14318c2ecf20Sopenharmony_ci CFG_AND(~NVDI); \ 14328c2ecf20Sopenharmony_ci CFG_OR((bitval) ? NVDI : 0); \ 14338c2ecf20Sopenharmony_ci CFG_OR(NVSK); \ 14348c2ecf20Sopenharmony_ci CFG_AND( ~NVSK); \ 14358c2ecf20Sopenharmony_ci } 14368c2ecf20Sopenharmony_ci 14378c2ecf20Sopenharmony_ci/*********************** 14388c2ecf20Sopenharmony_ci * 14398c2ecf20Sopenharmony_ci * clock the data bit in and return a 1 or 0, depending on the value 14408c2ecf20Sopenharmony_ci * that was received from the NOVRAM 14418c2ecf20Sopenharmony_ci * 14428c2ecf20Sopenharmony_ci ***********************/ 14438c2ecf20Sopenharmony_ci 14448c2ecf20Sopenharmony_ci#define NVRAM_CLKIN(value) { \ 14458c2ecf20Sopenharmony_ci u32 _t; \ 14468c2ecf20Sopenharmony_ci CFG_OR(NVSK); \ 14478c2ecf20Sopenharmony_ci CFG_AND(~NVSK); \ 14488c2ecf20Sopenharmony_ci _t = readl(iadev->reg+IPHASE5575_EEPROM_ACCESS); \ 14498c2ecf20Sopenharmony_ci value = (_t & NVDO) ? 1 : 0; \ 14508c2ecf20Sopenharmony_ci } 14518c2ecf20Sopenharmony_ci 14528c2ecf20Sopenharmony_ci 14538c2ecf20Sopenharmony_ci#endif /* IPHASE_H */ 1454