xref: /kernel/linux/linux-5.10/drivers/atm/idt77252.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/*******************************************************************
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * Copyright (c) 2000 ATecoM GmbH
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * The author may be reached at ecd@atecom.com.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute  it and/or modify it
88c2ecf20Sopenharmony_ci * under  the terms of  the GNU General  Public License as published by the
98c2ecf20Sopenharmony_ci * Free Software Foundation;  either version 2 of the  License, or (at your
108c2ecf20Sopenharmony_ci * option) any later version.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR   IMPLIED
138c2ecf20Sopenharmony_ci * WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
148c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
158c2ecf20Sopenharmony_ci * NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT,  INDIRECT,
168c2ecf20Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
178c2ecf20Sopenharmony_ci * NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
188c2ecf20Sopenharmony_ci * USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
198c2ecf20Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
208c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
218c2ecf20Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * You should have received a copy of the  GNU General Public License along
248c2ecf20Sopenharmony_ci * with this program; if not, write  to the Free Software Foundation, Inc.,
258c2ecf20Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA.
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci *******************************************************************/
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#ifndef _IDT77252_H
308c2ecf20Sopenharmony_ci#define _IDT77252_H 1
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#include <linux/ptrace.h>
348c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
358c2ecf20Sopenharmony_ci#include <linux/workqueue.h>
368c2ecf20Sopenharmony_ci#include <linux/mutex.h>
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/*****************************************************************************/
398c2ecf20Sopenharmony_ci/*                                                                           */
408c2ecf20Sopenharmony_ci/* Makros                                                                    */
418c2ecf20Sopenharmony_ci/*                                                                           */
428c2ecf20Sopenharmony_ci/*****************************************************************************/
438c2ecf20Sopenharmony_ci#define VPCI2VC(card, vpi, vci) \
448c2ecf20Sopenharmony_ci        (((vpi) << card->vcibits) | ((vci) & card->vcimask))
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/*****************************************************************************/
478c2ecf20Sopenharmony_ci/*                                                                           */
488c2ecf20Sopenharmony_ci/*   DEBUGGING definitions                                                   */
498c2ecf20Sopenharmony_ci/*                                                                           */
508c2ecf20Sopenharmony_ci/*****************************************************************************/
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define DBG_RAW_CELL	0x00000400
538c2ecf20Sopenharmony_ci#define DBG_TINY	0x00000200
548c2ecf20Sopenharmony_ci#define DBG_GENERAL     0x00000100
558c2ecf20Sopenharmony_ci#define DBG_XGENERAL    0x00000080
568c2ecf20Sopenharmony_ci#define DBG_INIT        0x00000040
578c2ecf20Sopenharmony_ci#define DBG_DEINIT      0x00000020
588c2ecf20Sopenharmony_ci#define DBG_INTERRUPT   0x00000010
598c2ecf20Sopenharmony_ci#define DBG_OPEN_CONN   0x00000008
608c2ecf20Sopenharmony_ci#define DBG_CLOSE_CONN  0x00000004
618c2ecf20Sopenharmony_ci#define DBG_RX_DATA     0x00000002
628c2ecf20Sopenharmony_ci#define DBG_TX_DATA     0x00000001
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#ifdef CONFIG_ATM_IDT77252_DEBUG
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define CPRINTK(args...)   do { if (debug & DBG_CLOSE_CONN) printk(args); } while(0)
678c2ecf20Sopenharmony_ci#define OPRINTK(args...)   do { if (debug & DBG_OPEN_CONN)  printk(args); } while(0)
688c2ecf20Sopenharmony_ci#define IPRINTK(args...)   do { if (debug & DBG_INIT)       printk(args); } while(0)
698c2ecf20Sopenharmony_ci#define INTPRINTK(args...) do { if (debug & DBG_INTERRUPT)  printk(args); } while(0)
708c2ecf20Sopenharmony_ci#define DIPRINTK(args...)  do { if (debug & DBG_DEINIT)     printk(args); } while(0)
718c2ecf20Sopenharmony_ci#define TXPRINTK(args...)  do { if (debug & DBG_TX_DATA)    printk(args); } while(0)
728c2ecf20Sopenharmony_ci#define RXPRINTK(args...)  do { if (debug & DBG_RX_DATA)    printk(args); } while(0)
738c2ecf20Sopenharmony_ci#define XPRINTK(args...)   do { if (debug & DBG_XGENERAL)   printk(args); } while(0)
748c2ecf20Sopenharmony_ci#define DPRINTK(args...)   do { if (debug & DBG_GENERAL)    printk(args); } while(0)
758c2ecf20Sopenharmony_ci#define NPRINTK(args...)   do { if (debug & DBG_TINY)	    printk(args); } while(0)
768c2ecf20Sopenharmony_ci#define RPRINTK(args...)   do { if (debug & DBG_RAW_CELL)   printk(args); } while(0)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#else
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define CPRINTK(args...)	do { } while(0)
818c2ecf20Sopenharmony_ci#define OPRINTK(args...)	do { } while(0)
828c2ecf20Sopenharmony_ci#define IPRINTK(args...)	do { } while(0)
838c2ecf20Sopenharmony_ci#define INTPRINTK(args...)	do { } while(0)
848c2ecf20Sopenharmony_ci#define DIPRINTK(args...)	do { } while(0)
858c2ecf20Sopenharmony_ci#define TXPRINTK(args...)	do { } while(0)
868c2ecf20Sopenharmony_ci#define RXPRINTK(args...)	do { } while(0)
878c2ecf20Sopenharmony_ci#define XPRINTK(args...)	do { } while(0)
888c2ecf20Sopenharmony_ci#define DPRINTK(args...)	do { } while(0)
898c2ecf20Sopenharmony_ci#define NPRINTK(args...)	do { } while(0)
908c2ecf20Sopenharmony_ci#define RPRINTK(args...)	do { } while(0)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#endif
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define SCHED_UBR0		0
958c2ecf20Sopenharmony_ci#define SCHED_UBR		1
968c2ecf20Sopenharmony_ci#define SCHED_VBR		2
978c2ecf20Sopenharmony_ci#define SCHED_ABR		3
988c2ecf20Sopenharmony_ci#define SCHED_CBR		4
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define SCQFULL_TIMEOUT		HZ
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/*****************************************************************************/
1038c2ecf20Sopenharmony_ci/*                                                                           */
1048c2ecf20Sopenharmony_ci/*   Free Buffer Queue Layout                                                */
1058c2ecf20Sopenharmony_ci/*                                                                           */
1068c2ecf20Sopenharmony_ci/*****************************************************************************/
1078c2ecf20Sopenharmony_ci#define SAR_FB_SIZE_0		(2048 - 256)
1088c2ecf20Sopenharmony_ci#define SAR_FB_SIZE_1		(4096 - 256)
1098c2ecf20Sopenharmony_ci#define SAR_FB_SIZE_2		(8192 - 256)
1108c2ecf20Sopenharmony_ci#define SAR_FB_SIZE_3		(16384 - 256)
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define SAR_FBQ0_LOW		4
1138c2ecf20Sopenharmony_ci#define SAR_FBQ0_HIGH		8
1148c2ecf20Sopenharmony_ci#define SAR_FBQ1_LOW		2
1158c2ecf20Sopenharmony_ci#define SAR_FBQ1_HIGH		4
1168c2ecf20Sopenharmony_ci#define SAR_FBQ2_LOW		1
1178c2ecf20Sopenharmony_ci#define SAR_FBQ2_HIGH		2
1188c2ecf20Sopenharmony_ci#define SAR_FBQ3_LOW		1
1198c2ecf20Sopenharmony_ci#define SAR_FBQ3_HIGH		2
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#if 0
1228c2ecf20Sopenharmony_ci#define SAR_TST_RESERVED	44	/* Num TST reserved for UBR/ABR/VBR */
1238c2ecf20Sopenharmony_ci#else
1248c2ecf20Sopenharmony_ci#define SAR_TST_RESERVED	0	/* Num TST reserved for UBR/ABR/VBR */
1258c2ecf20Sopenharmony_ci#endif
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci#define TCT_CBR			0x00000000
1288c2ecf20Sopenharmony_ci#define TCT_UBR			0x00000000
1298c2ecf20Sopenharmony_ci#define TCT_VBR			0x40000000
1308c2ecf20Sopenharmony_ci#define TCT_ABR			0x80000000
1318c2ecf20Sopenharmony_ci#define TCT_TYPE		0xc0000000
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci#define TCT_RR			0x20000000
1348c2ecf20Sopenharmony_ci#define TCT_LMCR		0x08000000
1358c2ecf20Sopenharmony_ci#define TCT_SCD_MASK		0x0007ffff
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define TCT_TSIF		0x00004000
1388c2ecf20Sopenharmony_ci#define TCT_HALT		0x80000000
1398c2ecf20Sopenharmony_ci#define TCT_IDLE		0x40000000
1408c2ecf20Sopenharmony_ci#define TCT_FLAG_UBR		0x80000000
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/*****************************************************************************/
1438c2ecf20Sopenharmony_ci/*                                                                           */
1448c2ecf20Sopenharmony_ci/*   Structure describing an IDT77252                                        */
1458c2ecf20Sopenharmony_ci/*                                                                           */
1468c2ecf20Sopenharmony_ci/*****************************************************************************/
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_cistruct scqe
1498c2ecf20Sopenharmony_ci{
1508c2ecf20Sopenharmony_ci	u32		word_1;
1518c2ecf20Sopenharmony_ci	u32		word_2;
1528c2ecf20Sopenharmony_ci	u32		word_3;
1538c2ecf20Sopenharmony_ci	u32		word_4;
1548c2ecf20Sopenharmony_ci};
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define SCQ_ENTRIES	64
1578c2ecf20Sopenharmony_ci#define SCQ_SIZE	(SCQ_ENTRIES * sizeof(struct scqe))
1588c2ecf20Sopenharmony_ci#define SCQ_MASK	(SCQ_SIZE - 1)
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_cistruct scq_info
1618c2ecf20Sopenharmony_ci{
1628c2ecf20Sopenharmony_ci	struct scqe		*base;
1638c2ecf20Sopenharmony_ci	struct scqe		*next;
1648c2ecf20Sopenharmony_ci	struct scqe		*last;
1658c2ecf20Sopenharmony_ci	dma_addr_t		paddr;
1668c2ecf20Sopenharmony_ci	spinlock_t		lock;
1678c2ecf20Sopenharmony_ci	atomic_t		used;
1688c2ecf20Sopenharmony_ci	unsigned long		trans_start;
1698c2ecf20Sopenharmony_ci        unsigned long		scd;
1708c2ecf20Sopenharmony_ci	spinlock_t		skblock;
1718c2ecf20Sopenharmony_ci	struct sk_buff_head	transmit;
1728c2ecf20Sopenharmony_ci	struct sk_buff_head	pending;
1738c2ecf20Sopenharmony_ci};
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_cistruct rx_pool {
1768c2ecf20Sopenharmony_ci	struct sk_buff_head	queue;
1778c2ecf20Sopenharmony_ci	unsigned int		len;
1788c2ecf20Sopenharmony_ci};
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_cistruct aal1 {
1818c2ecf20Sopenharmony_ci	unsigned int		total;
1828c2ecf20Sopenharmony_ci	unsigned int		count;
1838c2ecf20Sopenharmony_ci	struct sk_buff		*data;
1848c2ecf20Sopenharmony_ci	unsigned char		sequence;
1858c2ecf20Sopenharmony_ci};
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_cistruct vc_map;
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_cistruct rate_estimator {
1908c2ecf20Sopenharmony_ci	struct timer_list	timer;
1918c2ecf20Sopenharmony_ci	unsigned int		interval;
1928c2ecf20Sopenharmony_ci	unsigned int		ewma_log;
1938c2ecf20Sopenharmony_ci	u64			cells;
1948c2ecf20Sopenharmony_ci	u64			last_cells;
1958c2ecf20Sopenharmony_ci	long			avcps;
1968c2ecf20Sopenharmony_ci	u32			cps;
1978c2ecf20Sopenharmony_ci	u32			maxcps;
1988c2ecf20Sopenharmony_ci	struct vc_map		*vc;
1998c2ecf20Sopenharmony_ci};
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_cistruct vc_map {
2028c2ecf20Sopenharmony_ci	unsigned int		index;
2038c2ecf20Sopenharmony_ci	unsigned long		flags;
2048c2ecf20Sopenharmony_ci#define VCF_TX		0
2058c2ecf20Sopenharmony_ci#define VCF_RX		1
2068c2ecf20Sopenharmony_ci#define VCF_IDLE	2
2078c2ecf20Sopenharmony_ci#define VCF_RSV		3
2088c2ecf20Sopenharmony_ci	unsigned int		class;
2098c2ecf20Sopenharmony_ci	u8			init_er;
2108c2ecf20Sopenharmony_ci	u8			lacr;
2118c2ecf20Sopenharmony_ci	u8			max_er;
2128c2ecf20Sopenharmony_ci	unsigned int		ntste;
2138c2ecf20Sopenharmony_ci	spinlock_t		lock;
2148c2ecf20Sopenharmony_ci	struct atm_vcc		*tx_vcc;
2158c2ecf20Sopenharmony_ci	struct atm_vcc		*rx_vcc;
2168c2ecf20Sopenharmony_ci	struct idt77252_dev	*card;
2178c2ecf20Sopenharmony_ci	struct scq_info		*scq;		/* To keep track of the SCQ */
2188c2ecf20Sopenharmony_ci	struct rate_estimator	*estimator;
2198c2ecf20Sopenharmony_ci	int			scd_index;
2208c2ecf20Sopenharmony_ci	union {
2218c2ecf20Sopenharmony_ci		struct rx_pool	rx_pool;
2228c2ecf20Sopenharmony_ci		struct aal1	aal1;
2238c2ecf20Sopenharmony_ci	} rcv;
2248c2ecf20Sopenharmony_ci};
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci/*****************************************************************************/
2278c2ecf20Sopenharmony_ci/*                                                                           */
2288c2ecf20Sopenharmony_ci/*   RCTE - Receive Connection Table Entry                                   */
2298c2ecf20Sopenharmony_ci/*                                                                           */
2308c2ecf20Sopenharmony_ci/*****************************************************************************/
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cistruct rct_entry
2338c2ecf20Sopenharmony_ci{
2348c2ecf20Sopenharmony_ci	u32		word_1;
2358c2ecf20Sopenharmony_ci	u32		buffer_handle;
2368c2ecf20Sopenharmony_ci	u32		dma_address;
2378c2ecf20Sopenharmony_ci	u32		aal5_crc32;
2388c2ecf20Sopenharmony_ci};
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci/*****************************************************************************/
2418c2ecf20Sopenharmony_ci/*                                                                           */
2428c2ecf20Sopenharmony_ci/*   RSQ - Receive Status Queue                                              */
2438c2ecf20Sopenharmony_ci/*                                                                           */
2448c2ecf20Sopenharmony_ci/*****************************************************************************/
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci#define SAR_RSQE_VALID      0x80000000
2478c2ecf20Sopenharmony_ci#define SAR_RSQE_IDLE       0x40000000
2488c2ecf20Sopenharmony_ci#define SAR_RSQE_BUF_MASK   0x00030000
2498c2ecf20Sopenharmony_ci#define SAR_RSQE_BUF_ASGN   0x00008000
2508c2ecf20Sopenharmony_ci#define SAR_RSQE_NZGFC      0x00004000
2518c2ecf20Sopenharmony_ci#define SAR_RSQE_EPDU       0x00002000
2528c2ecf20Sopenharmony_ci#define SAR_RSQE_BUF_CONT   0x00001000
2538c2ecf20Sopenharmony_ci#define SAR_RSQE_EFCIE      0x00000800
2548c2ecf20Sopenharmony_ci#define SAR_RSQE_CLP        0x00000400
2558c2ecf20Sopenharmony_ci#define SAR_RSQE_CRC        0x00000200
2568c2ecf20Sopenharmony_ci#define SAR_RSQE_CELLCNT    0x000001FF
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci#define RSQSIZE            8192
2608c2ecf20Sopenharmony_ci#define RSQ_NUM_ENTRIES    (RSQSIZE / 16)
2618c2ecf20Sopenharmony_ci#define RSQ_ALIGNMENT      8192
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistruct rsq_entry {
2648c2ecf20Sopenharmony_ci	u32			word_1;
2658c2ecf20Sopenharmony_ci	u32			word_2;
2668c2ecf20Sopenharmony_ci	u32			word_3;
2678c2ecf20Sopenharmony_ci	u32			word_4;
2688c2ecf20Sopenharmony_ci};
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_cistruct rsq_info {
2718c2ecf20Sopenharmony_ci	struct rsq_entry	*base;
2728c2ecf20Sopenharmony_ci	struct rsq_entry	*next;
2738c2ecf20Sopenharmony_ci	struct rsq_entry	*last;
2748c2ecf20Sopenharmony_ci	dma_addr_t		paddr;
2758c2ecf20Sopenharmony_ci};
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci/*****************************************************************************/
2798c2ecf20Sopenharmony_ci/*                                                                           */
2808c2ecf20Sopenharmony_ci/*   TSQ - Transmit Status Queue                                             */
2818c2ecf20Sopenharmony_ci/*                                                                           */
2828c2ecf20Sopenharmony_ci/*****************************************************************************/
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci#define SAR_TSQE_INVALID         0x80000000
2858c2ecf20Sopenharmony_ci#define SAR_TSQE_TIMESTAMP       0x00FFFFFF
2868c2ecf20Sopenharmony_ci#define SAR_TSQE_TYPE		 0x60000000
2878c2ecf20Sopenharmony_ci#define SAR_TSQE_TYPE_TIMER      0x00000000
2888c2ecf20Sopenharmony_ci#define SAR_TSQE_TYPE_TSR        0x20000000
2898c2ecf20Sopenharmony_ci#define SAR_TSQE_TYPE_IDLE       0x40000000
2908c2ecf20Sopenharmony_ci#define SAR_TSQE_TYPE_TBD_COMP   0x60000000
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci#define SAR_TSQE_TAG(stat)	(((stat) >> 24) & 0x1f)
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci#define TSQSIZE            8192
2958c2ecf20Sopenharmony_ci#define TSQ_NUM_ENTRIES    1024
2968c2ecf20Sopenharmony_ci#define TSQ_ALIGNMENT      8192
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_cistruct tsq_entry
2998c2ecf20Sopenharmony_ci{
3008c2ecf20Sopenharmony_ci	u32			word_1;
3018c2ecf20Sopenharmony_ci	u32			word_2;
3028c2ecf20Sopenharmony_ci};
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_cistruct tsq_info
3058c2ecf20Sopenharmony_ci{
3068c2ecf20Sopenharmony_ci	struct tsq_entry	*base;
3078c2ecf20Sopenharmony_ci	struct tsq_entry	*next;
3088c2ecf20Sopenharmony_ci	struct tsq_entry	*last;
3098c2ecf20Sopenharmony_ci	dma_addr_t		paddr;
3108c2ecf20Sopenharmony_ci};
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_cistruct tst_info
3138c2ecf20Sopenharmony_ci{
3148c2ecf20Sopenharmony_ci	struct vc_map		*vc;
3158c2ecf20Sopenharmony_ci	u32			tste;
3168c2ecf20Sopenharmony_ci};
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci#define TSTE_MASK		0x601fffff
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci#define TSTE_OPC_MASK		0x60000000
3218c2ecf20Sopenharmony_ci#define TSTE_OPC_NULL		0x00000000
3228c2ecf20Sopenharmony_ci#define TSTE_OPC_CBR		0x20000000
3238c2ecf20Sopenharmony_ci#define TSTE_OPC_VAR		0x40000000
3248c2ecf20Sopenharmony_ci#define TSTE_OPC_JMP		0x60000000
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci#define TSTE_PUSH_IDLE		0x01000000
3278c2ecf20Sopenharmony_ci#define TSTE_PUSH_ACTIVE	0x02000000
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci#define TST_SWITCH_DONE		0
3308c2ecf20Sopenharmony_ci#define TST_SWITCH_PENDING	1
3318c2ecf20Sopenharmony_ci#define TST_SWITCH_WAIT		2
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci#define FBQ_SHIFT		9
3348c2ecf20Sopenharmony_ci#define FBQ_SIZE		(1 << FBQ_SHIFT)
3358c2ecf20Sopenharmony_ci#define FBQ_MASK		(FBQ_SIZE - 1)
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_cistruct sb_pool
3388c2ecf20Sopenharmony_ci{
3398c2ecf20Sopenharmony_ci	unsigned int		index;
3408c2ecf20Sopenharmony_ci	struct sk_buff		*skb[FBQ_SIZE];
3418c2ecf20Sopenharmony_ci};
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci#define POOL_HANDLE(queue, index)	(((queue + 1) << 16) | (index))
3448c2ecf20Sopenharmony_ci#define POOL_QUEUE(handle)		(((handle) >> 16) - 1)
3458c2ecf20Sopenharmony_ci#define POOL_INDEX(handle)		((handle) & 0xffff)
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_cistruct idt77252_dev
3488c2ecf20Sopenharmony_ci{
3498c2ecf20Sopenharmony_ci        struct tsq_info		tsq;		/* Transmit Status Queue */
3508c2ecf20Sopenharmony_ci        struct rsq_info		rsq;		/* Receive Status Queue */
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci	struct pci_dev		*pcidev;	/* PCI handle (desriptor) */
3538c2ecf20Sopenharmony_ci	struct atm_dev		*atmdev;	/* ATM device desriptor */
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci	void __iomem		*membase;	/* SAR's memory base address */
3568c2ecf20Sopenharmony_ci	unsigned long		srambase;	/* SAR's sram  base address */
3578c2ecf20Sopenharmony_ci	void __iomem		*fbq[4];	/* FBQ fill addresses */
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci	struct mutex		mutex;
3608c2ecf20Sopenharmony_ci	spinlock_t		cmd_lock;	/* for r/w utility/sram */
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci	unsigned long		softstat;
3638c2ecf20Sopenharmony_ci	unsigned long		flags;		/* see blow */
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci	struct work_struct	tqueue;
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci	unsigned long		tct_base;	/* TCT base address in SRAM */
3688c2ecf20Sopenharmony_ci        unsigned long		rct_base;	/* RCT base address in SRAM */
3698c2ecf20Sopenharmony_ci        unsigned long		rt_base;	/* Rate Table base in SRAM */
3708c2ecf20Sopenharmony_ci        unsigned long		scd_base;	/* SCD base address in SRAM */
3718c2ecf20Sopenharmony_ci        unsigned long		tst[2];		/* TST base address in SRAM */
3728c2ecf20Sopenharmony_ci	unsigned long		abrst_base;	/* ABRST base address in SRAM */
3738c2ecf20Sopenharmony_ci        unsigned long		fifo_base;	/* RX FIFO base in SRAM */
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci	unsigned long		irqstat[16];
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci	unsigned int		sramsize;	/* SAR's sram size */
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci        unsigned int		tct_size;	/* total TCT entries */
3808c2ecf20Sopenharmony_ci        unsigned int		rct_size;	/* total RCT entries */
3818c2ecf20Sopenharmony_ci        unsigned int		scd_size;	/* length of SCD */
3828c2ecf20Sopenharmony_ci        unsigned int		tst_size;	/* total TST entries */
3838c2ecf20Sopenharmony_ci        unsigned int		tst_free;	/* free TSTEs in TST */
3848c2ecf20Sopenharmony_ci        unsigned int		abrst_size;	/* size of ABRST in words */
3858c2ecf20Sopenharmony_ci        unsigned int		fifo_size;	/* size of RX FIFO in words */
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci        unsigned int		vpibits;	/* Bits used for VPI index */
3888c2ecf20Sopenharmony_ci        unsigned int		vcibits;	/* Bits used for VCI index */
3898c2ecf20Sopenharmony_ci        unsigned int		vcimask;	/* Mask for VCI index */
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci	unsigned int		utopia_pcr;	/* Utopia Itf's Cell Rate */
3928c2ecf20Sopenharmony_ci	unsigned int		link_pcr;	/* PHY's Peek Cell Rate */
3938c2ecf20Sopenharmony_ci
3948c2ecf20Sopenharmony_ci	struct vc_map		**vcs;		/* Open Connections */
3958c2ecf20Sopenharmony_ci	struct vc_map		**scd2vc;	/* SCD to Connection map */
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci	struct tst_info		*soft_tst;	/* TST to Connection map */
3988c2ecf20Sopenharmony_ci	unsigned int		tst_index;	/* Current TST in use */
3998c2ecf20Sopenharmony_ci	struct timer_list	tst_timer;
4008c2ecf20Sopenharmony_ci	spinlock_t		tst_lock;
4018c2ecf20Sopenharmony_ci	unsigned long		tst_state;
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci	struct sb_pool		sbpool[4];	/* Pool of RX skbuffs */
4048c2ecf20Sopenharmony_ci	struct sk_buff		*raw_cell_head; /* Pointer to raw cell queue */
4058c2ecf20Sopenharmony_ci	u32			*raw_cell_hnd;	/* Pointer to RCQ handle */
4068c2ecf20Sopenharmony_ci	dma_addr_t		raw_cell_paddr;
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_ci	int			index;		/* SAR's ID */
4098c2ecf20Sopenharmony_ci	int			revision;	/* chip revision */
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci	char			name[16];	/* Device name */
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci	struct idt77252_dev	*next;
4148c2ecf20Sopenharmony_ci};
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci/* definition for flag field above */
4188c2ecf20Sopenharmony_ci#define IDT77252_BIT_INIT		1
4198c2ecf20Sopenharmony_ci#define IDT77252_BIT_INTERRUPT		2
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci#define ATM_CELL_PAYLOAD         48
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci#define FREEBUF_ALIGNMENT        16
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_ci/*****************************************************************************/
4278c2ecf20Sopenharmony_ci/*                                                                           */
4288c2ecf20Sopenharmony_ci/* Makros                                                                    */
4298c2ecf20Sopenharmony_ci/*                                                                           */
4308c2ecf20Sopenharmony_ci/*****************************************************************************/
4318c2ecf20Sopenharmony_ci#define ALIGN_ADDRESS(addr, alignment) \
4328c2ecf20Sopenharmony_ci        ((((u32)(addr)) + (((u32)(alignment))-1)) & ~(((u32)(alignment)) - 1))
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_ci/*****************************************************************************/
4368c2ecf20Sopenharmony_ci/*                                                                           */
4378c2ecf20Sopenharmony_ci/*   ABR SAR Network operation Register                                      */
4388c2ecf20Sopenharmony_ci/*                                                                           */
4398c2ecf20Sopenharmony_ci/*****************************************************************************/
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci#define SAR_REG_DR0	(card->membase + 0x00)
4428c2ecf20Sopenharmony_ci#define SAR_REG_DR1	(card->membase + 0x04)
4438c2ecf20Sopenharmony_ci#define SAR_REG_DR2	(card->membase + 0x08)
4448c2ecf20Sopenharmony_ci#define SAR_REG_DR3	(card->membase + 0x0C)
4458c2ecf20Sopenharmony_ci#define SAR_REG_CMD	(card->membase + 0x10)
4468c2ecf20Sopenharmony_ci#define SAR_REG_CFG	(card->membase + 0x14)
4478c2ecf20Sopenharmony_ci#define SAR_REG_STAT	(card->membase + 0x18)
4488c2ecf20Sopenharmony_ci#define SAR_REG_RSQB	(card->membase + 0x1C)
4498c2ecf20Sopenharmony_ci#define SAR_REG_RSQT	(card->membase + 0x20)
4508c2ecf20Sopenharmony_ci#define SAR_REG_RSQH	(card->membase + 0x24)
4518c2ecf20Sopenharmony_ci#define SAR_REG_CDC	(card->membase + 0x28)
4528c2ecf20Sopenharmony_ci#define SAR_REG_VPEC	(card->membase + 0x2C)
4538c2ecf20Sopenharmony_ci#define SAR_REG_ICC	(card->membase + 0x30)
4548c2ecf20Sopenharmony_ci#define SAR_REG_RAWCT	(card->membase + 0x34)
4558c2ecf20Sopenharmony_ci#define SAR_REG_TMR	(card->membase + 0x38)
4568c2ecf20Sopenharmony_ci#define SAR_REG_TSTB	(card->membase + 0x3C)
4578c2ecf20Sopenharmony_ci#define SAR_REG_TSQB	(card->membase + 0x40)
4588c2ecf20Sopenharmony_ci#define SAR_REG_TSQT	(card->membase + 0x44)
4598c2ecf20Sopenharmony_ci#define SAR_REG_TSQH	(card->membase + 0x48)
4608c2ecf20Sopenharmony_ci#define SAR_REG_GP	(card->membase + 0x4C)
4618c2ecf20Sopenharmony_ci#define SAR_REG_VPM	(card->membase + 0x50)
4628c2ecf20Sopenharmony_ci#define SAR_REG_RXFD	(card->membase + 0x54)
4638c2ecf20Sopenharmony_ci#define SAR_REG_RXFT	(card->membase + 0x58)
4648c2ecf20Sopenharmony_ci#define SAR_REG_RXFH	(card->membase + 0x5C)
4658c2ecf20Sopenharmony_ci#define SAR_REG_RAWHND	(card->membase + 0x60)
4668c2ecf20Sopenharmony_ci#define SAR_REG_RXSTAT	(card->membase + 0x64)
4678c2ecf20Sopenharmony_ci#define SAR_REG_ABRSTD	(card->membase + 0x68)
4688c2ecf20Sopenharmony_ci#define SAR_REG_ABRRQ	(card->membase + 0x6C)
4698c2ecf20Sopenharmony_ci#define SAR_REG_VBRRQ	(card->membase + 0x70)
4708c2ecf20Sopenharmony_ci#define SAR_REG_RTBL	(card->membase + 0x74)
4718c2ecf20Sopenharmony_ci#define SAR_REG_MDFCT	(card->membase + 0x78)
4728c2ecf20Sopenharmony_ci#define SAR_REG_TXSTAT	(card->membase + 0x7C)
4738c2ecf20Sopenharmony_ci#define SAR_REG_TCMDQ	(card->membase + 0x80)
4748c2ecf20Sopenharmony_ci#define SAR_REG_IRCP	(card->membase + 0x84)
4758c2ecf20Sopenharmony_ci#define SAR_REG_FBQP0	(card->membase + 0x88)
4768c2ecf20Sopenharmony_ci#define SAR_REG_FBQP1	(card->membase + 0x8C)
4778c2ecf20Sopenharmony_ci#define SAR_REG_FBQP2	(card->membase + 0x90)
4788c2ecf20Sopenharmony_ci#define SAR_REG_FBQP3	(card->membase + 0x94)
4798c2ecf20Sopenharmony_ci#define SAR_REG_FBQS0	(card->membase + 0x98)
4808c2ecf20Sopenharmony_ci#define SAR_REG_FBQS1	(card->membase + 0x9C)
4818c2ecf20Sopenharmony_ci#define SAR_REG_FBQS2	(card->membase + 0xA0)
4828c2ecf20Sopenharmony_ci#define SAR_REG_FBQS3	(card->membase + 0xA4)
4838c2ecf20Sopenharmony_ci#define SAR_REG_FBQWP0	(card->membase + 0xA8)
4848c2ecf20Sopenharmony_ci#define SAR_REG_FBQWP1	(card->membase + 0xAC)
4858c2ecf20Sopenharmony_ci#define SAR_REG_FBQWP2	(card->membase + 0xB0)
4868c2ecf20Sopenharmony_ci#define SAR_REG_FBQWP3	(card->membase + 0xB4)
4878c2ecf20Sopenharmony_ci#define SAR_REG_NOW	(card->membase + 0xB8)
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci/*****************************************************************************/
4918c2ecf20Sopenharmony_ci/*                                                                           */
4928c2ecf20Sopenharmony_ci/*   Commands                                                                */
4938c2ecf20Sopenharmony_ci/*                                                                           */
4948c2ecf20Sopenharmony_ci/*****************************************************************************/
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci#define SAR_CMD_NO_OPERATION         0x00000000
4978c2ecf20Sopenharmony_ci#define SAR_CMD_OPENCLOSE_CONNECTION 0x20000000
4988c2ecf20Sopenharmony_ci#define SAR_CMD_WRITE_SRAM           0x40000000
4998c2ecf20Sopenharmony_ci#define SAR_CMD_READ_SRAM            0x50000000
5008c2ecf20Sopenharmony_ci#define SAR_CMD_READ_UTILITY         0x80000000
5018c2ecf20Sopenharmony_ci#define SAR_CMD_WRITE_UTILITY        0x90000000
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci#define SAR_CMD_OPEN_CONNECTION     (SAR_CMD_OPENCLOSE_CONNECTION | 0x00080000)
5048c2ecf20Sopenharmony_ci#define SAR_CMD_CLOSE_CONNECTION     SAR_CMD_OPENCLOSE_CONNECTION
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci/*****************************************************************************/
5088c2ecf20Sopenharmony_ci/*                                                                           */
5098c2ecf20Sopenharmony_ci/*   Configuration Register bits                                             */
5108c2ecf20Sopenharmony_ci/*                                                                           */
5118c2ecf20Sopenharmony_ci/*****************************************************************************/
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci#define SAR_CFG_SWRST          0x80000000  /* Software reset                 */
5148c2ecf20Sopenharmony_ci#define SAR_CFG_LOOP           0x40000000  /* Internal Loopback              */
5158c2ecf20Sopenharmony_ci#define SAR_CFG_RXPTH          0x20000000  /* Receive Path Enable            */
5168c2ecf20Sopenharmony_ci#define SAR_CFG_IDLE_CLP       0x10000000  /* SAR set CLP Bits of Null Cells */
5178c2ecf20Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_1 0x04000000  /* TX FIFO Size = 1 cell          */
5188c2ecf20Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_2 0x08000000  /* TX FIFO Size = 2 cells         */
5198c2ecf20Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_4 0x0C000000  /* TX FIFO Size = 4 cells         */
5208c2ecf20Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_9 0x00000000  /* TX FIFO Size = 9 cells (full)  */
5218c2ecf20Sopenharmony_ci#define SAR_CFG_NO_IDLE        0x02000000  /* SAR sends no Null Cells        */
5228c2ecf20Sopenharmony_ci#define SAR_CFG_RSVD1          0x01000000  /* Reserved                       */
5238c2ecf20Sopenharmony_ci#define SAR_CFG_RXSTQ_SIZE_2k  0x00000000  /* RX Stat Queue Size = 2048 byte */
5248c2ecf20Sopenharmony_ci#define SAR_CFG_RXSTQ_SIZE_4k  0x00400000  /* RX Stat Queue Size = 4096 byte */
5258c2ecf20Sopenharmony_ci#define SAR_CFG_RXSTQ_SIZE_8k  0x00800000  /* RX Stat Queue Size = 8192 byte */
5268c2ecf20Sopenharmony_ci#define SAR_CFG_RXSTQ_SIZE_R   0x00C00000  /* RX Stat Queue Size = reserved  */
5278c2ecf20Sopenharmony_ci#define SAR_CFG_ICAPT          0x00200000  /* accept Invalid Cells           */
5288c2ecf20Sopenharmony_ci#define SAR_CFG_IGGFC          0x00100000  /* Ignore GFC                     */
5298c2ecf20Sopenharmony_ci#define SAR_CFG_VPVCS_0        0x00000000  /* VPI/VCI Select bit range       */
5308c2ecf20Sopenharmony_ci#define SAR_CFG_VPVCS_1        0x00040000  /* VPI/VCI Select bit range       */
5318c2ecf20Sopenharmony_ci#define SAR_CFG_VPVCS_2        0x00080000  /* VPI/VCI Select bit range       */
5328c2ecf20Sopenharmony_ci#define SAR_CFG_VPVCS_8        0x000C0000  /* VPI/VCI Select bit range       */
5338c2ecf20Sopenharmony_ci#define SAR_CFG_CNTBL_1k       0x00000000  /* Connection Table Size          */
5348c2ecf20Sopenharmony_ci#define SAR_CFG_CNTBL_4k       0x00010000  /* Connection Table Size          */
5358c2ecf20Sopenharmony_ci#define SAR_CFG_CNTBL_16k      0x00020000  /* Connection Table Size          */
5368c2ecf20Sopenharmony_ci#define SAR_CFG_CNTBL_512      0x00030000  /* Connection Table Size          */
5378c2ecf20Sopenharmony_ci#define SAR_CFG_VPECA          0x00008000  /* VPI/VCI Error Cell Accept      */
5388c2ecf20Sopenharmony_ci#define SAR_CFG_RXINT_NOINT    0x00000000  /* No Interrupt on PDU received   */
5398c2ecf20Sopenharmony_ci#define SAR_CFG_RXINT_NODELAY  0x00001000  /* Interrupt without delay to host*/
5408c2ecf20Sopenharmony_ci#define SAR_CFG_RXINT_256US    0x00002000  /* Interrupt with delay 256 usec  */
5418c2ecf20Sopenharmony_ci#define SAR_CFG_RXINT_505US    0x00003000  /* Interrupt with delay 505 usec  */
5428c2ecf20Sopenharmony_ci#define SAR_CFG_RXINT_742US    0x00004000  /* Interrupt with delay 742 usec  */
5438c2ecf20Sopenharmony_ci#define SAR_CFG_RAWIE          0x00000800  /* Raw Cell Queue Interrupt Enable*/
5448c2ecf20Sopenharmony_ci#define SAR_CFG_RQFIE          0x00000400  /* RSQ Almost Full Int Enable     */
5458c2ecf20Sopenharmony_ci#define SAR_CFG_RSVD2          0x00000200  /* Reserved                       */
5468c2ecf20Sopenharmony_ci#define SAR_CFG_CACHE          0x00000100  /* DMA on Cache Line Boundary     */
5478c2ecf20Sopenharmony_ci#define SAR_CFG_TMOIE          0x00000080  /* Timer Roll Over Int Enable     */
5488c2ecf20Sopenharmony_ci#define SAR_CFG_FBIE           0x00000040  /* Free Buffer Queue Int Enable   */
5498c2ecf20Sopenharmony_ci#define SAR_CFG_TXEN           0x00000020  /* Transmit Operation Enable      */
5508c2ecf20Sopenharmony_ci#define SAR_CFG_TXINT          0x00000010  /* Transmit status Int Enable     */
5518c2ecf20Sopenharmony_ci#define SAR_CFG_TXUIE          0x00000008  /* Transmit underrun Int Enable   */
5528c2ecf20Sopenharmony_ci#define SAR_CFG_UMODE          0x00000004  /* Utopia Mode Select             */
5538c2ecf20Sopenharmony_ci#define SAR_CFG_TXSFI          0x00000002  /* Transmit status Full Int Enable*/
5548c2ecf20Sopenharmony_ci#define SAR_CFG_PHYIE          0x00000001  /* PHY Interrupt Enable           */
5558c2ecf20Sopenharmony_ci
5568c2ecf20Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_MASK 0x0C000000  /* TX FIFO Size Mask           */
5578c2ecf20Sopenharmony_ci#define SAR_CFG_RXSTQSIZE_MASK 0x00C00000
5588c2ecf20Sopenharmony_ci#define SAR_CFG_CNTBL_MASK     0x00030000
5598c2ecf20Sopenharmony_ci#define SAR_CFG_RXINT_MASK     0x00007000
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci
5628c2ecf20Sopenharmony_ci/*****************************************************************************/
5638c2ecf20Sopenharmony_ci/*                                                                           */
5648c2ecf20Sopenharmony_ci/*   Status Register bits                                                    */
5658c2ecf20Sopenharmony_ci/*                                                                           */
5668c2ecf20Sopenharmony_ci/*****************************************************************************/
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci#define SAR_STAT_FRAC_3     0xF0000000 /* Fraction of Free Buffer Queue 3 */
5698c2ecf20Sopenharmony_ci#define SAR_STAT_FRAC_2     0x0F000000 /* Fraction of Free Buffer Queue 2 */
5708c2ecf20Sopenharmony_ci#define SAR_STAT_FRAC_1     0x00F00000 /* Fraction of Free Buffer Queue 1 */
5718c2ecf20Sopenharmony_ci#define SAR_STAT_FRAC_0     0x000F0000 /* Fraction of Free Buffer Queue 0 */
5728c2ecf20Sopenharmony_ci#define SAR_STAT_TSIF       0x00008000 /* Transmit Status Indicator       */
5738c2ecf20Sopenharmony_ci#define SAR_STAT_TXICP      0x00004000 /* Transmit Status Indicator       */
5748c2ecf20Sopenharmony_ci#define SAR_STAT_RSVD1      0x00002000 /* Reserved                        */
5758c2ecf20Sopenharmony_ci#define SAR_STAT_TSQF       0x00001000 /* Transmit Status Queue full      */
5768c2ecf20Sopenharmony_ci#define SAR_STAT_TMROF      0x00000800 /* Timer overflow                  */
5778c2ecf20Sopenharmony_ci#define SAR_STAT_PHYI       0x00000400 /* PHY device Interrupt flag       */
5788c2ecf20Sopenharmony_ci#define SAR_STAT_CMDBZ      0x00000200 /* ABR SAR Command Busy Flag       */
5798c2ecf20Sopenharmony_ci#define SAR_STAT_FBQ3A      0x00000100 /* Free Buffer Queue 3 Attention   */
5808c2ecf20Sopenharmony_ci#define SAR_STAT_FBQ2A      0x00000080 /* Free Buffer Queue 2 Attention   */
5818c2ecf20Sopenharmony_ci#define SAR_STAT_RSQF       0x00000040 /* Receive Status Queue full       */
5828c2ecf20Sopenharmony_ci#define SAR_STAT_EPDU       0x00000020 /* End Of PDU Flag                 */
5838c2ecf20Sopenharmony_ci#define SAR_STAT_RAWCF      0x00000010 /* Raw Cell Flag                   */
5848c2ecf20Sopenharmony_ci#define SAR_STAT_FBQ1A      0x00000008 /* Free Buffer Queue 1 Attention   */
5858c2ecf20Sopenharmony_ci#define SAR_STAT_FBQ0A      0x00000004 /* Free Buffer Queue 0 Attention   */
5868c2ecf20Sopenharmony_ci#define SAR_STAT_RSQAF      0x00000002 /* Receive Status Queue almost full*/
5878c2ecf20Sopenharmony_ci#define SAR_STAT_RSVD2      0x00000001 /* Reserved                        */
5888c2ecf20Sopenharmony_ci
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ci/*****************************************************************************/
5918c2ecf20Sopenharmony_ci/*                                                                           */
5928c2ecf20Sopenharmony_ci/*   General Purpose Register bits                                           */
5938c2ecf20Sopenharmony_ci/*                                                                           */
5948c2ecf20Sopenharmony_ci/*****************************************************************************/
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci#define SAR_GP_TXNCC_MASK   0xff000000  /* Transmit Negative Credit Count   */
5978c2ecf20Sopenharmony_ci#define SAR_GP_EEDI         0x00010000  /* EEPROM Data In                   */
5988c2ecf20Sopenharmony_ci#define SAR_GP_BIGE         0x00008000  /* Big Endian Operation             */
5998c2ecf20Sopenharmony_ci#define SAR_GP_RM_NORMAL    0x00000000  /* Normal handling of RM cells      */
6008c2ecf20Sopenharmony_ci#define SAR_GP_RM_TO_RCQ    0x00002000  /* put RM cells into Raw Cell Queue */
6018c2ecf20Sopenharmony_ci#define SAR_GP_RM_RSVD      0x00004000  /* Reserved                         */
6028c2ecf20Sopenharmony_ci#define SAR_GP_RM_INHIBIT   0x00006000  /* Inhibit update of Connection tab */
6038c2ecf20Sopenharmony_ci#define SAR_GP_PHY_RESET    0x00000008  /* PHY Reset                        */
6048c2ecf20Sopenharmony_ci#define SAR_GP_EESCLK	    0x00000004	/* EEPROM SCLK			    */
6058c2ecf20Sopenharmony_ci#define SAR_GP_EECS	    0x00000002	/* EEPROM Chip Select		    */
6068c2ecf20Sopenharmony_ci#define SAR_GP_EEDO	    0x00000001	/* EEPROM Data Out		    */
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci/*****************************************************************************/
6108c2ecf20Sopenharmony_ci/*                                                                           */
6118c2ecf20Sopenharmony_ci/*   SAR local SRAM layout for 128k work SRAM                                */
6128c2ecf20Sopenharmony_ci/*                                                                           */
6138c2ecf20Sopenharmony_ci/*****************************************************************************/
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci#define SAR_SRAM_SCD_SIZE        12
6168c2ecf20Sopenharmony_ci#define SAR_SRAM_TCT_SIZE         8
6178c2ecf20Sopenharmony_ci#define SAR_SRAM_RCT_SIZE         4
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_ci#define SAR_SRAM_TCT_128_BASE    0x00000
6208c2ecf20Sopenharmony_ci#define SAR_SRAM_TCT_128_TOP     0x01fff
6218c2ecf20Sopenharmony_ci#define SAR_SRAM_RCT_128_BASE    0x02000
6228c2ecf20Sopenharmony_ci#define SAR_SRAM_RCT_128_TOP     0x02fff
6238c2ecf20Sopenharmony_ci#define SAR_SRAM_FB0_128_BASE    0x03000
6248c2ecf20Sopenharmony_ci#define SAR_SRAM_FB0_128_TOP     0x033ff
6258c2ecf20Sopenharmony_ci#define SAR_SRAM_FB1_128_BASE    0x03400
6268c2ecf20Sopenharmony_ci#define SAR_SRAM_FB1_128_TOP     0x037ff
6278c2ecf20Sopenharmony_ci#define SAR_SRAM_FB2_128_BASE    0x03800
6288c2ecf20Sopenharmony_ci#define SAR_SRAM_FB2_128_TOP     0x03bff
6298c2ecf20Sopenharmony_ci#define SAR_SRAM_FB3_128_BASE    0x03c00
6308c2ecf20Sopenharmony_ci#define SAR_SRAM_FB3_128_TOP     0x03fff
6318c2ecf20Sopenharmony_ci#define SAR_SRAM_SCD_128_BASE    0x04000
6328c2ecf20Sopenharmony_ci#define SAR_SRAM_SCD_128_TOP     0x07fff
6338c2ecf20Sopenharmony_ci#define SAR_SRAM_TST1_128_BASE   0x08000
6348c2ecf20Sopenharmony_ci#define SAR_SRAM_TST1_128_TOP    0x0bfff
6358c2ecf20Sopenharmony_ci#define SAR_SRAM_TST2_128_BASE   0x0c000
6368c2ecf20Sopenharmony_ci#define SAR_SRAM_TST2_128_TOP    0x0ffff
6378c2ecf20Sopenharmony_ci#define SAR_SRAM_ABRSTD_128_BASE 0x10000
6388c2ecf20Sopenharmony_ci#define SAR_SRAM_ABRSTD_128_TOP  0x13fff
6398c2ecf20Sopenharmony_ci#define SAR_SRAM_RT_128_BASE     0x14000
6408c2ecf20Sopenharmony_ci#define SAR_SRAM_RT_128_TOP      0x15fff
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ci#define SAR_SRAM_FIFO_128_BASE   0x18000
6438c2ecf20Sopenharmony_ci#define SAR_SRAM_FIFO_128_TOP    0x1ffff
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ci
6468c2ecf20Sopenharmony_ci/*****************************************************************************/
6478c2ecf20Sopenharmony_ci/*                                                                           */
6488c2ecf20Sopenharmony_ci/*   SAR local SRAM layout for 32k work SRAM                                 */
6498c2ecf20Sopenharmony_ci/*                                                                           */
6508c2ecf20Sopenharmony_ci/*****************************************************************************/
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_ci#define SAR_SRAM_TCT_32_BASE     0x00000
6538c2ecf20Sopenharmony_ci#define SAR_SRAM_TCT_32_TOP      0x00fff
6548c2ecf20Sopenharmony_ci#define SAR_SRAM_RCT_32_BASE     0x01000
6558c2ecf20Sopenharmony_ci#define SAR_SRAM_RCT_32_TOP      0x017ff
6568c2ecf20Sopenharmony_ci#define SAR_SRAM_FB0_32_BASE     0x01800
6578c2ecf20Sopenharmony_ci#define SAR_SRAM_FB0_32_TOP      0x01bff
6588c2ecf20Sopenharmony_ci#define SAR_SRAM_FB1_32_BASE     0x01c00
6598c2ecf20Sopenharmony_ci#define SAR_SRAM_FB1_32_TOP      0x01fff
6608c2ecf20Sopenharmony_ci#define SAR_SRAM_FB2_32_BASE     0x02000
6618c2ecf20Sopenharmony_ci#define SAR_SRAM_FB2_32_TOP      0x023ff
6628c2ecf20Sopenharmony_ci#define SAR_SRAM_FB3_32_BASE     0x02400
6638c2ecf20Sopenharmony_ci#define SAR_SRAM_FB3_32_TOP      0x027ff
6648c2ecf20Sopenharmony_ci#define SAR_SRAM_SCD_32_BASE     0x02800
6658c2ecf20Sopenharmony_ci#define SAR_SRAM_SCD_32_TOP      0x03fff
6668c2ecf20Sopenharmony_ci#define SAR_SRAM_TST1_32_BASE    0x04000
6678c2ecf20Sopenharmony_ci#define SAR_SRAM_TST1_32_TOP     0x04fff
6688c2ecf20Sopenharmony_ci#define SAR_SRAM_TST2_32_BASE    0x05000
6698c2ecf20Sopenharmony_ci#define SAR_SRAM_TST2_32_TOP     0x05fff
6708c2ecf20Sopenharmony_ci#define SAR_SRAM_ABRSTD_32_BASE  0x06000
6718c2ecf20Sopenharmony_ci#define SAR_SRAM_ABRSTD_32_TOP   0x067ff
6728c2ecf20Sopenharmony_ci#define SAR_SRAM_RT_32_BASE      0x06800
6738c2ecf20Sopenharmony_ci#define SAR_SRAM_RT_32_TOP       0x06fff
6748c2ecf20Sopenharmony_ci#define SAR_SRAM_FIFO_32_BASE    0x07000
6758c2ecf20Sopenharmony_ci#define SAR_SRAM_FIFO_32_TOP     0x07fff
6768c2ecf20Sopenharmony_ci
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci/*****************************************************************************/
6798c2ecf20Sopenharmony_ci/*                                                                           */
6808c2ecf20Sopenharmony_ci/*   TSR - Transmit Status Request                                           */
6818c2ecf20Sopenharmony_ci/*                                                                           */
6828c2ecf20Sopenharmony_ci/*****************************************************************************/
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_ci#define SAR_TSR_TYPE_TSR  0x80000000
6858c2ecf20Sopenharmony_ci#define SAR_TSR_TYPE_TBD  0x00000000
6868c2ecf20Sopenharmony_ci#define SAR_TSR_TSIF      0x20000000
6878c2ecf20Sopenharmony_ci#define SAR_TSR_TAG_MASK  0x01F00000
6888c2ecf20Sopenharmony_ci
6898c2ecf20Sopenharmony_ci
6908c2ecf20Sopenharmony_ci/*****************************************************************************/
6918c2ecf20Sopenharmony_ci/*                                                                           */
6928c2ecf20Sopenharmony_ci/*   TBD - Transmit Buffer Descriptor                                        */
6938c2ecf20Sopenharmony_ci/*                                                                           */
6948c2ecf20Sopenharmony_ci/*****************************************************************************/
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_ci#define SAR_TBD_EPDU      0x40000000
6978c2ecf20Sopenharmony_ci#define SAR_TBD_TSIF      0x20000000
6988c2ecf20Sopenharmony_ci#define SAR_TBD_OAM       0x10000000
6998c2ecf20Sopenharmony_ci#define SAR_TBD_AAL0      0x00000000
7008c2ecf20Sopenharmony_ci#define SAR_TBD_AAL34     0x04000000
7018c2ecf20Sopenharmony_ci#define SAR_TBD_AAL5      0x08000000
7028c2ecf20Sopenharmony_ci#define SAR_TBD_GTSI      0x02000000
7038c2ecf20Sopenharmony_ci#define SAR_TBD_TAG_MASK  0x01F00000
7048c2ecf20Sopenharmony_ci
7058c2ecf20Sopenharmony_ci#define SAR_TBD_VPI_MASK  0x0FF00000
7068c2ecf20Sopenharmony_ci#define SAR_TBD_VCI_MASK  0x000FFFF0
7078c2ecf20Sopenharmony_ci#define SAR_TBD_VC_MASK   (SAR_TBD_VPI_MASK | SAR_TBD_VCI_MASK)
7088c2ecf20Sopenharmony_ci
7098c2ecf20Sopenharmony_ci#define SAR_TBD_VPI_SHIFT 20
7108c2ecf20Sopenharmony_ci#define SAR_TBD_VCI_SHIFT 4
7118c2ecf20Sopenharmony_ci
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_ci/*****************************************************************************/
7148c2ecf20Sopenharmony_ci/*                                                                           */
7158c2ecf20Sopenharmony_ci/*   RXFD - Receive FIFO Descriptor                                          */
7168c2ecf20Sopenharmony_ci/*                                                                           */
7178c2ecf20Sopenharmony_ci/*****************************************************************************/
7188c2ecf20Sopenharmony_ci
7198c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_MASK     0x0F000000
7208c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_512      0x00000000  /* 512 words                      */
7218c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_1K       0x01000000  /* 1k words                       */
7228c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_2K       0x02000000  /* 2k words                       */
7238c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_4K       0x03000000  /* 4k words                       */
7248c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_8K       0x04000000  /* 8k words                       */
7258c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_16K      0x05000000  /* 16k words                      */
7268c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_32K      0x06000000  /* 32k words                      */
7278c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_64K      0x07000000  /* 64k words                      */
7288c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_128K     0x08000000  /* 128k words                     */
7298c2ecf20Sopenharmony_ci#define SAR_RXFD_SIZE_256K     0x09000000  /* 256k words                     */
7308c2ecf20Sopenharmony_ci#define SAR_RXFD_ADDR_MASK     0x001ffc00
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_ci
7338c2ecf20Sopenharmony_ci/*****************************************************************************/
7348c2ecf20Sopenharmony_ci/*                                                                           */
7358c2ecf20Sopenharmony_ci/*   ABRSTD - ABR + VBR Schedule Tables                                      */
7368c2ecf20Sopenharmony_ci/*                                                                           */
7378c2ecf20Sopenharmony_ci/*****************************************************************************/
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci#define SAR_ABRSTD_SIZE_MASK   0x07000000
7408c2ecf20Sopenharmony_ci#define SAR_ABRSTD_SIZE_512    0x00000000  /* 512 words                      */
7418c2ecf20Sopenharmony_ci#define SAR_ABRSTD_SIZE_1K     0x01000000  /* 1k words                       */
7428c2ecf20Sopenharmony_ci#define SAR_ABRSTD_SIZE_2K     0x02000000  /* 2k words                       */
7438c2ecf20Sopenharmony_ci#define SAR_ABRSTD_SIZE_4K     0x03000000  /* 4k words                       */
7448c2ecf20Sopenharmony_ci#define SAR_ABRSTD_SIZE_8K     0x04000000  /* 8k words                       */
7458c2ecf20Sopenharmony_ci#define SAR_ABRSTD_SIZE_16K    0x05000000  /* 16k words                      */
7468c2ecf20Sopenharmony_ci#define SAR_ABRSTD_ADDR_MASK   0x001ffc00
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci/*****************************************************************************/
7508c2ecf20Sopenharmony_ci/*                                                                           */
7518c2ecf20Sopenharmony_ci/*   RCTE - Receive Connection Table Entry                                   */
7528c2ecf20Sopenharmony_ci/*                                                                           */
7538c2ecf20Sopenharmony_ci/*****************************************************************************/
7548c2ecf20Sopenharmony_ci
7558c2ecf20Sopenharmony_ci#define SAR_RCTE_IL_MASK       0xE0000000  /* inactivity limit               */
7568c2ecf20Sopenharmony_ci#define SAR_RCTE_IC_MASK       0x1C000000  /* inactivity count               */
7578c2ecf20Sopenharmony_ci#define SAR_RCTE_RSVD          0x02000000  /* reserved                       */
7588c2ecf20Sopenharmony_ci#define SAR_RCTE_LCD           0x01000000  /* last cell data                 */
7598c2ecf20Sopenharmony_ci#define SAR_RCTE_CI_VC         0x00800000  /* EFCI in previous cell of VC    */
7608c2ecf20Sopenharmony_ci#define SAR_RCTE_FBP_01        0x00000000  /* 1. cell->FBQ0, others->FBQ1    */
7618c2ecf20Sopenharmony_ci#define SAR_RCTE_FBP_1         0x00200000  /* use FBQ 1 for all cells        */
7628c2ecf20Sopenharmony_ci#define SAR_RCTE_FBP_2         0x00400000  /* use FBQ 2 for all cells        */
7638c2ecf20Sopenharmony_ci#define SAR_RCTE_FBP_3         0x00600000  /* use FBQ 3 for all cells        */
7648c2ecf20Sopenharmony_ci#define SAR_RCTE_NZ_GFC        0x00100000  /* non zero GFC in all cell of VC */
7658c2ecf20Sopenharmony_ci#define SAR_RCTE_CONNECTOPEN   0x00080000  /* VC is open                     */
7668c2ecf20Sopenharmony_ci#define SAR_RCTE_AAL_MASK      0x00070000  /* mask for AAL type field s.b.   */
7678c2ecf20Sopenharmony_ci#define SAR_RCTE_RAWCELLINTEN  0x00008000  /* raw cell interrupt enable      */
7688c2ecf20Sopenharmony_ci#define SAR_RCTE_RXCONCELLADDR 0x00004000  /* RX constant cell address       */
7698c2ecf20Sopenharmony_ci#define SAR_RCTE_BUFFSTAT_MASK 0x00003000  /* buffer status                  */
7708c2ecf20Sopenharmony_ci#define SAR_RCTE_EFCI          0x00000800  /* EFCI Congestion flag           */
7718c2ecf20Sopenharmony_ci#define SAR_RCTE_CLP           0x00000400  /* Cell Loss Priority flag        */
7728c2ecf20Sopenharmony_ci#define SAR_RCTE_CRC           0x00000200  /* Received CRC Error             */
7738c2ecf20Sopenharmony_ci#define SAR_RCTE_CELLCNT_MASK  0x000001FF  /* cell Count                     */
7748c2ecf20Sopenharmony_ci
7758c2ecf20Sopenharmony_ci#define SAR_RCTE_AAL0          0x00000000  /* AAL types for ALL field        */
7768c2ecf20Sopenharmony_ci#define SAR_RCTE_AAL34         0x00010000
7778c2ecf20Sopenharmony_ci#define SAR_RCTE_AAL5          0x00020000
7788c2ecf20Sopenharmony_ci#define SAR_RCTE_RCQ           0x00030000
7798c2ecf20Sopenharmony_ci#define SAR_RCTE_OAM           0x00040000
7808c2ecf20Sopenharmony_ci
7818c2ecf20Sopenharmony_ci#define TCMDQ_START		0x01000000
7828c2ecf20Sopenharmony_ci#define TCMDQ_LACR		0x02000000
7838c2ecf20Sopenharmony_ci#define TCMDQ_START_LACR	0x03000000
7848c2ecf20Sopenharmony_ci#define TCMDQ_INIT_ER		0x04000000
7858c2ecf20Sopenharmony_ci#define TCMDQ_HALT		0x05000000
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_ci
7888c2ecf20Sopenharmony_cistruct idt77252_skb_prv {
7898c2ecf20Sopenharmony_ci	struct scqe	tbd;	/* Transmit Buffer Descriptor */
7908c2ecf20Sopenharmony_ci	dma_addr_t	paddr;	/* DMA handle */
7918c2ecf20Sopenharmony_ci	u32		pool;	/* sb_pool handle */
7928c2ecf20Sopenharmony_ci};
7938c2ecf20Sopenharmony_ci
7948c2ecf20Sopenharmony_ci#define IDT77252_PRV_TBD(skb)	\
7958c2ecf20Sopenharmony_ci	(((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->tbd)
7968c2ecf20Sopenharmony_ci#define IDT77252_PRV_PADDR(skb)	\
7978c2ecf20Sopenharmony_ci	(((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->paddr)
7988c2ecf20Sopenharmony_ci#define IDT77252_PRV_POOL(skb)	\
7998c2ecf20Sopenharmony_ci	(((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->pool)
8008c2ecf20Sopenharmony_ci
8018c2ecf20Sopenharmony_ci/*****************************************************************************/
8028c2ecf20Sopenharmony_ci/*                                                                           */
8038c2ecf20Sopenharmony_ci/*   PCI related items                                                       */
8048c2ecf20Sopenharmony_ci/*                                                                           */
8058c2ecf20Sopenharmony_ci/*****************************************************************************/
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci#ifndef PCI_VENDOR_ID_IDT
8088c2ecf20Sopenharmony_ci#define PCI_VENDOR_ID_IDT 0x111D
8098c2ecf20Sopenharmony_ci#endif /* PCI_VENDOR_ID_IDT */
8108c2ecf20Sopenharmony_ci
8118c2ecf20Sopenharmony_ci#ifndef PCI_DEVICE_ID_IDT_IDT77252
8128c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_IDT77252 0x0003
8138c2ecf20Sopenharmony_ci#endif /* PCI_DEVICE_ID_IDT_IDT772052 */
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ci
8168c2ecf20Sopenharmony_ci#endif /* !(_IDT77252_H) */
817