hfc_multi.h 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  1. /*
  2. * see notice in hfc_multi.c
  3. */
  4. #define DEBUG_HFCMULTI_FIFO 0x00010000
  5. #define DEBUG_HFCMULTI_CRC 0x00020000
  6. #define DEBUG_HFCMULTI_INIT 0x00040000
  7. #define DEBUG_HFCMULTI_PLXSD 0x00080000
  8. #define DEBUG_HFCMULTI_MODE 0x00100000
  9. #define DEBUG_HFCMULTI_MSG 0x00200000
  10. #define DEBUG_HFCMULTI_STATE 0x00400000
  11. #define DEBUG_HFCMULTI_FILL 0x00800000
  12. #define DEBUG_HFCMULTI_SYNC 0x01000000
  13. #define DEBUG_HFCMULTI_DTMF 0x02000000
  14. #define DEBUG_HFCMULTI_LOCK 0x80000000
  15. #define PCI_ENA_REGIO 0x01
  16. #define PCI_ENA_MEMIO 0x02
  17. #define XHFC_IRQ 4 /* SIU_IRQ2 */
  18. #define XHFC_MEMBASE 0xFE000000
  19. #define XHFC_MEMSIZE 0x00001000
  20. #define XHFC_OFFSET 0x00001000
  21. #define PA_XHFC_A0 0x0020 /* PA10 */
  22. #define PB_XHFC_IRQ1 0x00000100 /* PB23 */
  23. #define PB_XHFC_IRQ2 0x00000200 /* PB22 */
  24. #define PB_XHFC_IRQ3 0x00000400 /* PB21 */
  25. #define PB_XHFC_IRQ4 0x00000800 /* PB20 */
  26. /*
  27. * NOTE: some registers are assigned multiple times due to different modes
  28. * also registers are assigned differen for HFC-4s/8s and HFC-E1
  29. */
  30. /*
  31. #define MAX_FRAME_SIZE 2048
  32. */
  33. struct hfc_chan {
  34. struct dchannel *dch; /* link if channel is a D-channel */
  35. struct bchannel *bch; /* link if channel is a B-channel */
  36. int port; /* the interface port this */
  37. /* channel is associated with */
  38. int nt_timer; /* -1 if off, 0 if elapsed, >0 if running */
  39. int los, ais, slip_tx, slip_rx, rdi; /* current alarms */
  40. int jitter;
  41. u_long cfg; /* port configuration */
  42. int sync; /* sync state (used by E1) */
  43. u_int protocol; /* current protocol */
  44. int slot_tx; /* current pcm slot */
  45. int bank_tx; /* current pcm bank */
  46. int slot_rx;
  47. int bank_rx;
  48. int conf; /* conference setting of TX slot */
  49. int txpending; /* if there is currently data in */
  50. /* the FIFO 0=no, 1=yes, 2=splloop */
  51. int Zfill; /* rx-fifo level on last hfcmulti_tx */
  52. int rx_off; /* set to turn fifo receive off */
  53. int coeff_count; /* curren coeff block */
  54. s32 *coeff; /* memory pointer to 8 coeff blocks */
  55. };
  56. struct hfcm_hw {
  57. u_char r_ctrl;
  58. u_char r_irq_ctrl;
  59. u_char r_cirm;
  60. u_char r_ram_sz;
  61. u_char r_pcm_md0;
  62. u_char r_irqmsk_misc;
  63. u_char r_dtmf;
  64. u_char r_st_sync;
  65. u_char r_sci_msk;
  66. u_char r_tx0, r_tx1;
  67. u_char a_st_ctrl0[8];
  68. u_char r_bert_wd_md;
  69. timer_t timer;
  70. };
  71. /* for each stack these flags are used (cfg) */
  72. #define HFC_CFG_NONCAP_TX 1 /* S/T TX interface has less capacity */
  73. #define HFC_CFG_DIS_ECHANNEL 2 /* disable E-channel processing */
  74. #define HFC_CFG_REG_ECHANNEL 3 /* register E-channel */
  75. #define HFC_CFG_OPTICAL 4 /* the E1 interface is optical */
  76. #define HFC_CFG_REPORT_LOS 5 /* the card should report loss of signal */
  77. #define HFC_CFG_REPORT_AIS 6 /* the card should report alarm ind. sign. */
  78. #define HFC_CFG_REPORT_SLIP 7 /* the card should report bit slips */
  79. #define HFC_CFG_REPORT_RDI 8 /* the card should report remote alarm */
  80. #define HFC_CFG_DTMF 9 /* enable DTMF-detection */
  81. #define HFC_CFG_CRC4 10 /* disable CRC-4 Multiframe mode, */
  82. /* use double frame instead. */
  83. #define HFC_TYPE_E1 1 /* controller is HFC-E1 */
  84. #define HFC_TYPE_4S 4 /* controller is HFC-4S */
  85. #define HFC_TYPE_8S 8 /* controller is HFC-8S */
  86. #define HFC_TYPE_XHFC 5 /* controller is XHFC */
  87. #define HFC_CHIP_EXRAM_128 0 /* external ram 128k */
  88. #define HFC_CHIP_EXRAM_512 1 /* external ram 256k */
  89. #define HFC_CHIP_REVISION0 2 /* old fifo handling */
  90. #define HFC_CHIP_PCM_SLAVE 3 /* PCM is slave */
  91. #define HFC_CHIP_PCM_MASTER 4 /* PCM is master */
  92. #define HFC_CHIP_RX_SYNC 5 /* disable pll sync for pcm */
  93. #define HFC_CHIP_DTMF 6 /* DTMF decoding is enabled */
  94. #define HFC_CHIP_CONF 7 /* conference handling is enabled */
  95. #define HFC_CHIP_ULAW 8 /* ULAW mode */
  96. #define HFC_CHIP_CLOCK2 9 /* double clock mode */
  97. #define HFC_CHIP_E1CLOCK_GET 10 /* always get clock from E1 interface */
  98. #define HFC_CHIP_E1CLOCK_PUT 11 /* always put clock from E1 interface */
  99. #define HFC_CHIP_WATCHDOG 12 /* whether we should send signals */
  100. /* to the watchdog */
  101. #define HFC_CHIP_B410P 13 /* whether we have a b410p with echocan in */
  102. /* hw */
  103. #define HFC_CHIP_PLXSD 14 /* whether we have a Speech-Design PLX */
  104. #define HFC_CHIP_EMBSD 15 /* whether we have a SD Embedded board */
  105. #define HFC_IO_MODE_PCIMEM 0x00 /* normal memory mapped IO */
  106. #define HFC_IO_MODE_REGIO 0x01 /* PCI io access */
  107. #define HFC_IO_MODE_PLXSD 0x02 /* access HFC via PLX9030 */
  108. #define HFC_IO_MODE_EMBSD 0x03 /* direct access */
  109. /* table entry in the PCI devices list */
  110. struct hm_map {
  111. char *vendor_name;
  112. char *card_name;
  113. int type;
  114. int ports;
  115. int clock2;
  116. int leds;
  117. int opticalsupport;
  118. int dip_type;
  119. int io_mode;
  120. int irq;
  121. };
  122. struct hfc_multi {
  123. struct list_head list;
  124. struct hm_map *mtyp;
  125. int id;
  126. int pcm; /* id of pcm bus */
  127. int ctype; /* controller type */
  128. int ports;
  129. u_int irq; /* irq used by card */
  130. u_int irqcnt;
  131. struct pci_dev *pci_dev;
  132. int io_mode; /* selects mode */
  133. #ifdef HFC_REGISTER_DEBUG
  134. void (*HFC_outb)(struct hfc_multi *hc, u_char reg,
  135. u_char val, const char *function, int line);
  136. void (*HFC_outb_nodebug)(struct hfc_multi *hc, u_char reg,
  137. u_char val, const char *function, int line);
  138. u_char (*HFC_inb)(struct hfc_multi *hc, u_char reg,
  139. const char *function, int line);
  140. u_char (*HFC_inb_nodebug)(struct hfc_multi *hc, u_char reg,
  141. const char *function, int line);
  142. u_short (*HFC_inw)(struct hfc_multi *hc, u_char reg,
  143. const char *function, int line);
  144. u_short (*HFC_inw_nodebug)(struct hfc_multi *hc, u_char reg,
  145. const char *function, int line);
  146. void (*HFC_wait)(struct hfc_multi *hc,
  147. const char *function, int line);
  148. void (*HFC_wait_nodebug)(struct hfc_multi *hc,
  149. const char *function, int line);
  150. #else
  151. void (*HFC_outb)(struct hfc_multi *hc, u_char reg,
  152. u_char val);
  153. void (*HFC_outb_nodebug)(struct hfc_multi *hc, u_char reg,
  154. u_char val);
  155. u_char (*HFC_inb)(struct hfc_multi *hc, u_char reg);
  156. u_char (*HFC_inb_nodebug)(struct hfc_multi *hc, u_char reg);
  157. u_short (*HFC_inw)(struct hfc_multi *hc, u_char reg);
  158. u_short (*HFC_inw_nodebug)(struct hfc_multi *hc, u_char reg);
  159. void (*HFC_wait)(struct hfc_multi *hc);
  160. void (*HFC_wait_nodebug)(struct hfc_multi *hc);
  161. #endif
  162. void (*read_fifo)(struct hfc_multi *hc, u_char *data,
  163. int len);
  164. void (*write_fifo)(struct hfc_multi *hc, u_char *data,
  165. int len);
  166. u_long pci_origmembase, plx_origmembase;
  167. void __iomem *pci_membase; /* PCI memory */
  168. void __iomem *plx_membase; /* PLX memory */
  169. u_long xhfc_origmembase;
  170. u_char *xhfc_membase;
  171. u_long *xhfc_memaddr, *xhfc_memdata;
  172. #ifdef CONFIG_MISDN_HFCMULTI_8xx
  173. struct immap *immap;
  174. #endif
  175. u_long pb_irqmsk; /* Portbit mask to check the IRQ line */
  176. u_long pci_iobase; /* PCI IO */
  177. struct hfcm_hw hw; /* remember data of write-only-registers */
  178. u_long chip; /* chip configuration */
  179. int masterclk; /* port that provides master clock -1=off */
  180. unsigned char silence;/* silence byte */
  181. unsigned char silence_data[128];/* silence block */
  182. int dtmf; /* flag that dtmf is currently in process */
  183. int Flen; /* F-buffer size */
  184. int Zlen; /* Z-buffer size (must be int for calculation)*/
  185. int max_trans; /* maximum transparent fifo fill */
  186. int Zmin; /* Z-buffer offset */
  187. int DTMFbase; /* base address of DTMF coefficients */
  188. u_int slots; /* number of PCM slots */
  189. u_int leds; /* type of leds */
  190. u_long ledstate; /* save last state of leds */
  191. int opticalsupport; /* has the e1 board */
  192. /* an optical Interface */
  193. u_int bmask[32]; /* bitmask of bchannels for port */
  194. u_char dnum[32]; /* array of used dchannel numbers for port */
  195. u_char created[32]; /* what port is created */
  196. u_int activity_tx; /* if there is data TX / RX */
  197. u_int activity_rx; /* bitmask according to port number */
  198. /* (will be cleared after */
  199. /* showing led-states) */
  200. u_int flash[8]; /* counter for flashing 8 leds on activity */
  201. u_long wdcount; /* every 500 ms we need to */
  202. /* send the watchdog a signal */
  203. u_char wdbyte; /* watchdog toggle byte */
  204. int e1_state; /* keep track of last state */
  205. int e1_getclock; /* if sync is retrieved from interface */
  206. int syncronized; /* keep track of existing sync interface */
  207. int e1_resync; /* resync jobs */
  208. spinlock_t lock; /* the lock */
  209. struct mISDNclock *iclock; /* isdn clock support */
  210. int iclock_on;
  211. /*
  212. * the channel index is counted from 0, regardless where the channel
  213. * is located on the hfc-channel.
  214. * the bch->channel is equvalent to the hfc-channel
  215. */
  216. struct hfc_chan chan[32];
  217. signed char slot_owner[256]; /* owner channel of slot */
  218. };
  219. /* PLX GPIOs */
  220. #define PLX_GPIO4_DIR_BIT 13
  221. #define PLX_GPIO4_BIT 14
  222. #define PLX_GPIO5_DIR_BIT 16
  223. #define PLX_GPIO5_BIT 17
  224. #define PLX_GPIO6_DIR_BIT 19
  225. #define PLX_GPIO6_BIT 20
  226. #define PLX_GPIO7_DIR_BIT 22
  227. #define PLX_GPIO7_BIT 23
  228. #define PLX_GPIO8_DIR_BIT 25
  229. #define PLX_GPIO8_BIT 26
  230. #define PLX_GPIO4 (1 << PLX_GPIO4_BIT)
  231. #define PLX_GPIO5 (1 << PLX_GPIO5_BIT)
  232. #define PLX_GPIO6 (1 << PLX_GPIO6_BIT)
  233. #define PLX_GPIO7 (1 << PLX_GPIO7_BIT)
  234. #define PLX_GPIO8 (1 << PLX_GPIO8_BIT)
  235. #define PLX_GPIO4_DIR (1 << PLX_GPIO4_DIR_BIT)
  236. #define PLX_GPIO5_DIR (1 << PLX_GPIO5_DIR_BIT)
  237. #define PLX_GPIO6_DIR (1 << PLX_GPIO6_DIR_BIT)
  238. #define PLX_GPIO7_DIR (1 << PLX_GPIO7_DIR_BIT)
  239. #define PLX_GPIO8_DIR (1 << PLX_GPIO8_DIR_BIT)
  240. #define PLX_TERM_ON PLX_GPIO7
  241. #define PLX_SLAVE_EN_N PLX_GPIO5
  242. #define PLX_MASTER_EN PLX_GPIO6
  243. #define PLX_SYNC_O_EN PLX_GPIO4
  244. #define PLX_DSP_RES_N PLX_GPIO8
  245. /* GPIO4..8 Enable & Set to OUT, SLAVE_EN_N = 1 */
  246. #define PLX_GPIOC_INIT (PLX_GPIO4_DIR | PLX_GPIO5_DIR | PLX_GPIO6_DIR \
  247. | PLX_GPIO7_DIR | PLX_GPIO8_DIR | PLX_SLAVE_EN_N)
  248. /* PLX Interrupt Control/STATUS */
  249. #define PLX_INTCSR_LINTI1_ENABLE 0x01
  250. #define PLX_INTCSR_LINTI1_STATUS 0x04
  251. #define PLX_INTCSR_LINTI2_ENABLE 0x08
  252. #define PLX_INTCSR_LINTI2_STATUS 0x20
  253. #define PLX_INTCSR_PCIINT_ENABLE 0x40
  254. /* PLX Registers */
  255. #define PLX_INTCSR 0x4c
  256. #define PLX_CNTRL 0x50
  257. #define PLX_GPIOC 0x54
  258. /*
  259. * REGISTER SETTING FOR HFC-4S/8S AND HFC-E1
  260. */
  261. /* write only registers */
  262. #define R_CIRM 0x00
  263. #define R_CTRL 0x01
  264. #define R_BRG_PCM_CFG 0x02
  265. #define R_RAM_ADDR0 0x08
  266. #define R_RAM_ADDR1 0x09
  267. #define R_RAM_ADDR2 0x0A
  268. #define R_FIRST_FIFO 0x0B
  269. #define R_RAM_SZ 0x0C
  270. #define R_FIFO_MD 0x0D
  271. #define R_INC_RES_FIFO 0x0E
  272. #define R_FSM_IDX 0x0F
  273. #define R_FIFO 0x0F
  274. #define R_SLOT 0x10
  275. #define R_IRQMSK_MISC 0x11
  276. #define R_SCI_MSK 0x12
  277. #define R_IRQ_CTRL 0x13
  278. #define R_PCM_MD0 0x14
  279. #define R_PCM_MD1 0x15
  280. #define R_PCM_MD2 0x15
  281. #define R_SH0H 0x15
  282. #define R_SH1H 0x15
  283. #define R_SH0L 0x15
  284. #define R_SH1L 0x15
  285. #define R_SL_SEL0 0x15
  286. #define R_SL_SEL1 0x15
  287. #define R_SL_SEL2 0x15
  288. #define R_SL_SEL3 0x15
  289. #define R_SL_SEL4 0x15
  290. #define R_SL_SEL5 0x15
  291. #define R_SL_SEL6 0x15
  292. #define R_SL_SEL7 0x15
  293. #define R_ST_SEL 0x16
  294. #define R_ST_SYNC 0x17
  295. #define R_CONF_EN 0x18
  296. #define R_TI_WD 0x1A
  297. #define R_BERT_WD_MD 0x1B
  298. #define R_DTMF 0x1C
  299. #define R_DTMF_N 0x1D
  300. #define R_E1_WR_STA 0x20
  301. #define R_E1_RD_STA 0x20
  302. #define R_LOS0 0x22
  303. #define R_LOS1 0x23
  304. #define R_RX0 0x24
  305. #define R_RX_FR0 0x25
  306. #define R_RX_FR1 0x26
  307. #define R_TX0 0x28
  308. #define R_TX1 0x29
  309. #define R_TX_FR0 0x2C
  310. #define R_TX_FR1 0x2D
  311. #define R_TX_FR2 0x2E
  312. #define R_JATT_ATT 0x2F /* undocumented */
  313. #define A_ST_RD_STATE 0x30
  314. #define A_ST_WR_STATE 0x30
  315. #define R_RX_OFF 0x30
  316. #define A_ST_CTRL0 0x31
  317. #define R_SYNC_OUT 0x31
  318. #define A_ST_CTRL1 0x32
  319. #define A_ST_CTRL2 0x33
  320. #define A_ST_SQ_WR 0x34
  321. #define R_TX_OFF 0x34
  322. #define R_SYNC_CTRL 0x35
  323. #define A_ST_CLK_DLY 0x37
  324. #define R_PWM0 0x38
  325. #define R_PWM1 0x39
  326. #define A_ST_B1_TX 0x3C
  327. #define A_ST_B2_TX 0x3D
  328. #define A_ST_D_TX 0x3E
  329. #define R_GPIO_OUT0 0x40
  330. #define R_GPIO_OUT1 0x41
  331. #define R_GPIO_EN0 0x42
  332. #define R_GPIO_EN1 0x43
  333. #define R_GPIO_SEL 0x44
  334. #define R_BRG_CTRL 0x45
  335. #define R_PWM_MD 0x46
  336. #define R_BRG_MD 0x47
  337. #define R_BRG_TIM0 0x48
  338. #define R_BRG_TIM1 0x49
  339. #define R_BRG_TIM2 0x4A
  340. #define R_BRG_TIM3 0x4B
  341. #define R_BRG_TIM_SEL01 0x4C
  342. #define R_BRG_TIM_SEL23 0x4D
  343. #define R_BRG_TIM_SEL45 0x4E
  344. #define R_BRG_TIM_SEL67 0x4F
  345. #define A_SL_CFG 0xD0
  346. #define A_CONF 0xD1
  347. #define A_CH_MSK 0xF4
  348. #define A_CON_HDLC 0xFA
  349. #define A_SUBCH_CFG 0xFB
  350. #define A_CHANNEL 0xFC
  351. #define A_FIFO_SEQ 0xFD
  352. #define A_IRQ_MSK 0xFF
  353. /* read only registers */
  354. #define A_Z12 0x04
  355. #define A_Z1L 0x04
  356. #define A_Z1 0x04
  357. #define A_Z1H 0x05
  358. #define A_Z2L 0x06
  359. #define A_Z2 0x06
  360. #define A_Z2H 0x07
  361. #define A_F1 0x0C
  362. #define A_F12 0x0C
  363. #define A_F2 0x0D
  364. #define R_IRQ_OVIEW 0x10
  365. #define R_IRQ_MISC 0x11
  366. #define R_IRQ_STATECH 0x12
  367. #define R_CONF_OFLOW 0x14
  368. #define R_RAM_USE 0x15
  369. #define R_CHIP_ID 0x16
  370. #define R_BERT_STA 0x17
  371. #define R_F0_CNTL 0x18
  372. #define R_F0_CNTH 0x19
  373. #define R_BERT_EC 0x1A
  374. #define R_BERT_ECL 0x1A
  375. #define R_BERT_ECH 0x1B
  376. #define R_STATUS 0x1C
  377. #define R_CHIP_RV 0x1F
  378. #define R_STATE 0x20
  379. #define R_SYNC_STA 0x24
  380. #define R_RX_SL0_0 0x25
  381. #define R_RX_SL0_1 0x26
  382. #define R_RX_SL0_2 0x27
  383. #define R_JATT_DIR 0x2b /* undocumented */
  384. #define R_SLIP 0x2c
  385. #define A_ST_RD_STA 0x30
  386. #define R_FAS_EC 0x30
  387. #define R_FAS_ECL 0x30
  388. #define R_FAS_ECH 0x31
  389. #define R_VIO_EC 0x32
  390. #define R_VIO_ECL 0x32
  391. #define R_VIO_ECH 0x33
  392. #define A_ST_SQ_RD 0x34
  393. #define R_CRC_EC 0x34
  394. #define R_CRC_ECL 0x34
  395. #define R_CRC_ECH 0x35
  396. #define R_E_EC 0x36
  397. #define R_E_ECL 0x36
  398. #define R_E_ECH 0x37
  399. #define R_SA6_SA13_EC 0x38
  400. #define R_SA6_SA13_ECL 0x38
  401. #define R_SA6_SA13_ECH 0x39
  402. #define R_SA6_SA23_EC 0x3A
  403. #define R_SA6_SA23_ECL 0x3A
  404. #define R_SA6_SA23_ECH 0x3B
  405. #define A_ST_B1_RX 0x3C
  406. #define A_ST_B2_RX 0x3D
  407. #define A_ST_D_RX 0x3E
  408. #define A_ST_E_RX 0x3F
  409. #define R_GPIO_IN0 0x40
  410. #define R_GPIO_IN1 0x41
  411. #define R_GPI_IN0 0x44
  412. #define R_GPI_IN1 0x45
  413. #define R_GPI_IN2 0x46
  414. #define R_GPI_IN3 0x47
  415. #define R_INT_DATA 0x88
  416. #define R_IRQ_FIFO_BL0 0xC8
  417. #define R_IRQ_FIFO_BL1 0xC9
  418. #define R_IRQ_FIFO_BL2 0xCA
  419. #define R_IRQ_FIFO_BL3 0xCB
  420. #define R_IRQ_FIFO_BL4 0xCC
  421. #define R_IRQ_FIFO_BL5 0xCD
  422. #define R_IRQ_FIFO_BL6 0xCE
  423. #define R_IRQ_FIFO_BL7 0xCF
  424. /* read and write registers */
  425. #define A_FIFO_DATA0 0x80
  426. #define A_FIFO_DATA1 0x80
  427. #define A_FIFO_DATA2 0x80
  428. #define A_FIFO_DATA0_NOINC 0x84
  429. #define A_FIFO_DATA1_NOINC 0x84
  430. #define A_FIFO_DATA2_NOINC 0x84
  431. #define R_RAM_DATA 0xC0
  432. /*
  433. * BIT SETTING FOR HFC-4S/8S AND HFC-E1
  434. */
  435. /* chapter 2: universal bus interface */
  436. /* R_CIRM */
  437. #define V_IRQ_SEL 0x01
  438. #define V_SRES 0x08
  439. #define V_HFCRES 0x10
  440. #define V_PCMRES 0x20
  441. #define V_STRES 0x40
  442. #define V_ETRES 0x40
  443. #define V_RLD_EPR 0x80
  444. /* R_CTRL */
  445. #define V_FIFO_LPRIO 0x02
  446. #define V_SLOW_RD 0x04
  447. #define V_EXT_RAM 0x08
  448. #define V_CLK_OFF 0x20
  449. #define V_ST_CLK 0x40
  450. /* R_RAM_ADDR0 */
  451. #define V_RAM_ADDR2 0x01
  452. #define V_ADDR_RES 0x40
  453. #define V_ADDR_INC 0x80
  454. /* R_RAM_SZ */
  455. #define V_RAM_SZ 0x01
  456. #define V_PWM0_16KHZ 0x10
  457. #define V_PWM1_16KHZ 0x20
  458. #define V_FZ_MD 0x80
  459. /* R_CHIP_ID */
  460. #define V_PNP_IRQ 0x01
  461. #define V_CHIP_ID 0x10
  462. /* chapter 3: data flow */
  463. /* R_FIRST_FIFO */
  464. #define V_FIRST_FIRO_DIR 0x01
  465. #define V_FIRST_FIFO_NUM 0x02
  466. /* R_FIFO_MD */
  467. #define V_FIFO_MD 0x01
  468. #define V_CSM_MD 0x04
  469. #define V_FSM_MD 0x08
  470. #define V_FIFO_SZ 0x10
  471. /* R_FIFO */
  472. #define V_FIFO_DIR 0x01
  473. #define V_FIFO_NUM 0x02
  474. #define V_REV 0x80
  475. /* R_SLOT */
  476. #define V_SL_DIR 0x01
  477. #define V_SL_NUM 0x02
  478. /* A_SL_CFG */
  479. #define V_CH_DIR 0x01
  480. #define V_CH_SEL 0x02
  481. #define V_ROUTING 0x40
  482. /* A_CON_HDLC */
  483. #define V_IFF 0x01
  484. #define V_HDLC_TRP 0x02
  485. #define V_TRP_IRQ 0x04
  486. #define V_DATA_FLOW 0x20
  487. /* A_SUBCH_CFG */
  488. #define V_BIT_CNT 0x01
  489. #define V_START_BIT 0x08
  490. #define V_LOOP_FIFO 0x40
  491. #define V_INV_DATA 0x80
  492. /* A_CHANNEL */
  493. #define V_CH_DIR0 0x01
  494. #define V_CH_NUM0 0x02
  495. /* A_FIFO_SEQ */
  496. #define V_NEXT_FIFO_DIR 0x01
  497. #define V_NEXT_FIFO_NUM 0x02
  498. #define V_SEQ_END 0x40
  499. /* chapter 4: FIFO handling and HDLC controller */
  500. /* R_INC_RES_FIFO */
  501. #define V_INC_F 0x01
  502. #define V_RES_F 0x02
  503. #define V_RES_LOST 0x04
  504. /* chapter 5: S/T interface */
  505. /* R_SCI_MSK */
  506. #define V_SCI_MSK_ST0 0x01
  507. #define V_SCI_MSK_ST1 0x02
  508. #define V_SCI_MSK_ST2 0x04
  509. #define V_SCI_MSK_ST3 0x08
  510. #define V_SCI_MSK_ST4 0x10
  511. #define V_SCI_MSK_ST5 0x20
  512. #define V_SCI_MSK_ST6 0x40
  513. #define V_SCI_MSK_ST7 0x80
  514. /* R_ST_SEL */
  515. #define V_ST_SEL 0x01
  516. #define V_MULT_ST 0x08
  517. /* R_ST_SYNC */
  518. #define V_SYNC_SEL 0x01
  519. #define V_AUTO_SYNC 0x08
  520. /* A_ST_WR_STA */
  521. #define V_ST_SET_STA 0x01
  522. #define V_ST_LD_STA 0x10
  523. #define V_ST_ACT 0x20
  524. #define V_SET_G2_G3 0x80
  525. /* A_ST_CTRL0 */
  526. #define V_B1_EN 0x01
  527. #define V_B2_EN 0x02
  528. #define V_ST_MD 0x04
  529. #define V_D_PRIO 0x08
  530. #define V_SQ_EN 0x10
  531. #define V_96KHZ 0x20
  532. #define V_TX_LI 0x40
  533. #define V_ST_STOP 0x80
  534. /* A_ST_CTRL1 */
  535. #define V_G2_G3_EN 0x01
  536. #define V_D_HI 0x04
  537. #define V_E_IGNO 0x08
  538. #define V_E_LO 0x10
  539. #define V_B12_SWAP 0x80
  540. /* A_ST_CTRL2 */
  541. #define V_B1_RX_EN 0x01
  542. #define V_B2_RX_EN 0x02
  543. #define V_ST_TRIS 0x40
  544. /* A_ST_CLK_DLY */
  545. #define V_ST_CK_DLY 0x01
  546. #define V_ST_SMPL 0x10
  547. /* A_ST_D_TX */
  548. #define V_ST_D_TX 0x40
  549. /* R_IRQ_STATECH */
  550. #define V_SCI_ST0 0x01
  551. #define V_SCI_ST1 0x02
  552. #define V_SCI_ST2 0x04
  553. #define V_SCI_ST3 0x08
  554. #define V_SCI_ST4 0x10
  555. #define V_SCI_ST5 0x20
  556. #define V_SCI_ST6 0x40
  557. #define V_SCI_ST7 0x80
  558. /* A_ST_RD_STA */
  559. #define V_ST_STA 0x01
  560. #define V_FR_SYNC_ST 0x10
  561. #define V_TI2_EXP 0x20
  562. #define V_INFO0 0x40
  563. #define V_G2_G3 0x80
  564. /* A_ST_SQ_RD */
  565. #define V_ST_SQ 0x01
  566. #define V_MF_RX_RDY 0x10
  567. #define V_MF_TX_RDY 0x80
  568. /* A_ST_D_RX */
  569. #define V_ST_D_RX 0x40
  570. /* A_ST_E_RX */
  571. #define V_ST_E_RX 0x40
  572. /* chapter 5: E1 interface */
  573. /* R_E1_WR_STA */
  574. /* R_E1_RD_STA */
  575. #define V_E1_SET_STA 0x01
  576. #define V_E1_LD_STA 0x10
  577. /* R_RX0 */
  578. #define V_RX_CODE 0x01
  579. #define V_RX_FBAUD 0x04
  580. #define V_RX_CMI 0x08
  581. #define V_RX_INV_CMI 0x10
  582. #define V_RX_INV_CLK 0x20
  583. #define V_RX_INV_DATA 0x40
  584. #define V_AIS_ITU 0x80
  585. /* R_RX_FR0 */
  586. #define V_NO_INSYNC 0x01
  587. #define V_AUTO_RESYNC 0x02
  588. #define V_AUTO_RECO 0x04
  589. #define V_SWORD_COND 0x08
  590. #define V_SYNC_LOSS 0x10
  591. #define V_XCRC_SYNC 0x20
  592. #define V_MF_RESYNC 0x40
  593. #define V_RESYNC 0x80
  594. /* R_RX_FR1 */
  595. #define V_RX_MF 0x01
  596. #define V_RX_MF_SYNC 0x02
  597. #define V_RX_SL0_RAM 0x04
  598. #define V_ERR_SIM 0x20
  599. #define V_RES_NMF 0x40
  600. /* R_TX0 */
  601. #define V_TX_CODE 0x01
  602. #define V_TX_FBAUD 0x04
  603. #define V_TX_CMI_CODE 0x08
  604. #define V_TX_INV_CMI_CODE 0x10
  605. #define V_TX_INV_CLK 0x20
  606. #define V_TX_INV_DATA 0x40
  607. #define V_OUT_EN 0x80
  608. /* R_TX1 */
  609. #define V_INV_CLK 0x01
  610. #define V_EXCHG_DATA_LI 0x02
  611. #define V_AIS_OUT 0x04
  612. #define V_ATX 0x20
  613. #define V_NTRI 0x40
  614. #define V_AUTO_ERR_RES 0x80
  615. /* R_TX_FR0 */
  616. #define V_TRP_FAS 0x01
  617. #define V_TRP_NFAS 0x02
  618. #define V_TRP_RAL 0x04
  619. #define V_TRP_SA 0x08
  620. /* R_TX_FR1 */
  621. #define V_TX_FAS 0x01
  622. #define V_TX_NFAS 0x02
  623. #define V_TX_RAL 0x04
  624. #define V_TX_SA 0x08
  625. /* R_TX_FR2 */
  626. #define V_TX_MF 0x01
  627. #define V_TRP_SL0 0x02
  628. #define V_TX_SL0_RAM 0x04
  629. #define V_TX_E 0x10
  630. #define V_NEG_E 0x20
  631. #define V_XS12_ON 0x40
  632. #define V_XS15_ON 0x80
  633. /* R_RX_OFF */
  634. #define V_RX_SZ 0x01
  635. #define V_RX_INIT 0x04
  636. /* R_SYNC_OUT */
  637. #define V_SYNC_E1_RX 0x01
  638. #define V_IPATS0 0x20
  639. #define V_IPATS1 0x40
  640. #define V_IPATS2 0x80
  641. /* R_TX_OFF */
  642. #define V_TX_SZ 0x01
  643. #define V_TX_INIT 0x04
  644. /* R_SYNC_CTRL */
  645. #define V_EXT_CLK_SYNC 0x01
  646. #define V_SYNC_OFFS 0x02
  647. #define V_PCM_SYNC 0x04
  648. #define V_NEG_CLK 0x08
  649. #define V_HCLK 0x10
  650. /*
  651. #define V_JATT_AUTO_DEL 0x20
  652. #define V_JATT_AUTO 0x40
  653. */
  654. #define V_JATT_OFF 0x80
  655. /* R_STATE */
  656. #define V_E1_STA 0x01
  657. #define V_ALT_FR_RX 0x40
  658. #define V_ALT_FR_TX 0x80
  659. /* R_SYNC_STA */
  660. #define V_RX_STA 0x01
  661. #define V_FR_SYNC_E1 0x04
  662. #define V_SIG_LOS 0x08
  663. #define V_MFA_STA 0x10
  664. #define V_AIS 0x40
  665. #define V_NO_MF_SYNC 0x80
  666. /* R_RX_SL0_0 */
  667. #define V_SI_FAS 0x01
  668. #define V_SI_NFAS 0x02
  669. #define V_A 0x04
  670. #define V_CRC_OK 0x08
  671. #define V_TX_E1 0x10
  672. #define V_TX_E2 0x20
  673. #define V_RX_E1 0x40
  674. #define V_RX_E2 0x80
  675. /* R_SLIP */
  676. #define V_SLIP_RX 0x01
  677. #define V_FOSLIP_RX 0x08
  678. #define V_SLIP_TX 0x10
  679. #define V_FOSLIP_TX 0x80
  680. /* chapter 6: PCM interface */
  681. /* R_PCM_MD0 */
  682. #define V_PCM_MD 0x01
  683. #define V_C4_POL 0x02
  684. #define V_F0_NEG 0x04
  685. #define V_F0_LEN 0x08
  686. #define V_PCM_ADDR 0x10
  687. /* R_SL_SEL0 */
  688. #define V_SL_SEL0 0x01
  689. #define V_SH_SEL0 0x80
  690. /* R_SL_SEL1 */
  691. #define V_SL_SEL1 0x01
  692. #define V_SH_SEL1 0x80
  693. /* R_SL_SEL2 */
  694. #define V_SL_SEL2 0x01
  695. #define V_SH_SEL2 0x80
  696. /* R_SL_SEL3 */
  697. #define V_SL_SEL3 0x01
  698. #define V_SH_SEL3 0x80
  699. /* R_SL_SEL4 */
  700. #define V_SL_SEL4 0x01
  701. #define V_SH_SEL4 0x80
  702. /* R_SL_SEL5 */
  703. #define V_SL_SEL5 0x01
  704. #define V_SH_SEL5 0x80
  705. /* R_SL_SEL6 */
  706. #define V_SL_SEL6 0x01
  707. #define V_SH_SEL6 0x80
  708. /* R_SL_SEL7 */
  709. #define V_SL_SEL7 0x01
  710. #define V_SH_SEL7 0x80
  711. /* R_PCM_MD1 */
  712. #define V_ODEC_CON 0x01
  713. #define V_PLL_ADJ 0x04
  714. #define V_PCM_DR 0x10
  715. #define V_PCM_LOOP 0x40
  716. /* R_PCM_MD2 */
  717. #define V_SYNC_PLL 0x02
  718. #define V_SYNC_SRC 0x04
  719. #define V_SYNC_OUT 0x08
  720. #define V_ICR_FR_TIME 0x40
  721. #define V_EN_PLL 0x80
  722. /* chapter 7: pulse width modulation */
  723. /* R_PWM_MD */
  724. #define V_EXT_IRQ_EN 0x08
  725. #define V_PWM0_MD 0x10
  726. #define V_PWM1_MD 0x40
  727. /* chapter 8: multiparty audio conferences */
  728. /* R_CONF_EN */
  729. #define V_CONF_EN 0x01
  730. #define V_ULAW 0x80
  731. /* A_CONF */
  732. #define V_CONF_NUM 0x01
  733. #define V_NOISE_SUPPR 0x08
  734. #define V_ATT_LEV 0x20
  735. #define V_CONF_SL 0x80
  736. /* R_CONF_OFLOW */
  737. #define V_CONF_OFLOW0 0x01
  738. #define V_CONF_OFLOW1 0x02
  739. #define V_CONF_OFLOW2 0x04
  740. #define V_CONF_OFLOW3 0x08
  741. #define V_CONF_OFLOW4 0x10
  742. #define V_CONF_OFLOW5 0x20
  743. #define V_CONF_OFLOW6 0x40
  744. #define V_CONF_OFLOW7 0x80
  745. /* chapter 9: DTMF contoller */
  746. /* R_DTMF0 */
  747. #define V_DTMF_EN 0x01
  748. #define V_HARM_SEL 0x02
  749. #define V_DTMF_RX_CH 0x04
  750. #define V_DTMF_STOP 0x08
  751. #define V_CHBL_SEL 0x10
  752. #define V_RST_DTMF 0x40
  753. #define V_ULAW_SEL 0x80
  754. /* chapter 10: BERT */
  755. /* R_BERT_WD_MD */
  756. #define V_PAT_SEQ 0x01
  757. #define V_BERT_ERR 0x08
  758. #define V_AUTO_WD_RES 0x20
  759. #define V_WD_RES 0x80
  760. /* R_BERT_STA */
  761. #define V_BERT_SYNC_SRC 0x01
  762. #define V_BERT_SYNC 0x10
  763. #define V_BERT_INV_DATA 0x20
  764. /* chapter 11: auxiliary interface */
  765. /* R_BRG_PCM_CFG */
  766. #define V_BRG_EN 0x01
  767. #define V_BRG_MD 0x02
  768. #define V_PCM_CLK 0x20
  769. #define V_ADDR_WRDLY 0x40
  770. /* R_BRG_CTRL */
  771. #define V_BRG_CS 0x01
  772. #define V_BRG_ADDR 0x08
  773. #define V_BRG_CS_SRC 0x80
  774. /* R_BRG_MD */
  775. #define V_BRG_MD0 0x01
  776. #define V_BRG_MD1 0x02
  777. #define V_BRG_MD2 0x04
  778. #define V_BRG_MD3 0x08
  779. #define V_BRG_MD4 0x10
  780. #define V_BRG_MD5 0x20
  781. #define V_BRG_MD6 0x40
  782. #define V_BRG_MD7 0x80
  783. /* R_BRG_TIM0 */
  784. #define V_BRG_TIM0_IDLE 0x01
  785. #define V_BRG_TIM0_CLK 0x10
  786. /* R_BRG_TIM1 */
  787. #define V_BRG_TIM1_IDLE 0x01
  788. #define V_BRG_TIM1_CLK 0x10
  789. /* R_BRG_TIM2 */
  790. #define V_BRG_TIM2_IDLE 0x01
  791. #define V_BRG_TIM2_CLK 0x10
  792. /* R_BRG_TIM3 */
  793. #define V_BRG_TIM3_IDLE 0x01
  794. #define V_BRG_TIM3_CLK 0x10
  795. /* R_BRG_TIM_SEL01 */
  796. #define V_BRG_WR_SEL0 0x01
  797. #define V_BRG_RD_SEL0 0x04
  798. #define V_BRG_WR_SEL1 0x10
  799. #define V_BRG_RD_SEL1 0x40
  800. /* R_BRG_TIM_SEL23 */
  801. #define V_BRG_WR_SEL2 0x01
  802. #define V_BRG_RD_SEL2 0x04
  803. #define V_BRG_WR_SEL3 0x10
  804. #define V_BRG_RD_SEL3 0x40
  805. /* R_BRG_TIM_SEL45 */
  806. #define V_BRG_WR_SEL4 0x01
  807. #define V_BRG_RD_SEL4 0x04
  808. #define V_BRG_WR_SEL5 0x10
  809. #define V_BRG_RD_SEL5 0x40
  810. /* R_BRG_TIM_SEL67 */
  811. #define V_BRG_WR_SEL6 0x01
  812. #define V_BRG_RD_SEL6 0x04
  813. #define V_BRG_WR_SEL7 0x10
  814. #define V_BRG_RD_SEL7 0x40
  815. /* chapter 12: clock, reset, interrupt, timer and watchdog */
  816. /* R_IRQMSK_MISC */
  817. #define V_STA_IRQMSK 0x01
  818. #define V_TI_IRQMSK 0x02
  819. #define V_PROC_IRQMSK 0x04
  820. #define V_DTMF_IRQMSK 0x08
  821. #define V_IRQ1S_MSK 0x10
  822. #define V_SA6_IRQMSK 0x20
  823. #define V_RX_EOMF_MSK 0x40
  824. #define V_TX_EOMF_MSK 0x80
  825. /* R_IRQ_CTRL */
  826. #define V_FIFO_IRQ 0x01
  827. #define V_GLOB_IRQ_EN 0x08
  828. #define V_IRQ_POL 0x10
  829. /* R_TI_WD */
  830. #define V_EV_TS 0x01
  831. #define V_WD_TS 0x10
  832. /* A_IRQ_MSK */
  833. #define V_IRQ 0x01
  834. #define V_BERT_EN 0x02
  835. #define V_MIX_IRQ 0x04
  836. /* R_IRQ_OVIEW */
  837. #define V_IRQ_FIFO_BL0 0x01
  838. #define V_IRQ_FIFO_BL1 0x02
  839. #define V_IRQ_FIFO_BL2 0x04
  840. #define V_IRQ_FIFO_BL3 0x08
  841. #define V_IRQ_FIFO_BL4 0x10
  842. #define V_IRQ_FIFO_BL5 0x20
  843. #define V_IRQ_FIFO_BL6 0x40
  844. #define V_IRQ_FIFO_BL7 0x80
  845. /* R_IRQ_MISC */
  846. #define V_STA_IRQ 0x01
  847. #define V_TI_IRQ 0x02
  848. #define V_IRQ_PROC 0x04
  849. #define V_DTMF_IRQ 0x08
  850. #define V_IRQ1S 0x10
  851. #define V_SA6_IRQ 0x20
  852. #define V_RX_EOMF 0x40
  853. #define V_TX_EOMF 0x80
  854. /* R_STATUS */
  855. #define V_BUSY 0x01
  856. #define V_PROC 0x02
  857. #define V_DTMF_STA 0x04
  858. #define V_LOST_STA 0x08
  859. #define V_SYNC_IN 0x10
  860. #define V_EXT_IRQSTA 0x20
  861. #define V_MISC_IRQSTA 0x40
  862. #define V_FR_IRQSTA 0x80
  863. /* R_IRQ_FIFO_BL0 */
  864. #define V_IRQ_FIFO0_TX 0x01
  865. #define V_IRQ_FIFO0_RX 0x02
  866. #define V_IRQ_FIFO1_TX 0x04
  867. #define V_IRQ_FIFO1_RX 0x08
  868. #define V_IRQ_FIFO2_TX 0x10
  869. #define V_IRQ_FIFO2_RX 0x20
  870. #define V_IRQ_FIFO3_TX 0x40
  871. #define V_IRQ_FIFO3_RX 0x80
  872. /* R_IRQ_FIFO_BL1 */
  873. #define V_IRQ_FIFO4_TX 0x01
  874. #define V_IRQ_FIFO4_RX 0x02
  875. #define V_IRQ_FIFO5_TX 0x04
  876. #define V_IRQ_FIFO5_RX 0x08
  877. #define V_IRQ_FIFO6_TX 0x10
  878. #define V_IRQ_FIFO6_RX 0x20
  879. #define V_IRQ_FIFO7_TX 0x40
  880. #define V_IRQ_FIFO7_RX 0x80
  881. /* R_IRQ_FIFO_BL2 */
  882. #define V_IRQ_FIFO8_TX 0x01
  883. #define V_IRQ_FIFO8_RX 0x02
  884. #define V_IRQ_FIFO9_TX 0x04
  885. #define V_IRQ_FIFO9_RX 0x08
  886. #define V_IRQ_FIFO10_TX 0x10
  887. #define V_IRQ_FIFO10_RX 0x20
  888. #define V_IRQ_FIFO11_TX 0x40
  889. #define V_IRQ_FIFO11_RX 0x80
  890. /* R_IRQ_FIFO_BL3 */
  891. #define V_IRQ_FIFO12_TX 0x01
  892. #define V_IRQ_FIFO12_RX 0x02
  893. #define V_IRQ_FIFO13_TX 0x04
  894. #define V_IRQ_FIFO13_RX 0x08
  895. #define V_IRQ_FIFO14_TX 0x10
  896. #define V_IRQ_FIFO14_RX 0x20
  897. #define V_IRQ_FIFO15_TX 0x40
  898. #define V_IRQ_FIFO15_RX 0x80
  899. /* R_IRQ_FIFO_BL4 */
  900. #define V_IRQ_FIFO16_TX 0x01
  901. #define V_IRQ_FIFO16_RX 0x02
  902. #define V_IRQ_FIFO17_TX 0x04
  903. #define V_IRQ_FIFO17_RX 0x08
  904. #define V_IRQ_FIFO18_TX 0x10
  905. #define V_IRQ_FIFO18_RX 0x20
  906. #define V_IRQ_FIFO19_TX 0x40
  907. #define V_IRQ_FIFO19_RX 0x80
  908. /* R_IRQ_FIFO_BL5 */
  909. #define V_IRQ_FIFO20_TX 0x01
  910. #define V_IRQ_FIFO20_RX 0x02
  911. #define V_IRQ_FIFO21_TX 0x04
  912. #define V_IRQ_FIFO21_RX 0x08
  913. #define V_IRQ_FIFO22_TX 0x10
  914. #define V_IRQ_FIFO22_RX 0x20
  915. #define V_IRQ_FIFO23_TX 0x40
  916. #define V_IRQ_FIFO23_RX 0x80
  917. /* R_IRQ_FIFO_BL6 */
  918. #define V_IRQ_FIFO24_TX 0x01
  919. #define V_IRQ_FIFO24_RX 0x02
  920. #define V_IRQ_FIFO25_TX 0x04
  921. #define V_IRQ_FIFO25_RX 0x08
  922. #define V_IRQ_FIFO26_TX 0x10
  923. #define V_IRQ_FIFO26_RX 0x20
  924. #define V_IRQ_FIFO27_TX 0x40
  925. #define V_IRQ_FIFO27_RX 0x80
  926. /* R_IRQ_FIFO_BL7 */
  927. #define V_IRQ_FIFO28_TX 0x01
  928. #define V_IRQ_FIFO28_RX 0x02
  929. #define V_IRQ_FIFO29_TX 0x04
  930. #define V_IRQ_FIFO29_RX 0x08
  931. #define V_IRQ_FIFO30_TX 0x10
  932. #define V_IRQ_FIFO30_RX 0x20
  933. #define V_IRQ_FIFO31_TX 0x40
  934. #define V_IRQ_FIFO31_RX 0x80
  935. /* chapter 13: general purpose I/O pins (GPIO) and input pins (GPI) */
  936. /* R_GPIO_OUT0 */
  937. #define V_GPIO_OUT0 0x01
  938. #define V_GPIO_OUT1 0x02
  939. #define V_GPIO_OUT2 0x04
  940. #define V_GPIO_OUT3 0x08
  941. #define V_GPIO_OUT4 0x10
  942. #define V_GPIO_OUT5 0x20
  943. #define V_GPIO_OUT6 0x40
  944. #define V_GPIO_OUT7 0x80
  945. /* R_GPIO_OUT1 */
  946. #define V_GPIO_OUT8 0x01
  947. #define V_GPIO_OUT9 0x02
  948. #define V_GPIO_OUT10 0x04
  949. #define V_GPIO_OUT11 0x08
  950. #define V_GPIO_OUT12 0x10
  951. #define V_GPIO_OUT13 0x20
  952. #define V_GPIO_OUT14 0x40
  953. #define V_GPIO_OUT15 0x80
  954. /* R_GPIO_EN0 */
  955. #define V_GPIO_EN0 0x01
  956. #define V_GPIO_EN1 0x02
  957. #define V_GPIO_EN2 0x04
  958. #define V_GPIO_EN3 0x08
  959. #define V_GPIO_EN4 0x10
  960. #define V_GPIO_EN5 0x20
  961. #define V_GPIO_EN6 0x40
  962. #define V_GPIO_EN7 0x80
  963. /* R_GPIO_EN1 */
  964. #define V_GPIO_EN8 0x01
  965. #define V_GPIO_EN9 0x02
  966. #define V_GPIO_EN10 0x04
  967. #define V_GPIO_EN11 0x08
  968. #define V_GPIO_EN12 0x10
  969. #define V_GPIO_EN13 0x20
  970. #define V_GPIO_EN14 0x40
  971. #define V_GPIO_EN15 0x80
  972. /* R_GPIO_SEL */
  973. #define V_GPIO_SEL0 0x01
  974. #define V_GPIO_SEL1 0x02
  975. #define V_GPIO_SEL2 0x04
  976. #define V_GPIO_SEL3 0x08
  977. #define V_GPIO_SEL4 0x10
  978. #define V_GPIO_SEL5 0x20
  979. #define V_GPIO_SEL6 0x40
  980. #define V_GPIO_SEL7 0x80
  981. /* R_GPIO_IN0 */
  982. #define V_GPIO_IN0 0x01
  983. #define V_GPIO_IN1 0x02
  984. #define V_GPIO_IN2 0x04
  985. #define V_GPIO_IN3 0x08
  986. #define V_GPIO_IN4 0x10
  987. #define V_GPIO_IN5 0x20
  988. #define V_GPIO_IN6 0x40
  989. #define V_GPIO_IN7 0x80
  990. /* R_GPIO_IN1 */
  991. #define V_GPIO_IN8 0x01
  992. #define V_GPIO_IN9 0x02
  993. #define V_GPIO_IN10 0x04
  994. #define V_GPIO_IN11 0x08
  995. #define V_GPIO_IN12 0x10
  996. #define V_GPIO_IN13 0x20
  997. #define V_GPIO_IN14 0x40
  998. #define V_GPIO_IN15 0x80
  999. /* R_GPI_IN0 */
  1000. #define V_GPI_IN0 0x01
  1001. #define V_GPI_IN1 0x02
  1002. #define V_GPI_IN2 0x04
  1003. #define V_GPI_IN3 0x08
  1004. #define V_GPI_IN4 0x10
  1005. #define V_GPI_IN5 0x20
  1006. #define V_GPI_IN6 0x40
  1007. #define V_GPI_IN7 0x80
  1008. /* R_GPI_IN1 */
  1009. #define V_GPI_IN8 0x01
  1010. #define V_GPI_IN9 0x02
  1011. #define V_GPI_IN10 0x04
  1012. #define V_GPI_IN11 0x08
  1013. #define V_GPI_IN12 0x10
  1014. #define V_GPI_IN13 0x20
  1015. #define V_GPI_IN14 0x40
  1016. #define V_GPI_IN15 0x80
  1017. /* R_GPI_IN2 */
  1018. #define V_GPI_IN16 0x01
  1019. #define V_GPI_IN17 0x02
  1020. #define V_GPI_IN18 0x04
  1021. #define V_GPI_IN19 0x08
  1022. #define V_GPI_IN20 0x10
  1023. #define V_GPI_IN21 0x20
  1024. #define V_GPI_IN22 0x40
  1025. #define V_GPI_IN23 0x80
  1026. /* R_GPI_IN3 */
  1027. #define V_GPI_IN24 0x01
  1028. #define V_GPI_IN25 0x02
  1029. #define V_GPI_IN26 0x04
  1030. #define V_GPI_IN27 0x08
  1031. #define V_GPI_IN28 0x10
  1032. #define V_GPI_IN29 0x20
  1033. #define V_GPI_IN30 0x40
  1034. #define V_GPI_IN31 0x80
  1035. /* map of all registers, used for debugging */
  1036. #ifdef HFC_REGISTER_DEBUG
  1037. struct hfc_register_names {
  1038. char *name;
  1039. u_char reg;
  1040. } hfc_register_names[] = {
  1041. /* write registers */
  1042. {"R_CIRM", 0x00},
  1043. {"R_CTRL", 0x01},
  1044. {"R_BRG_PCM_CFG ", 0x02},
  1045. {"R_RAM_ADDR0", 0x08},
  1046. {"R_RAM_ADDR1", 0x09},
  1047. {"R_RAM_ADDR2", 0x0A},
  1048. {"R_FIRST_FIFO", 0x0B},
  1049. {"R_RAM_SZ", 0x0C},
  1050. {"R_FIFO_MD", 0x0D},
  1051. {"R_INC_RES_FIFO", 0x0E},
  1052. {"R_FIFO / R_FSM_IDX", 0x0F},
  1053. {"R_SLOT", 0x10},
  1054. {"R_IRQMSK_MISC", 0x11},
  1055. {"R_SCI_MSK", 0x12},
  1056. {"R_IRQ_CTRL", 0x13},
  1057. {"R_PCM_MD0", 0x14},
  1058. {"R_0x15", 0x15},
  1059. {"R_ST_SEL", 0x16},
  1060. {"R_ST_SYNC", 0x17},
  1061. {"R_CONF_EN", 0x18},
  1062. {"R_TI_WD", 0x1A},
  1063. {"R_BERT_WD_MD", 0x1B},
  1064. {"R_DTMF", 0x1C},
  1065. {"R_DTMF_N", 0x1D},
  1066. {"R_E1_XX_STA", 0x20},
  1067. {"R_LOS0", 0x22},
  1068. {"R_LOS1", 0x23},
  1069. {"R_RX0", 0x24},
  1070. {"R_RX_FR0", 0x25},
  1071. {"R_RX_FR1", 0x26},
  1072. {"R_TX0", 0x28},
  1073. {"R_TX1", 0x29},
  1074. {"R_TX_FR0", 0x2C},
  1075. {"R_TX_FR1", 0x2D},
  1076. {"R_TX_FR2", 0x2E},
  1077. {"R_JATT_ATT", 0x2F},
  1078. {"A_ST_xx_STA/R_RX_OFF", 0x30},
  1079. {"A_ST_CTRL0/R_SYNC_OUT", 0x31},
  1080. {"A_ST_CTRL1", 0x32},
  1081. {"A_ST_CTRL2", 0x33},
  1082. {"A_ST_SQ_WR", 0x34},
  1083. {"R_TX_OFF", 0x34},
  1084. {"R_SYNC_CTRL", 0x35},
  1085. {"A_ST_CLK_DLY", 0x37},
  1086. {"R_PWM0", 0x38},
  1087. {"R_PWM1", 0x39},
  1088. {"A_ST_B1_TX", 0x3C},
  1089. {"A_ST_B2_TX", 0x3D},
  1090. {"A_ST_D_TX", 0x3E},
  1091. {"R_GPIO_OUT0", 0x40},
  1092. {"R_GPIO_OUT1", 0x41},
  1093. {"R_GPIO_EN0", 0x42},
  1094. {"R_GPIO_EN1", 0x43},
  1095. {"R_GPIO_SEL", 0x44},
  1096. {"R_BRG_CTRL", 0x45},
  1097. {"R_PWM_MD", 0x46},
  1098. {"R_BRG_MD", 0x47},
  1099. {"R_BRG_TIM0", 0x48},
  1100. {"R_BRG_TIM1", 0x49},
  1101. {"R_BRG_TIM2", 0x4A},
  1102. {"R_BRG_TIM3", 0x4B},
  1103. {"R_BRG_TIM_SEL01", 0x4C},
  1104. {"R_BRG_TIM_SEL23", 0x4D},
  1105. {"R_BRG_TIM_SEL45", 0x4E},
  1106. {"R_BRG_TIM_SEL67", 0x4F},
  1107. {"A_FIFO_DATA0-2", 0x80},
  1108. {"A_FIFO_DATA0-2_NOINC", 0x84},
  1109. {"R_RAM_DATA", 0xC0},
  1110. {"A_SL_CFG", 0xD0},
  1111. {"A_CONF", 0xD1},
  1112. {"A_CH_MSK", 0xF4},
  1113. {"A_CON_HDLC", 0xFA},
  1114. {"A_SUBCH_CFG", 0xFB},
  1115. {"A_CHANNEL", 0xFC},
  1116. {"A_FIFO_SEQ", 0xFD},
  1117. {"A_IRQ_MSK", 0xFF},
  1118. {NULL, 0},
  1119. /* read registers */
  1120. {"A_Z1", 0x04},
  1121. {"A_Z1H", 0x05},
  1122. {"A_Z2", 0x06},
  1123. {"A_Z2H", 0x07},
  1124. {"A_F1", 0x0C},
  1125. {"A_F2", 0x0D},
  1126. {"R_IRQ_OVIEW", 0x10},
  1127. {"R_IRQ_MISC", 0x11},
  1128. {"R_IRQ_STATECH", 0x12},
  1129. {"R_CONF_OFLOW", 0x14},
  1130. {"R_RAM_USE", 0x15},
  1131. {"R_CHIP_ID", 0x16},
  1132. {"R_BERT_STA", 0x17},
  1133. {"R_F0_CNTL", 0x18},
  1134. {"R_F0_CNTH", 0x19},
  1135. {"R_BERT_ECL", 0x1A},
  1136. {"R_BERT_ECH", 0x1B},
  1137. {"R_STATUS", 0x1C},
  1138. {"R_CHIP_RV", 0x1F},
  1139. {"R_STATE", 0x20},
  1140. {"R_SYNC_STA", 0x24},
  1141. {"R_RX_SL0_0", 0x25},
  1142. {"R_RX_SL0_1", 0x26},
  1143. {"R_RX_SL0_2", 0x27},
  1144. {"R_JATT_DIR", 0x2b},
  1145. {"R_SLIP", 0x2c},
  1146. {"A_ST_RD_STA", 0x30},
  1147. {"R_FAS_ECL", 0x30},
  1148. {"R_FAS_ECH", 0x31},
  1149. {"R_VIO_ECL", 0x32},
  1150. {"R_VIO_ECH", 0x33},
  1151. {"R_CRC_ECL / A_ST_SQ_RD", 0x34},
  1152. {"R_CRC_ECH", 0x35},
  1153. {"R_E_ECL", 0x36},
  1154. {"R_E_ECH", 0x37},
  1155. {"R_SA6_SA13_ECL", 0x38},
  1156. {"R_SA6_SA13_ECH", 0x39},
  1157. {"R_SA6_SA23_ECL", 0x3A},
  1158. {"R_SA6_SA23_ECH", 0x3B},
  1159. {"A_ST_B1_RX", 0x3C},
  1160. {"A_ST_B2_RX", 0x3D},
  1161. {"A_ST_D_RX", 0x3E},
  1162. {"A_ST_E_RX", 0x3F},
  1163. {"R_GPIO_IN0", 0x40},
  1164. {"R_GPIO_IN1", 0x41},
  1165. {"R_GPI_IN0", 0x44},
  1166. {"R_GPI_IN1", 0x45},
  1167. {"R_GPI_IN2", 0x46},
  1168. {"R_GPI_IN3", 0x47},
  1169. {"A_FIFO_DATA0-2", 0x80},
  1170. {"A_FIFO_DATA0-2_NOINC", 0x84},
  1171. {"R_INT_DATA", 0x88},
  1172. {"R_RAM_DATA", 0xC0},
  1173. {"R_IRQ_FIFO_BL0", 0xC8},
  1174. {"R_IRQ_FIFO_BL1", 0xC9},
  1175. {"R_IRQ_FIFO_BL2", 0xCA},
  1176. {"R_IRQ_FIFO_BL3", 0xCB},
  1177. {"R_IRQ_FIFO_BL4", 0xCC},
  1178. {"R_IRQ_FIFO_BL5", 0xCD},
  1179. {"R_IRQ_FIFO_BL6", 0xCE},
  1180. {"R_IRQ_FIFO_BL7", 0xCF},
  1181. };
  1182. #endif /* HFC_REGISTER_DEBUG */