18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * isar.h ISAR (Siemens PSB 7110) specific defines 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Author Karsten Keil (keil@isdn4linux.de) 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright 2009 by Karsten Keil <keil@isdn4linux.de> 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include "iohelper.h" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistruct isar_hw; 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct isar_ch { 168c2ecf20Sopenharmony_ci struct bchannel bch; 178c2ecf20Sopenharmony_ci struct isar_hw *is; 188c2ecf20Sopenharmony_ci struct timer_list ftimer; 198c2ecf20Sopenharmony_ci u8 nr; 208c2ecf20Sopenharmony_ci u8 dpath; 218c2ecf20Sopenharmony_ci u8 mml; 228c2ecf20Sopenharmony_ci u8 state; 238c2ecf20Sopenharmony_ci u8 cmd; 248c2ecf20Sopenharmony_ci u8 mod; 258c2ecf20Sopenharmony_ci u8 newcmd; 268c2ecf20Sopenharmony_ci u8 newmod; 278c2ecf20Sopenharmony_ci u8 try_mod; 288c2ecf20Sopenharmony_ci u8 conmsg[16]; 298c2ecf20Sopenharmony_ci}; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistruct isar_hw { 328c2ecf20Sopenharmony_ci struct isar_ch ch[2]; 338c2ecf20Sopenharmony_ci void *hw; 348c2ecf20Sopenharmony_ci spinlock_t *hwlock; /* lock HW access */ 358c2ecf20Sopenharmony_ci char *name; 368c2ecf20Sopenharmony_ci struct module *owner; 378c2ecf20Sopenharmony_ci read_reg_func *read_reg; 388c2ecf20Sopenharmony_ci write_reg_func *write_reg; 398c2ecf20Sopenharmony_ci fifo_func *read_fifo; 408c2ecf20Sopenharmony_ci fifo_func *write_fifo; 418c2ecf20Sopenharmony_ci int (*ctrl)(void *, u32, u_long); 428c2ecf20Sopenharmony_ci void (*release)(struct isar_hw *); 438c2ecf20Sopenharmony_ci int (*init)(struct isar_hw *); 448c2ecf20Sopenharmony_ci int (*open)(struct isar_hw *, struct channel_req *); 458c2ecf20Sopenharmony_ci int (*firmware)(struct isar_hw *, const u8 *, int); 468c2ecf20Sopenharmony_ci unsigned long Flags; 478c2ecf20Sopenharmony_ci int version; 488c2ecf20Sopenharmony_ci u8 bstat; 498c2ecf20Sopenharmony_ci u8 iis; 508c2ecf20Sopenharmony_ci u8 cmsb; 518c2ecf20Sopenharmony_ci u8 clsb; 528c2ecf20Sopenharmony_ci u8 buf[256]; 538c2ecf20Sopenharmony_ci u8 log[256]; 548c2ecf20Sopenharmony_ci}; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define ISAR_IRQMSK 0x04 578c2ecf20Sopenharmony_ci#define ISAR_IRQSTA 0x04 588c2ecf20Sopenharmony_ci#define ISAR_IRQBIT 0x75 598c2ecf20Sopenharmony_ci#define ISAR_CTRL_H 0x61 608c2ecf20Sopenharmony_ci#define ISAR_CTRL_L 0x60 618c2ecf20Sopenharmony_ci#define ISAR_IIS 0x58 628c2ecf20Sopenharmony_ci#define ISAR_IIA 0x58 638c2ecf20Sopenharmony_ci#define ISAR_HIS 0x50 648c2ecf20Sopenharmony_ci#define ISAR_HIA 0x50 658c2ecf20Sopenharmony_ci#define ISAR_MBOX 0x4c 668c2ecf20Sopenharmony_ci#define ISAR_WADR 0x4a 678c2ecf20Sopenharmony_ci#define ISAR_RADR 0x48 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define ISAR_HIS_VNR 0x14 708c2ecf20Sopenharmony_ci#define ISAR_HIS_DKEY 0x02 718c2ecf20Sopenharmony_ci#define ISAR_HIS_FIRM 0x1e 728c2ecf20Sopenharmony_ci#define ISAR_HIS_STDSP 0x08 738c2ecf20Sopenharmony_ci#define ISAR_HIS_DIAG 0x05 748c2ecf20Sopenharmony_ci#define ISAR_HIS_P0CFG 0x3c 758c2ecf20Sopenharmony_ci#define ISAR_HIS_P12CFG 0x24 768c2ecf20Sopenharmony_ci#define ISAR_HIS_SARTCFG 0x25 778c2ecf20Sopenharmony_ci#define ISAR_HIS_PUMPCFG 0x26 788c2ecf20Sopenharmony_ci#define ISAR_HIS_PUMPCTRL 0x2a 798c2ecf20Sopenharmony_ci#define ISAR_HIS_IOM2CFG 0x27 808c2ecf20Sopenharmony_ci#define ISAR_HIS_IOM2REQ 0x07 818c2ecf20Sopenharmony_ci#define ISAR_HIS_IOM2CTRL 0x2b 828c2ecf20Sopenharmony_ci#define ISAR_HIS_BSTREQ 0x0c 838c2ecf20Sopenharmony_ci#define ISAR_HIS_PSTREQ 0x0e 848c2ecf20Sopenharmony_ci#define ISAR_HIS_SDATA 0x20 858c2ecf20Sopenharmony_ci#define ISAR_HIS_DPS1 0x40 868c2ecf20Sopenharmony_ci#define ISAR_HIS_DPS2 0x80 878c2ecf20Sopenharmony_ci#define SET_DPS(x) ((x << 6) & 0xc0) 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci#define ISAR_IIS_MSCMSD 0x3f 908c2ecf20Sopenharmony_ci#define ISAR_IIS_VNR 0x15 918c2ecf20Sopenharmony_ci#define ISAR_IIS_DKEY 0x03 928c2ecf20Sopenharmony_ci#define ISAR_IIS_FIRM 0x1f 938c2ecf20Sopenharmony_ci#define ISAR_IIS_STDSP 0x09 948c2ecf20Sopenharmony_ci#define ISAR_IIS_DIAG 0x25 958c2ecf20Sopenharmony_ci#define ISAR_IIS_GSTEV 0x00 968c2ecf20Sopenharmony_ci#define ISAR_IIS_BSTEV 0x28 978c2ecf20Sopenharmony_ci#define ISAR_IIS_BSTRSP 0x2c 988c2ecf20Sopenharmony_ci#define ISAR_IIS_PSTRSP 0x2e 998c2ecf20Sopenharmony_ci#define ISAR_IIS_PSTEV 0x2a 1008c2ecf20Sopenharmony_ci#define ISAR_IIS_IOM2RSP 0x27 1018c2ecf20Sopenharmony_ci#define ISAR_IIS_RDATA 0x20 1028c2ecf20Sopenharmony_ci#define ISAR_IIS_INVMSG 0x3f 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define ISAR_CTRL_SWVER 0x10 1058c2ecf20Sopenharmony_ci#define ISAR_CTRL_STST 0x40 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define ISAR_MSG_HWVER 0x20 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define ISAR_DP1_USE 1 1108c2ecf20Sopenharmony_ci#define ISAR_DP2_USE 2 1118c2ecf20Sopenharmony_ci#define ISAR_RATE_REQ 3 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#define PMOD_DISABLE 0 1148c2ecf20Sopenharmony_ci#define PMOD_FAX 1 1158c2ecf20Sopenharmony_ci#define PMOD_DATAMODEM 2 1168c2ecf20Sopenharmony_ci#define PMOD_HALFDUPLEX 3 1178c2ecf20Sopenharmony_ci#define PMOD_V110 4 1188c2ecf20Sopenharmony_ci#define PMOD_DTMF 5 1198c2ecf20Sopenharmony_ci#define PMOD_DTMF_TRANS 6 1208c2ecf20Sopenharmony_ci#define PMOD_BYPASS 7 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci#define PCTRL_ORIG 0x80 1238c2ecf20Sopenharmony_ci#define PV32P2_V23R 0x40 1248c2ecf20Sopenharmony_ci#define PV32P2_V22A 0x20 1258c2ecf20Sopenharmony_ci#define PV32P2_V22B 0x10 1268c2ecf20Sopenharmony_ci#define PV32P2_V22C 0x08 1278c2ecf20Sopenharmony_ci#define PV32P2_V21 0x02 1288c2ecf20Sopenharmony_ci#define PV32P2_BEL 0x01 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci/* LSB MSB in ISAR doc wrong !!! Arghhh */ 1318c2ecf20Sopenharmony_ci#define PV32P3_AMOD 0x80 1328c2ecf20Sopenharmony_ci#define PV32P3_V32B 0x02 1338c2ecf20Sopenharmony_ci#define PV32P3_V23B 0x01 1348c2ecf20Sopenharmony_ci#define PV32P4_48 0x11 1358c2ecf20Sopenharmony_ci#define PV32P5_48 0x05 1368c2ecf20Sopenharmony_ci#define PV32P4_UT48 0x11 1378c2ecf20Sopenharmony_ci#define PV32P5_UT48 0x0d 1388c2ecf20Sopenharmony_ci#define PV32P4_96 0x11 1398c2ecf20Sopenharmony_ci#define PV32P5_96 0x03 1408c2ecf20Sopenharmony_ci#define PV32P4_UT96 0x11 1418c2ecf20Sopenharmony_ci#define PV32P5_UT96 0x0f 1428c2ecf20Sopenharmony_ci#define PV32P4_B96 0x91 1438c2ecf20Sopenharmony_ci#define PV32P5_B96 0x0b 1448c2ecf20Sopenharmony_ci#define PV32P4_UTB96 0xd1 1458c2ecf20Sopenharmony_ci#define PV32P5_UTB96 0x0f 1468c2ecf20Sopenharmony_ci#define PV32P4_120 0xb1 1478c2ecf20Sopenharmony_ci#define PV32P5_120 0x09 1488c2ecf20Sopenharmony_ci#define PV32P4_UT120 0xf1 1498c2ecf20Sopenharmony_ci#define PV32P5_UT120 0x0f 1508c2ecf20Sopenharmony_ci#define PV32P4_144 0x99 1518c2ecf20Sopenharmony_ci#define PV32P5_144 0x09 1528c2ecf20Sopenharmony_ci#define PV32P4_UT144 0xf9 1538c2ecf20Sopenharmony_ci#define PV32P5_UT144 0x0f 1548c2ecf20Sopenharmony_ci#define PV32P6_CTN 0x01 1558c2ecf20Sopenharmony_ci#define PV32P6_ATN 0x02 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci#define PFAXP2_CTN 0x01 1588c2ecf20Sopenharmony_ci#define PFAXP2_ATN 0x04 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#define PSEV_10MS_TIMER 0x02 1618c2ecf20Sopenharmony_ci#define PSEV_CON_ON 0x18 1628c2ecf20Sopenharmony_ci#define PSEV_CON_OFF 0x19 1638c2ecf20Sopenharmony_ci#define PSEV_V24_OFF 0x20 1648c2ecf20Sopenharmony_ci#define PSEV_CTS_ON 0x21 1658c2ecf20Sopenharmony_ci#define PSEV_CTS_OFF 0x22 1668c2ecf20Sopenharmony_ci#define PSEV_DCD_ON 0x23 1678c2ecf20Sopenharmony_ci#define PSEV_DCD_OFF 0x24 1688c2ecf20Sopenharmony_ci#define PSEV_DSR_ON 0x25 1698c2ecf20Sopenharmony_ci#define PSEV_DSR_OFF 0x26 1708c2ecf20Sopenharmony_ci#define PSEV_REM_RET 0xcc 1718c2ecf20Sopenharmony_ci#define PSEV_REM_REN 0xcd 1728c2ecf20Sopenharmony_ci#define PSEV_GSTN_CLR 0xd4 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci#define PSEV_RSP_READY 0xbc 1758c2ecf20Sopenharmony_ci#define PSEV_LINE_TX_H 0xb3 1768c2ecf20Sopenharmony_ci#define PSEV_LINE_TX_B 0xb2 1778c2ecf20Sopenharmony_ci#define PSEV_LINE_RX_H 0xb1 1788c2ecf20Sopenharmony_ci#define PSEV_LINE_RX_B 0xb0 1798c2ecf20Sopenharmony_ci#define PSEV_RSP_CONN 0xb5 1808c2ecf20Sopenharmony_ci#define PSEV_RSP_DISC 0xb7 1818c2ecf20Sopenharmony_ci#define PSEV_RSP_FCERR 0xb9 1828c2ecf20Sopenharmony_ci#define PSEV_RSP_SILDET 0xbe 1838c2ecf20Sopenharmony_ci#define PSEV_RSP_SILOFF 0xab 1848c2ecf20Sopenharmony_ci#define PSEV_FLAGS_DET 0xba 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci#define PCTRL_CMD_TDTMF 0x5a 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#define PCTRL_CMD_FTH 0xa7 1898c2ecf20Sopenharmony_ci#define PCTRL_CMD_FRH 0xa5 1908c2ecf20Sopenharmony_ci#define PCTRL_CMD_FTM 0xa8 1918c2ecf20Sopenharmony_ci#define PCTRL_CMD_FRM 0xa6 1928c2ecf20Sopenharmony_ci#define PCTRL_CMD_SILON 0xac 1938c2ecf20Sopenharmony_ci#define PCTRL_CMD_CONT 0xa2 1948c2ecf20Sopenharmony_ci#define PCTRL_CMD_ESC 0xa4 1958c2ecf20Sopenharmony_ci#define PCTRL_CMD_SILOFF 0xab 1968c2ecf20Sopenharmony_ci#define PCTRL_CMD_HALT 0xa9 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci#define PCTRL_LOC_RET 0xcf 1998c2ecf20Sopenharmony_ci#define PCTRL_LOC_REN 0xce 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci#define SMODE_DISABLE 0 2028c2ecf20Sopenharmony_ci#define SMODE_V14 2 2038c2ecf20Sopenharmony_ci#define SMODE_HDLC 3 2048c2ecf20Sopenharmony_ci#define SMODE_BINARY 4 2058c2ecf20Sopenharmony_ci#define SMODE_FSK_V14 5 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci#define SCTRL_HDMC_BOTH 0x00 2088c2ecf20Sopenharmony_ci#define SCTRL_HDMC_DTX 0x80 2098c2ecf20Sopenharmony_ci#define SCTRL_HDMC_DRX 0x40 2108c2ecf20Sopenharmony_ci#define S_P1_OVSP 0x40 2118c2ecf20Sopenharmony_ci#define S_P1_SNP 0x20 2128c2ecf20Sopenharmony_ci#define S_P1_EOP 0x10 2138c2ecf20Sopenharmony_ci#define S_P1_EDP 0x08 2148c2ecf20Sopenharmony_ci#define S_P1_NSB 0x04 2158c2ecf20Sopenharmony_ci#define S_P1_CHS_8 0x03 2168c2ecf20Sopenharmony_ci#define S_P1_CHS_7 0x02 2178c2ecf20Sopenharmony_ci#define S_P1_CHS_6 0x01 2188c2ecf20Sopenharmony_ci#define S_P1_CHS_5 0x00 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci#define S_P2_BFT_DEF 0x10 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci#define IOM_CTRL_ENA 0x80 2238c2ecf20Sopenharmony_ci#define IOM_CTRL_NOPCM 0x00 2248c2ecf20Sopenharmony_ci#define IOM_CTRL_ALAW 0x02 2258c2ecf20Sopenharmony_ci#define IOM_CTRL_ULAW 0x04 2268c2ecf20Sopenharmony_ci#define IOM_CTRL_RCV 0x01 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci#define IOM_P1_TXD 0x10 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci#define HDLC_FED 0x40 2318c2ecf20Sopenharmony_ci#define HDLC_FSD 0x20 2328c2ecf20Sopenharmony_ci#define HDLC_FST 0x20 2338c2ecf20Sopenharmony_ci#define HDLC_ERROR 0x1c 2348c2ecf20Sopenharmony_ci#define HDLC_ERR_FAD 0x10 2358c2ecf20Sopenharmony_ci#define HDLC_ERR_RER 0x08 2368c2ecf20Sopenharmony_ci#define HDLC_ERR_CER 0x04 2378c2ecf20Sopenharmony_ci#define SART_NMD 0x01 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci#define BSTAT_RDM0 0x1 2408c2ecf20Sopenharmony_ci#define BSTAT_RDM1 0x2 2418c2ecf20Sopenharmony_ci#define BSTAT_RDM2 0x4 2428c2ecf20Sopenharmony_ci#define BSTAT_RDM3 0x8 2438c2ecf20Sopenharmony_ci#define BSTEV_TBO 0x1f 2448c2ecf20Sopenharmony_ci#define BSTEV_RBO 0x2f 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci/* FAX State Machine */ 2478c2ecf20Sopenharmony_ci#define STFAX_NULL 0 2488c2ecf20Sopenharmony_ci#define STFAX_READY 1 2498c2ecf20Sopenharmony_ci#define STFAX_LINE 2 2508c2ecf20Sopenharmony_ci#define STFAX_CONT 3 2518c2ecf20Sopenharmony_ci#define STFAX_ACTIV 4 2528c2ecf20Sopenharmony_ci#define STFAX_ESCAPE 5 2538c2ecf20Sopenharmony_ci#define STFAX_SILDET 6 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ciextern u32 mISDNisar_init(struct isar_hw *, void *); 2568c2ecf20Sopenharmony_ciextern void mISDNisar_irq(struct isar_hw *); 257