isar.h 5.6 KB

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