ipac.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. /*
  2. *
  3. * ipac.h Defines for the Infineon (former Siemens) ISDN
  4. * chip series
  5. *
  6. * Author Karsten Keil <keil@isdn4linux.de>
  7. *
  8. * Copyright 2009 by Karsten Keil <keil@isdn4linux.de>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. *
  23. */
  24. #include "iohelper.h"
  25. struct isac_hw {
  26. struct dchannel dch;
  27. u32 type;
  28. u32 off; /* offset to isac regs */
  29. char *name;
  30. spinlock_t *hwlock; /* lock HW access */
  31. read_reg_func *read_reg;
  32. write_reg_func *write_reg;
  33. fifo_func *read_fifo;
  34. fifo_func *write_fifo;
  35. int (*monitor)(void *, u32, u8 *, int);
  36. void (*release)(struct isac_hw *);
  37. int (*init)(struct isac_hw *);
  38. int (*ctrl)(struct isac_hw *, u32, u_long);
  39. int (*open)(struct isac_hw *, struct channel_req *);
  40. u8 *mon_tx;
  41. u8 *mon_rx;
  42. int mon_txp;
  43. int mon_txc;
  44. int mon_rxp;
  45. struct arcofi_msg *arcofi_list;
  46. struct timer_list arcofitimer;
  47. wait_queue_head_t arcofi_wait;
  48. u8 arcofi_bc;
  49. u8 arcofi_state;
  50. u8 mocr;
  51. u8 adf2;
  52. u8 state;
  53. };
  54. struct ipac_hw;
  55. struct hscx_hw {
  56. struct bchannel bch;
  57. struct ipac_hw *ip;
  58. u8 fifo_size;
  59. u8 off; /* offset to ICA or ICB */
  60. u8 slot;
  61. char log[64];
  62. };
  63. struct ipac_hw {
  64. struct isac_hw isac;
  65. struct hscx_hw hscx[2];
  66. char *name;
  67. void *hw;
  68. spinlock_t *hwlock; /* lock HW access */
  69. struct module *owner;
  70. u32 type;
  71. read_reg_func *read_reg;
  72. write_reg_func *write_reg;
  73. fifo_func *read_fifo;
  74. fifo_func *write_fifo;
  75. void (*release)(struct ipac_hw *);
  76. int (*init)(struct ipac_hw *);
  77. int (*ctrl)(struct ipac_hw *, u32, u_long);
  78. u8 conf;
  79. };
  80. #define IPAC_TYPE_ISAC 0x0010
  81. #define IPAC_TYPE_IPAC 0x0020
  82. #define IPAC_TYPE_ISACX 0x0040
  83. #define IPAC_TYPE_IPACX 0x0080
  84. #define IPAC_TYPE_HSCX 0x0100
  85. #define ISAC_USE_ARCOFI 0x1000
  86. /* Monitor functions */
  87. #define MONITOR_RX_0 0x1000
  88. #define MONITOR_RX_1 0x1001
  89. #define MONITOR_TX_0 0x2000
  90. #define MONITOR_TX_1 0x2001
  91. /* All registers original Siemens Spec */
  92. /* IPAC/ISAC registers */
  93. #define ISAC_MASK 0x20
  94. #define ISAC_ISTA 0x20
  95. #define ISAC_STAR 0x21
  96. #define ISAC_CMDR 0x21
  97. #define ISAC_EXIR 0x24
  98. #define ISAC_ADF2 0x39
  99. #define ISAC_SPCR 0x30
  100. #define ISAC_ADF1 0x38
  101. #define ISAC_CIR0 0x31
  102. #define ISAC_CIX0 0x31
  103. #define ISAC_CIR1 0x33
  104. #define ISAC_CIX1 0x33
  105. #define ISAC_STCR 0x37
  106. #define ISAC_MODE 0x22
  107. #define ISAC_RSTA 0x27
  108. #define ISAC_RBCL 0x25
  109. #define ISAC_RBCH 0x2A
  110. #define ISAC_TIMR 0x23
  111. #define ISAC_SQXR 0x3b
  112. #define ISAC_SQRR 0x3b
  113. #define ISAC_MOSR 0x3a
  114. #define ISAC_MOCR 0x3a
  115. #define ISAC_MOR0 0x32
  116. #define ISAC_MOX0 0x32
  117. #define ISAC_MOR1 0x34
  118. #define ISAC_MOX1 0x34
  119. #define ISAC_RBCH_XAC 0x80
  120. #define IPAC_D_TIN2 0x01
  121. /* IPAC/HSCX */
  122. #define IPAC_ISTAB 0x20 /* RD */
  123. #define IPAC_MASKB 0x20 /* WR */
  124. #define IPAC_STARB 0x21 /* RD */
  125. #define IPAC_CMDRB 0x21 /* WR */
  126. #define IPAC_MODEB 0x22 /* R/W */
  127. #define IPAC_EXIRB 0x24 /* RD */
  128. #define IPAC_RBCLB 0x25 /* RD */
  129. #define IPAC_RAH1 0x26 /* WR */
  130. #define IPAC_RAH2 0x27 /* WR */
  131. #define IPAC_RSTAB 0x27 /* RD */
  132. #define IPAC_RAL1 0x28 /* R/W */
  133. #define IPAC_RAL2 0x29 /* WR */
  134. #define IPAC_RHCRB 0x29 /* RD */
  135. #define IPAC_XBCL 0x2A /* WR */
  136. #define IPAC_CCR2 0x2C /* R/W */
  137. #define IPAC_RBCHB 0x2D /* RD */
  138. #define IPAC_XBCH 0x2D /* WR */
  139. #define HSCX_VSTR 0x2E /* RD */
  140. #define IPAC_RLCR 0x2E /* WR */
  141. #define IPAC_CCR1 0x2F /* R/W */
  142. #define IPAC_TSAX 0x30 /* WR */
  143. #define IPAC_TSAR 0x31 /* WR */
  144. #define IPAC_XCCR 0x32 /* WR */
  145. #define IPAC_RCCR 0x33 /* WR */
  146. /* IPAC_ISTAB/IPAC_MASKB bits */
  147. #define IPAC_B_XPR 0x10
  148. #define IPAC_B_RPF 0x40
  149. #define IPAC_B_RME 0x80
  150. #define IPAC_B_ON 0x2F
  151. /* IPAC_EXIRB bits */
  152. #define IPAC_B_RFS 0x04
  153. #define IPAC_B_RFO 0x10
  154. #define IPAC_B_XDU 0x40
  155. #define IPAC_B_XMR 0x80
  156. /* IPAC special registers */
  157. #define IPAC_CONF 0xC0 /* R/W */
  158. #define IPAC_ISTA 0xC1 /* RD */
  159. #define IPAC_MASK 0xC1 /* WR */
  160. #define IPAC_ID 0xC2 /* RD */
  161. #define IPAC_ACFG 0xC3 /* R/W */
  162. #define IPAC_AOE 0xC4 /* R/W */
  163. #define IPAC_ARX 0xC5 /* RD */
  164. #define IPAC_ATX 0xC5 /* WR */
  165. #define IPAC_PITA1 0xC6 /* R/W */
  166. #define IPAC_PITA2 0xC7 /* R/W */
  167. #define IPAC_POTA1 0xC8 /* R/W */
  168. #define IPAC_POTA2 0xC9 /* R/W */
  169. #define IPAC_PCFG 0xCA /* R/W */
  170. #define IPAC_SCFG 0xCB /* R/W */
  171. #define IPAC_TIMR2 0xCC /* R/W */
  172. /* IPAC_ISTA/_MASK bits */
  173. #define IPAC__EXB 0x01
  174. #define IPAC__ICB 0x02
  175. #define IPAC__EXA 0x04
  176. #define IPAC__ICA 0x08
  177. #define IPAC__EXD 0x10
  178. #define IPAC__ICD 0x20
  179. #define IPAC__INT0 0x40
  180. #define IPAC__INT1 0x80
  181. #define IPAC__ON 0xC0
  182. /* HSCX ISTA/MASK bits */
  183. #define HSCX__EXB 0x01
  184. #define HSCX__EXA 0x02
  185. #define HSCX__ICA 0x04
  186. /* ISAC/ISACX/IPAC/IPACX L1 commands */
  187. #define ISAC_CMD_TIM 0x0
  188. #define ISAC_CMD_RS 0x1
  189. #define ISAC_CMD_SCZ 0x4
  190. #define ISAC_CMD_SSZ 0x2
  191. #define ISAC_CMD_AR8 0x8
  192. #define ISAC_CMD_AR10 0x9
  193. #define ISAC_CMD_ARL 0xA
  194. #define ISAC_CMD_DUI 0xF
  195. /* ISAC/ISACX/IPAC/IPACX L1 indications */
  196. #define ISAC_IND_RS 0x1
  197. #define ISAC_IND_PU 0x7
  198. #define ISAC_IND_DR 0x0
  199. #define ISAC_IND_SD 0x2
  200. #define ISAC_IND_DIS 0x3
  201. #define ISAC_IND_EI 0x6
  202. #define ISAC_IND_RSY 0x4
  203. #define ISAC_IND_ARD 0x8
  204. #define ISAC_IND_TI 0xA
  205. #define ISAC_IND_ATI 0xB
  206. #define ISAC_IND_AI8 0xC
  207. #define ISAC_IND_AI10 0xD
  208. #define ISAC_IND_DID 0xF
  209. /* the new ISACX / IPACX */
  210. /* D-channel registers */
  211. #define ISACX_RFIFOD 0x00 /* RD */
  212. #define ISACX_XFIFOD 0x00 /* WR */
  213. #define ISACX_ISTAD 0x20 /* RD */
  214. #define ISACX_MASKD 0x20 /* WR */
  215. #define ISACX_STARD 0x21 /* RD */
  216. #define ISACX_CMDRD 0x21 /* WR */
  217. #define ISACX_MODED 0x22 /* R/W */
  218. #define ISACX_EXMD1 0x23 /* R/W */
  219. #define ISACX_TIMR1 0x24 /* R/W */
  220. #define ISACX_SAP1 0x25 /* WR */
  221. #define ISACX_SAP2 0x26 /* WR */
  222. #define ISACX_RBCLD 0x26 /* RD */
  223. #define ISACX_RBCHD 0x27 /* RD */
  224. #define ISACX_TEI1 0x27 /* WR */
  225. #define ISACX_TEI2 0x28 /* WR */
  226. #define ISACX_RSTAD 0x28 /* RD */
  227. #define ISACX_TMD 0x29 /* R/W */
  228. #define ISACX_CIR0 0x2E /* RD */
  229. #define ISACX_CIX0 0x2E /* WR */
  230. #define ISACX_CIR1 0x2F /* RD */
  231. #define ISACX_CIX1 0x2F /* WR */
  232. /* Transceiver registers */
  233. #define ISACX_TR_CONF0 0x30 /* R/W */
  234. #define ISACX_TR_CONF1 0x31 /* R/W */
  235. #define ISACX_TR_CONF2 0x32 /* R/W */
  236. #define ISACX_TR_STA 0x33 /* RD */
  237. #define ISACX_TR_CMD 0x34 /* R/W */
  238. #define ISACX_SQRR1 0x35 /* RD */
  239. #define ISACX_SQXR1 0x35 /* WR */
  240. #define ISACX_SQRR2 0x36 /* RD */
  241. #define ISACX_SQXR2 0x36 /* WR */
  242. #define ISACX_SQRR3 0x37 /* RD */
  243. #define ISACX_SQXR3 0x37 /* WR */
  244. #define ISACX_ISTATR 0x38 /* RD */
  245. #define ISACX_MASKTR 0x39 /* R/W */
  246. #define ISACX_TR_MODE 0x3A /* R/W */
  247. #define ISACX_ACFG1 0x3C /* R/W */
  248. #define ISACX_ACFG2 0x3D /* R/W */
  249. #define ISACX_AOE 0x3E /* R/W */
  250. #define ISACX_ARX 0x3F /* RD */
  251. #define ISACX_ATX 0x3F /* WR */
  252. /* IOM: Timeslot, DPS, CDA */
  253. #define ISACX_CDA10 0x40 /* R/W */
  254. #define ISACX_CDA11 0x41 /* R/W */
  255. #define ISACX_CDA20 0x42 /* R/W */
  256. #define ISACX_CDA21 0x43 /* R/W */
  257. #define ISACX_CDA_TSDP10 0x44 /* R/W */
  258. #define ISACX_CDA_TSDP11 0x45 /* R/W */
  259. #define ISACX_CDA_TSDP20 0x46 /* R/W */
  260. #define ISACX_CDA_TSDP21 0x47 /* R/W */
  261. #define ISACX_BCHA_TSDP_BC1 0x48 /* R/W */
  262. #define ISACX_BCHA_TSDP_BC2 0x49 /* R/W */
  263. #define ISACX_BCHB_TSDP_BC1 0x4A /* R/W */
  264. #define ISACX_BCHB_TSDP_BC2 0x4B /* R/W */
  265. #define ISACX_TR_TSDP_BC1 0x4C /* R/W */
  266. #define ISACX_TR_TSDP_BC2 0x4D /* R/W */
  267. #define ISACX_CDA1_CR 0x4E /* R/W */
  268. #define ISACX_CDA2_CR 0x4F /* R/W */
  269. /* IOM: Contol, Sync transfer, Monitor */
  270. #define ISACX_TR_CR 0x50 /* R/W */
  271. #define ISACX_TRC_CR 0x50 /* R/W */
  272. #define ISACX_BCHA_CR 0x51 /* R/W */
  273. #define ISACX_BCHB_CR 0x52 /* R/W */
  274. #define ISACX_DCI_CR 0x53 /* R/W */
  275. #define ISACX_DCIC_CR 0x53 /* R/W */
  276. #define ISACX_MON_CR 0x54 /* R/W */
  277. #define ISACX_SDS1_CR 0x55 /* R/W */
  278. #define ISACX_SDS2_CR 0x56 /* R/W */
  279. #define ISACX_IOM_CR 0x57 /* R/W */
  280. #define ISACX_STI 0x58 /* RD */
  281. #define ISACX_ASTI 0x58 /* WR */
  282. #define ISACX_MSTI 0x59 /* R/W */
  283. #define ISACX_SDS_CONF 0x5A /* R/W */
  284. #define ISACX_MCDA 0x5B /* RD */
  285. #define ISACX_MOR 0x5C /* RD */
  286. #define ISACX_MOX 0x5C /* WR */
  287. #define ISACX_MOSR 0x5D /* RD */
  288. #define ISACX_MOCR 0x5E /* R/W */
  289. #define ISACX_MSTA 0x5F /* RD */
  290. #define ISACX_MCONF 0x5F /* WR */
  291. /* Interrupt and general registers */
  292. #define ISACX_ISTA 0x60 /* RD */
  293. #define ISACX_MASK 0x60 /* WR */
  294. #define ISACX_AUXI 0x61 /* RD */
  295. #define ISACX_AUXM 0x61 /* WR */
  296. #define ISACX_MODE1 0x62 /* R/W */
  297. #define ISACX_MODE2 0x63 /* R/W */
  298. #define ISACX_ID 0x64 /* RD */
  299. #define ISACX_SRES 0x64 /* WR */
  300. #define ISACX_TIMR2 0x65 /* R/W */
  301. /* Register Bits */
  302. /* ISACX/IPACX _ISTAD (R) and _MASKD (W) */
  303. #define ISACX_D_XDU 0x04
  304. #define ISACX_D_XMR 0x08
  305. #define ISACX_D_XPR 0x10
  306. #define ISACX_D_RFO 0x20
  307. #define ISACX_D_RPF 0x40
  308. #define ISACX_D_RME 0x80
  309. /* ISACX/IPACX _ISTA (R) and _MASK (W) */
  310. #define ISACX__ICD 0x01
  311. #define ISACX__MOS 0x02
  312. #define ISACX__TRAN 0x04
  313. #define ISACX__AUX 0x08
  314. #define ISACX__CIC 0x10
  315. #define ISACX__ST 0x20
  316. #define IPACX__ICB 0x40
  317. #define IPACX__ICA 0x80
  318. #define IPACX__ON 0x2C
  319. /* ISACX/IPACX _CMDRD (W) */
  320. #define ISACX_CMDRD_XRES 0x01
  321. #define ISACX_CMDRD_XME 0x02
  322. #define ISACX_CMDRD_XTF 0x08
  323. #define ISACX_CMDRD_STI 0x10
  324. #define ISACX_CMDRD_RRES 0x40
  325. #define ISACX_CMDRD_RMC 0x80
  326. /* ISACX/IPACX _RSTAD (R) */
  327. #define ISACX_RSTAD_TA 0x01
  328. #define ISACX_RSTAD_CR 0x02
  329. #define ISACX_RSTAD_SA0 0x04
  330. #define ISACX_RSTAD_SA1 0x08
  331. #define ISACX_RSTAD_RAB 0x10
  332. #define ISACX_RSTAD_CRC 0x20
  333. #define ISACX_RSTAD_RDO 0x40
  334. #define ISACX_RSTAD_VFR 0x80
  335. /* ISACX/IPACX _CIR0 (R) */
  336. #define ISACX_CIR0_BAS 0x01
  337. #define ISACX_CIR0_SG 0x08
  338. #define ISACX_CIR0_CIC1 0x08
  339. #define ISACX_CIR0_CIC0 0x08
  340. /* B-channel registers */
  341. #define IPACX_OFF_ICA 0x70
  342. #define IPACX_OFF_ICB 0x80
  343. /* ICA: IPACX_OFF_ICA + Reg ICB: IPACX_OFF_ICB + Reg */
  344. #define IPACX_ISTAB 0x00 /* RD */
  345. #define IPACX_MASKB 0x00 /* WR */
  346. #define IPACX_STARB 0x01 /* RD */
  347. #define IPACX_CMDRB 0x01 /* WR */
  348. #define IPACX_MODEB 0x02 /* R/W */
  349. #define IPACX_EXMB 0x03 /* R/W */
  350. #define IPACX_RAH1 0x05 /* WR */
  351. #define IPACX_RAH2 0x06 /* WR */
  352. #define IPACX_RBCLB 0x06 /* RD */
  353. #define IPACX_RBCHB 0x07 /* RD */
  354. #define IPACX_RAL1 0x07 /* WR */
  355. #define IPACX_RAL2 0x08 /* WR */
  356. #define IPACX_RSTAB 0x08 /* RD */
  357. #define IPACX_TMB 0x09 /* R/W */
  358. #define IPACX_RFIFOB 0x0A /* RD */
  359. #define IPACX_XFIFOB 0x0A /* WR */
  360. /* IPACX_ISTAB / IPACX_MASKB bits */
  361. #define IPACX_B_XDU 0x04
  362. #define IPACX_B_XPR 0x10
  363. #define IPACX_B_RFO 0x20
  364. #define IPACX_B_RPF 0x40
  365. #define IPACX_B_RME 0x80
  366. #define IPACX_B_ON 0x0B
  367. extern int mISDNisac_init(struct isac_hw *, void *);
  368. extern irqreturn_t mISDNisac_irq(struct isac_hw *, u8);
  369. extern u32 mISDNipac_init(struct ipac_hw *, void *);
  370. extern irqreturn_t mISDNipac_irq(struct ipac_hw *, int);