1*82c29810SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2da2272c9SKarsten Keil /* 3da2272c9SKarsten Keil * 4da2272c9SKarsten Keil * isar.h ISAR (Siemens PSB 7110) specific defines 5da2272c9SKarsten Keil * 6da2272c9SKarsten Keil * Author Karsten Keil (keil@isdn4linux.de) 7da2272c9SKarsten Keil * 8da2272c9SKarsten Keil * Copyright 2009 by Karsten Keil <keil@isdn4linux.de> 9da2272c9SKarsten Keil */ 10da2272c9SKarsten Keil 11da2272c9SKarsten Keil #include "iohelper.h" 12da2272c9SKarsten Keil 13da2272c9SKarsten Keil struct isar_hw; 14da2272c9SKarsten Keil 15da2272c9SKarsten Keil struct isar_ch { 16da2272c9SKarsten Keil struct bchannel bch; 17da2272c9SKarsten Keil struct isar_hw *is; 18da2272c9SKarsten Keil struct timer_list ftimer; 19da2272c9SKarsten Keil u8 nr; 20da2272c9SKarsten Keil u8 dpath; 21da2272c9SKarsten Keil u8 mml; 22da2272c9SKarsten Keil u8 state; 23da2272c9SKarsten Keil u8 cmd; 24da2272c9SKarsten Keil u8 mod; 25da2272c9SKarsten Keil u8 newcmd; 26da2272c9SKarsten Keil u8 newmod; 27da2272c9SKarsten Keil u8 try_mod; 28da2272c9SKarsten Keil u8 conmsg[16]; 29da2272c9SKarsten Keil }; 30da2272c9SKarsten Keil 31da2272c9SKarsten Keil struct isar_hw { 32da2272c9SKarsten Keil struct isar_ch ch[2]; 33da2272c9SKarsten Keil void *hw; 34b595076aSUwe Kleine-König spinlock_t *hwlock; /* lock HW access */ 35da2272c9SKarsten Keil char *name; 36da2272c9SKarsten Keil struct module *owner; 37663a31ceSKarsten Keil read_reg_func *read_reg; 38663a31ceSKarsten Keil write_reg_func *write_reg; 39663a31ceSKarsten Keil fifo_func *read_fifo; 40663a31ceSKarsten Keil fifo_func *write_fifo; 41da2272c9SKarsten Keil int (*ctrl)(void *, u32, u_long); 42da2272c9SKarsten Keil void (*release)(struct isar_hw *); 43da2272c9SKarsten Keil int (*init)(struct isar_hw *); 44da2272c9SKarsten Keil int (*open)(struct isar_hw *, struct channel_req *); 45da2272c9SKarsten Keil int (*firmware)(struct isar_hw *, const u8 *, int); 46da2272c9SKarsten Keil unsigned long Flags; 47da2272c9SKarsten Keil int version; 48da2272c9SKarsten Keil u8 bstat; 49da2272c9SKarsten Keil u8 iis; 50da2272c9SKarsten Keil u8 cmsb; 51da2272c9SKarsten Keil u8 clsb; 52da2272c9SKarsten Keil u8 buf[256]; 53da2272c9SKarsten Keil u8 log[256]; 54da2272c9SKarsten Keil }; 55da2272c9SKarsten Keil 56da2272c9SKarsten Keil #define ISAR_IRQMSK 0x04 57da2272c9SKarsten Keil #define ISAR_IRQSTA 0x04 58da2272c9SKarsten Keil #define ISAR_IRQBIT 0x75 59da2272c9SKarsten Keil #define ISAR_CTRL_H 0x61 60da2272c9SKarsten Keil #define ISAR_CTRL_L 0x60 61da2272c9SKarsten Keil #define ISAR_IIS 0x58 62da2272c9SKarsten Keil #define ISAR_IIA 0x58 63da2272c9SKarsten Keil #define ISAR_HIS 0x50 64da2272c9SKarsten Keil #define ISAR_HIA 0x50 65da2272c9SKarsten Keil #define ISAR_MBOX 0x4c 66da2272c9SKarsten Keil #define ISAR_WADR 0x4a 67da2272c9SKarsten Keil #define ISAR_RADR 0x48 68da2272c9SKarsten Keil 69da2272c9SKarsten Keil #define ISAR_HIS_VNR 0x14 70da2272c9SKarsten Keil #define ISAR_HIS_DKEY 0x02 71da2272c9SKarsten Keil #define ISAR_HIS_FIRM 0x1e 72da2272c9SKarsten Keil #define ISAR_HIS_STDSP 0x08 73da2272c9SKarsten Keil #define ISAR_HIS_DIAG 0x05 74da2272c9SKarsten Keil #define ISAR_HIS_P0CFG 0x3c 75da2272c9SKarsten Keil #define ISAR_HIS_P12CFG 0x24 76da2272c9SKarsten Keil #define ISAR_HIS_SARTCFG 0x25 77da2272c9SKarsten Keil #define ISAR_HIS_PUMPCFG 0x26 78da2272c9SKarsten Keil #define ISAR_HIS_PUMPCTRL 0x2a 79da2272c9SKarsten Keil #define ISAR_HIS_IOM2CFG 0x27 80da2272c9SKarsten Keil #define ISAR_HIS_IOM2REQ 0x07 81da2272c9SKarsten Keil #define ISAR_HIS_IOM2CTRL 0x2b 82da2272c9SKarsten Keil #define ISAR_HIS_BSTREQ 0x0c 83da2272c9SKarsten Keil #define ISAR_HIS_PSTREQ 0x0e 84da2272c9SKarsten Keil #define ISAR_HIS_SDATA 0x20 85da2272c9SKarsten Keil #define ISAR_HIS_DPS1 0x40 86da2272c9SKarsten Keil #define ISAR_HIS_DPS2 0x80 87da2272c9SKarsten Keil #define SET_DPS(x) ((x << 6) & 0xc0) 88da2272c9SKarsten Keil 89da2272c9SKarsten Keil #define ISAR_IIS_MSCMSD 0x3f 90da2272c9SKarsten Keil #define ISAR_IIS_VNR 0x15 91da2272c9SKarsten Keil #define ISAR_IIS_DKEY 0x03 92da2272c9SKarsten Keil #define ISAR_IIS_FIRM 0x1f 93da2272c9SKarsten Keil #define ISAR_IIS_STDSP 0x09 94da2272c9SKarsten Keil #define ISAR_IIS_DIAG 0x25 95da2272c9SKarsten Keil #define ISAR_IIS_GSTEV 0x00 96da2272c9SKarsten Keil #define ISAR_IIS_BSTEV 0x28 97da2272c9SKarsten Keil #define ISAR_IIS_BSTRSP 0x2c 98da2272c9SKarsten Keil #define ISAR_IIS_PSTRSP 0x2e 99da2272c9SKarsten Keil #define ISAR_IIS_PSTEV 0x2a 100da2272c9SKarsten Keil #define ISAR_IIS_IOM2RSP 0x27 101da2272c9SKarsten Keil #define ISAR_IIS_RDATA 0x20 102da2272c9SKarsten Keil #define ISAR_IIS_INVMSG 0x3f 103da2272c9SKarsten Keil 104da2272c9SKarsten Keil #define ISAR_CTRL_SWVER 0x10 105da2272c9SKarsten Keil #define ISAR_CTRL_STST 0x40 106da2272c9SKarsten Keil 107da2272c9SKarsten Keil #define ISAR_MSG_HWVER 0x20 108da2272c9SKarsten Keil 109da2272c9SKarsten Keil #define ISAR_DP1_USE 1 110da2272c9SKarsten Keil #define ISAR_DP2_USE 2 111da2272c9SKarsten Keil #define ISAR_RATE_REQ 3 112da2272c9SKarsten Keil 113da2272c9SKarsten Keil #define PMOD_DISABLE 0 114da2272c9SKarsten Keil #define PMOD_FAX 1 115da2272c9SKarsten Keil #define PMOD_DATAMODEM 2 116da2272c9SKarsten Keil #define PMOD_HALFDUPLEX 3 117da2272c9SKarsten Keil #define PMOD_V110 4 118da2272c9SKarsten Keil #define PMOD_DTMF 5 119da2272c9SKarsten Keil #define PMOD_DTMF_TRANS 6 120da2272c9SKarsten Keil #define PMOD_BYPASS 7 121da2272c9SKarsten Keil 122da2272c9SKarsten Keil #define PCTRL_ORIG 0x80 123da2272c9SKarsten Keil #define PV32P2_V23R 0x40 124da2272c9SKarsten Keil #define PV32P2_V22A 0x20 125da2272c9SKarsten Keil #define PV32P2_V22B 0x10 126da2272c9SKarsten Keil #define PV32P2_V22C 0x08 127da2272c9SKarsten Keil #define PV32P2_V21 0x02 128da2272c9SKarsten Keil #define PV32P2_BEL 0x01 129da2272c9SKarsten Keil 130da2272c9SKarsten Keil /* LSB MSB in ISAR doc wrong !!! Arghhh */ 131da2272c9SKarsten Keil #define PV32P3_AMOD 0x80 132da2272c9SKarsten Keil #define PV32P3_V32B 0x02 133da2272c9SKarsten Keil #define PV32P3_V23B 0x01 134da2272c9SKarsten Keil #define PV32P4_48 0x11 135da2272c9SKarsten Keil #define PV32P5_48 0x05 136da2272c9SKarsten Keil #define PV32P4_UT48 0x11 137da2272c9SKarsten Keil #define PV32P5_UT48 0x0d 138da2272c9SKarsten Keil #define PV32P4_96 0x11 139da2272c9SKarsten Keil #define PV32P5_96 0x03 140da2272c9SKarsten Keil #define PV32P4_UT96 0x11 141da2272c9SKarsten Keil #define PV32P5_UT96 0x0f 142da2272c9SKarsten Keil #define PV32P4_B96 0x91 143da2272c9SKarsten Keil #define PV32P5_B96 0x0b 144da2272c9SKarsten Keil #define PV32P4_UTB96 0xd1 145da2272c9SKarsten Keil #define PV32P5_UTB96 0x0f 146da2272c9SKarsten Keil #define PV32P4_120 0xb1 147da2272c9SKarsten Keil #define PV32P5_120 0x09 148da2272c9SKarsten Keil #define PV32P4_UT120 0xf1 149da2272c9SKarsten Keil #define PV32P5_UT120 0x0f 150da2272c9SKarsten Keil #define PV32P4_144 0x99 151da2272c9SKarsten Keil #define PV32P5_144 0x09 152da2272c9SKarsten Keil #define PV32P4_UT144 0xf9 153da2272c9SKarsten Keil #define PV32P5_UT144 0x0f 154da2272c9SKarsten Keil #define PV32P6_CTN 0x01 155da2272c9SKarsten Keil #define PV32P6_ATN 0x02 156da2272c9SKarsten Keil 157da2272c9SKarsten Keil #define PFAXP2_CTN 0x01 158da2272c9SKarsten Keil #define PFAXP2_ATN 0x04 159da2272c9SKarsten Keil 160da2272c9SKarsten Keil #define PSEV_10MS_TIMER 0x02 161da2272c9SKarsten Keil #define PSEV_CON_ON 0x18 162da2272c9SKarsten Keil #define PSEV_CON_OFF 0x19 163da2272c9SKarsten Keil #define PSEV_V24_OFF 0x20 164da2272c9SKarsten Keil #define PSEV_CTS_ON 0x21 165da2272c9SKarsten Keil #define PSEV_CTS_OFF 0x22 166da2272c9SKarsten Keil #define PSEV_DCD_ON 0x23 167da2272c9SKarsten Keil #define PSEV_DCD_OFF 0x24 168da2272c9SKarsten Keil #define PSEV_DSR_ON 0x25 169da2272c9SKarsten Keil #define PSEV_DSR_OFF 0x26 170da2272c9SKarsten Keil #define PSEV_REM_RET 0xcc 171da2272c9SKarsten Keil #define PSEV_REM_REN 0xcd 172da2272c9SKarsten Keil #define PSEV_GSTN_CLR 0xd4 173da2272c9SKarsten Keil 174da2272c9SKarsten Keil #define PSEV_RSP_READY 0xbc 175da2272c9SKarsten Keil #define PSEV_LINE_TX_H 0xb3 176da2272c9SKarsten Keil #define PSEV_LINE_TX_B 0xb2 177da2272c9SKarsten Keil #define PSEV_LINE_RX_H 0xb1 178da2272c9SKarsten Keil #define PSEV_LINE_RX_B 0xb0 179da2272c9SKarsten Keil #define PSEV_RSP_CONN 0xb5 180da2272c9SKarsten Keil #define PSEV_RSP_DISC 0xb7 181da2272c9SKarsten Keil #define PSEV_RSP_FCERR 0xb9 182da2272c9SKarsten Keil #define PSEV_RSP_SILDET 0xbe 183da2272c9SKarsten Keil #define PSEV_RSP_SILOFF 0xab 184da2272c9SKarsten Keil #define PSEV_FLAGS_DET 0xba 185da2272c9SKarsten Keil 186da2272c9SKarsten Keil #define PCTRL_CMD_TDTMF 0x5a 187da2272c9SKarsten Keil 188da2272c9SKarsten Keil #define PCTRL_CMD_FTH 0xa7 189da2272c9SKarsten Keil #define PCTRL_CMD_FRH 0xa5 190da2272c9SKarsten Keil #define PCTRL_CMD_FTM 0xa8 191da2272c9SKarsten Keil #define PCTRL_CMD_FRM 0xa6 192da2272c9SKarsten Keil #define PCTRL_CMD_SILON 0xac 193da2272c9SKarsten Keil #define PCTRL_CMD_CONT 0xa2 194da2272c9SKarsten Keil #define PCTRL_CMD_ESC 0xa4 195da2272c9SKarsten Keil #define PCTRL_CMD_SILOFF 0xab 196da2272c9SKarsten Keil #define PCTRL_CMD_HALT 0xa9 197da2272c9SKarsten Keil 198da2272c9SKarsten Keil #define PCTRL_LOC_RET 0xcf 199da2272c9SKarsten Keil #define PCTRL_LOC_REN 0xce 200da2272c9SKarsten Keil 201da2272c9SKarsten Keil #define SMODE_DISABLE 0 202da2272c9SKarsten Keil #define SMODE_V14 2 203da2272c9SKarsten Keil #define SMODE_HDLC 3 204da2272c9SKarsten Keil #define SMODE_BINARY 4 205da2272c9SKarsten Keil #define SMODE_FSK_V14 5 206da2272c9SKarsten Keil 207da2272c9SKarsten Keil #define SCTRL_HDMC_BOTH 0x00 208da2272c9SKarsten Keil #define SCTRL_HDMC_DTX 0x80 209da2272c9SKarsten Keil #define SCTRL_HDMC_DRX 0x40 210da2272c9SKarsten Keil #define S_P1_OVSP 0x40 211da2272c9SKarsten Keil #define S_P1_SNP 0x20 212da2272c9SKarsten Keil #define S_P1_EOP 0x10 213da2272c9SKarsten Keil #define S_P1_EDP 0x08 214da2272c9SKarsten Keil #define S_P1_NSB 0x04 215da2272c9SKarsten Keil #define S_P1_CHS_8 0x03 216da2272c9SKarsten Keil #define S_P1_CHS_7 0x02 217da2272c9SKarsten Keil #define S_P1_CHS_6 0x01 218da2272c9SKarsten Keil #define S_P1_CHS_5 0x00 219da2272c9SKarsten Keil 220da2272c9SKarsten Keil #define S_P2_BFT_DEF 0x10 221da2272c9SKarsten Keil 222da2272c9SKarsten Keil #define IOM_CTRL_ENA 0x80 223da2272c9SKarsten Keil #define IOM_CTRL_NOPCM 0x00 224da2272c9SKarsten Keil #define IOM_CTRL_ALAW 0x02 225da2272c9SKarsten Keil #define IOM_CTRL_ULAW 0x04 226da2272c9SKarsten Keil #define IOM_CTRL_RCV 0x01 227da2272c9SKarsten Keil 228da2272c9SKarsten Keil #define IOM_P1_TXD 0x10 229da2272c9SKarsten Keil 230da2272c9SKarsten Keil #define HDLC_FED 0x40 231da2272c9SKarsten Keil #define HDLC_FSD 0x20 232da2272c9SKarsten Keil #define HDLC_FST 0x20 233da2272c9SKarsten Keil #define HDLC_ERROR 0x1c 234da2272c9SKarsten Keil #define HDLC_ERR_FAD 0x10 235da2272c9SKarsten Keil #define HDLC_ERR_RER 0x08 236da2272c9SKarsten Keil #define HDLC_ERR_CER 0x04 237da2272c9SKarsten Keil #define SART_NMD 0x01 238da2272c9SKarsten Keil 239da2272c9SKarsten Keil #define BSTAT_RDM0 0x1 240da2272c9SKarsten Keil #define BSTAT_RDM1 0x2 241da2272c9SKarsten Keil #define BSTAT_RDM2 0x4 242da2272c9SKarsten Keil #define BSTAT_RDM3 0x8 243da2272c9SKarsten Keil #define BSTEV_TBO 0x1f 244da2272c9SKarsten Keil #define BSTEV_RBO 0x2f 245da2272c9SKarsten Keil 246da2272c9SKarsten Keil /* FAX State Machine */ 247da2272c9SKarsten Keil #define STFAX_NULL 0 248da2272c9SKarsten Keil #define STFAX_READY 1 249da2272c9SKarsten Keil #define STFAX_LINE 2 250da2272c9SKarsten Keil #define STFAX_CONT 3 251da2272c9SKarsten Keil #define STFAX_ACTIV 4 252da2272c9SKarsten Keil #define STFAX_ESCAPE 5 253da2272c9SKarsten Keil #define STFAX_SILDET 6 254da2272c9SKarsten Keil 255da2272c9SKarsten Keil extern u32 mISDNisar_init(struct isar_hw *, void *); 256da2272c9SKarsten Keil extern void mISDNisar_irq(struct isar_hw *); 257