18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci he.h 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci ForeRunnerHE ATM Adapter driver for ATM on Linux 68c2ecf20Sopenharmony_ci Copyright (C) 1999-2001 Naval Research Laboratory 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci This library is free software; you can redistribute it and/or 98c2ecf20Sopenharmony_ci modify it under the terms of the GNU Lesser General Public 108c2ecf20Sopenharmony_ci License as published by the Free Software Foundation; either 118c2ecf20Sopenharmony_ci version 2.1 of the License, or (at your option) any later version. 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci This library is distributed in the hope that it will be useful, 148c2ecf20Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 158c2ecf20Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 168c2ecf20Sopenharmony_ci Lesser General Public License for more details. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci You should have received a copy of the GNU Lesser General Public 198c2ecf20Sopenharmony_ci License along with this library; if not, write to the Free Software 208c2ecf20Sopenharmony_ci Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci*/ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci he.h 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci ForeRunnerHE ATM Adapter driver for ATM on Linux 298c2ecf20Sopenharmony_ci Copyright (C) 1999-2000 Naval Research Laboratory 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci Permission to use, copy, modify and distribute this software and its 328c2ecf20Sopenharmony_ci documentation is hereby granted, provided that both the copyright 338c2ecf20Sopenharmony_ci notice and this permission notice appear in all copies of the software, 348c2ecf20Sopenharmony_ci derivative works or modified versions, and any portions thereof, and 358c2ecf20Sopenharmony_ci that both notices appear in supporting documentation. 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci NRL ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND 388c2ecf20Sopenharmony_ci DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER 398c2ecf20Sopenharmony_ci RESULTING FROM THE USE OF THIS SOFTWARE. 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci */ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#ifndef _HE_H_ 448c2ecf20Sopenharmony_ci#define _HE_H_ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define DEV_LABEL "he" 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define CONFIG_DEFAULT_VCIBITS 12 498c2ecf20Sopenharmony_ci#define CONFIG_DEFAULT_VPIBITS 0 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define CONFIG_IRQ_SIZE 128 528c2ecf20Sopenharmony_ci#define CONFIG_IRQ_THRESH (CONFIG_IRQ_SIZE/2) 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define CONFIG_TPDRQ_SIZE 512 558c2ecf20Sopenharmony_ci#define TPDRQ_MASK(x) (((unsigned long)(x))&((CONFIG_TPDRQ_SIZE<<3)-1)) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define CONFIG_RBRQ_SIZE 512 588c2ecf20Sopenharmony_ci#define CONFIG_RBRQ_THRESH 400 598c2ecf20Sopenharmony_ci#define RBRQ_MASK(x) (((unsigned long)(x))&((CONFIG_RBRQ_SIZE<<3)-1)) 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#define CONFIG_TBRQ_SIZE 512 628c2ecf20Sopenharmony_ci#define CONFIG_TBRQ_THRESH 400 638c2ecf20Sopenharmony_ci#define TBRQ_MASK(x) (((unsigned long)(x))&((CONFIG_TBRQ_SIZE<<2)-1)) 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define CONFIG_RBPL_SIZE 512 668c2ecf20Sopenharmony_ci#define CONFIG_RBPL_THRESH 64 678c2ecf20Sopenharmony_ci#define CONFIG_RBPL_BUFSIZE 4096 688c2ecf20Sopenharmony_ci#define RBPL_MASK(x) (((unsigned long)(x))&((CONFIG_RBPL_SIZE<<3)-1)) 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci/* 5.1.3 initialize connection memory */ 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define CONFIG_RSRA 0x00000 738c2ecf20Sopenharmony_ci#define CONFIG_RCMLBM 0x08000 748c2ecf20Sopenharmony_ci#define CONFIG_RCMABR 0x0d800 758c2ecf20Sopenharmony_ci#define CONFIG_RSRB 0x0e000 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#define CONFIG_TSRA 0x00000 788c2ecf20Sopenharmony_ci#define CONFIG_TSRB 0x08000 798c2ecf20Sopenharmony_ci#define CONFIG_TSRC 0x0c000 808c2ecf20Sopenharmony_ci#define CONFIG_TSRD 0x0e000 818c2ecf20Sopenharmony_ci#define CONFIG_TMABR 0x0f000 828c2ecf20Sopenharmony_ci#define CONFIG_TPDBA 0x10000 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define HE_MAXCIDBITS 12 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci/* 2.9.3.3 interrupt encodings */ 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_cistruct he_irq { 898c2ecf20Sopenharmony_ci volatile u32 isw; 908c2ecf20Sopenharmony_ci}; 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define IRQ_ALIGNMENT 0x1000 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci#define NEXT_ENTRY(base, tail, mask) \ 958c2ecf20Sopenharmony_ci (((unsigned long)base)|(((unsigned long)(tail+1))&mask)) 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#define ITYPE_INVALID 0xffffffff 988c2ecf20Sopenharmony_ci#define ITYPE_TBRQ_THRESH (0<<3) 998c2ecf20Sopenharmony_ci#define ITYPE_TPD_COMPLETE (1<<3) 1008c2ecf20Sopenharmony_ci#define ITYPE_RBPS_THRESH (2<<3) 1018c2ecf20Sopenharmony_ci#define ITYPE_RBPL_THRESH (3<<3) 1028c2ecf20Sopenharmony_ci#define ITYPE_RBRQ_THRESH (4<<3) 1038c2ecf20Sopenharmony_ci#define ITYPE_RBRQ_TIMER (5<<3) 1048c2ecf20Sopenharmony_ci#define ITYPE_PHY (6<<3) 1058c2ecf20Sopenharmony_ci#define ITYPE_OTHER 0x80 1068c2ecf20Sopenharmony_ci#define ITYPE_PARITY 0x81 1078c2ecf20Sopenharmony_ci#define ITYPE_ABORT 0x82 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define ITYPE_GROUP(x) (x & 0x7) 1108c2ecf20Sopenharmony_ci#define ITYPE_TYPE(x) (x & 0xf8) 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define HE_NUM_GROUPS 8 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/* 2.1.4 transmit packet descriptor */ 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_cistruct he_tpd { 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci /* read by the adapter */ 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci volatile u32 status; 1218c2ecf20Sopenharmony_ci volatile u32 reserved; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#define TPD_MAXIOV 3 1248c2ecf20Sopenharmony_ci struct { 1258c2ecf20Sopenharmony_ci u32 addr, len; 1268c2ecf20Sopenharmony_ci } iovec[TPD_MAXIOV]; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci#define address0 iovec[0].addr 1298c2ecf20Sopenharmony_ci#define length0 iovec[0].len 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /* linux-atm extensions */ 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci struct sk_buff *skb; 1348c2ecf20Sopenharmony_ci struct atm_vcc *vcc; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci struct list_head entry; 1378c2ecf20Sopenharmony_ci}; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci#define TPD_ALIGNMENT 64 1408c2ecf20Sopenharmony_ci#define TPD_LEN_MASK 0xffff 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define TPD_ADDR_SHIFT 6 1438c2ecf20Sopenharmony_ci#define TPD_MASK 0xffffffc0 1448c2ecf20Sopenharmony_ci#define TPD_ADDR(x) ((x) & TPD_MASK) 1458c2ecf20Sopenharmony_ci#define TPD_INDEX(x) (TPD_ADDR(x) >> TPD_ADDR_SHIFT) 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci/* table 2.3 transmit buffer return elements */ 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_cistruct he_tbrq { 1518c2ecf20Sopenharmony_ci volatile u32 tbre; 1528c2ecf20Sopenharmony_ci}; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define TBRQ_ALIGNMENT CONFIG_TBRQ_SIZE 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci#define TBRQ_TPD(tbrq) ((tbrq)->tbre & 0xffffffc0) 1578c2ecf20Sopenharmony_ci#define TBRQ_EOS(tbrq) ((tbrq)->tbre & (1<<3)) 1588c2ecf20Sopenharmony_ci#define TBRQ_MULTIPLE(tbrq) ((tbrq)->tbre & (1)) 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci/* table 2.21 receive buffer return queue element field organization */ 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cistruct he_rbrq { 1638c2ecf20Sopenharmony_ci volatile u32 addr; 1648c2ecf20Sopenharmony_ci volatile u32 cidlen; 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci#define RBRQ_ALIGNMENT CONFIG_RBRQ_SIZE 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci#define RBRQ_ADDR(rbrq) ((rbrq)->addr & 0xffffffc0) 1708c2ecf20Sopenharmony_ci#define RBRQ_CRC_ERR(rbrq) ((rbrq)->addr & (1<<5)) 1718c2ecf20Sopenharmony_ci#define RBRQ_LEN_ERR(rbrq) ((rbrq)->addr & (1<<4)) 1728c2ecf20Sopenharmony_ci#define RBRQ_END_PDU(rbrq) ((rbrq)->addr & (1<<3)) 1738c2ecf20Sopenharmony_ci#define RBRQ_AAL5_PROT(rbrq) ((rbrq)->addr & (1<<2)) 1748c2ecf20Sopenharmony_ci#define RBRQ_CON_CLOSED(rbrq) ((rbrq)->addr & (1<<1)) 1758c2ecf20Sopenharmony_ci#define RBRQ_HBUF_ERR(rbrq) ((rbrq)->addr & 1) 1768c2ecf20Sopenharmony_ci#define RBRQ_CID(rbrq) (((rbrq)->cidlen >> 16) & 0x1fff) 1778c2ecf20Sopenharmony_ci#define RBRQ_BUFLEN(rbrq) ((rbrq)->cidlen & 0xffff) 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci/* figure 2.3 transmit packet descriptor ready queue */ 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_cistruct he_tpdrq { 1828c2ecf20Sopenharmony_ci volatile u32 tpd; 1838c2ecf20Sopenharmony_ci volatile u32 cid; 1848c2ecf20Sopenharmony_ci}; 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define TPDRQ_ALIGNMENT CONFIG_TPDRQ_SIZE 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci/* table 2.30 host status page detail */ 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci#define HSP_ALIGNMENT 0x400 /* must align on 1k boundary */ 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_cistruct he_hsp { 1938c2ecf20Sopenharmony_ci struct he_hsp_entry { 1948c2ecf20Sopenharmony_ci volatile u32 tbrq_tail; 1958c2ecf20Sopenharmony_ci volatile u32 reserved1[15]; 1968c2ecf20Sopenharmony_ci volatile u32 rbrq_tail; 1978c2ecf20Sopenharmony_ci volatile u32 reserved2[15]; 1988c2ecf20Sopenharmony_ci } group[HE_NUM_GROUPS]; 1998c2ecf20Sopenharmony_ci}; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* 2028c2ecf20Sopenharmony_ci * figure 2.9 receive buffer pools 2038c2ecf20Sopenharmony_ci * 2048c2ecf20Sopenharmony_ci * since a virtual address might be more than 32 bits, we store an index 2058c2ecf20Sopenharmony_ci * in the virt member of he_rbp. NOTE: the lower six bits in the rbrq 2068c2ecf20Sopenharmony_ci * addr member are used for buffer status further limiting us to 26 bits. 2078c2ecf20Sopenharmony_ci */ 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_cistruct he_rbp { 2108c2ecf20Sopenharmony_ci volatile u32 phys; 2118c2ecf20Sopenharmony_ci volatile u32 idx; /* virt */ 2128c2ecf20Sopenharmony_ci}; 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci#define RBP_IDX_OFFSET 6 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci/* 2178c2ecf20Sopenharmony_ci * the he dma engine will try to hold an extra 16 buffers in its local 2188c2ecf20Sopenharmony_ci * caches. and add a couple buffers for safety. 2198c2ecf20Sopenharmony_ci */ 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci#define RBPL_TABLE_SIZE (CONFIG_RBPL_SIZE + 16 + 2) 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_cistruct he_buff { 2248c2ecf20Sopenharmony_ci struct list_head entry; 2258c2ecf20Sopenharmony_ci dma_addr_t mapping; 2268c2ecf20Sopenharmony_ci unsigned long len; 2278c2ecf20Sopenharmony_ci u8 data[]; 2288c2ecf20Sopenharmony_ci}; 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci#ifdef notyet 2318c2ecf20Sopenharmony_cistruct he_group { 2328c2ecf20Sopenharmony_ci u32 rpbl_size, rpbl_qsize; 2338c2ecf20Sopenharmony_ci struct he_rpb_entry *rbpl_ba; 2348c2ecf20Sopenharmony_ci}; 2358c2ecf20Sopenharmony_ci#endif 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci#define HE_LOOKUP_VCC(dev, cid) ((dev)->he_vcc_table[(cid)].vcc) 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_cistruct he_vcc_table 2408c2ecf20Sopenharmony_ci{ 2418c2ecf20Sopenharmony_ci struct atm_vcc *vcc; 2428c2ecf20Sopenharmony_ci}; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_cistruct he_cs_stper 2458c2ecf20Sopenharmony_ci{ 2468c2ecf20Sopenharmony_ci long pcr; 2478c2ecf20Sopenharmony_ci int inuse; 2488c2ecf20Sopenharmony_ci}; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci#define HE_NUM_CS_STPER 16 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_cistruct he_dev { 2538c2ecf20Sopenharmony_ci unsigned int number; 2548c2ecf20Sopenharmony_ci unsigned int irq; 2558c2ecf20Sopenharmony_ci void __iomem *membase; 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci char prod_id[30]; 2588c2ecf20Sopenharmony_ci char mac_addr[6]; 2598c2ecf20Sopenharmony_ci int media; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci unsigned int vcibits, vpibits; 2628c2ecf20Sopenharmony_ci unsigned int cells_per_row; 2638c2ecf20Sopenharmony_ci unsigned int bytes_per_row; 2648c2ecf20Sopenharmony_ci unsigned int cells_per_lbuf; 2658c2ecf20Sopenharmony_ci unsigned int r0_numrows, r0_startrow, r0_numbuffs; 2668c2ecf20Sopenharmony_ci unsigned int r1_numrows, r1_startrow, r1_numbuffs; 2678c2ecf20Sopenharmony_ci unsigned int tx_numrows, tx_startrow, tx_numbuffs; 2688c2ecf20Sopenharmony_ci unsigned int buffer_limit; 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci struct he_vcc_table *he_vcc_table; 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci#ifdef notyet 2738c2ecf20Sopenharmony_ci struct he_group group[HE_NUM_GROUPS]; 2748c2ecf20Sopenharmony_ci#endif 2758c2ecf20Sopenharmony_ci struct he_cs_stper cs_stper[HE_NUM_CS_STPER]; 2768c2ecf20Sopenharmony_ci unsigned total_bw; 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci dma_addr_t irq_phys; 2798c2ecf20Sopenharmony_ci struct he_irq *irq_base, *irq_head, *irq_tail; 2808c2ecf20Sopenharmony_ci volatile unsigned *irq_tailoffset; 2818c2ecf20Sopenharmony_ci int irq_peak; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci struct tasklet_struct tasklet; 2848c2ecf20Sopenharmony_ci struct dma_pool *tpd_pool; 2858c2ecf20Sopenharmony_ci struct list_head outstanding_tpds; 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci dma_addr_t tpdrq_phys; 2888c2ecf20Sopenharmony_ci struct he_tpdrq *tpdrq_base, *tpdrq_tail, *tpdrq_head; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci spinlock_t global_lock; /* 8.1.5 pci transaction ordering 2918c2ecf20Sopenharmony_ci error problem */ 2928c2ecf20Sopenharmony_ci dma_addr_t rbrq_phys; 2938c2ecf20Sopenharmony_ci struct he_rbrq *rbrq_base, *rbrq_head; 2948c2ecf20Sopenharmony_ci int rbrq_peak; 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci struct he_buff **rbpl_virt; 2978c2ecf20Sopenharmony_ci unsigned long *rbpl_table; 2988c2ecf20Sopenharmony_ci unsigned long rbpl_hint; 2998c2ecf20Sopenharmony_ci struct dma_pool *rbpl_pool; 3008c2ecf20Sopenharmony_ci dma_addr_t rbpl_phys; 3018c2ecf20Sopenharmony_ci struct he_rbp *rbpl_base, *rbpl_tail; 3028c2ecf20Sopenharmony_ci struct list_head rbpl_outstanding; 3038c2ecf20Sopenharmony_ci int rbpl_peak; 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci dma_addr_t tbrq_phys; 3068c2ecf20Sopenharmony_ci struct he_tbrq *tbrq_base, *tbrq_head; 3078c2ecf20Sopenharmony_ci int tbrq_peak; 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci dma_addr_t hsp_phys; 3108c2ecf20Sopenharmony_ci struct he_hsp *hsp; 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci struct pci_dev *pci_dev; 3138c2ecf20Sopenharmony_ci struct atm_dev *atm_dev; 3148c2ecf20Sopenharmony_ci struct he_dev *next; 3158c2ecf20Sopenharmony_ci}; 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci#define HE_MAXIOV 20 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_cistruct he_vcc 3208c2ecf20Sopenharmony_ci{ 3218c2ecf20Sopenharmony_ci struct list_head buffers; 3228c2ecf20Sopenharmony_ci int pdu_len; 3238c2ecf20Sopenharmony_ci int rc_index; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci wait_queue_head_t rx_waitq; 3268c2ecf20Sopenharmony_ci wait_queue_head_t tx_waitq; 3278c2ecf20Sopenharmony_ci}; 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci#define HE_VCC(vcc) ((struct he_vcc *)(vcc->dev_data)) 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci#define PCI_VENDOR_ID_FORE 0x1127 3328c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_FORE_HE 0x400 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ci#define GEN_CNTL_0 0x40 3358c2ecf20Sopenharmony_ci#define INT_PROC_ENBL (1<<25) 3368c2ecf20Sopenharmony_ci#define SLAVE_ENDIAN_MODE (1<<16) 3378c2ecf20Sopenharmony_ci#define MRL_ENB (1<<5) 3388c2ecf20Sopenharmony_ci#define MRM_ENB (1<<4) 3398c2ecf20Sopenharmony_ci#define INIT_ENB (1<<2) 3408c2ecf20Sopenharmony_ci#define IGNORE_TIMEOUT (1<<1) 3418c2ecf20Sopenharmony_ci#define ENBL_64 (1<<0) 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci#define MIN_PCI_LATENCY 32 /* errata 8.1.3 */ 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci#define HE_DEV(dev) ((struct he_dev *) (dev)->dev_data) 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_ci#define he_is622(dev) ((dev)->media & 0x1) 3488c2ecf20Sopenharmony_ci#define he_isMM(dev) ((dev)->media & 0x20) 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci#define HE_REGMAP_SIZE 0x100000 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ci#define RESET_CNTL 0x80000 3538c2ecf20Sopenharmony_ci#define BOARD_RST_STATUS (1<<6) 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci#define HOST_CNTL 0x80004 3568c2ecf20Sopenharmony_ci#define PCI_BUS_SIZE64 (1<<27) 3578c2ecf20Sopenharmony_ci#define DESC_RD_STATIC_64 (1<<26) 3588c2ecf20Sopenharmony_ci#define DATA_RD_STATIC_64 (1<<25) 3598c2ecf20Sopenharmony_ci#define DATA_WR_STATIC_64 (1<<24) 3608c2ecf20Sopenharmony_ci#define ID_CS (1<<12) 3618c2ecf20Sopenharmony_ci#define ID_WREN (1<<11) 3628c2ecf20Sopenharmony_ci#define ID_DOUT (1<<10) 3638c2ecf20Sopenharmony_ci#define ID_DOFFSET 10 3648c2ecf20Sopenharmony_ci#define ID_DIN (1<<9) 3658c2ecf20Sopenharmony_ci#define ID_CLOCK (1<<8) 3668c2ecf20Sopenharmony_ci#define QUICK_RD_RETRY (1<<7) 3678c2ecf20Sopenharmony_ci#define QUICK_WR_RETRY (1<<6) 3688c2ecf20Sopenharmony_ci#define OUTFF_ENB (1<<5) 3698c2ecf20Sopenharmony_ci#define CMDFF_ENB (1<<4) 3708c2ecf20Sopenharmony_ci#define PERR_INT_ENB (1<<2) 3718c2ecf20Sopenharmony_ci#define IGNORE_INTR (1<<0) 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci#define LB_SWAP 0x80008 3748c2ecf20Sopenharmony_ci#define SWAP_RNUM_MAX(x) (x<<27) 3758c2ecf20Sopenharmony_ci#define DATA_WR_SWAP (1<<20) 3768c2ecf20Sopenharmony_ci#define DESC_RD_SWAP (1<<19) 3778c2ecf20Sopenharmony_ci#define DATA_RD_SWAP (1<<18) 3788c2ecf20Sopenharmony_ci#define INTR_SWAP (1<<17) 3798c2ecf20Sopenharmony_ci#define DESC_WR_SWAP (1<<16) 3808c2ecf20Sopenharmony_ci#define SDRAM_INIT (1<<15) 3818c2ecf20Sopenharmony_ci#define BIG_ENDIAN_HOST (1<<14) 3828c2ecf20Sopenharmony_ci#define XFER_SIZE (1<<7) 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci#define LB_MEM_ADDR 0x8000c 3858c2ecf20Sopenharmony_ci#define LB_MEM_DATA 0x80010 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ci#define LB_MEM_ACCESS 0x80014 3888c2ecf20Sopenharmony_ci#define LB_MEM_HNDSHK (1<<30) 3898c2ecf20Sopenharmony_ci#define LM_MEM_WRITE (0x7) 3908c2ecf20Sopenharmony_ci#define LM_MEM_READ (0x3) 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci#define SDRAM_CTL 0x80018 3938c2ecf20Sopenharmony_ci#define LB_64_ENB (1<<3) 3948c2ecf20Sopenharmony_ci#define LB_TWR (1<<2) 3958c2ecf20Sopenharmony_ci#define LB_TRP (1<<1) 3968c2ecf20Sopenharmony_ci#define LB_TRAS (1<<0) 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci#define INT_FIFO 0x8001c 3998c2ecf20Sopenharmony_ci#define INT_MASK_D (1<<15) 4008c2ecf20Sopenharmony_ci#define INT_MASK_C (1<<14) 4018c2ecf20Sopenharmony_ci#define INT_MASK_B (1<<13) 4028c2ecf20Sopenharmony_ci#define INT_MASK_A (1<<12) 4038c2ecf20Sopenharmony_ci#define INT_CLEAR_D (1<<11) 4048c2ecf20Sopenharmony_ci#define INT_CLEAR_C (1<<10) 4058c2ecf20Sopenharmony_ci#define INT_CLEAR_B (1<<9) 4068c2ecf20Sopenharmony_ci#define INT_CLEAR_A (1<<8) 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci#define ABORT_ADDR 0x80020 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci#define IRQ0_BASE 0x80080 4118c2ecf20Sopenharmony_ci#define IRQ_BASE(x) (x<<12) 4128c2ecf20Sopenharmony_ci#define IRQ_MASK ((CONFIG_IRQ_SIZE<<2)-1) /* was 0x3ff */ 4138c2ecf20Sopenharmony_ci#define IRQ_TAIL(x) (((unsigned long)(x)) & IRQ_MASK) 4148c2ecf20Sopenharmony_ci#define IRQ0_HEAD 0x80084 4158c2ecf20Sopenharmony_ci#define IRQ_SIZE(x) (x<<22) 4168c2ecf20Sopenharmony_ci#define IRQ_THRESH(x) (x<<12) 4178c2ecf20Sopenharmony_ci#define IRQ_HEAD(x) (x<<2) 4188c2ecf20Sopenharmony_ci/* #define IRQ_PENDING (1) conflict with linux/irq.h */ 4198c2ecf20Sopenharmony_ci#define IRQ0_CNTL 0x80088 4208c2ecf20Sopenharmony_ci#define IRQ_ADDRSEL(x) (x<<2) 4218c2ecf20Sopenharmony_ci#define IRQ_INT_A (0<<2) 4228c2ecf20Sopenharmony_ci#define IRQ_INT_B (1<<2) 4238c2ecf20Sopenharmony_ci#define IRQ_INT_C (2<<2) 4248c2ecf20Sopenharmony_ci#define IRQ_INT_D (3<<2) 4258c2ecf20Sopenharmony_ci#define IRQ_TYPE_ADDR 0x1 4268c2ecf20Sopenharmony_ci#define IRQ_TYPE_LINE 0x0 4278c2ecf20Sopenharmony_ci#define IRQ0_DATA 0x8008c 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci#define IRQ1_BASE 0x80090 4308c2ecf20Sopenharmony_ci#define IRQ1_HEAD 0x80094 4318c2ecf20Sopenharmony_ci#define IRQ1_CNTL 0x80098 4328c2ecf20Sopenharmony_ci#define IRQ1_DATA 0x8009c 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci#define IRQ2_BASE 0x800a0 4358c2ecf20Sopenharmony_ci#define IRQ2_HEAD 0x800a4 4368c2ecf20Sopenharmony_ci#define IRQ2_CNTL 0x800a8 4378c2ecf20Sopenharmony_ci#define IRQ2_DATA 0x800ac 4388c2ecf20Sopenharmony_ci 4398c2ecf20Sopenharmony_ci#define IRQ3_BASE 0x800b0 4408c2ecf20Sopenharmony_ci#define IRQ3_HEAD 0x800b4 4418c2ecf20Sopenharmony_ci#define IRQ3_CNTL 0x800b8 4428c2ecf20Sopenharmony_ci#define IRQ3_DATA 0x800bc 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_ci#define GRP_10_MAP 0x800c0 4458c2ecf20Sopenharmony_ci#define GRP_32_MAP 0x800c4 4468c2ecf20Sopenharmony_ci#define GRP_54_MAP 0x800c8 4478c2ecf20Sopenharmony_ci#define GRP_76_MAP 0x800cc 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_ci#define G0_RBPS_S 0x80400 4508c2ecf20Sopenharmony_ci#define G0_RBPS_T 0x80404 4518c2ecf20Sopenharmony_ci#define RBP_TAIL(x) ((x)<<3) 4528c2ecf20Sopenharmony_ci#define RBP_MASK(x) ((x)|0x1fff) 4538c2ecf20Sopenharmony_ci#define G0_RBPS_QI 0x80408 4548c2ecf20Sopenharmony_ci#define RBP_QSIZE(x) ((x)<<14) 4558c2ecf20Sopenharmony_ci#define RBP_INT_ENB (1<<13) 4568c2ecf20Sopenharmony_ci#define RBP_THRESH(x) (x) 4578c2ecf20Sopenharmony_ci#define G0_RBPS_BS 0x8040c 4588c2ecf20Sopenharmony_ci#define G0_RBPL_S 0x80410 4598c2ecf20Sopenharmony_ci#define G0_RBPL_T 0x80414 4608c2ecf20Sopenharmony_ci#define G0_RBPL_QI 0x80418 4618c2ecf20Sopenharmony_ci#define G0_RBPL_BS 0x8041c 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci#define G1_RBPS_S 0x80420 4648c2ecf20Sopenharmony_ci#define G1_RBPS_T 0x80424 4658c2ecf20Sopenharmony_ci#define G1_RBPS_QI 0x80428 4668c2ecf20Sopenharmony_ci#define G1_RBPS_BS 0x8042c 4678c2ecf20Sopenharmony_ci#define G1_RBPL_S 0x80430 4688c2ecf20Sopenharmony_ci#define G1_RBPL_T 0x80434 4698c2ecf20Sopenharmony_ci#define G1_RBPL_QI 0x80438 4708c2ecf20Sopenharmony_ci#define G1_RBPL_BS 0x8043c 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci#define G2_RBPS_S 0x80440 4738c2ecf20Sopenharmony_ci#define G2_RBPS_T 0x80444 4748c2ecf20Sopenharmony_ci#define G2_RBPS_QI 0x80448 4758c2ecf20Sopenharmony_ci#define G2_RBPS_BS 0x8044c 4768c2ecf20Sopenharmony_ci#define G2_RBPL_S 0x80450 4778c2ecf20Sopenharmony_ci#define G2_RBPL_T 0x80454 4788c2ecf20Sopenharmony_ci#define G2_RBPL_QI 0x80458 4798c2ecf20Sopenharmony_ci#define G2_RBPL_BS 0x8045c 4808c2ecf20Sopenharmony_ci 4818c2ecf20Sopenharmony_ci#define G3_RBPS_S 0x80460 4828c2ecf20Sopenharmony_ci#define G3_RBPS_T 0x80464 4838c2ecf20Sopenharmony_ci#define G3_RBPS_QI 0x80468 4848c2ecf20Sopenharmony_ci#define G3_RBPS_BS 0x8046c 4858c2ecf20Sopenharmony_ci#define G3_RBPL_S 0x80470 4868c2ecf20Sopenharmony_ci#define G3_RBPL_T 0x80474 4878c2ecf20Sopenharmony_ci#define G3_RBPL_QI 0x80478 4888c2ecf20Sopenharmony_ci#define G3_RBPL_BS 0x8047c 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ci#define G4_RBPS_S 0x80480 4918c2ecf20Sopenharmony_ci#define G4_RBPS_T 0x80484 4928c2ecf20Sopenharmony_ci#define G4_RBPS_QI 0x80488 4938c2ecf20Sopenharmony_ci#define G4_RBPS_BS 0x8048c 4948c2ecf20Sopenharmony_ci#define G4_RBPL_S 0x80490 4958c2ecf20Sopenharmony_ci#define G4_RBPL_T 0x80494 4968c2ecf20Sopenharmony_ci#define G4_RBPL_QI 0x80498 4978c2ecf20Sopenharmony_ci#define G4_RBPL_BS 0x8049c 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ci#define G5_RBPS_S 0x804a0 5008c2ecf20Sopenharmony_ci#define G5_RBPS_T 0x804a4 5018c2ecf20Sopenharmony_ci#define G5_RBPS_QI 0x804a8 5028c2ecf20Sopenharmony_ci#define G5_RBPS_BS 0x804ac 5038c2ecf20Sopenharmony_ci#define G5_RBPL_S 0x804b0 5048c2ecf20Sopenharmony_ci#define G5_RBPL_T 0x804b4 5058c2ecf20Sopenharmony_ci#define G5_RBPL_QI 0x804b8 5068c2ecf20Sopenharmony_ci#define G5_RBPL_BS 0x804bc 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_ci#define G6_RBPS_S 0x804c0 5098c2ecf20Sopenharmony_ci#define G6_RBPS_T 0x804c4 5108c2ecf20Sopenharmony_ci#define G6_RBPS_QI 0x804c8 5118c2ecf20Sopenharmony_ci#define G6_RBPS_BS 0x804cc 5128c2ecf20Sopenharmony_ci#define G6_RBPL_S 0x804d0 5138c2ecf20Sopenharmony_ci#define G6_RBPL_T 0x804d4 5148c2ecf20Sopenharmony_ci#define G6_RBPL_QI 0x804d8 5158c2ecf20Sopenharmony_ci#define G6_RBPL_BS 0x804dc 5168c2ecf20Sopenharmony_ci 5178c2ecf20Sopenharmony_ci#define G7_RBPS_S 0x804e0 5188c2ecf20Sopenharmony_ci#define G7_RBPS_T 0x804e4 5198c2ecf20Sopenharmony_ci#define G7_RBPS_QI 0x804e8 5208c2ecf20Sopenharmony_ci#define G7_RBPS_BS 0x804ec 5218c2ecf20Sopenharmony_ci 5228c2ecf20Sopenharmony_ci#define G7_RBPL_S 0x804f0 5238c2ecf20Sopenharmony_ci#define G7_RBPL_T 0x804f4 5248c2ecf20Sopenharmony_ci#define G7_RBPL_QI 0x804f8 5258c2ecf20Sopenharmony_ci#define G7_RBPL_BS 0x804fc 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci#define G0_RBRQ_ST 0x80500 5288c2ecf20Sopenharmony_ci#define G0_RBRQ_H 0x80504 5298c2ecf20Sopenharmony_ci#define G0_RBRQ_Q 0x80508 5308c2ecf20Sopenharmony_ci#define RBRQ_THRESH(x) ((x)<<13) 5318c2ecf20Sopenharmony_ci#define RBRQ_SIZE(x) (x) 5328c2ecf20Sopenharmony_ci#define G0_RBRQ_I 0x8050c 5338c2ecf20Sopenharmony_ci#define RBRQ_TIME(x) ((x)<<8) 5348c2ecf20Sopenharmony_ci#define RBRQ_COUNT(x) (x) 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ci/* fill in 1 ... 7 later */ 5378c2ecf20Sopenharmony_ci 5388c2ecf20Sopenharmony_ci#define G0_TBRQ_B_T 0x80600 5398c2ecf20Sopenharmony_ci#define G0_TBRQ_H 0x80604 5408c2ecf20Sopenharmony_ci#define G0_TBRQ_S 0x80608 5418c2ecf20Sopenharmony_ci#define G0_TBRQ_THRESH 0x8060c 5428c2ecf20Sopenharmony_ci#define TBRQ_THRESH(x) (x) 5438c2ecf20Sopenharmony_ci 5448c2ecf20Sopenharmony_ci/* fill in 1 ... 7 later */ 5458c2ecf20Sopenharmony_ci 5468c2ecf20Sopenharmony_ci#define RH_CONFIG 0x805c0 5478c2ecf20Sopenharmony_ci#define PHY_INT_ENB (1<<10) 5488c2ecf20Sopenharmony_ci#define OAM_GID(x) (x<<7) 5498c2ecf20Sopenharmony_ci#define PTMR_PRE(x) (x) 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_ci#define G0_INMQ_S 0x80580 5528c2ecf20Sopenharmony_ci#define G0_INMQ_L 0x80584 5538c2ecf20Sopenharmony_ci#define G1_INMQ_S 0x80588 5548c2ecf20Sopenharmony_ci#define G1_INMQ_L 0x8058c 5558c2ecf20Sopenharmony_ci#define G2_INMQ_S 0x80590 5568c2ecf20Sopenharmony_ci#define G2_INMQ_L 0x80594 5578c2ecf20Sopenharmony_ci#define G3_INMQ_S 0x80598 5588c2ecf20Sopenharmony_ci#define G3_INMQ_L 0x8059c 5598c2ecf20Sopenharmony_ci#define G4_INMQ_S 0x805a0 5608c2ecf20Sopenharmony_ci#define G4_INMQ_L 0x805a4 5618c2ecf20Sopenharmony_ci#define G5_INMQ_S 0x805a8 5628c2ecf20Sopenharmony_ci#define G5_INMQ_L 0x805ac 5638c2ecf20Sopenharmony_ci#define G6_INMQ_S 0x805b0 5648c2ecf20Sopenharmony_ci#define G6_INMQ_L 0x805b4 5658c2ecf20Sopenharmony_ci#define G7_INMQ_S 0x805b8 5668c2ecf20Sopenharmony_ci#define G7_INMQ_L 0x805bc 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_ci#define TPDRQ_B_H 0x80680 5698c2ecf20Sopenharmony_ci#define TPDRQ_T 0x80684 5708c2ecf20Sopenharmony_ci#define TPDRQ_S 0x80688 5718c2ecf20Sopenharmony_ci 5728c2ecf20Sopenharmony_ci#define UBUFF_BA 0x8068c 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_ci#define RLBF0_H 0x806c0 5758c2ecf20Sopenharmony_ci#define RLBF0_T 0x806c4 5768c2ecf20Sopenharmony_ci#define RLBF1_H 0x806c8 5778c2ecf20Sopenharmony_ci#define RLBF1_T 0x806cc 5788c2ecf20Sopenharmony_ci#define RLBC_H 0x806d0 5798c2ecf20Sopenharmony_ci#define RLBC_T 0x806d4 5808c2ecf20Sopenharmony_ci#define RLBC_H2 0x806d8 5818c2ecf20Sopenharmony_ci#define TLBF_H 0x806e0 5828c2ecf20Sopenharmony_ci#define TLBF_T 0x806e4 5838c2ecf20Sopenharmony_ci#define RLBF0_C 0x806e8 5848c2ecf20Sopenharmony_ci#define RLBF1_C 0x806ec 5858c2ecf20Sopenharmony_ci#define RXTHRSH 0x806f0 5868c2ecf20Sopenharmony_ci#define LITHRSH 0x806f4 5878c2ecf20Sopenharmony_ci 5888c2ecf20Sopenharmony_ci#define LBARB 0x80700 5898c2ecf20Sopenharmony_ci#define SLICE_X(x) (x<<28) 5908c2ecf20Sopenharmony_ci#define ARB_RNUM_MAX(x) (x<<23) 5918c2ecf20Sopenharmony_ci#define TH_PRTY(x) (x<<21) 5928c2ecf20Sopenharmony_ci#define RH_PRTY(x) (x<<19) 5938c2ecf20Sopenharmony_ci#define TL_PRTY(x) (x<<17) 5948c2ecf20Sopenharmony_ci#define RL_PRTY(x) (x<<15) 5958c2ecf20Sopenharmony_ci#define BUS_MULTI(x) (x<<8) 5968c2ecf20Sopenharmony_ci#define NET_PREF(x) (x) 5978c2ecf20Sopenharmony_ci 5988c2ecf20Sopenharmony_ci#define SDRAMCON 0x80704 5998c2ecf20Sopenharmony_ci#define BANK_ON (1<<14) 6008c2ecf20Sopenharmony_ci#define WIDE_DATA (1<<13) 6018c2ecf20Sopenharmony_ci#define TWR_WAIT (1<<12) 6028c2ecf20Sopenharmony_ci#define TRP_WAIT (1<<11) 6038c2ecf20Sopenharmony_ci#define TRAS_WAIT (1<<10) 6048c2ecf20Sopenharmony_ci#define REF_RATE(x) (x) 6058c2ecf20Sopenharmony_ci 6068c2ecf20Sopenharmony_ci#define LBSTAT 0x80708 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_ci#define RCC_STAT 0x8070c 6098c2ecf20Sopenharmony_ci#define RCC_BUSY (1) 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_ci#define TCMCONFIG 0x80740 6128c2ecf20Sopenharmony_ci#define TM_DESL2 (1<<10) 6138c2ecf20Sopenharmony_ci#define TM_BANK_WAIT(x) (x<<6) 6148c2ecf20Sopenharmony_ci#define TM_ADD_BANK4(x) (x<<4) 6158c2ecf20Sopenharmony_ci#define TM_PAR_CHECK(x) (x<<3) 6168c2ecf20Sopenharmony_ci#define TM_RW_WAIT(x) (x<<2) 6178c2ecf20Sopenharmony_ci#define TM_SRAM_TYPE(x) (x) 6188c2ecf20Sopenharmony_ci 6198c2ecf20Sopenharmony_ci#define TSRB_BA 0x80744 6208c2ecf20Sopenharmony_ci#define TSRC_BA 0x80748 6218c2ecf20Sopenharmony_ci#define TMABR_BA 0x8074c 6228c2ecf20Sopenharmony_ci#define TPD_BA 0x80750 6238c2ecf20Sopenharmony_ci#define TSRD_BA 0x80758 6248c2ecf20Sopenharmony_ci 6258c2ecf20Sopenharmony_ci#define TX_CONFIG 0x80760 6268c2ecf20Sopenharmony_ci#define DRF_THRESH(x) (x<<22) 6278c2ecf20Sopenharmony_ci#define TX_UT_MODE(x) (x<<21) 6288c2ecf20Sopenharmony_ci#define TX_VCI_MASK(x) (x<<17) 6298c2ecf20Sopenharmony_ci#define LBFREE_CNT(x) (x) 6308c2ecf20Sopenharmony_ci 6318c2ecf20Sopenharmony_ci#define TXAAL5_PROTO 0x80764 6328c2ecf20Sopenharmony_ci#define CPCS_UU(x) (x<<8) 6338c2ecf20Sopenharmony_ci#define CPI(x) (x) 6348c2ecf20Sopenharmony_ci 6358c2ecf20Sopenharmony_ci#define RCMCONFIG 0x80780 6368c2ecf20Sopenharmony_ci#define RM_DESL2(x) (x<<10) 6378c2ecf20Sopenharmony_ci#define RM_BANK_WAIT(x) (x<<6) 6388c2ecf20Sopenharmony_ci#define RM_ADD_BANK(x) (x<<4) 6398c2ecf20Sopenharmony_ci#define RM_PAR_CHECK(x) (x<<3) 6408c2ecf20Sopenharmony_ci#define RM_RW_WAIT(x) (x<<2) 6418c2ecf20Sopenharmony_ci#define RM_SRAM_TYPE(x) (x) 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_ci#define RCMRSRB_BA 0x80784 6448c2ecf20Sopenharmony_ci#define RCMLBM_BA 0x80788 6458c2ecf20Sopenharmony_ci#define RCMABR_BA 0x8078c 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_ci#define RC_CONFIG 0x807c0 6488c2ecf20Sopenharmony_ci#define UT_RD_DELAY(x) (x<<11) 6498c2ecf20Sopenharmony_ci#define WRAP_MODE(x) (x<<10) 6508c2ecf20Sopenharmony_ci#define RC_UT_MODE(x) (x<<9) 6518c2ecf20Sopenharmony_ci#define RX_ENABLE (1<<8) 6528c2ecf20Sopenharmony_ci#define RX_VALVP(x) (x<<4) 6538c2ecf20Sopenharmony_ci#define RX_VALVC(x) (x) 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ci#define MCC 0x807c4 6568c2ecf20Sopenharmony_ci#define OEC 0x807c8 6578c2ecf20Sopenharmony_ci#define DCC 0x807cc 6588c2ecf20Sopenharmony_ci#define CEC 0x807d0 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_ci#define HSP_BA 0x807f0 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_ci#define LB_CONFIG 0x807f4 6638c2ecf20Sopenharmony_ci#define LB_SIZE(x) (x) 6648c2ecf20Sopenharmony_ci 6658c2ecf20Sopenharmony_ci#define CON_DAT 0x807f8 6668c2ecf20Sopenharmony_ci#define CON_CTL 0x807fc 6678c2ecf20Sopenharmony_ci#define CON_CTL_MBOX (2<<30) 6688c2ecf20Sopenharmony_ci#define CON_CTL_TCM (1<<30) 6698c2ecf20Sopenharmony_ci#define CON_CTL_RCM (0<<30) 6708c2ecf20Sopenharmony_ci#define CON_CTL_WRITE (1<<29) 6718c2ecf20Sopenharmony_ci#define CON_CTL_READ (0<<29) 6728c2ecf20Sopenharmony_ci#define CON_CTL_BUSY (1<<28) 6738c2ecf20Sopenharmony_ci#define CON_BYTE_DISABLE_3 (1<<22) /* 24..31 */ 6748c2ecf20Sopenharmony_ci#define CON_BYTE_DISABLE_2 (1<<21) /* 16..23 */ 6758c2ecf20Sopenharmony_ci#define CON_BYTE_DISABLE_1 (1<<20) /* 8..15 */ 6768c2ecf20Sopenharmony_ci#define CON_BYTE_DISABLE_0 (1<<19) /* 0..7 */ 6778c2ecf20Sopenharmony_ci#define CON_CTL_ADDR(x) (x) 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_ci#define FRAMER 0x80800 /* to 0x80bfc */ 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_ci/* 3.3 network controller (internal) mailbox registers */ 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_ci#define CS_STPER0 0x0 6848c2ecf20Sopenharmony_ci /* ... */ 6858c2ecf20Sopenharmony_ci#define CS_STPER31 0x01f 6868c2ecf20Sopenharmony_ci 6878c2ecf20Sopenharmony_ci#define CS_STTIM0 0x020 6888c2ecf20Sopenharmony_ci /* ... */ 6898c2ecf20Sopenharmony_ci#define CS_STTIM31 0x03f 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_ci#define CS_TGRLD0 0x040 6928c2ecf20Sopenharmony_ci /* ... */ 6938c2ecf20Sopenharmony_ci#define CS_TGRLD15 0x04f 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_ci#define CS_ERTHR0 0x050 6968c2ecf20Sopenharmony_ci#define CS_ERTHR1 0x051 6978c2ecf20Sopenharmony_ci#define CS_ERTHR2 0x052 6988c2ecf20Sopenharmony_ci#define CS_ERTHR3 0x053 6998c2ecf20Sopenharmony_ci#define CS_ERTHR4 0x054 7008c2ecf20Sopenharmony_ci#define CS_ERCTL0 0x055 7018c2ecf20Sopenharmony_ci#define TX_ENABLE (1<<28) 7028c2ecf20Sopenharmony_ci#define ER_ENABLE (1<<27) 7038c2ecf20Sopenharmony_ci#define CS_ERCTL1 0x056 7048c2ecf20Sopenharmony_ci#define CS_ERCTL2 0x057 7058c2ecf20Sopenharmony_ci#define CS_ERSTAT0 0x058 7068c2ecf20Sopenharmony_ci#define CS_ERSTAT1 0x059 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_ci#define CS_RTCCT 0x060 7098c2ecf20Sopenharmony_ci#define CS_RTFWC 0x061 7108c2ecf20Sopenharmony_ci#define CS_RTFWR 0x062 7118c2ecf20Sopenharmony_ci#define CS_RTFTC 0x063 7128c2ecf20Sopenharmony_ci#define CS_RTATR 0x064 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_ci#define CS_TFBSET 0x070 7158c2ecf20Sopenharmony_ci#define CS_TFBADD 0x071 7168c2ecf20Sopenharmony_ci#define CS_TFBSUB 0x072 7178c2ecf20Sopenharmony_ci#define CS_WCRMAX 0x073 7188c2ecf20Sopenharmony_ci#define CS_WCRMIN 0x074 7198c2ecf20Sopenharmony_ci#define CS_WCRINC 0x075 7208c2ecf20Sopenharmony_ci#define CS_WCRDEC 0x076 7218c2ecf20Sopenharmony_ci#define CS_WCRCEIL 0x077 7228c2ecf20Sopenharmony_ci#define CS_BWDCNT 0x078 7238c2ecf20Sopenharmony_ci 7248c2ecf20Sopenharmony_ci#define CS_OTPPER 0x080 7258c2ecf20Sopenharmony_ci#define CS_OTWPER 0x081 7268c2ecf20Sopenharmony_ci#define CS_OTTLIM 0x082 7278c2ecf20Sopenharmony_ci#define CS_OTTCNT 0x083 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_ci#define CS_HGRRT0 0x090 7308c2ecf20Sopenharmony_ci /* ... */ 7318c2ecf20Sopenharmony_ci#define CS_HGRRT7 0x097 7328c2ecf20Sopenharmony_ci 7338c2ecf20Sopenharmony_ci#define CS_ORPTRS 0x0a0 7348c2ecf20Sopenharmony_ci 7358c2ecf20Sopenharmony_ci#define RXCON_CLOSE 0x100 7368c2ecf20Sopenharmony_ci 7378c2ecf20Sopenharmony_ci 7388c2ecf20Sopenharmony_ci#define RCM_MEM_SIZE 0x10000 /* 1M of 32-bit registers */ 7398c2ecf20Sopenharmony_ci#define TCM_MEM_SIZE 0x20000 /* 2M of 32-bit registers */ 7408c2ecf20Sopenharmony_ci 7418c2ecf20Sopenharmony_ci/* 2.5 transmit connection memory registers */ 7428c2ecf20Sopenharmony_ci 7438c2ecf20Sopenharmony_ci#define TSR0_CONN_STATE(x) ((x>>28) & 0x7) 7448c2ecf20Sopenharmony_ci#define TSR0_USE_WMIN (1<<23) 7458c2ecf20Sopenharmony_ci#define TSR0_GROUP(x) ((x & 0x7)<<18) 7468c2ecf20Sopenharmony_ci#define TSR0_ABR (2<<16) 7478c2ecf20Sopenharmony_ci#define TSR0_UBR (1<<16) 7488c2ecf20Sopenharmony_ci#define TSR0_CBR (0<<16) 7498c2ecf20Sopenharmony_ci#define TSR0_PROT (1<<15) 7508c2ecf20Sopenharmony_ci#define TSR0_AAL0_SDU (2<<12) 7518c2ecf20Sopenharmony_ci#define TSR0_AAL0 (1<<12) 7528c2ecf20Sopenharmony_ci#define TSR0_AAL5 (0<<12) 7538c2ecf20Sopenharmony_ci#define TSR0_HALT_ER (1<<11) 7548c2ecf20Sopenharmony_ci#define TSR0_MARK_CI (1<<10) 7558c2ecf20Sopenharmony_ci#define TSR0_MARK_ER (1<<9) 7568c2ecf20Sopenharmony_ci#define TSR0_UPDATE_GER (1<<8) 7578c2ecf20Sopenharmony_ci#define TSR0_RC_INDEX(x) (x & 0x1F) 7588c2ecf20Sopenharmony_ci 7598c2ecf20Sopenharmony_ci#define TSR1_PCR(x) ((x & 0x7FFF)<<16) 7608c2ecf20Sopenharmony_ci#define TSR1_MCR(x) (x & 0x7FFF) 7618c2ecf20Sopenharmony_ci 7628c2ecf20Sopenharmony_ci#define TSR2_ACR(x) ((x & 0x7FFF)<<16) 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_ci#define TSR3_NRM_CNT(x) ((x & 0xFF)<<24) 7658c2ecf20Sopenharmony_ci#define TSR3_CRM_CNT(x) (x & 0xFFFF) 7668c2ecf20Sopenharmony_ci 7678c2ecf20Sopenharmony_ci#define TSR4_FLUSH_CONN (1<<31) 7688c2ecf20Sopenharmony_ci#define TSR4_SESSION_ENDED (1<<30) 7698c2ecf20Sopenharmony_ci#define TSR4_CRC10 (1<<28) 7708c2ecf20Sopenharmony_ci#define TSR4_NULL_CRC10 (1<<27) 7718c2ecf20Sopenharmony_ci#define TSR4_PROT (1<<26) 7728c2ecf20Sopenharmony_ci#define TSR4_AAL0_SDU (2<<23) 7738c2ecf20Sopenharmony_ci#define TSR4_AAL0 (1<<23) 7748c2ecf20Sopenharmony_ci#define TSR4_AAL5 (0<<23) 7758c2ecf20Sopenharmony_ci 7768c2ecf20Sopenharmony_ci#define TSR9_OPEN_CONN (1<<20) 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_ci#define TSR11_ICR(x) ((x & 0x7FFF)<<16) 7798c2ecf20Sopenharmony_ci#define TSR11_TRM(x) ((x & 0x7)<<13) 7808c2ecf20Sopenharmony_ci#define TSR11_NRM(x) ((x & 0x7)<<10) 7818c2ecf20Sopenharmony_ci#define TSR11_ADTF(x) (x & 0x3FF) 7828c2ecf20Sopenharmony_ci 7838c2ecf20Sopenharmony_ci#define TSR13_RDF(x) ((x & 0xF)<<23) 7848c2ecf20Sopenharmony_ci#define TSR13_RIF(x) ((x & 0xF)<<19) 7858c2ecf20Sopenharmony_ci#define TSR13_CDF(x) ((x & 0x7)<<16) 7868c2ecf20Sopenharmony_ci#define TSR13_CRM(x) (x & 0xFFFF) 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_ci#define TSR14_DELETE (1<<31) 7898c2ecf20Sopenharmony_ci#define TSR14_ABR_CLOSE (1<<16) 7908c2ecf20Sopenharmony_ci 7918c2ecf20Sopenharmony_ci/* 2.7.1 per connection receieve state registers */ 7928c2ecf20Sopenharmony_ci 7938c2ecf20Sopenharmony_ci#define RSR0_START_PDU (1<<10) 7948c2ecf20Sopenharmony_ci#define RSR0_OPEN_CONN (1<<6) 7958c2ecf20Sopenharmony_ci#define RSR0_CLOSE_CONN (0<<6) 7968c2ecf20Sopenharmony_ci#define RSR0_PPD_ENABLE (1<<5) 7978c2ecf20Sopenharmony_ci#define RSR0_EPD_ENABLE (1<<4) 7988c2ecf20Sopenharmony_ci#define RSR0_TCP_CKSUM (1<<3) 7998c2ecf20Sopenharmony_ci#define RSR0_AAL5 (0) 8008c2ecf20Sopenharmony_ci#define RSR0_AAL0 (1) 8018c2ecf20Sopenharmony_ci#define RSR0_AAL0_SDU (2) 8028c2ecf20Sopenharmony_ci#define RSR0_RAWCELL (3) 8038c2ecf20Sopenharmony_ci#define RSR0_RAWCELL_CRC10 (4) 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_ci#define RSR1_AQI_ENABLE (1<<20) 8068c2ecf20Sopenharmony_ci#define RSR1_RBPL_ONLY (1<<19) 8078c2ecf20Sopenharmony_ci#define RSR1_GROUP(x) ((x)<<16) 8088c2ecf20Sopenharmony_ci 8098c2ecf20Sopenharmony_ci#define RSR4_AQI_ENABLE (1<<30) 8108c2ecf20Sopenharmony_ci#define RSR4_GROUP(x) ((x)<<27) 8118c2ecf20Sopenharmony_ci#define RSR4_RBPL_ONLY (1<<26) 8128c2ecf20Sopenharmony_ci 8138c2ecf20Sopenharmony_ci/* 2.1.4 transmit packet descriptor */ 8148c2ecf20Sopenharmony_ci 8158c2ecf20Sopenharmony_ci#define TPD_USERCELL 0x0 8168c2ecf20Sopenharmony_ci#define TPD_SEGMENT_OAMF5 0x4 8178c2ecf20Sopenharmony_ci#define TPD_END2END_OAMF5 0x5 8188c2ecf20Sopenharmony_ci#define TPD_RMCELL 0x6 8198c2ecf20Sopenharmony_ci#define TPD_CELLTYPE(x) (x<<3) 8208c2ecf20Sopenharmony_ci#define TPD_EOS (1<<2) 8218c2ecf20Sopenharmony_ci#define TPD_CLP (1<<1) 8228c2ecf20Sopenharmony_ci#define TPD_INT (1<<0) 8238c2ecf20Sopenharmony_ci#define TPD_LST (1<<31) 8248c2ecf20Sopenharmony_ci 8258c2ecf20Sopenharmony_ci/* table 4.3 serial eeprom information */ 8268c2ecf20Sopenharmony_ci 8278c2ecf20Sopenharmony_ci#define PROD_ID 0x08 /* char[] */ 8288c2ecf20Sopenharmony_ci#define PROD_ID_LEN 30 8298c2ecf20Sopenharmony_ci#define HW_REV 0x26 /* char[] */ 8308c2ecf20Sopenharmony_ci#define M_SN 0x3a /* integer */ 8318c2ecf20Sopenharmony_ci#define MEDIA 0x3e /* integer */ 8328c2ecf20Sopenharmony_ci#define HE155MM 0x26 8338c2ecf20Sopenharmony_ci#define HE622MM 0x27 8348c2ecf20Sopenharmony_ci#define HE155SM 0x46 8358c2ecf20Sopenharmony_ci#define HE622SM 0x47 8368c2ecf20Sopenharmony_ci#define MAC_ADDR 0x42 /* char[] */ 8378c2ecf20Sopenharmony_ci 8388c2ecf20Sopenharmony_ci#define CS_LOW 0x0 8398c2ecf20Sopenharmony_ci#define CS_HIGH ID_CS /* HOST_CNTL_ID_PROM_SEL */ 8408c2ecf20Sopenharmony_ci#define CLK_LOW 0x0 8418c2ecf20Sopenharmony_ci#define CLK_HIGH ID_CLOCK /* HOST_CNTL_ID_PROM_CLOCK */ 8428c2ecf20Sopenharmony_ci#define SI_HIGH ID_DIN /* HOST_CNTL_ID_PROM_DATA_IN */ 8438c2ecf20Sopenharmony_ci#define EEPROM_DELAY 400 /* microseconds */ 8448c2ecf20Sopenharmony_ci 8458c2ecf20Sopenharmony_ci#endif /* _HE_H_ */ 846