1*1700fe1aSKarsten Keil /* 2*1700fe1aSKarsten Keil * specific defines for CCD's HFC 2BDS0 PCI chips 3*1700fe1aSKarsten Keil * 4*1700fe1aSKarsten Keil * Author Werner Cornelius (werner@isdn4linux.de) 5*1700fe1aSKarsten Keil * 6*1700fe1aSKarsten Keil * Copyright 1999 by Werner Cornelius (werner@isdn4linux.de) 7*1700fe1aSKarsten Keil * 8*1700fe1aSKarsten Keil * This program is free software; you can redistribute it and/or modify 9*1700fe1aSKarsten Keil * it under the terms of the GNU General Public License as published by 10*1700fe1aSKarsten Keil * the Free Software Foundation; either version 2, or (at your option) 11*1700fe1aSKarsten Keil * any later version. 12*1700fe1aSKarsten Keil * 13*1700fe1aSKarsten Keil * This program is distributed in the hope that it will be useful, 14*1700fe1aSKarsten Keil * but WITHOUT ANY WARRANTY; without even the implied warranty of 15*1700fe1aSKarsten Keil * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*1700fe1aSKarsten Keil * GNU General Public License for more details. 17*1700fe1aSKarsten Keil * 18*1700fe1aSKarsten Keil * You should have received a copy of the GNU General Public License 19*1700fe1aSKarsten Keil * along with this program; if not, write to the Free Software 20*1700fe1aSKarsten Keil * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21*1700fe1aSKarsten Keil * 22*1700fe1aSKarsten Keil */ 23*1700fe1aSKarsten Keil 24*1700fe1aSKarsten Keil /* 25*1700fe1aSKarsten Keil * thresholds for transparent B-channel mode 26*1700fe1aSKarsten Keil * change mask and threshold simultaneously 27*1700fe1aSKarsten Keil */ 28*1700fe1aSKarsten Keil #define HFCPCI_BTRANS_THRESHOLD 128 29*1700fe1aSKarsten Keil #define HFCPCI_BTRANS_MAX 256 30*1700fe1aSKarsten Keil #define HFCPCI_BTRANS_THRESMASK 0x00 31*1700fe1aSKarsten Keil 32*1700fe1aSKarsten Keil /* defines for PCI config */ 33*1700fe1aSKarsten Keil #define PCI_ENA_MEMIO 0x02 34*1700fe1aSKarsten Keil #define PCI_ENA_MASTER 0x04 35*1700fe1aSKarsten Keil 36*1700fe1aSKarsten Keil /* GCI/IOM bus monitor registers */ 37*1700fe1aSKarsten Keil #define HCFPCI_C_I 0x08 38*1700fe1aSKarsten Keil #define HFCPCI_TRxR 0x0C 39*1700fe1aSKarsten Keil #define HFCPCI_MON1_D 0x28 40*1700fe1aSKarsten Keil #define HFCPCI_MON2_D 0x2C 41*1700fe1aSKarsten Keil 42*1700fe1aSKarsten Keil /* GCI/IOM bus timeslot registers */ 43*1700fe1aSKarsten Keil #define HFCPCI_B1_SSL 0x80 44*1700fe1aSKarsten Keil #define HFCPCI_B2_SSL 0x84 45*1700fe1aSKarsten Keil #define HFCPCI_AUX1_SSL 0x88 46*1700fe1aSKarsten Keil #define HFCPCI_AUX2_SSL 0x8C 47*1700fe1aSKarsten Keil #define HFCPCI_B1_RSL 0x90 48*1700fe1aSKarsten Keil #define HFCPCI_B2_RSL 0x94 49*1700fe1aSKarsten Keil #define HFCPCI_AUX1_RSL 0x98 50*1700fe1aSKarsten Keil #define HFCPCI_AUX2_RSL 0x9C 51*1700fe1aSKarsten Keil 52*1700fe1aSKarsten Keil /* GCI/IOM bus data registers */ 53*1700fe1aSKarsten Keil #define HFCPCI_B1_D 0xA0 54*1700fe1aSKarsten Keil #define HFCPCI_B2_D 0xA4 55*1700fe1aSKarsten Keil #define HFCPCI_AUX1_D 0xA8 56*1700fe1aSKarsten Keil #define HFCPCI_AUX2_D 0xAC 57*1700fe1aSKarsten Keil 58*1700fe1aSKarsten Keil /* GCI/IOM bus configuration registers */ 59*1700fe1aSKarsten Keil #define HFCPCI_MST_EMOD 0xB4 60*1700fe1aSKarsten Keil #define HFCPCI_MST_MODE 0xB8 61*1700fe1aSKarsten Keil #define HFCPCI_CONNECT 0xBC 62*1700fe1aSKarsten Keil 63*1700fe1aSKarsten Keil 64*1700fe1aSKarsten Keil /* Interrupt and status registers */ 65*1700fe1aSKarsten Keil #define HFCPCI_FIFO_EN 0x44 66*1700fe1aSKarsten Keil #define HFCPCI_TRM 0x48 67*1700fe1aSKarsten Keil #define HFCPCI_B_MODE 0x4C 68*1700fe1aSKarsten Keil #define HFCPCI_CHIP_ID 0x58 69*1700fe1aSKarsten Keil #define HFCPCI_CIRM 0x60 70*1700fe1aSKarsten Keil #define HFCPCI_CTMT 0x64 71*1700fe1aSKarsten Keil #define HFCPCI_INT_M1 0x68 72*1700fe1aSKarsten Keil #define HFCPCI_INT_M2 0x6C 73*1700fe1aSKarsten Keil #define HFCPCI_INT_S1 0x78 74*1700fe1aSKarsten Keil #define HFCPCI_INT_S2 0x7C 75*1700fe1aSKarsten Keil #define HFCPCI_STATUS 0x70 76*1700fe1aSKarsten Keil 77*1700fe1aSKarsten Keil /* S/T section registers */ 78*1700fe1aSKarsten Keil #define HFCPCI_STATES 0xC0 79*1700fe1aSKarsten Keil #define HFCPCI_SCTRL 0xC4 80*1700fe1aSKarsten Keil #define HFCPCI_SCTRL_E 0xC8 81*1700fe1aSKarsten Keil #define HFCPCI_SCTRL_R 0xCC 82*1700fe1aSKarsten Keil #define HFCPCI_SQ 0xD0 83*1700fe1aSKarsten Keil #define HFCPCI_CLKDEL 0xDC 84*1700fe1aSKarsten Keil #define HFCPCI_B1_REC 0xF0 85*1700fe1aSKarsten Keil #define HFCPCI_B1_SEND 0xF0 86*1700fe1aSKarsten Keil #define HFCPCI_B2_REC 0xF4 87*1700fe1aSKarsten Keil #define HFCPCI_B2_SEND 0xF4 88*1700fe1aSKarsten Keil #define HFCPCI_D_REC 0xF8 89*1700fe1aSKarsten Keil #define HFCPCI_D_SEND 0xF8 90*1700fe1aSKarsten Keil #define HFCPCI_E_REC 0xFC 91*1700fe1aSKarsten Keil 92*1700fe1aSKarsten Keil 93*1700fe1aSKarsten Keil /* bits in status register (READ) */ 94*1700fe1aSKarsten Keil #define HFCPCI_PCI_PROC 0x02 95*1700fe1aSKarsten Keil #define HFCPCI_NBUSY 0x04 96*1700fe1aSKarsten Keil #define HFCPCI_TIMER_ELAP 0x10 97*1700fe1aSKarsten Keil #define HFCPCI_STATINT 0x20 98*1700fe1aSKarsten Keil #define HFCPCI_FRAMEINT 0x40 99*1700fe1aSKarsten Keil #define HFCPCI_ANYINT 0x80 100*1700fe1aSKarsten Keil 101*1700fe1aSKarsten Keil /* bits in CTMT (Write) */ 102*1700fe1aSKarsten Keil #define HFCPCI_CLTIMER 0x80 103*1700fe1aSKarsten Keil #define HFCPCI_TIM3_125 0x04 104*1700fe1aSKarsten Keil #define HFCPCI_TIM25 0x10 105*1700fe1aSKarsten Keil #define HFCPCI_TIM50 0x14 106*1700fe1aSKarsten Keil #define HFCPCI_TIM400 0x18 107*1700fe1aSKarsten Keil #define HFCPCI_TIM800 0x1C 108*1700fe1aSKarsten Keil #define HFCPCI_AUTO_TIMER 0x20 109*1700fe1aSKarsten Keil #define HFCPCI_TRANSB2 0x02 110*1700fe1aSKarsten Keil #define HFCPCI_TRANSB1 0x01 111*1700fe1aSKarsten Keil 112*1700fe1aSKarsten Keil /* bits in CIRM (Write) */ 113*1700fe1aSKarsten Keil #define HFCPCI_AUX_MSK 0x07 114*1700fe1aSKarsten Keil #define HFCPCI_RESET 0x08 115*1700fe1aSKarsten Keil #define HFCPCI_B1_REV 0x40 116*1700fe1aSKarsten Keil #define HFCPCI_B2_REV 0x80 117*1700fe1aSKarsten Keil 118*1700fe1aSKarsten Keil /* bits in INT_M1 and INT_S1 */ 119*1700fe1aSKarsten Keil #define HFCPCI_INTS_B1TRANS 0x01 120*1700fe1aSKarsten Keil #define HFCPCI_INTS_B2TRANS 0x02 121*1700fe1aSKarsten Keil #define HFCPCI_INTS_DTRANS 0x04 122*1700fe1aSKarsten Keil #define HFCPCI_INTS_B1REC 0x08 123*1700fe1aSKarsten Keil #define HFCPCI_INTS_B2REC 0x10 124*1700fe1aSKarsten Keil #define HFCPCI_INTS_DREC 0x20 125*1700fe1aSKarsten Keil #define HFCPCI_INTS_L1STATE 0x40 126*1700fe1aSKarsten Keil #define HFCPCI_INTS_TIMER 0x80 127*1700fe1aSKarsten Keil 128*1700fe1aSKarsten Keil /* bits in INT_M2 */ 129*1700fe1aSKarsten Keil #define HFCPCI_PROC_TRANS 0x01 130*1700fe1aSKarsten Keil #define HFCPCI_GCI_I_CHG 0x02 131*1700fe1aSKarsten Keil #define HFCPCI_GCI_MON_REC 0x04 132*1700fe1aSKarsten Keil #define HFCPCI_IRQ_ENABLE 0x08 133*1700fe1aSKarsten Keil #define HFCPCI_PMESEL 0x80 134*1700fe1aSKarsten Keil 135*1700fe1aSKarsten Keil /* bits in STATES */ 136*1700fe1aSKarsten Keil #define HFCPCI_STATE_MSK 0x0F 137*1700fe1aSKarsten Keil #define HFCPCI_LOAD_STATE 0x10 138*1700fe1aSKarsten Keil #define HFCPCI_ACTIVATE 0x20 139*1700fe1aSKarsten Keil #define HFCPCI_DO_ACTION 0x40 140*1700fe1aSKarsten Keil #define HFCPCI_NT_G2_G3 0x80 141*1700fe1aSKarsten Keil 142*1700fe1aSKarsten Keil /* bits in HFCD_MST_MODE */ 143*1700fe1aSKarsten Keil #define HFCPCI_MASTER 0x01 144*1700fe1aSKarsten Keil #define HFCPCI_SLAVE 0x00 145*1700fe1aSKarsten Keil #define HFCPCI_F0IO_POSITIV 0x02 146*1700fe1aSKarsten Keil #define HFCPCI_F0_NEGATIV 0x04 147*1700fe1aSKarsten Keil #define HFCPCI_F0_2C4 0x08 148*1700fe1aSKarsten Keil /* remaining bits are for codecs control */ 149*1700fe1aSKarsten Keil 150*1700fe1aSKarsten Keil /* bits in HFCD_SCTRL */ 151*1700fe1aSKarsten Keil #define SCTRL_B1_ENA 0x01 152*1700fe1aSKarsten Keil #define SCTRL_B2_ENA 0x02 153*1700fe1aSKarsten Keil #define SCTRL_MODE_TE 0x00 154*1700fe1aSKarsten Keil #define SCTRL_MODE_NT 0x04 155*1700fe1aSKarsten Keil #define SCTRL_LOW_PRIO 0x08 156*1700fe1aSKarsten Keil #define SCTRL_SQ_ENA 0x10 157*1700fe1aSKarsten Keil #define SCTRL_TEST 0x20 158*1700fe1aSKarsten Keil #define SCTRL_NONE_CAP 0x40 159*1700fe1aSKarsten Keil #define SCTRL_PWR_DOWN 0x80 160*1700fe1aSKarsten Keil 161*1700fe1aSKarsten Keil /* bits in SCTRL_E */ 162*1700fe1aSKarsten Keil #define HFCPCI_AUTO_AWAKE 0x01 163*1700fe1aSKarsten Keil #define HFCPCI_DBIT_1 0x04 164*1700fe1aSKarsten Keil #define HFCPCI_IGNORE_COL 0x08 165*1700fe1aSKarsten Keil #define HFCPCI_CHG_B1_B2 0x80 166*1700fe1aSKarsten Keil 167*1700fe1aSKarsten Keil /* bits in FIFO_EN register */ 168*1700fe1aSKarsten Keil #define HFCPCI_FIFOEN_B1 0x03 169*1700fe1aSKarsten Keil #define HFCPCI_FIFOEN_B2 0x0C 170*1700fe1aSKarsten Keil #define HFCPCI_FIFOEN_DTX 0x10 171*1700fe1aSKarsten Keil #define HFCPCI_FIFOEN_B1TX 0x01 172*1700fe1aSKarsten Keil #define HFCPCI_FIFOEN_B1RX 0x02 173*1700fe1aSKarsten Keil #define HFCPCI_FIFOEN_B2TX 0x04 174*1700fe1aSKarsten Keil #define HFCPCI_FIFOEN_B2RX 0x08 175*1700fe1aSKarsten Keil 176*1700fe1aSKarsten Keil 177*1700fe1aSKarsten Keil /* definitions of fifo memory area */ 178*1700fe1aSKarsten Keil #define MAX_D_FRAMES 15 179*1700fe1aSKarsten Keil #define MAX_B_FRAMES 31 180*1700fe1aSKarsten Keil #define B_SUB_VAL 0x200 181*1700fe1aSKarsten Keil #define B_FIFO_SIZE (0x2000 - B_SUB_VAL) 182*1700fe1aSKarsten Keil #define D_FIFO_SIZE 512 183*1700fe1aSKarsten Keil #define D_FREG_MASK 0xF 184*1700fe1aSKarsten Keil 185*1700fe1aSKarsten Keil struct zt { 186*1700fe1aSKarsten Keil unsigned short z1; /* Z1 pointer 16 Bit */ 187*1700fe1aSKarsten Keil unsigned short z2; /* Z2 pointer 16 Bit */ 188*1700fe1aSKarsten Keil }; 189*1700fe1aSKarsten Keil 190*1700fe1aSKarsten Keil struct dfifo { 191*1700fe1aSKarsten Keil u_char data[D_FIFO_SIZE]; /* FIFO data space */ 192*1700fe1aSKarsten Keil u_char fill1[0x20A0-D_FIFO_SIZE]; /* reserved, do not use */ 193*1700fe1aSKarsten Keil u_char f1, f2; /* f pointers */ 194*1700fe1aSKarsten Keil u_char fill2[0x20C0-0x20A2]; /* reserved, do not use */ 195*1700fe1aSKarsten Keil /* mask index with D_FREG_MASK for access */ 196*1700fe1aSKarsten Keil struct zt za[MAX_D_FRAMES+1]; 197*1700fe1aSKarsten Keil u_char fill3[0x4000-0x2100]; /* align 16K */ 198*1700fe1aSKarsten Keil }; 199*1700fe1aSKarsten Keil 200*1700fe1aSKarsten Keil struct bzfifo { 201*1700fe1aSKarsten Keil struct zt za[MAX_B_FRAMES+1]; /* only range 0x0..0x1F allowed */ 202*1700fe1aSKarsten Keil u_char f1, f2; /* f pointers */ 203*1700fe1aSKarsten Keil u_char fill[0x2100-0x2082]; /* alignment */ 204*1700fe1aSKarsten Keil }; 205*1700fe1aSKarsten Keil 206*1700fe1aSKarsten Keil 207*1700fe1aSKarsten Keil union fifo_area { 208*1700fe1aSKarsten Keil struct { 209*1700fe1aSKarsten Keil struct dfifo d_tx; /* D-send channel */ 210*1700fe1aSKarsten Keil struct dfifo d_rx; /* D-receive channel */ 211*1700fe1aSKarsten Keil } d_chan; 212*1700fe1aSKarsten Keil struct { 213*1700fe1aSKarsten Keil u_char fill1[0x200]; 214*1700fe1aSKarsten Keil u_char txdat_b1[B_FIFO_SIZE]; 215*1700fe1aSKarsten Keil struct bzfifo txbz_b1; 216*1700fe1aSKarsten Keil struct bzfifo txbz_b2; 217*1700fe1aSKarsten Keil u_char txdat_b2[B_FIFO_SIZE]; 218*1700fe1aSKarsten Keil u_char fill2[D_FIFO_SIZE]; 219*1700fe1aSKarsten Keil u_char rxdat_b1[B_FIFO_SIZE]; 220*1700fe1aSKarsten Keil struct bzfifo rxbz_b1; 221*1700fe1aSKarsten Keil struct bzfifo rxbz_b2; 222*1700fe1aSKarsten Keil u_char rxdat_b2[B_FIFO_SIZE]; 223*1700fe1aSKarsten Keil } b_chans; 224*1700fe1aSKarsten Keil u_char fill[32768]; 225*1700fe1aSKarsten Keil }; 226*1700fe1aSKarsten Keil 227*1700fe1aSKarsten Keil #define Write_hfc(a, b, c) (writeb(c, (a->hw.pci_io)+b)) 228*1700fe1aSKarsten Keil #define Read_hfc(a, b) (readb((a->hw.pci_io)+b)) 229