162306a36Sopenharmony_ci/******************************************************************* 262306a36Sopenharmony_ci * 362306a36Sopenharmony_ci * Copyright (c) 2000 ATecoM GmbH 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * The author may be reached at ecd@atecom.com. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 862306a36Sopenharmony_ci * under the terms of the GNU General Public License as published by the 962306a36Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 1062306a36Sopenharmony_ci * option) any later version. 1162306a36Sopenharmony_ci * 1262306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 1362306a36Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1462306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 1562306a36Sopenharmony_ci * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1662306a36Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1762306a36Sopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1862306a36Sopenharmony_ci * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 1962306a36Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2062306a36Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2162306a36Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2262306a36Sopenharmony_ci * 2362306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License along 2462306a36Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 2562306a36Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 2662306a36Sopenharmony_ci * 2762306a36Sopenharmony_ci *******************************************************************/ 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#ifndef _IDT77252_H 3062306a36Sopenharmony_ci#define _IDT77252_H 1 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#include <linux/ptrace.h> 3462306a36Sopenharmony_ci#include <linux/skbuff.h> 3562306a36Sopenharmony_ci#include <linux/workqueue.h> 3662306a36Sopenharmony_ci#include <linux/mutex.h> 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci/*****************************************************************************/ 3962306a36Sopenharmony_ci/* */ 4062306a36Sopenharmony_ci/* Makros */ 4162306a36Sopenharmony_ci/* */ 4262306a36Sopenharmony_ci/*****************************************************************************/ 4362306a36Sopenharmony_ci#define VPCI2VC(card, vpi, vci) \ 4462306a36Sopenharmony_ci (((vpi) << card->vcibits) | ((vci) & card->vcimask)) 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci/*****************************************************************************/ 4762306a36Sopenharmony_ci/* */ 4862306a36Sopenharmony_ci/* DEBUGGING definitions */ 4962306a36Sopenharmony_ci/* */ 5062306a36Sopenharmony_ci/*****************************************************************************/ 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#define DBG_RAW_CELL 0x00000400 5362306a36Sopenharmony_ci#define DBG_TINY 0x00000200 5462306a36Sopenharmony_ci#define DBG_GENERAL 0x00000100 5562306a36Sopenharmony_ci#define DBG_XGENERAL 0x00000080 5662306a36Sopenharmony_ci#define DBG_INIT 0x00000040 5762306a36Sopenharmony_ci#define DBG_DEINIT 0x00000020 5862306a36Sopenharmony_ci#define DBG_INTERRUPT 0x00000010 5962306a36Sopenharmony_ci#define DBG_OPEN_CONN 0x00000008 6062306a36Sopenharmony_ci#define DBG_CLOSE_CONN 0x00000004 6162306a36Sopenharmony_ci#define DBG_RX_DATA 0x00000002 6262306a36Sopenharmony_ci#define DBG_TX_DATA 0x00000001 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#ifdef CONFIG_ATM_IDT77252_DEBUG 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#define CPRINTK(args...) do { if (debug & DBG_CLOSE_CONN) printk(args); } while(0) 6762306a36Sopenharmony_ci#define OPRINTK(args...) do { if (debug & DBG_OPEN_CONN) printk(args); } while(0) 6862306a36Sopenharmony_ci#define IPRINTK(args...) do { if (debug & DBG_INIT) printk(args); } while(0) 6962306a36Sopenharmony_ci#define INTPRINTK(args...) do { if (debug & DBG_INTERRUPT) printk(args); } while(0) 7062306a36Sopenharmony_ci#define DIPRINTK(args...) do { if (debug & DBG_DEINIT) printk(args); } while(0) 7162306a36Sopenharmony_ci#define TXPRINTK(args...) do { if (debug & DBG_TX_DATA) printk(args); } while(0) 7262306a36Sopenharmony_ci#define RXPRINTK(args...) do { if (debug & DBG_RX_DATA) printk(args); } while(0) 7362306a36Sopenharmony_ci#define XPRINTK(args...) do { if (debug & DBG_XGENERAL) printk(args); } while(0) 7462306a36Sopenharmony_ci#define DPRINTK(args...) do { if (debug & DBG_GENERAL) printk(args); } while(0) 7562306a36Sopenharmony_ci#define NPRINTK(args...) do { if (debug & DBG_TINY) printk(args); } while(0) 7662306a36Sopenharmony_ci#define RPRINTK(args...) do { if (debug & DBG_RAW_CELL) printk(args); } while(0) 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci#else 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci#define CPRINTK(args...) do { } while(0) 8162306a36Sopenharmony_ci#define OPRINTK(args...) do { } while(0) 8262306a36Sopenharmony_ci#define IPRINTK(args...) do { } while(0) 8362306a36Sopenharmony_ci#define INTPRINTK(args...) do { } while(0) 8462306a36Sopenharmony_ci#define DIPRINTK(args...) do { } while(0) 8562306a36Sopenharmony_ci#define TXPRINTK(args...) do { } while(0) 8662306a36Sopenharmony_ci#define RXPRINTK(args...) do { } while(0) 8762306a36Sopenharmony_ci#define XPRINTK(args...) do { } while(0) 8862306a36Sopenharmony_ci#define DPRINTK(args...) do { } while(0) 8962306a36Sopenharmony_ci#define NPRINTK(args...) do { } while(0) 9062306a36Sopenharmony_ci#define RPRINTK(args...) do { } while(0) 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci#endif 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#define SCHED_UBR0 0 9562306a36Sopenharmony_ci#define SCHED_UBR 1 9662306a36Sopenharmony_ci#define SCHED_VBR 2 9762306a36Sopenharmony_ci#define SCHED_ABR 3 9862306a36Sopenharmony_ci#define SCHED_CBR 4 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci#define SCQFULL_TIMEOUT HZ 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci/*****************************************************************************/ 10362306a36Sopenharmony_ci/* */ 10462306a36Sopenharmony_ci/* Free Buffer Queue Layout */ 10562306a36Sopenharmony_ci/* */ 10662306a36Sopenharmony_ci/*****************************************************************************/ 10762306a36Sopenharmony_ci#define SAR_FB_SIZE_0 (2048 - 256) 10862306a36Sopenharmony_ci#define SAR_FB_SIZE_1 (4096 - 256) 10962306a36Sopenharmony_ci#define SAR_FB_SIZE_2 (8192 - 256) 11062306a36Sopenharmony_ci#define SAR_FB_SIZE_3 (16384 - 256) 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci#define SAR_FBQ0_LOW 4 11362306a36Sopenharmony_ci#define SAR_FBQ0_HIGH 8 11462306a36Sopenharmony_ci#define SAR_FBQ1_LOW 2 11562306a36Sopenharmony_ci#define SAR_FBQ1_HIGH 4 11662306a36Sopenharmony_ci#define SAR_FBQ2_LOW 1 11762306a36Sopenharmony_ci#define SAR_FBQ2_HIGH 2 11862306a36Sopenharmony_ci#define SAR_FBQ3_LOW 1 11962306a36Sopenharmony_ci#define SAR_FBQ3_HIGH 2 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci#if 0 12262306a36Sopenharmony_ci#define SAR_TST_RESERVED 44 /* Num TST reserved for UBR/ABR/VBR */ 12362306a36Sopenharmony_ci#else 12462306a36Sopenharmony_ci#define SAR_TST_RESERVED 0 /* Num TST reserved for UBR/ABR/VBR */ 12562306a36Sopenharmony_ci#endif 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci#define TCT_CBR 0x00000000 12862306a36Sopenharmony_ci#define TCT_UBR 0x00000000 12962306a36Sopenharmony_ci#define TCT_VBR 0x40000000 13062306a36Sopenharmony_ci#define TCT_ABR 0x80000000 13162306a36Sopenharmony_ci#define TCT_TYPE 0xc0000000 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci#define TCT_RR 0x20000000 13462306a36Sopenharmony_ci#define TCT_LMCR 0x08000000 13562306a36Sopenharmony_ci#define TCT_SCD_MASK 0x0007ffff 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci#define TCT_TSIF 0x00004000 13862306a36Sopenharmony_ci#define TCT_HALT 0x80000000 13962306a36Sopenharmony_ci#define TCT_IDLE 0x40000000 14062306a36Sopenharmony_ci#define TCT_FLAG_UBR 0x80000000 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci/*****************************************************************************/ 14362306a36Sopenharmony_ci/* */ 14462306a36Sopenharmony_ci/* Structure describing an IDT77252 */ 14562306a36Sopenharmony_ci/* */ 14662306a36Sopenharmony_ci/*****************************************************************************/ 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_cistruct scqe 14962306a36Sopenharmony_ci{ 15062306a36Sopenharmony_ci u32 word_1; 15162306a36Sopenharmony_ci u32 word_2; 15262306a36Sopenharmony_ci u32 word_3; 15362306a36Sopenharmony_ci u32 word_4; 15462306a36Sopenharmony_ci}; 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#define SCQ_ENTRIES 64 15762306a36Sopenharmony_ci#define SCQ_SIZE (SCQ_ENTRIES * sizeof(struct scqe)) 15862306a36Sopenharmony_ci#define SCQ_MASK (SCQ_SIZE - 1) 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_cistruct scq_info 16162306a36Sopenharmony_ci{ 16262306a36Sopenharmony_ci struct scqe *base; 16362306a36Sopenharmony_ci struct scqe *next; 16462306a36Sopenharmony_ci struct scqe *last; 16562306a36Sopenharmony_ci dma_addr_t paddr; 16662306a36Sopenharmony_ci spinlock_t lock; 16762306a36Sopenharmony_ci atomic_t used; 16862306a36Sopenharmony_ci unsigned long trans_start; 16962306a36Sopenharmony_ci unsigned long scd; 17062306a36Sopenharmony_ci spinlock_t skblock; 17162306a36Sopenharmony_ci struct sk_buff_head transmit; 17262306a36Sopenharmony_ci struct sk_buff_head pending; 17362306a36Sopenharmony_ci}; 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_cistruct rx_pool { 17662306a36Sopenharmony_ci struct sk_buff_head queue; 17762306a36Sopenharmony_ci unsigned int len; 17862306a36Sopenharmony_ci}; 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_cistruct aal1 { 18162306a36Sopenharmony_ci unsigned int total; 18262306a36Sopenharmony_ci unsigned int count; 18362306a36Sopenharmony_ci struct sk_buff *data; 18462306a36Sopenharmony_ci unsigned char sequence; 18562306a36Sopenharmony_ci}; 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_cistruct vc_map; 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_cistruct rate_estimator { 19062306a36Sopenharmony_ci struct timer_list timer; 19162306a36Sopenharmony_ci unsigned int interval; 19262306a36Sopenharmony_ci unsigned int ewma_log; 19362306a36Sopenharmony_ci u64 cells; 19462306a36Sopenharmony_ci u64 last_cells; 19562306a36Sopenharmony_ci long avcps; 19662306a36Sopenharmony_ci u32 cps; 19762306a36Sopenharmony_ci u32 maxcps; 19862306a36Sopenharmony_ci struct vc_map *vc; 19962306a36Sopenharmony_ci}; 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_cistruct vc_map { 20262306a36Sopenharmony_ci unsigned int index; 20362306a36Sopenharmony_ci unsigned long flags; 20462306a36Sopenharmony_ci#define VCF_TX 0 20562306a36Sopenharmony_ci#define VCF_RX 1 20662306a36Sopenharmony_ci#define VCF_IDLE 2 20762306a36Sopenharmony_ci#define VCF_RSV 3 20862306a36Sopenharmony_ci unsigned int class; 20962306a36Sopenharmony_ci u8 init_er; 21062306a36Sopenharmony_ci u8 lacr; 21162306a36Sopenharmony_ci u8 max_er; 21262306a36Sopenharmony_ci unsigned int ntste; 21362306a36Sopenharmony_ci spinlock_t lock; 21462306a36Sopenharmony_ci struct atm_vcc *tx_vcc; 21562306a36Sopenharmony_ci struct atm_vcc *rx_vcc; 21662306a36Sopenharmony_ci struct idt77252_dev *card; 21762306a36Sopenharmony_ci struct scq_info *scq; /* To keep track of the SCQ */ 21862306a36Sopenharmony_ci struct rate_estimator *estimator; 21962306a36Sopenharmony_ci int scd_index; 22062306a36Sopenharmony_ci union { 22162306a36Sopenharmony_ci struct rx_pool rx_pool; 22262306a36Sopenharmony_ci struct aal1 aal1; 22362306a36Sopenharmony_ci } rcv; 22462306a36Sopenharmony_ci}; 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci/*****************************************************************************/ 22762306a36Sopenharmony_ci/* */ 22862306a36Sopenharmony_ci/* RCTE - Receive Connection Table Entry */ 22962306a36Sopenharmony_ci/* */ 23062306a36Sopenharmony_ci/*****************************************************************************/ 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_cistruct rct_entry 23362306a36Sopenharmony_ci{ 23462306a36Sopenharmony_ci u32 word_1; 23562306a36Sopenharmony_ci u32 buffer_handle; 23662306a36Sopenharmony_ci u32 dma_address; 23762306a36Sopenharmony_ci u32 aal5_crc32; 23862306a36Sopenharmony_ci}; 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci/*****************************************************************************/ 24162306a36Sopenharmony_ci/* */ 24262306a36Sopenharmony_ci/* RSQ - Receive Status Queue */ 24362306a36Sopenharmony_ci/* */ 24462306a36Sopenharmony_ci/*****************************************************************************/ 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci#define SAR_RSQE_VALID 0x80000000 24762306a36Sopenharmony_ci#define SAR_RSQE_IDLE 0x40000000 24862306a36Sopenharmony_ci#define SAR_RSQE_BUF_MASK 0x00030000 24962306a36Sopenharmony_ci#define SAR_RSQE_BUF_ASGN 0x00008000 25062306a36Sopenharmony_ci#define SAR_RSQE_NZGFC 0x00004000 25162306a36Sopenharmony_ci#define SAR_RSQE_EPDU 0x00002000 25262306a36Sopenharmony_ci#define SAR_RSQE_BUF_CONT 0x00001000 25362306a36Sopenharmony_ci#define SAR_RSQE_EFCIE 0x00000800 25462306a36Sopenharmony_ci#define SAR_RSQE_CLP 0x00000400 25562306a36Sopenharmony_ci#define SAR_RSQE_CRC 0x00000200 25662306a36Sopenharmony_ci#define SAR_RSQE_CELLCNT 0x000001FF 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci#define RSQSIZE 8192 26062306a36Sopenharmony_ci#define RSQ_NUM_ENTRIES (RSQSIZE / 16) 26162306a36Sopenharmony_ci#define RSQ_ALIGNMENT 8192 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_cistruct rsq_entry { 26462306a36Sopenharmony_ci u32 word_1; 26562306a36Sopenharmony_ci u32 word_2; 26662306a36Sopenharmony_ci u32 word_3; 26762306a36Sopenharmony_ci u32 word_4; 26862306a36Sopenharmony_ci}; 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_cistruct rsq_info { 27162306a36Sopenharmony_ci struct rsq_entry *base; 27262306a36Sopenharmony_ci struct rsq_entry *next; 27362306a36Sopenharmony_ci struct rsq_entry *last; 27462306a36Sopenharmony_ci dma_addr_t paddr; 27562306a36Sopenharmony_ci}; 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_ci/*****************************************************************************/ 27962306a36Sopenharmony_ci/* */ 28062306a36Sopenharmony_ci/* TSQ - Transmit Status Queue */ 28162306a36Sopenharmony_ci/* */ 28262306a36Sopenharmony_ci/*****************************************************************************/ 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci#define SAR_TSQE_INVALID 0x80000000 28562306a36Sopenharmony_ci#define SAR_TSQE_TIMESTAMP 0x00FFFFFF 28662306a36Sopenharmony_ci#define SAR_TSQE_TYPE 0x60000000 28762306a36Sopenharmony_ci#define SAR_TSQE_TYPE_TIMER 0x00000000 28862306a36Sopenharmony_ci#define SAR_TSQE_TYPE_TSR 0x20000000 28962306a36Sopenharmony_ci#define SAR_TSQE_TYPE_IDLE 0x40000000 29062306a36Sopenharmony_ci#define SAR_TSQE_TYPE_TBD_COMP 0x60000000 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_ci#define SAR_TSQE_TAG(stat) (((stat) >> 24) & 0x1f) 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci#define TSQSIZE 8192 29562306a36Sopenharmony_ci#define TSQ_NUM_ENTRIES 1024 29662306a36Sopenharmony_ci#define TSQ_ALIGNMENT 8192 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_cistruct tsq_entry 29962306a36Sopenharmony_ci{ 30062306a36Sopenharmony_ci u32 word_1; 30162306a36Sopenharmony_ci u32 word_2; 30262306a36Sopenharmony_ci}; 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_cistruct tsq_info 30562306a36Sopenharmony_ci{ 30662306a36Sopenharmony_ci struct tsq_entry *base; 30762306a36Sopenharmony_ci struct tsq_entry *next; 30862306a36Sopenharmony_ci struct tsq_entry *last; 30962306a36Sopenharmony_ci dma_addr_t paddr; 31062306a36Sopenharmony_ci}; 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_cistruct tst_info 31362306a36Sopenharmony_ci{ 31462306a36Sopenharmony_ci struct vc_map *vc; 31562306a36Sopenharmony_ci u32 tste; 31662306a36Sopenharmony_ci}; 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ci#define TSTE_MASK 0x601fffff 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_ci#define TSTE_OPC_MASK 0x60000000 32162306a36Sopenharmony_ci#define TSTE_OPC_NULL 0x00000000 32262306a36Sopenharmony_ci#define TSTE_OPC_CBR 0x20000000 32362306a36Sopenharmony_ci#define TSTE_OPC_VAR 0x40000000 32462306a36Sopenharmony_ci#define TSTE_OPC_JMP 0x60000000 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci#define TSTE_PUSH_IDLE 0x01000000 32762306a36Sopenharmony_ci#define TSTE_PUSH_ACTIVE 0x02000000 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci#define TST_SWITCH_DONE 0 33062306a36Sopenharmony_ci#define TST_SWITCH_PENDING 1 33162306a36Sopenharmony_ci#define TST_SWITCH_WAIT 2 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_ci#define FBQ_SHIFT 9 33462306a36Sopenharmony_ci#define FBQ_SIZE (1 << FBQ_SHIFT) 33562306a36Sopenharmony_ci#define FBQ_MASK (FBQ_SIZE - 1) 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_cistruct sb_pool 33862306a36Sopenharmony_ci{ 33962306a36Sopenharmony_ci unsigned int index; 34062306a36Sopenharmony_ci struct sk_buff *skb[FBQ_SIZE]; 34162306a36Sopenharmony_ci}; 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci#define POOL_HANDLE(queue, index) (((queue + 1) << 16) | (index)) 34462306a36Sopenharmony_ci#define POOL_QUEUE(handle) (((handle) >> 16) - 1) 34562306a36Sopenharmony_ci#define POOL_INDEX(handle) ((handle) & 0xffff) 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_cistruct idt77252_dev 34862306a36Sopenharmony_ci{ 34962306a36Sopenharmony_ci struct tsq_info tsq; /* Transmit Status Queue */ 35062306a36Sopenharmony_ci struct rsq_info rsq; /* Receive Status Queue */ 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci struct pci_dev *pcidev; /* PCI handle (desriptor) */ 35362306a36Sopenharmony_ci struct atm_dev *atmdev; /* ATM device desriptor */ 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci void __iomem *membase; /* SAR's memory base address */ 35662306a36Sopenharmony_ci unsigned long srambase; /* SAR's sram base address */ 35762306a36Sopenharmony_ci void __iomem *fbq[4]; /* FBQ fill addresses */ 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ci struct mutex mutex; 36062306a36Sopenharmony_ci spinlock_t cmd_lock; /* for r/w utility/sram */ 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci unsigned long softstat; 36362306a36Sopenharmony_ci unsigned long flags; /* see blow */ 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ci struct work_struct tqueue; 36662306a36Sopenharmony_ci 36762306a36Sopenharmony_ci unsigned long tct_base; /* TCT base address in SRAM */ 36862306a36Sopenharmony_ci unsigned long rct_base; /* RCT base address in SRAM */ 36962306a36Sopenharmony_ci unsigned long rt_base; /* Rate Table base in SRAM */ 37062306a36Sopenharmony_ci unsigned long scd_base; /* SCD base address in SRAM */ 37162306a36Sopenharmony_ci unsigned long tst[2]; /* TST base address in SRAM */ 37262306a36Sopenharmony_ci unsigned long abrst_base; /* ABRST base address in SRAM */ 37362306a36Sopenharmony_ci unsigned long fifo_base; /* RX FIFO base in SRAM */ 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci unsigned long irqstat[16]; 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_ci unsigned int sramsize; /* SAR's sram size */ 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_ci unsigned int tct_size; /* total TCT entries */ 38062306a36Sopenharmony_ci unsigned int rct_size; /* total RCT entries */ 38162306a36Sopenharmony_ci unsigned int scd_size; /* length of SCD */ 38262306a36Sopenharmony_ci unsigned int tst_size; /* total TST entries */ 38362306a36Sopenharmony_ci unsigned int tst_free; /* free TSTEs in TST */ 38462306a36Sopenharmony_ci unsigned int abrst_size; /* size of ABRST in words */ 38562306a36Sopenharmony_ci unsigned int fifo_size; /* size of RX FIFO in words */ 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ci unsigned int vpibits; /* Bits used for VPI index */ 38862306a36Sopenharmony_ci unsigned int vcibits; /* Bits used for VCI index */ 38962306a36Sopenharmony_ci unsigned int vcimask; /* Mask for VCI index */ 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ci unsigned int utopia_pcr; /* Utopia Itf's Cell Rate */ 39262306a36Sopenharmony_ci unsigned int link_pcr; /* PHY's Peek Cell Rate */ 39362306a36Sopenharmony_ci 39462306a36Sopenharmony_ci struct vc_map **vcs; /* Open Connections */ 39562306a36Sopenharmony_ci struct vc_map **scd2vc; /* SCD to Connection map */ 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci struct tst_info *soft_tst; /* TST to Connection map */ 39862306a36Sopenharmony_ci unsigned int tst_index; /* Current TST in use */ 39962306a36Sopenharmony_ci struct timer_list tst_timer; 40062306a36Sopenharmony_ci spinlock_t tst_lock; 40162306a36Sopenharmony_ci unsigned long tst_state; 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci struct sb_pool sbpool[4]; /* Pool of RX skbuffs */ 40462306a36Sopenharmony_ci struct sk_buff *raw_cell_head; /* Pointer to raw cell queue */ 40562306a36Sopenharmony_ci u32 *raw_cell_hnd; /* Pointer to RCQ handle */ 40662306a36Sopenharmony_ci dma_addr_t raw_cell_paddr; 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ci int index; /* SAR's ID */ 40962306a36Sopenharmony_ci int revision; /* chip revision */ 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_ci char name[16]; /* Device name */ 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ci struct idt77252_dev *next; 41462306a36Sopenharmony_ci}; 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ci/* definition for flag field above */ 41862306a36Sopenharmony_ci#define IDT77252_BIT_INIT 1 41962306a36Sopenharmony_ci#define IDT77252_BIT_INTERRUPT 2 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_ci#define ATM_CELL_PAYLOAD 48 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_ci#define FREEBUF_ALIGNMENT 16 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_ci/*****************************************************************************/ 42762306a36Sopenharmony_ci/* */ 42862306a36Sopenharmony_ci/* Makros */ 42962306a36Sopenharmony_ci/* */ 43062306a36Sopenharmony_ci/*****************************************************************************/ 43162306a36Sopenharmony_ci#define ALIGN_ADDRESS(addr, alignment) \ 43262306a36Sopenharmony_ci ((((u32)(addr)) + (((u32)(alignment))-1)) & ~(((u32)(alignment)) - 1)) 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci 43562306a36Sopenharmony_ci/*****************************************************************************/ 43662306a36Sopenharmony_ci/* */ 43762306a36Sopenharmony_ci/* ABR SAR Network operation Register */ 43862306a36Sopenharmony_ci/* */ 43962306a36Sopenharmony_ci/*****************************************************************************/ 44062306a36Sopenharmony_ci 44162306a36Sopenharmony_ci#define SAR_REG_DR0 (card->membase + 0x00) 44262306a36Sopenharmony_ci#define SAR_REG_DR1 (card->membase + 0x04) 44362306a36Sopenharmony_ci#define SAR_REG_DR2 (card->membase + 0x08) 44462306a36Sopenharmony_ci#define SAR_REG_DR3 (card->membase + 0x0C) 44562306a36Sopenharmony_ci#define SAR_REG_CMD (card->membase + 0x10) 44662306a36Sopenharmony_ci#define SAR_REG_CFG (card->membase + 0x14) 44762306a36Sopenharmony_ci#define SAR_REG_STAT (card->membase + 0x18) 44862306a36Sopenharmony_ci#define SAR_REG_RSQB (card->membase + 0x1C) 44962306a36Sopenharmony_ci#define SAR_REG_RSQT (card->membase + 0x20) 45062306a36Sopenharmony_ci#define SAR_REG_RSQH (card->membase + 0x24) 45162306a36Sopenharmony_ci#define SAR_REG_CDC (card->membase + 0x28) 45262306a36Sopenharmony_ci#define SAR_REG_VPEC (card->membase + 0x2C) 45362306a36Sopenharmony_ci#define SAR_REG_ICC (card->membase + 0x30) 45462306a36Sopenharmony_ci#define SAR_REG_RAWCT (card->membase + 0x34) 45562306a36Sopenharmony_ci#define SAR_REG_TMR (card->membase + 0x38) 45662306a36Sopenharmony_ci#define SAR_REG_TSTB (card->membase + 0x3C) 45762306a36Sopenharmony_ci#define SAR_REG_TSQB (card->membase + 0x40) 45862306a36Sopenharmony_ci#define SAR_REG_TSQT (card->membase + 0x44) 45962306a36Sopenharmony_ci#define SAR_REG_TSQH (card->membase + 0x48) 46062306a36Sopenharmony_ci#define SAR_REG_GP (card->membase + 0x4C) 46162306a36Sopenharmony_ci#define SAR_REG_VPM (card->membase + 0x50) 46262306a36Sopenharmony_ci#define SAR_REG_RXFD (card->membase + 0x54) 46362306a36Sopenharmony_ci#define SAR_REG_RXFT (card->membase + 0x58) 46462306a36Sopenharmony_ci#define SAR_REG_RXFH (card->membase + 0x5C) 46562306a36Sopenharmony_ci#define SAR_REG_RAWHND (card->membase + 0x60) 46662306a36Sopenharmony_ci#define SAR_REG_RXSTAT (card->membase + 0x64) 46762306a36Sopenharmony_ci#define SAR_REG_ABRSTD (card->membase + 0x68) 46862306a36Sopenharmony_ci#define SAR_REG_ABRRQ (card->membase + 0x6C) 46962306a36Sopenharmony_ci#define SAR_REG_VBRRQ (card->membase + 0x70) 47062306a36Sopenharmony_ci#define SAR_REG_RTBL (card->membase + 0x74) 47162306a36Sopenharmony_ci#define SAR_REG_MDFCT (card->membase + 0x78) 47262306a36Sopenharmony_ci#define SAR_REG_TXSTAT (card->membase + 0x7C) 47362306a36Sopenharmony_ci#define SAR_REG_TCMDQ (card->membase + 0x80) 47462306a36Sopenharmony_ci#define SAR_REG_IRCP (card->membase + 0x84) 47562306a36Sopenharmony_ci#define SAR_REG_FBQP0 (card->membase + 0x88) 47662306a36Sopenharmony_ci#define SAR_REG_FBQP1 (card->membase + 0x8C) 47762306a36Sopenharmony_ci#define SAR_REG_FBQP2 (card->membase + 0x90) 47862306a36Sopenharmony_ci#define SAR_REG_FBQP3 (card->membase + 0x94) 47962306a36Sopenharmony_ci#define SAR_REG_FBQS0 (card->membase + 0x98) 48062306a36Sopenharmony_ci#define SAR_REG_FBQS1 (card->membase + 0x9C) 48162306a36Sopenharmony_ci#define SAR_REG_FBQS2 (card->membase + 0xA0) 48262306a36Sopenharmony_ci#define SAR_REG_FBQS3 (card->membase + 0xA4) 48362306a36Sopenharmony_ci#define SAR_REG_FBQWP0 (card->membase + 0xA8) 48462306a36Sopenharmony_ci#define SAR_REG_FBQWP1 (card->membase + 0xAC) 48562306a36Sopenharmony_ci#define SAR_REG_FBQWP2 (card->membase + 0xB0) 48662306a36Sopenharmony_ci#define SAR_REG_FBQWP3 (card->membase + 0xB4) 48762306a36Sopenharmony_ci#define SAR_REG_NOW (card->membase + 0xB8) 48862306a36Sopenharmony_ci 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ci/*****************************************************************************/ 49162306a36Sopenharmony_ci/* */ 49262306a36Sopenharmony_ci/* Commands */ 49362306a36Sopenharmony_ci/* */ 49462306a36Sopenharmony_ci/*****************************************************************************/ 49562306a36Sopenharmony_ci 49662306a36Sopenharmony_ci#define SAR_CMD_NO_OPERATION 0x00000000 49762306a36Sopenharmony_ci#define SAR_CMD_OPENCLOSE_CONNECTION 0x20000000 49862306a36Sopenharmony_ci#define SAR_CMD_WRITE_SRAM 0x40000000 49962306a36Sopenharmony_ci#define SAR_CMD_READ_SRAM 0x50000000 50062306a36Sopenharmony_ci#define SAR_CMD_READ_UTILITY 0x80000000 50162306a36Sopenharmony_ci#define SAR_CMD_WRITE_UTILITY 0x90000000 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_ci#define SAR_CMD_OPEN_CONNECTION (SAR_CMD_OPENCLOSE_CONNECTION | 0x00080000) 50462306a36Sopenharmony_ci#define SAR_CMD_CLOSE_CONNECTION SAR_CMD_OPENCLOSE_CONNECTION 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ci/*****************************************************************************/ 50862306a36Sopenharmony_ci/* */ 50962306a36Sopenharmony_ci/* Configuration Register bits */ 51062306a36Sopenharmony_ci/* */ 51162306a36Sopenharmony_ci/*****************************************************************************/ 51262306a36Sopenharmony_ci 51362306a36Sopenharmony_ci#define SAR_CFG_SWRST 0x80000000 /* Software reset */ 51462306a36Sopenharmony_ci#define SAR_CFG_LOOP 0x40000000 /* Internal Loopback */ 51562306a36Sopenharmony_ci#define SAR_CFG_RXPTH 0x20000000 /* Receive Path Enable */ 51662306a36Sopenharmony_ci#define SAR_CFG_IDLE_CLP 0x10000000 /* SAR set CLP Bits of Null Cells */ 51762306a36Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_1 0x04000000 /* TX FIFO Size = 1 cell */ 51862306a36Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_2 0x08000000 /* TX FIFO Size = 2 cells */ 51962306a36Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_4 0x0C000000 /* TX FIFO Size = 4 cells */ 52062306a36Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_9 0x00000000 /* TX FIFO Size = 9 cells (full) */ 52162306a36Sopenharmony_ci#define SAR_CFG_NO_IDLE 0x02000000 /* SAR sends no Null Cells */ 52262306a36Sopenharmony_ci#define SAR_CFG_RSVD1 0x01000000 /* Reserved */ 52362306a36Sopenharmony_ci#define SAR_CFG_RXSTQ_SIZE_2k 0x00000000 /* RX Stat Queue Size = 2048 byte */ 52462306a36Sopenharmony_ci#define SAR_CFG_RXSTQ_SIZE_4k 0x00400000 /* RX Stat Queue Size = 4096 byte */ 52562306a36Sopenharmony_ci#define SAR_CFG_RXSTQ_SIZE_8k 0x00800000 /* RX Stat Queue Size = 8192 byte */ 52662306a36Sopenharmony_ci#define SAR_CFG_RXSTQ_SIZE_R 0x00C00000 /* RX Stat Queue Size = reserved */ 52762306a36Sopenharmony_ci#define SAR_CFG_ICAPT 0x00200000 /* accept Invalid Cells */ 52862306a36Sopenharmony_ci#define SAR_CFG_IGGFC 0x00100000 /* Ignore GFC */ 52962306a36Sopenharmony_ci#define SAR_CFG_VPVCS_0 0x00000000 /* VPI/VCI Select bit range */ 53062306a36Sopenharmony_ci#define SAR_CFG_VPVCS_1 0x00040000 /* VPI/VCI Select bit range */ 53162306a36Sopenharmony_ci#define SAR_CFG_VPVCS_2 0x00080000 /* VPI/VCI Select bit range */ 53262306a36Sopenharmony_ci#define SAR_CFG_VPVCS_8 0x000C0000 /* VPI/VCI Select bit range */ 53362306a36Sopenharmony_ci#define SAR_CFG_CNTBL_1k 0x00000000 /* Connection Table Size */ 53462306a36Sopenharmony_ci#define SAR_CFG_CNTBL_4k 0x00010000 /* Connection Table Size */ 53562306a36Sopenharmony_ci#define SAR_CFG_CNTBL_16k 0x00020000 /* Connection Table Size */ 53662306a36Sopenharmony_ci#define SAR_CFG_CNTBL_512 0x00030000 /* Connection Table Size */ 53762306a36Sopenharmony_ci#define SAR_CFG_VPECA 0x00008000 /* VPI/VCI Error Cell Accept */ 53862306a36Sopenharmony_ci#define SAR_CFG_RXINT_NOINT 0x00000000 /* No Interrupt on PDU received */ 53962306a36Sopenharmony_ci#define SAR_CFG_RXINT_NODELAY 0x00001000 /* Interrupt without delay to host*/ 54062306a36Sopenharmony_ci#define SAR_CFG_RXINT_256US 0x00002000 /* Interrupt with delay 256 usec */ 54162306a36Sopenharmony_ci#define SAR_CFG_RXINT_505US 0x00003000 /* Interrupt with delay 505 usec */ 54262306a36Sopenharmony_ci#define SAR_CFG_RXINT_742US 0x00004000 /* Interrupt with delay 742 usec */ 54362306a36Sopenharmony_ci#define SAR_CFG_RAWIE 0x00000800 /* Raw Cell Queue Interrupt Enable*/ 54462306a36Sopenharmony_ci#define SAR_CFG_RQFIE 0x00000400 /* RSQ Almost Full Int Enable */ 54562306a36Sopenharmony_ci#define SAR_CFG_RSVD2 0x00000200 /* Reserved */ 54662306a36Sopenharmony_ci#define SAR_CFG_CACHE 0x00000100 /* DMA on Cache Line Boundary */ 54762306a36Sopenharmony_ci#define SAR_CFG_TMOIE 0x00000080 /* Timer Roll Over Int Enable */ 54862306a36Sopenharmony_ci#define SAR_CFG_FBIE 0x00000040 /* Free Buffer Queue Int Enable */ 54962306a36Sopenharmony_ci#define SAR_CFG_TXEN 0x00000020 /* Transmit Operation Enable */ 55062306a36Sopenharmony_ci#define SAR_CFG_TXINT 0x00000010 /* Transmit status Int Enable */ 55162306a36Sopenharmony_ci#define SAR_CFG_TXUIE 0x00000008 /* Transmit underrun Int Enable */ 55262306a36Sopenharmony_ci#define SAR_CFG_UMODE 0x00000004 /* Utopia Mode Select */ 55362306a36Sopenharmony_ci#define SAR_CFG_TXSFI 0x00000002 /* Transmit status Full Int Enable*/ 55462306a36Sopenharmony_ci#define SAR_CFG_PHYIE 0x00000001 /* PHY Interrupt Enable */ 55562306a36Sopenharmony_ci 55662306a36Sopenharmony_ci#define SAR_CFG_TX_FIFO_SIZE_MASK 0x0C000000 /* TX FIFO Size Mask */ 55762306a36Sopenharmony_ci#define SAR_CFG_RXSTQSIZE_MASK 0x00C00000 55862306a36Sopenharmony_ci#define SAR_CFG_CNTBL_MASK 0x00030000 55962306a36Sopenharmony_ci#define SAR_CFG_RXINT_MASK 0x00007000 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_ci 56262306a36Sopenharmony_ci/*****************************************************************************/ 56362306a36Sopenharmony_ci/* */ 56462306a36Sopenharmony_ci/* Status Register bits */ 56562306a36Sopenharmony_ci/* */ 56662306a36Sopenharmony_ci/*****************************************************************************/ 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_ci#define SAR_STAT_FRAC_3 0xF0000000 /* Fraction of Free Buffer Queue 3 */ 56962306a36Sopenharmony_ci#define SAR_STAT_FRAC_2 0x0F000000 /* Fraction of Free Buffer Queue 2 */ 57062306a36Sopenharmony_ci#define SAR_STAT_FRAC_1 0x00F00000 /* Fraction of Free Buffer Queue 1 */ 57162306a36Sopenharmony_ci#define SAR_STAT_FRAC_0 0x000F0000 /* Fraction of Free Buffer Queue 0 */ 57262306a36Sopenharmony_ci#define SAR_STAT_TSIF 0x00008000 /* Transmit Status Indicator */ 57362306a36Sopenharmony_ci#define SAR_STAT_TXICP 0x00004000 /* Transmit Status Indicator */ 57462306a36Sopenharmony_ci#define SAR_STAT_RSVD1 0x00002000 /* Reserved */ 57562306a36Sopenharmony_ci#define SAR_STAT_TSQF 0x00001000 /* Transmit Status Queue full */ 57662306a36Sopenharmony_ci#define SAR_STAT_TMROF 0x00000800 /* Timer overflow */ 57762306a36Sopenharmony_ci#define SAR_STAT_PHYI 0x00000400 /* PHY device Interrupt flag */ 57862306a36Sopenharmony_ci#define SAR_STAT_CMDBZ 0x00000200 /* ABR SAR Command Busy Flag */ 57962306a36Sopenharmony_ci#define SAR_STAT_FBQ3A 0x00000100 /* Free Buffer Queue 3 Attention */ 58062306a36Sopenharmony_ci#define SAR_STAT_FBQ2A 0x00000080 /* Free Buffer Queue 2 Attention */ 58162306a36Sopenharmony_ci#define SAR_STAT_RSQF 0x00000040 /* Receive Status Queue full */ 58262306a36Sopenharmony_ci#define SAR_STAT_EPDU 0x00000020 /* End Of PDU Flag */ 58362306a36Sopenharmony_ci#define SAR_STAT_RAWCF 0x00000010 /* Raw Cell Flag */ 58462306a36Sopenharmony_ci#define SAR_STAT_FBQ1A 0x00000008 /* Free Buffer Queue 1 Attention */ 58562306a36Sopenharmony_ci#define SAR_STAT_FBQ0A 0x00000004 /* Free Buffer Queue 0 Attention */ 58662306a36Sopenharmony_ci#define SAR_STAT_RSQAF 0x00000002 /* Receive Status Queue almost full*/ 58762306a36Sopenharmony_ci#define SAR_STAT_RSVD2 0x00000001 /* Reserved */ 58862306a36Sopenharmony_ci 58962306a36Sopenharmony_ci 59062306a36Sopenharmony_ci/*****************************************************************************/ 59162306a36Sopenharmony_ci/* */ 59262306a36Sopenharmony_ci/* General Purpose Register bits */ 59362306a36Sopenharmony_ci/* */ 59462306a36Sopenharmony_ci/*****************************************************************************/ 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ci#define SAR_GP_TXNCC_MASK 0xff000000 /* Transmit Negative Credit Count */ 59762306a36Sopenharmony_ci#define SAR_GP_EEDI 0x00010000 /* EEPROM Data In */ 59862306a36Sopenharmony_ci#define SAR_GP_BIGE 0x00008000 /* Big Endian Operation */ 59962306a36Sopenharmony_ci#define SAR_GP_RM_NORMAL 0x00000000 /* Normal handling of RM cells */ 60062306a36Sopenharmony_ci#define SAR_GP_RM_TO_RCQ 0x00002000 /* put RM cells into Raw Cell Queue */ 60162306a36Sopenharmony_ci#define SAR_GP_RM_RSVD 0x00004000 /* Reserved */ 60262306a36Sopenharmony_ci#define SAR_GP_RM_INHIBIT 0x00006000 /* Inhibit update of Connection tab */ 60362306a36Sopenharmony_ci#define SAR_GP_PHY_RESET 0x00000008 /* PHY Reset */ 60462306a36Sopenharmony_ci#define SAR_GP_EESCLK 0x00000004 /* EEPROM SCLK */ 60562306a36Sopenharmony_ci#define SAR_GP_EECS 0x00000002 /* EEPROM Chip Select */ 60662306a36Sopenharmony_ci#define SAR_GP_EEDO 0x00000001 /* EEPROM Data Out */ 60762306a36Sopenharmony_ci 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_ci/*****************************************************************************/ 61062306a36Sopenharmony_ci/* */ 61162306a36Sopenharmony_ci/* SAR local SRAM layout for 128k work SRAM */ 61262306a36Sopenharmony_ci/* */ 61362306a36Sopenharmony_ci/*****************************************************************************/ 61462306a36Sopenharmony_ci 61562306a36Sopenharmony_ci#define SAR_SRAM_SCD_SIZE 12 61662306a36Sopenharmony_ci#define SAR_SRAM_TCT_SIZE 8 61762306a36Sopenharmony_ci#define SAR_SRAM_RCT_SIZE 4 61862306a36Sopenharmony_ci 61962306a36Sopenharmony_ci#define SAR_SRAM_TCT_128_BASE 0x00000 62062306a36Sopenharmony_ci#define SAR_SRAM_TCT_128_TOP 0x01fff 62162306a36Sopenharmony_ci#define SAR_SRAM_RCT_128_BASE 0x02000 62262306a36Sopenharmony_ci#define SAR_SRAM_RCT_128_TOP 0x02fff 62362306a36Sopenharmony_ci#define SAR_SRAM_FB0_128_BASE 0x03000 62462306a36Sopenharmony_ci#define SAR_SRAM_FB0_128_TOP 0x033ff 62562306a36Sopenharmony_ci#define SAR_SRAM_FB1_128_BASE 0x03400 62662306a36Sopenharmony_ci#define SAR_SRAM_FB1_128_TOP 0x037ff 62762306a36Sopenharmony_ci#define SAR_SRAM_FB2_128_BASE 0x03800 62862306a36Sopenharmony_ci#define SAR_SRAM_FB2_128_TOP 0x03bff 62962306a36Sopenharmony_ci#define SAR_SRAM_FB3_128_BASE 0x03c00 63062306a36Sopenharmony_ci#define SAR_SRAM_FB3_128_TOP 0x03fff 63162306a36Sopenharmony_ci#define SAR_SRAM_SCD_128_BASE 0x04000 63262306a36Sopenharmony_ci#define SAR_SRAM_SCD_128_TOP 0x07fff 63362306a36Sopenharmony_ci#define SAR_SRAM_TST1_128_BASE 0x08000 63462306a36Sopenharmony_ci#define SAR_SRAM_TST1_128_TOP 0x0bfff 63562306a36Sopenharmony_ci#define SAR_SRAM_TST2_128_BASE 0x0c000 63662306a36Sopenharmony_ci#define SAR_SRAM_TST2_128_TOP 0x0ffff 63762306a36Sopenharmony_ci#define SAR_SRAM_ABRSTD_128_BASE 0x10000 63862306a36Sopenharmony_ci#define SAR_SRAM_ABRSTD_128_TOP 0x13fff 63962306a36Sopenharmony_ci#define SAR_SRAM_RT_128_BASE 0x14000 64062306a36Sopenharmony_ci#define SAR_SRAM_RT_128_TOP 0x15fff 64162306a36Sopenharmony_ci 64262306a36Sopenharmony_ci#define SAR_SRAM_FIFO_128_BASE 0x18000 64362306a36Sopenharmony_ci#define SAR_SRAM_FIFO_128_TOP 0x1ffff 64462306a36Sopenharmony_ci 64562306a36Sopenharmony_ci 64662306a36Sopenharmony_ci/*****************************************************************************/ 64762306a36Sopenharmony_ci/* */ 64862306a36Sopenharmony_ci/* SAR local SRAM layout for 32k work SRAM */ 64962306a36Sopenharmony_ci/* */ 65062306a36Sopenharmony_ci/*****************************************************************************/ 65162306a36Sopenharmony_ci 65262306a36Sopenharmony_ci#define SAR_SRAM_TCT_32_BASE 0x00000 65362306a36Sopenharmony_ci#define SAR_SRAM_TCT_32_TOP 0x00fff 65462306a36Sopenharmony_ci#define SAR_SRAM_RCT_32_BASE 0x01000 65562306a36Sopenharmony_ci#define SAR_SRAM_RCT_32_TOP 0x017ff 65662306a36Sopenharmony_ci#define SAR_SRAM_FB0_32_BASE 0x01800 65762306a36Sopenharmony_ci#define SAR_SRAM_FB0_32_TOP 0x01bff 65862306a36Sopenharmony_ci#define SAR_SRAM_FB1_32_BASE 0x01c00 65962306a36Sopenharmony_ci#define SAR_SRAM_FB1_32_TOP 0x01fff 66062306a36Sopenharmony_ci#define SAR_SRAM_FB2_32_BASE 0x02000 66162306a36Sopenharmony_ci#define SAR_SRAM_FB2_32_TOP 0x023ff 66262306a36Sopenharmony_ci#define SAR_SRAM_FB3_32_BASE 0x02400 66362306a36Sopenharmony_ci#define SAR_SRAM_FB3_32_TOP 0x027ff 66462306a36Sopenharmony_ci#define SAR_SRAM_SCD_32_BASE 0x02800 66562306a36Sopenharmony_ci#define SAR_SRAM_SCD_32_TOP 0x03fff 66662306a36Sopenharmony_ci#define SAR_SRAM_TST1_32_BASE 0x04000 66762306a36Sopenharmony_ci#define SAR_SRAM_TST1_32_TOP 0x04fff 66862306a36Sopenharmony_ci#define SAR_SRAM_TST2_32_BASE 0x05000 66962306a36Sopenharmony_ci#define SAR_SRAM_TST2_32_TOP 0x05fff 67062306a36Sopenharmony_ci#define SAR_SRAM_ABRSTD_32_BASE 0x06000 67162306a36Sopenharmony_ci#define SAR_SRAM_ABRSTD_32_TOP 0x067ff 67262306a36Sopenharmony_ci#define SAR_SRAM_RT_32_BASE 0x06800 67362306a36Sopenharmony_ci#define SAR_SRAM_RT_32_TOP 0x06fff 67462306a36Sopenharmony_ci#define SAR_SRAM_FIFO_32_BASE 0x07000 67562306a36Sopenharmony_ci#define SAR_SRAM_FIFO_32_TOP 0x07fff 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_ci 67862306a36Sopenharmony_ci/*****************************************************************************/ 67962306a36Sopenharmony_ci/* */ 68062306a36Sopenharmony_ci/* TSR - Transmit Status Request */ 68162306a36Sopenharmony_ci/* */ 68262306a36Sopenharmony_ci/*****************************************************************************/ 68362306a36Sopenharmony_ci 68462306a36Sopenharmony_ci#define SAR_TSR_TYPE_TSR 0x80000000 68562306a36Sopenharmony_ci#define SAR_TSR_TYPE_TBD 0x00000000 68662306a36Sopenharmony_ci#define SAR_TSR_TSIF 0x20000000 68762306a36Sopenharmony_ci#define SAR_TSR_TAG_MASK 0x01F00000 68862306a36Sopenharmony_ci 68962306a36Sopenharmony_ci 69062306a36Sopenharmony_ci/*****************************************************************************/ 69162306a36Sopenharmony_ci/* */ 69262306a36Sopenharmony_ci/* TBD - Transmit Buffer Descriptor */ 69362306a36Sopenharmony_ci/* */ 69462306a36Sopenharmony_ci/*****************************************************************************/ 69562306a36Sopenharmony_ci 69662306a36Sopenharmony_ci#define SAR_TBD_EPDU 0x40000000 69762306a36Sopenharmony_ci#define SAR_TBD_TSIF 0x20000000 69862306a36Sopenharmony_ci#define SAR_TBD_OAM 0x10000000 69962306a36Sopenharmony_ci#define SAR_TBD_AAL0 0x00000000 70062306a36Sopenharmony_ci#define SAR_TBD_AAL34 0x04000000 70162306a36Sopenharmony_ci#define SAR_TBD_AAL5 0x08000000 70262306a36Sopenharmony_ci#define SAR_TBD_GTSI 0x02000000 70362306a36Sopenharmony_ci#define SAR_TBD_TAG_MASK 0x01F00000 70462306a36Sopenharmony_ci 70562306a36Sopenharmony_ci#define SAR_TBD_VPI_MASK 0x0FF00000 70662306a36Sopenharmony_ci#define SAR_TBD_VCI_MASK 0x000FFFF0 70762306a36Sopenharmony_ci#define SAR_TBD_VC_MASK (SAR_TBD_VPI_MASK | SAR_TBD_VCI_MASK) 70862306a36Sopenharmony_ci 70962306a36Sopenharmony_ci#define SAR_TBD_VPI_SHIFT 20 71062306a36Sopenharmony_ci#define SAR_TBD_VCI_SHIFT 4 71162306a36Sopenharmony_ci 71262306a36Sopenharmony_ci 71362306a36Sopenharmony_ci/*****************************************************************************/ 71462306a36Sopenharmony_ci/* */ 71562306a36Sopenharmony_ci/* RXFD - Receive FIFO Descriptor */ 71662306a36Sopenharmony_ci/* */ 71762306a36Sopenharmony_ci/*****************************************************************************/ 71862306a36Sopenharmony_ci 71962306a36Sopenharmony_ci#define SAR_RXFD_SIZE_MASK 0x0F000000 72062306a36Sopenharmony_ci#define SAR_RXFD_SIZE_512 0x00000000 /* 512 words */ 72162306a36Sopenharmony_ci#define SAR_RXFD_SIZE_1K 0x01000000 /* 1k words */ 72262306a36Sopenharmony_ci#define SAR_RXFD_SIZE_2K 0x02000000 /* 2k words */ 72362306a36Sopenharmony_ci#define SAR_RXFD_SIZE_4K 0x03000000 /* 4k words */ 72462306a36Sopenharmony_ci#define SAR_RXFD_SIZE_8K 0x04000000 /* 8k words */ 72562306a36Sopenharmony_ci#define SAR_RXFD_SIZE_16K 0x05000000 /* 16k words */ 72662306a36Sopenharmony_ci#define SAR_RXFD_SIZE_32K 0x06000000 /* 32k words */ 72762306a36Sopenharmony_ci#define SAR_RXFD_SIZE_64K 0x07000000 /* 64k words */ 72862306a36Sopenharmony_ci#define SAR_RXFD_SIZE_128K 0x08000000 /* 128k words */ 72962306a36Sopenharmony_ci#define SAR_RXFD_SIZE_256K 0x09000000 /* 256k words */ 73062306a36Sopenharmony_ci#define SAR_RXFD_ADDR_MASK 0x001ffc00 73162306a36Sopenharmony_ci 73262306a36Sopenharmony_ci 73362306a36Sopenharmony_ci/*****************************************************************************/ 73462306a36Sopenharmony_ci/* */ 73562306a36Sopenharmony_ci/* ABRSTD - ABR + VBR Schedule Tables */ 73662306a36Sopenharmony_ci/* */ 73762306a36Sopenharmony_ci/*****************************************************************************/ 73862306a36Sopenharmony_ci 73962306a36Sopenharmony_ci#define SAR_ABRSTD_SIZE_MASK 0x07000000 74062306a36Sopenharmony_ci#define SAR_ABRSTD_SIZE_512 0x00000000 /* 512 words */ 74162306a36Sopenharmony_ci#define SAR_ABRSTD_SIZE_1K 0x01000000 /* 1k words */ 74262306a36Sopenharmony_ci#define SAR_ABRSTD_SIZE_2K 0x02000000 /* 2k words */ 74362306a36Sopenharmony_ci#define SAR_ABRSTD_SIZE_4K 0x03000000 /* 4k words */ 74462306a36Sopenharmony_ci#define SAR_ABRSTD_SIZE_8K 0x04000000 /* 8k words */ 74562306a36Sopenharmony_ci#define SAR_ABRSTD_SIZE_16K 0x05000000 /* 16k words */ 74662306a36Sopenharmony_ci#define SAR_ABRSTD_ADDR_MASK 0x001ffc00 74762306a36Sopenharmony_ci 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_ci/*****************************************************************************/ 75062306a36Sopenharmony_ci/* */ 75162306a36Sopenharmony_ci/* RCTE - Receive Connection Table Entry */ 75262306a36Sopenharmony_ci/* */ 75362306a36Sopenharmony_ci/*****************************************************************************/ 75462306a36Sopenharmony_ci 75562306a36Sopenharmony_ci#define SAR_RCTE_IL_MASK 0xE0000000 /* inactivity limit */ 75662306a36Sopenharmony_ci#define SAR_RCTE_IC_MASK 0x1C000000 /* inactivity count */ 75762306a36Sopenharmony_ci#define SAR_RCTE_RSVD 0x02000000 /* reserved */ 75862306a36Sopenharmony_ci#define SAR_RCTE_LCD 0x01000000 /* last cell data */ 75962306a36Sopenharmony_ci#define SAR_RCTE_CI_VC 0x00800000 /* EFCI in previous cell of VC */ 76062306a36Sopenharmony_ci#define SAR_RCTE_FBP_01 0x00000000 /* 1. cell->FBQ0, others->FBQ1 */ 76162306a36Sopenharmony_ci#define SAR_RCTE_FBP_1 0x00200000 /* use FBQ 1 for all cells */ 76262306a36Sopenharmony_ci#define SAR_RCTE_FBP_2 0x00400000 /* use FBQ 2 for all cells */ 76362306a36Sopenharmony_ci#define SAR_RCTE_FBP_3 0x00600000 /* use FBQ 3 for all cells */ 76462306a36Sopenharmony_ci#define SAR_RCTE_NZ_GFC 0x00100000 /* non zero GFC in all cell of VC */ 76562306a36Sopenharmony_ci#define SAR_RCTE_CONNECTOPEN 0x00080000 /* VC is open */ 76662306a36Sopenharmony_ci#define SAR_RCTE_AAL_MASK 0x00070000 /* mask for AAL type field s.b. */ 76762306a36Sopenharmony_ci#define SAR_RCTE_RAWCELLINTEN 0x00008000 /* raw cell interrupt enable */ 76862306a36Sopenharmony_ci#define SAR_RCTE_RXCONCELLADDR 0x00004000 /* RX constant cell address */ 76962306a36Sopenharmony_ci#define SAR_RCTE_BUFFSTAT_MASK 0x00003000 /* buffer status */ 77062306a36Sopenharmony_ci#define SAR_RCTE_EFCI 0x00000800 /* EFCI Congestion flag */ 77162306a36Sopenharmony_ci#define SAR_RCTE_CLP 0x00000400 /* Cell Loss Priority flag */ 77262306a36Sopenharmony_ci#define SAR_RCTE_CRC 0x00000200 /* Received CRC Error */ 77362306a36Sopenharmony_ci#define SAR_RCTE_CELLCNT_MASK 0x000001FF /* cell Count */ 77462306a36Sopenharmony_ci 77562306a36Sopenharmony_ci#define SAR_RCTE_AAL0 0x00000000 /* AAL types for ALL field */ 77662306a36Sopenharmony_ci#define SAR_RCTE_AAL34 0x00010000 77762306a36Sopenharmony_ci#define SAR_RCTE_AAL5 0x00020000 77862306a36Sopenharmony_ci#define SAR_RCTE_RCQ 0x00030000 77962306a36Sopenharmony_ci#define SAR_RCTE_OAM 0x00040000 78062306a36Sopenharmony_ci 78162306a36Sopenharmony_ci#define TCMDQ_START 0x01000000 78262306a36Sopenharmony_ci#define TCMDQ_LACR 0x02000000 78362306a36Sopenharmony_ci#define TCMDQ_START_LACR 0x03000000 78462306a36Sopenharmony_ci#define TCMDQ_INIT_ER 0x04000000 78562306a36Sopenharmony_ci#define TCMDQ_HALT 0x05000000 78662306a36Sopenharmony_ci 78762306a36Sopenharmony_ci 78862306a36Sopenharmony_cistruct idt77252_skb_prv { 78962306a36Sopenharmony_ci struct scqe tbd; /* Transmit Buffer Descriptor */ 79062306a36Sopenharmony_ci dma_addr_t paddr; /* DMA handle */ 79162306a36Sopenharmony_ci u32 pool; /* sb_pool handle */ 79262306a36Sopenharmony_ci} __packed; 79362306a36Sopenharmony_ci 79462306a36Sopenharmony_ci#define IDT77252_PRV_TBD(skb) \ 79562306a36Sopenharmony_ci (((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->tbd) 79662306a36Sopenharmony_ci#define IDT77252_PRV_PADDR(skb) \ 79762306a36Sopenharmony_ci (((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->paddr) 79862306a36Sopenharmony_ci#define IDT77252_PRV_POOL(skb) \ 79962306a36Sopenharmony_ci (((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->pool) 80062306a36Sopenharmony_ci 80162306a36Sopenharmony_ci/*****************************************************************************/ 80262306a36Sopenharmony_ci/* */ 80362306a36Sopenharmony_ci/* PCI related items */ 80462306a36Sopenharmony_ci/* */ 80562306a36Sopenharmony_ci/*****************************************************************************/ 80662306a36Sopenharmony_ci 80762306a36Sopenharmony_ci#ifndef PCI_VENDOR_ID_IDT 80862306a36Sopenharmony_ci#define PCI_VENDOR_ID_IDT 0x111D 80962306a36Sopenharmony_ci#endif /* PCI_VENDOR_ID_IDT */ 81062306a36Sopenharmony_ci 81162306a36Sopenharmony_ci#ifndef PCI_DEVICE_ID_IDT_IDT77252 81262306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_IDT77252 0x0003 81362306a36Sopenharmony_ci#endif /* PCI_DEVICE_ID_IDT_IDT772052 */ 81462306a36Sopenharmony_ci 81562306a36Sopenharmony_ci 81662306a36Sopenharmony_ci#endif /* !(_IDT77252_H) */ 817