Lines Matching refs:isac

34 ph_command(struct isac_hw *isac, u8 command)  in ph_command()  argument
36 pr_debug("%s: ph_command %x\n", isac->name, command); in ph_command()
37 if (isac->type & IPAC_TYPE_ISACX) in ph_command()
38 WriteISAC(isac, ISACX_CIX0, (command << 4) | 0xE); in ph_command()
40 WriteISAC(isac, ISAC_CIX0, (command << 2) | 3); in ph_command()
44 isac_ph_state_change(struct isac_hw *isac) in isac_ph_state_change() argument
46 switch (isac->state) { in isac_ph_state_change()
49 ph_command(isac, ISAC_CMD_DUI); in isac_ph_state_change()
51 schedule_event(&isac->dch, FLG_PHCHANGE); in isac_ph_state_change()
57 struct isac_hw *isac = container_of(dch, struct isac_hw, dch); in isac_ph_state_bh() local
59 switch (isac->state) { in isac_ph_state_bh()
100 pr_debug("%s: TE newstate %x\n", isac->name, dch->state); in isac_ph_state_bh()
104 isac_empty_fifo(struct isac_hw *isac, int count) in isac_empty_fifo() argument
108 pr_debug("%s: %s %d\n", isac->name, __func__, count); in isac_empty_fifo()
110 if (!isac->dch.rx_skb) { in isac_empty_fifo()
111 isac->dch.rx_skb = mI_alloc_skb(isac->dch.maxlen, GFP_ATOMIC); in isac_empty_fifo()
112 if (!isac->dch.rx_skb) { in isac_empty_fifo()
113 pr_info("%s: D receive out of memory\n", isac->name); in isac_empty_fifo()
114 WriteISAC(isac, ISAC_CMDR, 0x80); in isac_empty_fifo()
118 if ((isac->dch.rx_skb->len + count) >= isac->dch.maxlen) { in isac_empty_fifo()
119 pr_debug("%s: %s overrun %d\n", isac->name, __func__, in isac_empty_fifo()
120 isac->dch.rx_skb->len + count); in isac_empty_fifo()
121 WriteISAC(isac, ISAC_CMDR, 0x80); in isac_empty_fifo()
124 ptr = skb_put(isac->dch.rx_skb, count); in isac_empty_fifo()
125 isac->read_fifo(isac->dch.hw, isac->off, ptr, count); in isac_empty_fifo()
126 WriteISAC(isac, ISAC_CMDR, 0x80); in isac_empty_fifo()
127 if (isac->dch.debug & DEBUG_HW_DFIFO) { in isac_empty_fifo()
131 isac->name, count); in isac_empty_fifo()
137 isac_fill_fifo(struct isac_hw *isac) in isac_fill_fifo() argument
142 if (!isac->dch.tx_skb) in isac_fill_fifo()
144 count = isac->dch.tx_skb->len - isac->dch.tx_idx; in isac_fill_fifo()
153 pr_debug("%s: %s %d\n", isac->name, __func__, count); in isac_fill_fifo()
154 ptr = isac->dch.tx_skb->data + isac->dch.tx_idx; in isac_fill_fifo()
155 isac->dch.tx_idx += count; in isac_fill_fifo()
156 isac->write_fifo(isac->dch.hw, isac->off, ptr, count); in isac_fill_fifo()
157 WriteISAC(isac, ISAC_CMDR, more ? 0x8 : 0xa); in isac_fill_fifo()
158 if (test_and_set_bit(FLG_BUSY_TIMER, &isac->dch.Flags)) { in isac_fill_fifo()
159 pr_debug("%s: %s dbusytimer running\n", isac->name, __func__); in isac_fill_fifo()
160 del_timer(&isac->dch.timer); in isac_fill_fifo()
162 isac->dch.timer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ)/1000); in isac_fill_fifo()
163 add_timer(&isac->dch.timer); in isac_fill_fifo()
164 if (isac->dch.debug & DEBUG_HW_DFIFO) { in isac_fill_fifo()
168 isac->name, count); in isac_fill_fifo()
174 isac_rme_irq(struct isac_hw *isac) in isac_rme_irq() argument
178 val = ReadISAC(isac, ISAC_RSTA); in isac_rme_irq()
181 pr_debug("%s: ISAC RDO\n", isac->name); in isac_rme_irq()
183 isac->dch.err_rx++; in isac_rme_irq()
187 pr_debug("%s: ISAC CRC error\n", isac->name); in isac_rme_irq()
189 isac->dch.err_crc++; in isac_rme_irq()
192 WriteISAC(isac, ISAC_CMDR, 0x80); in isac_rme_irq()
193 dev_kfree_skb(isac->dch.rx_skb); in isac_rme_irq()
194 isac->dch.rx_skb = NULL; in isac_rme_irq()
196 count = ReadISAC(isac, ISAC_RBCL) & 0x1f; in isac_rme_irq()
199 isac_empty_fifo(isac, count); in isac_rme_irq()
200 recv_Dchannel(&isac->dch); in isac_rme_irq()
205 isac_xpr_irq(struct isac_hw *isac) in isac_xpr_irq() argument
207 if (test_and_clear_bit(FLG_BUSY_TIMER, &isac->dch.Flags)) in isac_xpr_irq()
208 del_timer(&isac->dch.timer); in isac_xpr_irq()
209 if (isac->dch.tx_skb && isac->dch.tx_idx < isac->dch.tx_skb->len) { in isac_xpr_irq()
210 isac_fill_fifo(isac); in isac_xpr_irq()
212 dev_kfree_skb(isac->dch.tx_skb); in isac_xpr_irq()
213 if (get_next_dframe(&isac->dch)) in isac_xpr_irq()
214 isac_fill_fifo(isac); in isac_xpr_irq()
219 isac_retransmit(struct isac_hw *isac) in isac_retransmit() argument
221 if (test_and_clear_bit(FLG_BUSY_TIMER, &isac->dch.Flags)) in isac_retransmit()
222 del_timer(&isac->dch.timer); in isac_retransmit()
223 if (test_bit(FLG_TX_BUSY, &isac->dch.Flags)) { in isac_retransmit()
225 isac->dch.tx_idx = 0; in isac_retransmit()
226 isac_fill_fifo(isac); in isac_retransmit()
227 } else if (isac->dch.tx_skb) { /* should not happen */ in isac_retransmit()
228 pr_info("%s: tx_skb exist but not busy\n", isac->name); in isac_retransmit()
229 test_and_set_bit(FLG_TX_BUSY, &isac->dch.Flags); in isac_retransmit()
230 isac->dch.tx_idx = 0; in isac_retransmit()
231 isac_fill_fifo(isac); in isac_retransmit()
233 pr_info("%s: ISAC XDU no TX_BUSY\n", isac->name); in isac_retransmit()
234 if (get_next_dframe(&isac->dch)) in isac_retransmit()
235 isac_fill_fifo(isac); in isac_retransmit()
240 isac_mos_irq(struct isac_hw *isac) in isac_mos_irq() argument
245 val = ReadISAC(isac, ISAC_MOSR); in isac_mos_irq()
246 pr_debug("%s: ISAC MOSR %02x\n", isac->name, val); in isac_mos_irq()
249 if (!isac->mon_rx) { in isac_mos_irq()
250 isac->mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC); in isac_mos_irq()
251 if (!isac->mon_rx) { in isac_mos_irq()
253 isac->name); in isac_mos_irq()
254 isac->mocr &= 0xf0; in isac_mos_irq()
255 isac->mocr |= 0x0a; in isac_mos_irq()
256 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
259 isac->mon_rxp = 0; in isac_mos_irq()
261 if (isac->mon_rxp >= MAX_MON_FRAME) { in isac_mos_irq()
262 isac->mocr &= 0xf0; in isac_mos_irq()
263 isac->mocr |= 0x0a; in isac_mos_irq()
264 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
265 isac->mon_rxp = 0; in isac_mos_irq()
266 pr_debug("%s: ISAC MON RX overflow!\n", isac->name); in isac_mos_irq()
269 isac->mon_rx[isac->mon_rxp++] = ReadISAC(isac, ISAC_MOR0); in isac_mos_irq()
270 pr_debug("%s: ISAC MOR0 %02x\n", isac->name, in isac_mos_irq()
271 isac->mon_rx[isac->mon_rxp - 1]); in isac_mos_irq()
272 if (isac->mon_rxp == 1) { in isac_mos_irq()
273 isac->mocr |= 0x04; in isac_mos_irq()
274 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
279 if (!isac->mon_rx) { in isac_mos_irq()
280 isac->mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC); in isac_mos_irq()
281 if (!isac->mon_rx) { in isac_mos_irq()
283 isac->name); in isac_mos_irq()
284 isac->mocr &= 0x0f; in isac_mos_irq()
285 isac->mocr |= 0xa0; in isac_mos_irq()
286 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
289 isac->mon_rxp = 0; in isac_mos_irq()
291 if (isac->mon_rxp >= MAX_MON_FRAME) { in isac_mos_irq()
292 isac->mocr &= 0x0f; in isac_mos_irq()
293 isac->mocr |= 0xa0; in isac_mos_irq()
294 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
295 isac->mon_rxp = 0; in isac_mos_irq()
296 pr_debug("%s: ISAC MON RX overflow!\n", isac->name); in isac_mos_irq()
299 isac->mon_rx[isac->mon_rxp++] = ReadISAC(isac, ISAC_MOR1); in isac_mos_irq()
300 pr_debug("%s: ISAC MOR1 %02x\n", isac->name, in isac_mos_irq()
301 isac->mon_rx[isac->mon_rxp - 1]); in isac_mos_irq()
302 isac->mocr |= 0x40; in isac_mos_irq()
303 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
307 isac->mocr &= 0xf0; in isac_mos_irq()
308 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
309 isac->mocr |= 0x0a; in isac_mos_irq()
310 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
311 if (isac->monitor) { in isac_mos_irq()
312 ret = isac->monitor(isac->dch.hw, MONITOR_RX_0, in isac_mos_irq()
313 isac->mon_rx, isac->mon_rxp); in isac_mos_irq()
315 kfree(isac->mon_rx); in isac_mos_irq()
318 isac->name, isac->mon_rxp); in isac_mos_irq()
319 kfree(isac->mon_rx); in isac_mos_irq()
321 isac->mon_rx = NULL; in isac_mos_irq()
322 isac->mon_rxp = 0; in isac_mos_irq()
325 isac->mocr &= 0x0f; in isac_mos_irq()
326 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
327 isac->mocr |= 0xa0; in isac_mos_irq()
328 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
329 if (isac->monitor) { in isac_mos_irq()
330 ret = isac->monitor(isac->dch.hw, MONITOR_RX_1, in isac_mos_irq()
331 isac->mon_rx, isac->mon_rxp); in isac_mos_irq()
333 kfree(isac->mon_rx); in isac_mos_irq()
336 isac->name, isac->mon_rxp); in isac_mos_irq()
337 kfree(isac->mon_rx); in isac_mos_irq()
339 isac->mon_rx = NULL; in isac_mos_irq()
340 isac->mon_rxp = 0; in isac_mos_irq()
343 if ((!isac->mon_tx) || (isac->mon_txc && in isac_mos_irq()
344 (isac->mon_txp >= isac->mon_txc) && !(val & 0x08))) { in isac_mos_irq()
345 isac->mocr &= 0xf0; in isac_mos_irq()
346 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
347 isac->mocr |= 0x0a; in isac_mos_irq()
348 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
349 if (isac->mon_txc && (isac->mon_txp >= isac->mon_txc)) { in isac_mos_irq()
350 if (isac->monitor) in isac_mos_irq()
351 isac->monitor(isac->dch.hw, in isac_mos_irq()
354 kfree(isac->mon_tx); in isac_mos_irq()
355 isac->mon_tx = NULL; in isac_mos_irq()
356 isac->mon_txc = 0; in isac_mos_irq()
357 isac->mon_txp = 0; in isac_mos_irq()
360 if (isac->mon_txc && (isac->mon_txp >= isac->mon_txc)) { in isac_mos_irq()
361 if (isac->monitor) in isac_mos_irq()
362 isac->monitor(isac->dch.hw, in isac_mos_irq()
364 kfree(isac->mon_tx); in isac_mos_irq()
365 isac->mon_tx = NULL; in isac_mos_irq()
366 isac->mon_txc = 0; in isac_mos_irq()
367 isac->mon_txp = 0; in isac_mos_irq()
370 WriteISAC(isac, ISAC_MOX0, isac->mon_tx[isac->mon_txp++]); in isac_mos_irq()
371 pr_debug("%s: ISAC %02x -> MOX0\n", isac->name, in isac_mos_irq()
372 isac->mon_tx[isac->mon_txp - 1]); in isac_mos_irq()
376 if ((!isac->mon_tx) || (isac->mon_txc && in isac_mos_irq()
377 (isac->mon_txp >= isac->mon_txc) && !(val & 0x80))) { in isac_mos_irq()
378 isac->mocr &= 0x0f; in isac_mos_irq()
379 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
380 isac->mocr |= 0xa0; in isac_mos_irq()
381 WriteISAC(isac, ISAC_MOCR, isac->mocr); in isac_mos_irq()
382 if (isac->mon_txc && (isac->mon_txp >= isac->mon_txc)) { in isac_mos_irq()
383 if (isac->monitor) in isac_mos_irq()
384 isac->monitor(isac->dch.hw, in isac_mos_irq()
387 kfree(isac->mon_tx); in isac_mos_irq()
388 isac->mon_tx = NULL; in isac_mos_irq()
389 isac->mon_txc = 0; in isac_mos_irq()
390 isac->mon_txp = 0; in isac_mos_irq()
393 if (isac->mon_txc && (isac->mon_txp >= isac->mon_txc)) { in isac_mos_irq()
394 if (isac->monitor) in isac_mos_irq()
395 isac->monitor(isac->dch.hw, in isac_mos_irq()
397 kfree(isac->mon_tx); in isac_mos_irq()
398 isac->mon_tx = NULL; in isac_mos_irq()
399 isac->mon_txc = 0; in isac_mos_irq()
400 isac->mon_txp = 0; in isac_mos_irq()
403 WriteISAC(isac, ISAC_MOX1, isac->mon_tx[isac->mon_txp++]); in isac_mos_irq()
404 pr_debug("%s: ISAC %02x -> MOX1\n", isac->name, in isac_mos_irq()
405 isac->mon_tx[isac->mon_txp - 1]); in isac_mos_irq()
413 isac_cisq_irq(struct isac_hw *isac) { in isac_cisq_irq() argument
416 val = ReadISAC(isac, ISAC_CIR0); in isac_cisq_irq()
417 pr_debug("%s: ISAC CIR0 %02X\n", isac->name, val); in isac_cisq_irq()
419 pr_debug("%s: ph_state change %x->%x\n", isac->name, in isac_cisq_irq()
420 isac->state, (val >> 2) & 0xf); in isac_cisq_irq()
421 isac->state = (val >> 2) & 0xf; in isac_cisq_irq()
422 isac_ph_state_change(isac); in isac_cisq_irq()
425 val = ReadISAC(isac, ISAC_CIR1); in isac_cisq_irq()
426 pr_debug("%s: ISAC CIR1 %02X\n", isac->name, val); in isac_cisq_irq()
431 isacsx_cic_irq(struct isac_hw *isac) in isacsx_cic_irq() argument
435 val = ReadISAC(isac, ISACX_CIR0); in isacsx_cic_irq()
436 pr_debug("%s: ISACX CIR0 %02X\n", isac->name, val); in isacsx_cic_irq()
438 pr_debug("%s: ph_state change %x->%x\n", isac->name, in isacsx_cic_irq()
439 isac->state, val >> 4); in isacsx_cic_irq()
440 isac->state = val >> 4; in isacsx_cic_irq()
441 isac_ph_state_change(isac); in isacsx_cic_irq()
446 isacsx_rme_irq(struct isac_hw *isac) in isacsx_rme_irq() argument
451 val = ReadISAC(isac, ISACX_RSTAD); in isacsx_rme_irq()
457 pr_debug("%s: RSTAD %#x, dropped\n", isac->name, val); in isacsx_rme_irq()
460 isac->dch.err_rx++; in isacsx_rme_irq()
462 isac->dch.err_crc++; in isacsx_rme_irq()
464 WriteISAC(isac, ISACX_CMDRD, ISACX_CMDRD_RMC); in isacsx_rme_irq()
465 dev_kfree_skb(isac->dch.rx_skb); in isacsx_rme_irq()
466 isac->dch.rx_skb = NULL; in isacsx_rme_irq()
468 count = ReadISAC(isac, ISACX_RBCLD) & 0x1f; in isacsx_rme_irq()
471 isac_empty_fifo(isac, count); in isacsx_rme_irq()
472 if (isac->dch.rx_skb) { in isacsx_rme_irq()
473 skb_trim(isac->dch.rx_skb, isac->dch.rx_skb->len - 1); in isacsx_rme_irq()
474 pr_debug("%s: dchannel received %d\n", isac->name, in isacsx_rme_irq()
475 isac->dch.rx_skb->len); in isacsx_rme_irq()
476 recv_Dchannel(&isac->dch); in isacsx_rme_irq()
482 mISDNisac_irq(struct isac_hw *isac, u8 val) in mISDNisac_irq() argument
486 pr_debug("%s: ISAC interrupt %02x\n", isac->name, val); in mISDNisac_irq()
487 if (isac->type & IPAC_TYPE_ISACX) { in mISDNisac_irq()
489 isacsx_cic_irq(isac); in mISDNisac_irq()
491 val = ReadISAC(isac, ISACX_ISTAD); in mISDNisac_irq()
492 pr_debug("%s: ISTAD %02x\n", isac->name, val); in mISDNisac_irq()
494 pr_debug("%s: ISAC XDU\n", isac->name); in mISDNisac_irq()
496 isac->dch.err_tx++; in mISDNisac_irq()
498 isac_retransmit(isac); in mISDNisac_irq()
501 pr_debug("%s: ISAC XMR\n", isac->name); in mISDNisac_irq()
503 isac->dch.err_tx++; in mISDNisac_irq()
505 isac_retransmit(isac); in mISDNisac_irq()
508 isac_xpr_irq(isac); in mISDNisac_irq()
510 pr_debug("%s: ISAC RFO\n", isac->name); in mISDNisac_irq()
511 WriteISAC(isac, ISACX_CMDRD, ISACX_CMDRD_RMC); in mISDNisac_irq()
514 isacsx_rme_irq(isac); in mISDNisac_irq()
516 isac_empty_fifo(isac, 0x20); in mISDNisac_irq()
520 isac_rme_irq(isac); in mISDNisac_irq()
522 isac_empty_fifo(isac, 32); in mISDNisac_irq()
524 isac_xpr_irq(isac); in mISDNisac_irq()
526 isac_cisq_irq(isac); in mISDNisac_irq()
528 pr_debug("%s: ISAC RSC interrupt\n", isac->name); in mISDNisac_irq()
530 pr_debug("%s: ISAC SIN interrupt\n", isac->name); in mISDNisac_irq()
532 val = ReadISAC(isac, ISAC_EXIR); in mISDNisac_irq()
533 pr_debug("%s: ISAC EXIR %02x\n", isac->name, val); in mISDNisac_irq()
535 pr_debug("%s: ISAC XMR\n", isac->name); in mISDNisac_irq()
537 pr_debug("%s: ISAC XDU\n", isac->name); in mISDNisac_irq()
539 isac->dch.err_tx++; in mISDNisac_irq()
541 isac_retransmit(isac); in mISDNisac_irq()
544 isac_mos_irq(isac); in mISDNisac_irq()
556 struct isac_hw *isac = container_of(dch, struct isac_hw, dch); in isac_l1hw() local
564 spin_lock_irqsave(isac->hwlock, flags); in isac_l1hw()
568 isac_fill_fifo(isac); in isac_l1hw()
570 spin_unlock_irqrestore(isac->hwlock, flags); in isac_l1hw()
573 spin_unlock_irqrestore(isac->hwlock, flags); in isac_l1hw()
590 isac_ctrl(struct isac_hw *isac, u32 cmd, unsigned long para) in isac_ctrl() argument
598 spin_lock_irqsave(isac->hwlock, flags); in isac_ctrl()
599 if (!(isac->type & IPAC_TYPE_ISACX)) { in isac_ctrl()
606 WriteISAC(isac, ISAC_SPCR, tl); in isac_ctrl()
608 WriteISAC(isac, ISAC_ADF1, 0x8); in isac_ctrl()
610 WriteISAC(isac, ISAC_ADF1, 0x0); in isac_ctrl()
612 spin_unlock_irqrestore(isac->hwlock, flags); in isac_ctrl()
615 ret = l1_event(isac->dch.l1, HW_TIMER3_VALUE | (para & 0xff)); in isac_ctrl()
618 pr_debug("%s: %s unknown command %x %lx\n", isac->name, in isac_ctrl()
628 struct isac_hw *isac = container_of(dch, struct isac_hw, dch); in isac_l1cmd() local
631 pr_debug("%s: cmd(%x) state(%02x)\n", isac->name, cmd, isac->state); in isac_l1cmd()
634 spin_lock_irqsave(isac->hwlock, flags); in isac_l1cmd()
635 ph_command(isac, ISAC_CMD_AR8); in isac_l1cmd()
636 spin_unlock_irqrestore(isac->hwlock, flags); in isac_l1cmd()
639 spin_lock_irqsave(isac->hwlock, flags); in isac_l1cmd()
640 ph_command(isac, ISAC_CMD_AR10); in isac_l1cmd()
641 spin_unlock_irqrestore(isac->hwlock, flags); in isac_l1cmd()
644 spin_lock_irqsave(isac->hwlock, flags); in isac_l1cmd()
645 if ((isac->state == ISAC_IND_EI) || in isac_l1cmd()
646 (isac->state == ISAC_IND_DR) || in isac_l1cmd()
647 (isac->state == ISAC_IND_DR6) || in isac_l1cmd()
648 (isac->state == ISAC_IND_RS)) in isac_l1cmd()
649 ph_command(isac, ISAC_CMD_TIM); in isac_l1cmd()
651 ph_command(isac, ISAC_CMD_RS); in isac_l1cmd()
652 spin_unlock_irqrestore(isac->hwlock, flags); in isac_l1cmd()
670 spin_lock_irqsave(isac->hwlock, flags); in isac_l1cmd()
671 ph_command(isac, ISAC_CMD_TIM); in isac_l1cmd()
672 spin_unlock_irqrestore(isac->hwlock, flags); in isac_l1cmd()
685 pr_debug("%s: %s unknown command %x\n", isac->name, in isac_l1cmd()
693 isac_release(struct isac_hw *isac) in isac_release() argument
695 if (isac->type & IPAC_TYPE_ISACX) in isac_release()
696 WriteISAC(isac, ISACX_MASK, 0xff); in isac_release()
697 else if (isac->type != 0) in isac_release()
698 WriteISAC(isac, ISAC_MASK, 0xff); in isac_release()
699 if (isac->dch.timer.function != NULL) { in isac_release()
700 del_timer(&isac->dch.timer); in isac_release()
701 isac->dch.timer.function = NULL; in isac_release()
703 kfree(isac->mon_rx); in isac_release()
704 isac->mon_rx = NULL; in isac_release()
705 kfree(isac->mon_tx); in isac_release()
706 isac->mon_tx = NULL; in isac_release()
707 if (isac->dch.l1) in isac_release()
708 l1_event(isac->dch.l1, CLOSE_CHANNEL); in isac_release()
709 mISDN_freedchannel(&isac->dch); in isac_release()
715 struct isac_hw *isac = from_timer(isac, t, dch.timer); in dbusy_timer_handler() local
719 if (test_bit(FLG_BUSY_TIMER, &isac->dch.Flags)) { in dbusy_timer_handler()
720 spin_lock_irqsave(isac->hwlock, flags); in dbusy_timer_handler()
721 rbch = ReadISAC(isac, ISAC_RBCH); in dbusy_timer_handler()
722 star = ReadISAC(isac, ISAC_STAR); in dbusy_timer_handler()
724 isac->name, rbch, star); in dbusy_timer_handler()
726 test_and_set_bit(FLG_L1_BUSY, &isac->dch.Flags); in dbusy_timer_handler()
729 test_and_clear_bit(FLG_BUSY_TIMER, &isac->dch.Flags); in dbusy_timer_handler()
730 if (isac->dch.tx_idx) in dbusy_timer_handler()
731 isac->dch.tx_idx = 0; in dbusy_timer_handler()
734 isac->name); in dbusy_timer_handler()
736 WriteISAC(isac, ISAC_CMDR, 0x01); in dbusy_timer_handler()
738 spin_unlock_irqrestore(isac->hwlock, flags); in dbusy_timer_handler()
743 open_dchannel_caller(struct isac_hw *isac, struct channel_req *rq, void *caller) in open_dchannel_caller() argument
745 pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__, in open_dchannel_caller()
746 isac->dch.dev.id, caller); in open_dchannel_caller()
752 rq->ch = &isac->dch.dev.D; in open_dchannel_caller()
754 if (isac->dch.state == 7) in open_dchannel_caller()
761 open_dchannel(struct isac_hw *isac, struct channel_req *rq) in open_dchannel() argument
763 return open_dchannel_caller(isac, rq, __builtin_return_address(0)); in open_dchannel()
771 isac_init(struct isac_hw *isac) in isac_init() argument
776 if (!isac->dch.l1) { in isac_init()
777 err = create_l1(&isac->dch, isac_l1cmd); in isac_init()
781 isac->mon_tx = NULL; in isac_init()
782 isac->mon_rx = NULL; in isac_init()
783 timer_setup(&isac->dch.timer, dbusy_timer_handler, 0); in isac_init()
784 isac->mocr = 0xaa; in isac_init()
785 if (isac->type & IPAC_TYPE_ISACX) { in isac_init()
787 WriteISAC(isac, ISACX_MASK, 0xff); in isac_init()
788 val = ReadISAC(isac, ISACX_STARD); in isac_init()
789 pr_debug("%s: ISACX STARD %x\n", isac->name, val); in isac_init()
790 val = ReadISAC(isac, ISACX_ISTAD); in isac_init()
791 pr_debug("%s: ISACX ISTAD %x\n", isac->name, val); in isac_init()
792 val = ReadISAC(isac, ISACX_ISTA); in isac_init()
793 pr_debug("%s: ISACX ISTA %x\n", isac->name, val); in isac_init()
795 WriteISAC(isac, ISACX_TR_CONF0, 0x00); in isac_init()
797 WriteISAC(isac, ISACX_TR_CONF2, 0x00); in isac_init()
799 WriteISAC(isac, ISACX_MODED, 0xc9); in isac_init()
801 val = ReadISAC(isac, ISACX_ID); in isac_init()
802 if (isac->dch.debug & DEBUG_HW) in isac_init()
804 isac->name, val & 0x3f); in isac_init()
805 val = ReadISAC(isac, ISACX_CIR0); in isac_init()
806 pr_debug("%s: ISACX CIR0 %02X\n", isac->name, val); in isac_init()
807 isac->state = val >> 4; in isac_init()
808 isac_ph_state_change(isac); in isac_init()
809 ph_command(isac, ISAC_CMD_RS); in isac_init()
810 WriteISAC(isac, ISACX_MASK, IPACX__ON); in isac_init()
811 WriteISAC(isac, ISACX_MASKD, 0x00); in isac_init()
813 WriteISAC(isac, ISAC_MASK, 0xff); in isac_init()
814 val = ReadISAC(isac, ISAC_STAR); in isac_init()
815 pr_debug("%s: ISAC STAR %x\n", isac->name, val); in isac_init()
816 val = ReadISAC(isac, ISAC_MODE); in isac_init()
817 pr_debug("%s: ISAC MODE %x\n", isac->name, val); in isac_init()
818 val = ReadISAC(isac, ISAC_ADF2); in isac_init()
819 pr_debug("%s: ISAC ADF2 %x\n", isac->name, val); in isac_init()
820 val = ReadISAC(isac, ISAC_ISTA); in isac_init()
821 pr_debug("%s: ISAC ISTA %x\n", isac->name, val); in isac_init()
823 val = ReadISAC(isac, ISAC_EXIR); in isac_init()
824 pr_debug("%s: ISAC EXIR %x\n", isac->name, val); in isac_init()
826 val = ReadISAC(isac, ISAC_RBCH); in isac_init()
827 if (isac->dch.debug & DEBUG_HW) in isac_init()
828 pr_notice("%s: ISAC version (%x): %s\n", isac->name, in isac_init()
830 isac->type |= ((val >> 5) & 3); in isac_init()
831 if (!isac->adf2) in isac_init()
832 isac->adf2 = 0x80; in isac_init()
833 if (!(isac->adf2 & 0x80)) { /* only IOM 2 Mode */ in isac_init()
835 isac->name, isac->adf2); in isac_init()
836 isac_release(isac); in isac_init()
839 WriteISAC(isac, ISAC_ADF2, isac->adf2); in isac_init()
840 WriteISAC(isac, ISAC_SQXR, 0x2f); in isac_init()
841 WriteISAC(isac, ISAC_SPCR, 0x00); in isac_init()
842 WriteISAC(isac, ISAC_STCR, 0x70); in isac_init()
843 WriteISAC(isac, ISAC_MODE, 0xc9); in isac_init()
844 WriteISAC(isac, ISAC_TIMR, 0x00); in isac_init()
845 WriteISAC(isac, ISAC_ADF1, 0x00); in isac_init()
846 val = ReadISAC(isac, ISAC_CIR0); in isac_init()
847 pr_debug("%s: ISAC CIR0 %x\n", isac->name, val); in isac_init()
848 isac->state = (val >> 2) & 0xf; in isac_init()
849 isac_ph_state_change(isac); in isac_init()
850 ph_command(isac, ISAC_CMD_RS); in isac_init()
851 WriteISAC(isac, ISAC_MASK, 0); in isac_init()
857 mISDNisac_init(struct isac_hw *isac, void *hw) in mISDNisac_init() argument
859 mISDN_initdchannel(&isac->dch, MAX_DFRAME_LEN_L1, isac_ph_state_bh); in mISDNisac_init()
860 isac->dch.hw = hw; in mISDNisac_init()
861 isac->dch.dev.D.send = isac_l1hw; in mISDNisac_init()
862 isac->init = isac_init; in mISDNisac_init()
863 isac->release = isac_release; in mISDNisac_init()
864 isac->ctrl = isac_ctrl; in mISDNisac_init()
865 isac->open = open_dchannel; in mISDNisac_init()
866 isac->dch.dev.Dprotocols = (1 << ISDN_P_TE_S0); in mISDNisac_init()
867 isac->dch.dev.nrbchan = 2; in mISDNisac_init()
1152 struct isac_hw *isac = &ipac->isac; in mISDNipac_irq() local
1163 mISDNisac_irq(&ipac->isac, ista); in mISDNipac_irq()
1171 istad = ReadISAC(isac, ISAC_ISTA); in mISDNipac_irq()
1177 mISDNisac_irq(isac, istad); in mISDNipac_irq()
1191 istad = ReadISAC(isac, ISAC_ISTA); in mISDNipac_irq()
1194 mISDNisac_irq(isac, istad); in mISDNipac_irq()
1420 isac_release(&ipac->isac); in free_ipac()
1475 return isac_init(&ipac->isac); in ipac_init()
1514 ret = ipac->isac.ctrl(&ipac->isac, HW_TIMER3_VALUE, cq->p1); in channel_ctrl()
1529 struct isac_hw *isac = container_of(dch, struct isac_hw, dch); in ipac_dctrl() local
1530 struct ipac_hw *ipac = container_of(isac, struct ipac_hw, isac); in ipac_dctrl()
1539 err = open_dchannel_caller(isac, rq, __builtin_return_address(0)); in ipac_dctrl()
1569 if (ipac->isac.dch.debug & DEBUG_HW) in mISDNipac_init()
1572 ipac->isac.type = IPAC_TYPE_ISAC; in mISDNipac_init()
1578 ipac->isac.type = IPAC_TYPE_IPAC | IPAC_TYPE_ISAC; in mISDNipac_init()
1584 ipac->isac.type = IPAC_TYPE_IPACX | IPAC_TYPE_ISACX; in mISDNipac_init()
1592 mISDNisac_init(&ipac->isac, hw); in mISDNipac_init()
1594 ipac->isac.dch.dev.D.ctrl = ipac_dctrl; in mISDNipac_init()
1598 set_channelmap(i + 1, ipac->isac.dch.dev.channelmap); in mISDNipac_init()
1600 &ipac->isac.dch.dev.bchannels); in mISDNipac_init()