Path: blob/master/drivers/isdn/hardware/mISDN/ipac.h
15112 views
/*1*2* ipac.h Defines for the Infineon (former Siemens) ISDN3* chip series4*5* Author Karsten Keil <[email protected]>6*7* Copyright 2009 by Karsten Keil <[email protected]>8*9* This program is free software; you can redistribute it and/or modify10* it under the terms of the GNU General Public License version 2 as11* published by the Free Software Foundation.12*13* This program is distributed in the hope that it will be useful,14* but WITHOUT ANY WARRANTY; without even the implied warranty of15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16* GNU General Public License for more details.17*18* You should have received a copy of the GNU General Public License19* along with this program; if not, write to the Free Software20* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.21*22*/2324#include "iohelper.h"2526struct isac_hw {27struct dchannel dch;28u32 type;29u32 off; /* offset to isac regs */30char *name;31spinlock_t *hwlock; /* lock HW access */32read_reg_func *read_reg;33write_reg_func *write_reg;34fifo_func *read_fifo;35fifo_func *write_fifo;36int (*monitor)(void *, u32, u8 *, int);37void (*release)(struct isac_hw *);38int (*init)(struct isac_hw *);39int (*ctrl)(struct isac_hw *, u32, u_long);40int (*open)(struct isac_hw *, struct channel_req *);41u8 *mon_tx;42u8 *mon_rx;43int mon_txp;44int mon_txc;45int mon_rxp;46struct arcofi_msg *arcofi_list;47struct timer_list arcofitimer;48wait_queue_head_t arcofi_wait;49u8 arcofi_bc;50u8 arcofi_state;51u8 mocr;52u8 adf2;53u8 state;54};5556struct ipac_hw;5758struct hscx_hw {59struct bchannel bch;60struct ipac_hw *ip;61u8 fifo_size;62u8 off; /* offset to ICA or ICB */63u8 slot;64char log[64];65};6667struct ipac_hw {68struct isac_hw isac;69struct hscx_hw hscx[2];70char *name;71void *hw;72spinlock_t *hwlock; /* lock HW access */73struct module *owner;74u32 type;75read_reg_func *read_reg;76write_reg_func *write_reg;77fifo_func *read_fifo;78fifo_func *write_fifo;79void (*release)(struct ipac_hw *);80int (*init)(struct ipac_hw *);81int (*ctrl)(struct ipac_hw *, u32, u_long);82u8 conf;83};8485#define IPAC_TYPE_ISAC 0x001086#define IPAC_TYPE_IPAC 0x002087#define IPAC_TYPE_ISACX 0x004088#define IPAC_TYPE_IPACX 0x008089#define IPAC_TYPE_HSCX 0x01009091#define ISAC_USE_ARCOFI 0x10009293/* Monitor functions */94#define MONITOR_RX_0 0x100095#define MONITOR_RX_1 0x100196#define MONITOR_TX_0 0x200097#define MONITOR_TX_1 0x20019899/* All registers original Siemens Spec */100/* IPAC/ISAC registers */101#define ISAC_MASK 0x20102#define ISAC_ISTA 0x20103#define ISAC_STAR 0x21104#define ISAC_CMDR 0x21105#define ISAC_EXIR 0x24106#define ISAC_ADF2 0x39107#define ISAC_SPCR 0x30108#define ISAC_ADF1 0x38109#define ISAC_CIR0 0x31110#define ISAC_CIX0 0x31111#define ISAC_CIR1 0x33112#define ISAC_CIX1 0x33113#define ISAC_STCR 0x37114#define ISAC_MODE 0x22115#define ISAC_RSTA 0x27116#define ISAC_RBCL 0x25117#define ISAC_RBCH 0x2A118#define ISAC_TIMR 0x23119#define ISAC_SQXR 0x3b120#define ISAC_SQRR 0x3b121#define ISAC_MOSR 0x3a122#define ISAC_MOCR 0x3a123#define ISAC_MOR0 0x32124#define ISAC_MOX0 0x32125#define ISAC_MOR1 0x34126#define ISAC_MOX1 0x34127128#define ISAC_RBCH_XAC 0x80129130#define IPAC_D_TIN2 0x01131132/* IPAC/HSCX */133#define IPAC_ISTAB 0x20 /* RD */134#define IPAC_MASKB 0x20 /* WR */135#define IPAC_STARB 0x21 /* RD */136#define IPAC_CMDRB 0x21 /* WR */137#define IPAC_MODEB 0x22 /* R/W */138#define IPAC_EXIRB 0x24 /* RD */139#define IPAC_RBCLB 0x25 /* RD */140#define IPAC_RAH1 0x26 /* WR */141#define IPAC_RAH2 0x27 /* WR */142#define IPAC_RSTAB 0x27 /* RD */143#define IPAC_RAL1 0x28 /* R/W */144#define IPAC_RAL2 0x29 /* WR */145#define IPAC_RHCRB 0x29 /* RD */146#define IPAC_XBCL 0x2A /* WR */147#define IPAC_CCR2 0x2C /* R/W */148#define IPAC_RBCHB 0x2D /* RD */149#define IPAC_XBCH 0x2D /* WR */150#define HSCX_VSTR 0x2E /* RD */151#define IPAC_RLCR 0x2E /* WR */152#define IPAC_CCR1 0x2F /* R/W */153#define IPAC_TSAX 0x30 /* WR */154#define IPAC_TSAR 0x31 /* WR */155#define IPAC_XCCR 0x32 /* WR */156#define IPAC_RCCR 0x33 /* WR */157158/* IPAC_ISTAB/IPAC_MASKB bits */159#define IPAC_B_XPR 0x10160#define IPAC_B_RPF 0x40161#define IPAC_B_RME 0x80162#define IPAC_B_ON 0x2F163164/* IPAC_EXIRB bits */165#define IPAC_B_RFS 0x04166#define IPAC_B_RFO 0x10167#define IPAC_B_XDU 0x40168#define IPAC_B_XMR 0x80169170/* IPAC special registers */171#define IPAC_CONF 0xC0 /* R/W */172#define IPAC_ISTA 0xC1 /* RD */173#define IPAC_MASK 0xC1 /* WR */174#define IPAC_ID 0xC2 /* RD */175#define IPAC_ACFG 0xC3 /* R/W */176#define IPAC_AOE 0xC4 /* R/W */177#define IPAC_ARX 0xC5 /* RD */178#define IPAC_ATX 0xC5 /* WR */179#define IPAC_PITA1 0xC6 /* R/W */180#define IPAC_PITA2 0xC7 /* R/W */181#define IPAC_POTA1 0xC8 /* R/W */182#define IPAC_POTA2 0xC9 /* R/W */183#define IPAC_PCFG 0xCA /* R/W */184#define IPAC_SCFG 0xCB /* R/W */185#define IPAC_TIMR2 0xCC /* R/W */186187/* IPAC_ISTA/_MASK bits */188#define IPAC__EXB 0x01189#define IPAC__ICB 0x02190#define IPAC__EXA 0x04191#define IPAC__ICA 0x08192#define IPAC__EXD 0x10193#define IPAC__ICD 0x20194#define IPAC__INT0 0x40195#define IPAC__INT1 0x80196#define IPAC__ON 0xC0197198/* HSCX ISTA/MASK bits */199#define HSCX__EXB 0x01200#define HSCX__EXA 0x02201#define HSCX__ICA 0x04202203/* ISAC/ISACX/IPAC/IPACX L1 commands */204#define ISAC_CMD_TIM 0x0205#define ISAC_CMD_RS 0x1206#define ISAC_CMD_SCZ 0x4207#define ISAC_CMD_SSZ 0x2208#define ISAC_CMD_AR8 0x8209#define ISAC_CMD_AR10 0x9210#define ISAC_CMD_ARL 0xA211#define ISAC_CMD_DUI 0xF212213/* ISAC/ISACX/IPAC/IPACX L1 indications */214#define ISAC_IND_RS 0x1215#define ISAC_IND_PU 0x7216#define ISAC_IND_DR 0x0217#define ISAC_IND_SD 0x2218#define ISAC_IND_DIS 0x3219#define ISAC_IND_EI 0x6220#define ISAC_IND_RSY 0x4221#define ISAC_IND_ARD 0x8222#define ISAC_IND_TI 0xA223#define ISAC_IND_ATI 0xB224#define ISAC_IND_AI8 0xC225#define ISAC_IND_AI10 0xD226#define ISAC_IND_DID 0xF227228/* the new ISACX / IPACX */229/* D-channel registers */230#define ISACX_RFIFOD 0x00 /* RD */231#define ISACX_XFIFOD 0x00 /* WR */232#define ISACX_ISTAD 0x20 /* RD */233#define ISACX_MASKD 0x20 /* WR */234#define ISACX_STARD 0x21 /* RD */235#define ISACX_CMDRD 0x21 /* WR */236#define ISACX_MODED 0x22 /* R/W */237#define ISACX_EXMD1 0x23 /* R/W */238#define ISACX_TIMR1 0x24 /* R/W */239#define ISACX_SAP1 0x25 /* WR */240#define ISACX_SAP2 0x26 /* WR */241#define ISACX_RBCLD 0x26 /* RD */242#define ISACX_RBCHD 0x27 /* RD */243#define ISACX_TEI1 0x27 /* WR */244#define ISACX_TEI2 0x28 /* WR */245#define ISACX_RSTAD 0x28 /* RD */246#define ISACX_TMD 0x29 /* R/W */247#define ISACX_CIR0 0x2E /* RD */248#define ISACX_CIX0 0x2E /* WR */249#define ISACX_CIR1 0x2F /* RD */250#define ISACX_CIX1 0x2F /* WR */251252/* Transceiver registers */253#define ISACX_TR_CONF0 0x30 /* R/W */254#define ISACX_TR_CONF1 0x31 /* R/W */255#define ISACX_TR_CONF2 0x32 /* R/W */256#define ISACX_TR_STA 0x33 /* RD */257#define ISACX_TR_CMD 0x34 /* R/W */258#define ISACX_SQRR1 0x35 /* RD */259#define ISACX_SQXR1 0x35 /* WR */260#define ISACX_SQRR2 0x36 /* RD */261#define ISACX_SQXR2 0x36 /* WR */262#define ISACX_SQRR3 0x37 /* RD */263#define ISACX_SQXR3 0x37 /* WR */264#define ISACX_ISTATR 0x38 /* RD */265#define ISACX_MASKTR 0x39 /* R/W */266#define ISACX_TR_MODE 0x3A /* R/W */267#define ISACX_ACFG1 0x3C /* R/W */268#define ISACX_ACFG2 0x3D /* R/W */269#define ISACX_AOE 0x3E /* R/W */270#define ISACX_ARX 0x3F /* RD */271#define ISACX_ATX 0x3F /* WR */272273/* IOM: Timeslot, DPS, CDA */274#define ISACX_CDA10 0x40 /* R/W */275#define ISACX_CDA11 0x41 /* R/W */276#define ISACX_CDA20 0x42 /* R/W */277#define ISACX_CDA21 0x43 /* R/W */278#define ISACX_CDA_TSDP10 0x44 /* R/W */279#define ISACX_CDA_TSDP11 0x45 /* R/W */280#define ISACX_CDA_TSDP20 0x46 /* R/W */281#define ISACX_CDA_TSDP21 0x47 /* R/W */282#define ISACX_BCHA_TSDP_BC1 0x48 /* R/W */283#define ISACX_BCHA_TSDP_BC2 0x49 /* R/W */284#define ISACX_BCHB_TSDP_BC1 0x4A /* R/W */285#define ISACX_BCHB_TSDP_BC2 0x4B /* R/W */286#define ISACX_TR_TSDP_BC1 0x4C /* R/W */287#define ISACX_TR_TSDP_BC2 0x4D /* R/W */288#define ISACX_CDA1_CR 0x4E /* R/W */289#define ISACX_CDA2_CR 0x4F /* R/W */290291/* IOM: Contol, Sync transfer, Monitor */292#define ISACX_TR_CR 0x50 /* R/W */293#define ISACX_TRC_CR 0x50 /* R/W */294#define ISACX_BCHA_CR 0x51 /* R/W */295#define ISACX_BCHB_CR 0x52 /* R/W */296#define ISACX_DCI_CR 0x53 /* R/W */297#define ISACX_DCIC_CR 0x53 /* R/W */298#define ISACX_MON_CR 0x54 /* R/W */299#define ISACX_SDS1_CR 0x55 /* R/W */300#define ISACX_SDS2_CR 0x56 /* R/W */301#define ISACX_IOM_CR 0x57 /* R/W */302#define ISACX_STI 0x58 /* RD */303#define ISACX_ASTI 0x58 /* WR */304#define ISACX_MSTI 0x59 /* R/W */305#define ISACX_SDS_CONF 0x5A /* R/W */306#define ISACX_MCDA 0x5B /* RD */307#define ISACX_MOR 0x5C /* RD */308#define ISACX_MOX 0x5C /* WR */309#define ISACX_MOSR 0x5D /* RD */310#define ISACX_MOCR 0x5E /* R/W */311#define ISACX_MSTA 0x5F /* RD */312#define ISACX_MCONF 0x5F /* WR */313314/* Interrupt and general registers */315#define ISACX_ISTA 0x60 /* RD */316#define ISACX_MASK 0x60 /* WR */317#define ISACX_AUXI 0x61 /* RD */318#define ISACX_AUXM 0x61 /* WR */319#define ISACX_MODE1 0x62 /* R/W */320#define ISACX_MODE2 0x63 /* R/W */321#define ISACX_ID 0x64 /* RD */322#define ISACX_SRES 0x64 /* WR */323#define ISACX_TIMR2 0x65 /* R/W */324325/* Register Bits */326/* ISACX/IPACX _ISTAD (R) and _MASKD (W) */327#define ISACX_D_XDU 0x04328#define ISACX_D_XMR 0x08329#define ISACX_D_XPR 0x10330#define ISACX_D_RFO 0x20331#define ISACX_D_RPF 0x40332#define ISACX_D_RME 0x80333334/* ISACX/IPACX _ISTA (R) and _MASK (W) */335#define ISACX__ICD 0x01336#define ISACX__MOS 0x02337#define ISACX__TRAN 0x04338#define ISACX__AUX 0x08339#define ISACX__CIC 0x10340#define ISACX__ST 0x20341#define IPACX__ICB 0x40342#define IPACX__ICA 0x80343#define IPACX__ON 0x2C344345/* ISACX/IPACX _CMDRD (W) */346#define ISACX_CMDRD_XRES 0x01347#define ISACX_CMDRD_XME 0x02348#define ISACX_CMDRD_XTF 0x08349#define ISACX_CMDRD_STI 0x10350#define ISACX_CMDRD_RRES 0x40351#define ISACX_CMDRD_RMC 0x80352353/* ISACX/IPACX _RSTAD (R) */354#define ISACX_RSTAD_TA 0x01355#define ISACX_RSTAD_CR 0x02356#define ISACX_RSTAD_SA0 0x04357#define ISACX_RSTAD_SA1 0x08358#define ISACX_RSTAD_RAB 0x10359#define ISACX_RSTAD_CRC 0x20360#define ISACX_RSTAD_RDO 0x40361#define ISACX_RSTAD_VFR 0x80362363/* ISACX/IPACX _CIR0 (R) */364#define ISACX_CIR0_BAS 0x01365#define ISACX_CIR0_SG 0x08366#define ISACX_CIR0_CIC1 0x08367#define ISACX_CIR0_CIC0 0x08368369/* B-channel registers */370#define IPACX_OFF_ICA 0x70371#define IPACX_OFF_ICB 0x80372373/* ICA: IPACX_OFF_ICA + Reg ICB: IPACX_OFF_ICB + Reg */374375#define IPACX_ISTAB 0x00 /* RD */376#define IPACX_MASKB 0x00 /* WR */377#define IPACX_STARB 0x01 /* RD */378#define IPACX_CMDRB 0x01 /* WR */379#define IPACX_MODEB 0x02 /* R/W */380#define IPACX_EXMB 0x03 /* R/W */381#define IPACX_RAH1 0x05 /* WR */382#define IPACX_RAH2 0x06 /* WR */383#define IPACX_RBCLB 0x06 /* RD */384#define IPACX_RBCHB 0x07 /* RD */385#define IPACX_RAL1 0x07 /* WR */386#define IPACX_RAL2 0x08 /* WR */387#define IPACX_RSTAB 0x08 /* RD */388#define IPACX_TMB 0x09 /* R/W */389#define IPACX_RFIFOB 0x0A /* RD */390#define IPACX_XFIFOB 0x0A /* WR */391392/* IPACX_ISTAB / IPACX_MASKB bits */393#define IPACX_B_XDU 0x04394#define IPACX_B_XPR 0x10395#define IPACX_B_RFO 0x20396#define IPACX_B_RPF 0x40397#define IPACX_B_RME 0x80398399#define IPACX_B_ON 0x0B400401extern int mISDNisac_init(struct isac_hw *, void *);402extern irqreturn_t mISDNisac_irq(struct isac_hw *, u8);403extern u32 mISDNipac_init(struct ipac_hw *, void *);404extern irqreturn_t mISDNipac_irq(struct ipac_hw *, int);405406407