Lines Matching refs:cs
64 static void Amd7930_new_ph(struct IsdnCardState *cs);
102 WriteWordAmd7930(struct IsdnCardState *cs, BYTE reg, WORD val) in WriteWordAmd7930() argument
104 wByteAMD(cs, 0x00, reg); in WriteWordAmd7930()
105 wByteAMD(cs, 0x01, LOBYTE(val)); in WriteWordAmd7930()
106 wByteAMD(cs, 0x01, HIBYTE(val)); in WriteWordAmd7930()
110 ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg) in ReadWordAmd7930() argument
115 res = rByteAMD(cs, reg); in ReadWordAmd7930()
116 res += 256 * rByteAMD(cs, reg); in ReadWordAmd7930()
120 wByteAMD(cs, 0x00, reg); in ReadWordAmd7930()
121 res = rByteAMD(cs, 0x01); in ReadWordAmd7930()
122 res += 256 * rByteAMD(cs, 0x01); in ReadWordAmd7930()
129 Amd7930_ph_command(struct IsdnCardState *cs, u_char command, char *s) in Amd7930_ph_command() argument
131 if (cs->debug & L1_DEB_ISAC) in Amd7930_ph_command()
132 debugl1(cs, "AMD7930: %s: ph_command 0x%02X", s, command); in Amd7930_ph_command()
134 cs->dc.amd7930.lmr1 = command; in Amd7930_ph_command()
135 wByteAMD(cs, 0xA3, command); in Amd7930_ph_command()
160 Amd7930_get_state(struct IsdnCardState *cs) { in Amd7930_get_state() argument
161 BYTE lsr = rByteAMD(cs, 0xA1); in Amd7930_get_state()
162 cs->dc.amd7930.ph_state = (lsr & 0x7) + 2; in Amd7930_get_state()
163 Amd7930_new_ph(cs); in Amd7930_get_state()
169 Amd7930_new_ph(struct IsdnCardState *cs) in Amd7930_new_ph() argument
171 …u_char index = stateHelper[cs->dc.amd7930.old_state] * 8 + stateHelper[cs->dc.amd7930.ph_state] - … in Amd7930_new_ph()
174 if (cs->debug & L1_DEB_ISAC) in Amd7930_new_ph()
175 debugl1(cs, "AMD7930: new_ph %d, old_ph %d, message %d, index %d", in Amd7930_new_ph()
176 cs->dc.amd7930.ph_state, cs->dc.amd7930.old_state, message & 0x0f, index); in Amd7930_new_ph()
178 cs->dc.amd7930.old_state = cs->dc.amd7930.ph_state; in Amd7930_new_ph()
181 if ((message & 0xf0) && (cs->tx_skb)) { in Amd7930_new_ph()
182 wByteAMD(cs, 0x21, 0xC2); in Amd7930_new_ph()
183 wByteAMD(cs, 0x21, 0x02); in Amd7930_new_ph()
189 l1_msg(cs, HW_RESET | INDICATION, NULL); in Amd7930_new_ph()
190 Amd7930_get_state(cs); in Amd7930_new_ph()
193 l1_msg(cs, HW_DEACTIVATE | CONFIRM, NULL); in Amd7930_new_ph()
196 l1_msg(cs, HW_DEACTIVATE | INDICATION, NULL); in Amd7930_new_ph()
199 l1_msg(cs, HW_POWERUP | CONFIRM, NULL); in Amd7930_new_ph()
200 Amd7930_ph_command(cs, 0x50, "HW_ENABLE REQUEST"); in Amd7930_new_ph()
203 l1_msg(cs, HW_RSYNC | INDICATION, NULL); in Amd7930_new_ph()
206 l1_msg(cs, HW_INFO4_P8 | INDICATION, NULL); in Amd7930_new_ph()
209 l1_msg(cs, HW_RSYNC | INDICATION, NULL); in Amd7930_new_ph()
210 l1_msg(cs, HW_INFO4_P8 | INDICATION, NULL); in Amd7930_new_ph()
213 l1_msg(cs, HW_POWERUP | CONFIRM, NULL); in Amd7930_new_ph()
216 Amd7930_ph_command(cs, 0x40, "HW_ENABLE REQ cleared if set"); in Amd7930_new_ph()
217 l1_msg(cs, HW_RSYNC | INDICATION, NULL); in Amd7930_new_ph()
218 l1_msg(cs, HW_INFO2 | INDICATION, NULL); in Amd7930_new_ph()
219 l1_msg(cs, HW_INFO4_P8 | INDICATION, NULL); in Amd7930_new_ph()
222 Amd7930_ph_command(cs, 0x40, "T3 expired, HW_ENABLE REQ cleared"); in Amd7930_new_ph()
223 cs->dc.amd7930.old_state = 3; in Amd7930_new_ph()
226 l1_msg(cs, HW_INFO2 | INDICATION, NULL); in Amd7930_new_ph()
238 struct IsdnCardState *cs = in Amd7930_bh() local
242 if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) { in Amd7930_bh()
243 if (cs->debug) in Amd7930_bh()
244 debugl1(cs, "Amd7930: bh, D-Channel Busy cleared"); in Amd7930_bh()
245 stptr = cs->stlist; in Amd7930_bh()
251 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) { in Amd7930_bh()
252 if (cs->debug & L1_DEB_ISAC) in Amd7930_bh()
253 debugl1(cs, "AMD7930: bh, D_L1STATECHANGE"); in Amd7930_bh()
254 Amd7930_new_ph(cs); in Amd7930_bh()
257 if (test_and_clear_bit(D_RCVBUFREADY, &cs->event)) { in Amd7930_bh()
258 if (cs->debug & L1_DEB_ISAC) in Amd7930_bh()
259 debugl1(cs, "AMD7930: bh, D_RCVBUFREADY"); in Amd7930_bh()
260 DChannel_proc_rcv(cs); in Amd7930_bh()
263 if (test_and_clear_bit(D_XMTBUFREADY, &cs->event)) { in Amd7930_bh()
264 if (cs->debug & L1_DEB_ISAC) in Amd7930_bh()
265 debugl1(cs, "AMD7930: bh, D_XMTBUFREADY"); in Amd7930_bh()
266 DChannel_proc_xmt(cs); in Amd7930_bh()
271 Amd7930_empty_Dfifo(struct IsdnCardState *cs, int flag) in Amd7930_empty_Dfifo() argument
279 if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO)) in Amd7930_empty_Dfifo()
280 debugl1(cs, "Amd7930: empty_Dfifo"); in Amd7930_empty_Dfifo()
283 ptr = cs->rcvbuf + cs->rcvidx; in Amd7930_empty_Dfifo()
286 AmdIrqOff(cs); in Amd7930_empty_Dfifo()
289 stat = rByteAMD(cs, 0x07); // DSR2 in Amd7930_empty_Dfifo()
292 while ((stat & 2) && ((ptr-cs->rcvbuf) < MAX_DFRAME_LEN_L1)) { in Amd7930_empty_Dfifo()
293 *ptr = rByteAMD(cs, 0x04); // DCRB in Amd7930_empty_Dfifo()
295 stat = rByteAMD(cs, 0x07); // DSR2 in Amd7930_empty_Dfifo()
296 cs->rcvidx = ptr - cs->rcvbuf; in Amd7930_empty_Dfifo()
301 der = rWordAMD(cs, 0x03); in Amd7930_empty_Dfifo()
305 rWordAMD(cs, 0x89); // clear DRCR in Amd7930_empty_Dfifo()
307 if ((cs->rcvidx) > 0) { in Amd7930_empty_Dfifo()
308 if (!(skb = alloc_skb(cs->rcvidx, GFP_ATOMIC))) in Amd7930_empty_Dfifo()
312 if (cs->debug & L1_DEB_ISAC_FIFO) { in Amd7930_empty_Dfifo()
313 char *t = cs->dlog; in Amd7930_empty_Dfifo()
315 t += sprintf(t, "Amd7930: empty_Dfifo cnt: %d |", cs->rcvidx); in Amd7930_empty_Dfifo()
316 QuickHex(t, cs->rcvbuf, cs->rcvidx); in Amd7930_empty_Dfifo()
317 debugl1(cs, "%s", cs->dlog); in Amd7930_empty_Dfifo()
320 skb_put_data(skb, cs->rcvbuf, in Amd7930_empty_Dfifo()
321 cs->rcvidx); in Amd7930_empty_Dfifo()
322 skb_queue_tail(&cs->rq, skb); in Amd7930_empty_Dfifo()
328 ptr = cs->rcvbuf; in Amd7930_empty_Dfifo()
329 cs->rcvidx = 0; in Amd7930_empty_Dfifo()
330 schedule_event(cs, D_RCVBUFREADY); in Amd7930_empty_Dfifo()
334 if (cs->rcvidx >= MAX_DFRAME_LEN_L1) { in Amd7930_empty_Dfifo()
335 if (cs->debug & L1_DEB_WARN) in Amd7930_empty_Dfifo()
336 debugl1(cs, "AMD7930: empty_Dfifo L2-Framelength overrun"); in Amd7930_empty_Dfifo()
337 cs->rcvidx = 0; in Amd7930_empty_Dfifo()
341 AmdIrqOn(cs); in Amd7930_empty_Dfifo()
346 Amd7930_fill_Dfifo(struct IsdnCardState *cs) in Amd7930_fill_Dfifo() argument
353 if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO)) in Amd7930_fill_Dfifo()
354 debugl1(cs, "Amd7930: fill_Dfifo"); in Amd7930_fill_Dfifo()
356 if ((!cs->tx_skb) || (cs->tx_skb->len <= 0)) in Amd7930_fill_Dfifo()
360 if (!cs->dc.amd7930.tx_xmtlen) in Amd7930_fill_Dfifo()
362 len = dtcrw = cs->tx_skb->len; in Amd7930_fill_Dfifo()
364 else len = cs->dc.amd7930.tx_xmtlen; in Amd7930_fill_Dfifo()
368 AmdIrqOff(cs); in Amd7930_fill_Dfifo()
370 deb_ptr = ptr = cs->tx_skb->data; in Amd7930_fill_Dfifo()
374 while ((txstat & 0x10) && (cs->tx_cnt < len)) { in Amd7930_fill_Dfifo()
375 wByteAMD(cs, 0x04, *ptr); in Amd7930_fill_Dfifo()
377 cs->tx_cnt++; in Amd7930_fill_Dfifo()
378 txstat = rByteAMD(cs, 0x07); in Amd7930_fill_Dfifo()
380 count = ptr - cs->tx_skb->data; in Amd7930_fill_Dfifo()
381 skb_pull(cs->tx_skb, count); in Amd7930_fill_Dfifo()
384 dtcrr = rWordAMD(cs, 0x85); // DTCR in Amd7930_fill_Dfifo()
385 dmr3 = rByteAMD(cs, 0x8E); in Amd7930_fill_Dfifo()
387 if (cs->debug & L1_DEB_ISAC) { in Amd7930_fill_Dfifo()
388 …debugl1(cs, "Amd7930: fill_Dfifo, DMR3: 0x%02X, DTCR read: 0x%04X write: 0x%02X 0x%02X", dmr3, dtc… in Amd7930_fill_Dfifo()
392 if (!cs->dc.amd7930.tx_xmtlen) { in Amd7930_fill_Dfifo()
393 wWordAMD(cs, 0x85, dtcrw); in Amd7930_fill_Dfifo()
394 cs->dc.amd7930.tx_xmtlen = dtcrw; in Amd7930_fill_Dfifo()
397 if (test_and_set_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) { in Amd7930_fill_Dfifo()
398 debugl1(cs, "Amd7930: fill_Dfifo dbusytimer running"); in Amd7930_fill_Dfifo()
399 del_timer(&cs->dbusytimer); in Amd7930_fill_Dfifo()
401 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000); in Amd7930_fill_Dfifo()
402 add_timer(&cs->dbusytimer); in Amd7930_fill_Dfifo()
404 if (cs->debug & L1_DEB_ISAC_FIFO) { in Amd7930_fill_Dfifo()
405 char *t = cs->dlog; in Amd7930_fill_Dfifo()
409 debugl1(cs, "%s", cs->dlog); in Amd7930_fill_Dfifo()
412 AmdIrqOn(cs); in Amd7930_fill_Dfifo()
416 void Amd7930_interrupt(struct IsdnCardState *cs, BYTE irflags) in Amd7930_interrupt() argument
424 dsr1 = rByteAMD(cs, 0x02); in Amd7930_interrupt()
425 der = rWordAMD(cs, 0x03); in Amd7930_interrupt()
426 dsr2 = rByteAMD(cs, 0x07); in Amd7930_interrupt()
427 lsr = rByteAMD(cs, 0xA1); in Amd7930_interrupt()
429 if (cs->debug & L1_DEB_ISAC) in Amd7930_interrupt()
430 …debugl1(cs, "Amd7930: interrupt: flags: 0x%02X, DSR1: 0x%02X, DSR2: 0x%02X, LSR: 0x%02X, DER=0x%04… in Amd7930_interrupt()
435 if (cs->debug & L1_DEB_WARN) in Amd7930_interrupt()
436 debugl1(cs, "Amd7930: interrupt: D error DER=0x%04X", der); in Amd7930_interrupt()
440 wByteAMD(cs, 0x21, 0xC2); in Amd7930_interrupt()
441 wByteAMD(cs, 0x21, 0x02); in Amd7930_interrupt()
442 if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) in Amd7930_interrupt()
443 del_timer(&cs->dbusytimer); in Amd7930_interrupt()
444 if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in Amd7930_interrupt()
445 schedule_event(cs, D_CLEARBUSY); in Amd7930_interrupt()
447 if (cs->tx_skb) { in Amd7930_interrupt()
448 skb_push(cs->tx_skb, cs->tx_cnt); in Amd7930_interrupt()
449 cs->tx_cnt = 0; in Amd7930_interrupt()
450 cs->dc.amd7930.tx_xmtlen = 0; in Amd7930_interrupt()
451 Amd7930_fill_Dfifo(cs); in Amd7930_interrupt()
454 debugl1(cs, "Amd7930: interrupt: D-Collision, no skb"); in Amd7930_interrupt()
458 Amd7930_empty_Dfifo(cs, 1); in Amd7930_interrupt()
460 if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) in Amd7930_interrupt()
461 del_timer(&cs->dbusytimer); in Amd7930_interrupt()
462 if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in Amd7930_interrupt()
463 schedule_event(cs, D_CLEARBUSY); in Amd7930_interrupt()
465 if (cs->tx_skb) { in Amd7930_interrupt()
466 skb_push(cs->tx_skb, cs->tx_cnt); in Amd7930_interrupt()
467 cs->tx_cnt = 0; in Amd7930_interrupt()
468 cs->dc.amd7930.tx_xmtlen = 0; in Amd7930_interrupt()
469 Amd7930_fill_Dfifo(cs); in Amd7930_interrupt()
475 if (cs->debug & L1_DEB_ISAC) in Amd7930_interrupt()
476 debugl1(cs, "Amd7930: interrupt: clear Timer and fill D-TX-FIFO if data"); in Amd7930_interrupt()
479 AmdIrqOff(cs); in Amd7930_interrupt()
481 if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) in Amd7930_interrupt()
482 del_timer(&cs->dbusytimer); in Amd7930_interrupt()
483 if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in Amd7930_interrupt()
484 schedule_event(cs, D_CLEARBUSY); in Amd7930_interrupt()
485 if (cs->tx_skb) { in Amd7930_interrupt()
486 if (cs->tx_skb->len) in Amd7930_interrupt()
487 Amd7930_fill_Dfifo(cs); in Amd7930_interrupt()
490 AmdIrqOn(cs); in Amd7930_interrupt()
496 if (cs->debug & L1_DEB_ISAC) in Amd7930_interrupt()
497 debugl1(cs, "Amd7930: interrupt: empty D-FIFO"); in Amd7930_interrupt()
498 Amd7930_empty_Dfifo(cs, 0); in Amd7930_interrupt()
504 if (cs->debug & L1_DEB_ISAC) { in Amd7930_interrupt()
505 debugl1(cs, "Amd7930: interrupt: transmit packet ready"); in Amd7930_interrupt()
508 AmdIrqOff(cs); in Amd7930_interrupt()
510 if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) in Amd7930_interrupt()
511 del_timer(&cs->dbusytimer); in Amd7930_interrupt()
512 if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in Amd7930_interrupt()
513 schedule_event(cs, D_CLEARBUSY); in Amd7930_interrupt()
515 if (cs->tx_skb) { in Amd7930_interrupt()
516 if (cs->debug & L1_DEB_ISAC) in Amd7930_interrupt()
517 debugl1(cs, "Amd7930: interrupt: TX-Packet ready, freeing skb"); in Amd7930_interrupt()
518 dev_kfree_skb_irq(cs->tx_skb); in Amd7930_interrupt()
519 cs->tx_cnt = 0; in Amd7930_interrupt()
520 cs->dc.amd7930.tx_xmtlen = 0; in Amd7930_interrupt()
521 cs->tx_skb = NULL; in Amd7930_interrupt()
523 if ((cs->tx_skb = skb_dequeue(&cs->sq))) { in Amd7930_interrupt()
524 if (cs->debug & L1_DEB_ISAC) in Amd7930_interrupt()
525 debugl1(cs, "Amd7930: interrupt: TX-Packet ready, next packet dequeued"); in Amd7930_interrupt()
526 cs->tx_cnt = 0; in Amd7930_interrupt()
527 cs->dc.amd7930.tx_xmtlen = 0; in Amd7930_interrupt()
528 Amd7930_fill_Dfifo(cs); in Amd7930_interrupt()
531 schedule_event(cs, D_XMTBUFREADY); in Amd7930_interrupt()
533 AmdIrqOn(cs); in Amd7930_interrupt()
539 AmdIrqOff(cs); in Amd7930_interrupt()
541 if (cs->debug & L1_DEB_ISAC) in Amd7930_interrupt()
542 debugl1(cs, "Amd: interrupt: LSR=0x%02X, LIU is in state %d", lsr, ((lsr & 0x7) + 2)); in Amd7930_interrupt()
544 cs->dc.amd7930.ph_state = (lsr & 0x7) + 2; in Amd7930_interrupt()
546 schedule_event(cs, D_L1STATECHANGE); in Amd7930_interrupt()
548 AmdIrqOn(cs); in Amd7930_interrupt()
552 irflags = rByteAMD(cs, 0x00); in Amd7930_interrupt()
560 struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware; in Amd7930_l1hw() local
564 if (cs->debug & L1_DEB_ISAC) in Amd7930_l1hw()
565 debugl1(cs, "Amd7930: l1hw called, pr: 0x%04X", pr); in Amd7930_l1hw()
569 if (cs->debug & DEB_DLOG_HEX) in Amd7930_l1hw()
570 LogFrame(cs, skb->data, skb->len); in Amd7930_l1hw()
571 if (cs->debug & DEB_DLOG_VERBOSE) in Amd7930_l1hw()
572 dlogframe(cs, skb, 0); in Amd7930_l1hw()
573 spin_lock_irqsave(&cs->lock, flags); in Amd7930_l1hw()
574 if (cs->tx_skb) { in Amd7930_l1hw()
575 skb_queue_tail(&cs->sq, skb); in Amd7930_l1hw()
577 if (cs->debug & L1_DEB_LAPD) in Amd7930_l1hw()
578 Logl2Frame(cs, skb, "Amd7930: l1hw: PH_DATA Queued", 0); in Amd7930_l1hw()
581 cs->tx_skb = skb; in Amd7930_l1hw()
582 cs->tx_cnt = 0; in Amd7930_l1hw()
583 cs->dc.amd7930.tx_xmtlen = 0; in Amd7930_l1hw()
585 if (cs->debug & L1_DEB_LAPD) in Amd7930_l1hw()
586 Logl2Frame(cs, skb, "Amd7930: l1hw: PH_DATA", 0); in Amd7930_l1hw()
588 Amd7930_fill_Dfifo(cs); in Amd7930_l1hw()
590 spin_unlock_irqrestore(&cs->lock, flags); in Amd7930_l1hw()
593 spin_lock_irqsave(&cs->lock, flags); in Amd7930_l1hw()
594 if (cs->tx_skb) { in Amd7930_l1hw()
595 if (cs->debug & L1_DEB_WARN) in Amd7930_l1hw()
596 debugl1(cs, "Amd7930: l1hw: l2l1 tx_skb exist this shouldn't happen"); in Amd7930_l1hw()
597 skb_queue_tail(&cs->sq, skb); in Amd7930_l1hw()
598 spin_unlock_irqrestore(&cs->lock, flags); in Amd7930_l1hw()
601 if (cs->debug & DEB_DLOG_HEX) in Amd7930_l1hw()
602 LogFrame(cs, skb->data, skb->len); in Amd7930_l1hw()
603 if (cs->debug & DEB_DLOG_VERBOSE) in Amd7930_l1hw()
604 dlogframe(cs, skb, 0); in Amd7930_l1hw()
605 cs->tx_skb = skb; in Amd7930_l1hw()
606 cs->tx_cnt = 0; in Amd7930_l1hw()
607 cs->dc.amd7930.tx_xmtlen = 0; in Amd7930_l1hw()
609 if (cs->debug & L1_DEB_LAPD) in Amd7930_l1hw()
610 Logl2Frame(cs, skb, "Amd7930: l1hw: PH_DATA_PULLED", 0); in Amd7930_l1hw()
612 Amd7930_fill_Dfifo(cs); in Amd7930_l1hw()
613 spin_unlock_irqrestore(&cs->lock, flags); in Amd7930_l1hw()
617 if (cs->debug & L1_DEB_LAPD) in Amd7930_l1hw()
618 debugl1(cs, "Amd7930: l1hw: -> PH_REQUEST_PULL, skb: %s", (cs->tx_skb) ? "yes" : "no"); in Amd7930_l1hw()
620 if (!cs->tx_skb) { in Amd7930_l1hw()
627 spin_lock_irqsave(&cs->lock, flags); in Amd7930_l1hw()
628 if ((cs->dc.amd7930.ph_state == 8)) { in Amd7930_l1hw()
631 Amd7930_ph_command(cs, 0x20, "HW_RESET REQUEST"); //LMR1 bit 5 in Amd7930_l1hw()
632 spin_unlock_irqrestore(&cs->lock, flags); in Amd7930_l1hw()
634 Amd7930_ph_command(cs, 0x40, "HW_RESET REQUEST"); in Amd7930_l1hw()
635 cs->dc.amd7930.ph_state = 2; in Amd7930_l1hw()
636 spin_unlock_irqrestore(&cs->lock, flags); in Amd7930_l1hw()
637 Amd7930_new_ph(cs); in Amd7930_l1hw()
641 cs->dc.amd7930.ph_state = 9; in Amd7930_l1hw()
642 Amd7930_new_ph(cs); in Amd7930_l1hw()
651 skb_queue_purge(&cs->rq); in Amd7930_l1hw()
652 skb_queue_purge(&cs->sq); in Amd7930_l1hw()
653 if (cs->tx_skb) { in Amd7930_l1hw()
654 dev_kfree_skb(cs->tx_skb); in Amd7930_l1hw()
655 cs->tx_skb = NULL; in Amd7930_l1hw()
657 if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) in Amd7930_l1hw()
658 del_timer(&cs->dbusytimer); in Amd7930_l1hw()
659 if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in Amd7930_l1hw()
660 schedule_event(cs, D_CLEARBUSY); in Amd7930_l1hw()
663 if (cs->debug & L1_DEB_WARN) in Amd7930_l1hw()
664 debugl1(cs, "Amd7930: l1hw: unknown %04x", pr); in Amd7930_l1hw()
670 setstack_Amd7930(struct PStack *st, struct IsdnCardState *cs) in setstack_Amd7930() argument
673 if (cs->debug & L1_DEB_ISAC) in setstack_Amd7930()
674 debugl1(cs, "Amd7930: setstack called"); in setstack_Amd7930()
681 DC_Close_Amd7930(struct IsdnCardState *cs) { in DC_Close_Amd7930() argument
682 if (cs->debug & L1_DEB_ISAC) in DC_Close_Amd7930()
683 debugl1(cs, "Amd7930: DC_Close called"); in DC_Close_Amd7930()
690 struct IsdnCardState *cs = from_timer(cs, t, dbusytimer); in dbusy_timer_handler() local
697 if (cs->debug & L1_DEB_ISAC) in dbusy_timer_handler()
698 debugl1(cs, "Amd7930: dbusy_timer expired!"); in dbusy_timer_handler()
700 if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) { in dbusy_timer_handler()
701 spin_lock_irqsave(&cs->lock, flags); in dbusy_timer_handler()
704 dtcr = rWordAMD(cs, 0x85); in dbusy_timer_handler()
705 dsr1 = rByteAMD(cs, 0x02); in dbusy_timer_handler()
706 dsr2 = rByteAMD(cs, 0x07); in dbusy_timer_handler()
707 der = rWordAMD(cs, 0x03); in dbusy_timer_handler()
709 if (cs->debug & L1_DEB_ISAC) in dbusy_timer_handler()
710 …cs, "Amd7930: dbusy_timer_handler: DSR1=0x%02X, DSR2=0x%02X, DER=0x%04X, cs->tx_skb->len=%u, tx_st… in dbusy_timer_handler()
712 if ((cs->dc.amd7930.tx_xmtlen - dtcr) < cs->tx_cnt) { /* D-Channel Busy */ in dbusy_timer_handler()
713 test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags); in dbusy_timer_handler()
714 stptr = cs->stlist; in dbusy_timer_handler()
715 spin_unlock_irqrestore(&cs->lock, flags); in dbusy_timer_handler()
723 test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags); in dbusy_timer_handler()
724 if (cs->tx_skb) { in dbusy_timer_handler()
725 dev_kfree_skb_any(cs->tx_skb); in dbusy_timer_handler()
726 cs->tx_cnt = 0; in dbusy_timer_handler()
727 cs->tx_skb = NULL; in dbusy_timer_handler()
728 cs->dc.amd7930.tx_xmtlen = 0; in dbusy_timer_handler()
731 debugl1(cs, "Amd7930: D-Channel Busy no skb"); in dbusy_timer_handler()
735 wByteAMD(cs, 0x21, 0x82); in dbusy_timer_handler()
736 wByteAMD(cs, 0x21, 0x02); in dbusy_timer_handler()
737 spin_unlock_irqrestore(&cs->lock, flags); in dbusy_timer_handler()
738 cs->irq_func(cs->irq, cs); in dbusy_timer_handler()
740 if (cs->debug & L1_DEB_ISAC) in dbusy_timer_handler()
741 debugl1(cs, "Amd7930: dbusy_timer_handler: Transmitter reset"); in dbusy_timer_handler()
748 void Amd7930_init(struct IsdnCardState *cs) in Amd7930_init() argument
753 if (cs->debug & L1_DEB_ISAC) in Amd7930_init()
754 debugl1(cs, "Amd7930: initamd called"); in Amd7930_init()
756 cs->dc.amd7930.tx_xmtlen = 0; in Amd7930_init()
757 cs->dc.amd7930.old_state = 0; in Amd7930_init()
758 cs->dc.amd7930.lmr1 = 0x40; in Amd7930_init()
759 cs->dc.amd7930.ph_command = Amd7930_ph_command; in Amd7930_init()
760 cs->setstack_d = setstack_Amd7930; in Amd7930_init()
761 cs->DC_Close = DC_Close_Amd7930; in Amd7930_init()
771 rByteAMD(cs, cmd); in Amd7930_init()
773 wByteAMD(cs, 0x00, cmd); in Amd7930_init()
775 rByteAMD(cs, 0x01); in Amd7930_init()
780 wByteAMD(cs, cmd, LOBYTE(*ptr++)); in Amd7930_init()
783 wByteAMD(cs, 0x00, cmd); in Amd7930_init()
785 wByteAMD(cs, 0x01, LOBYTE(*ptr++)); in Amd7930_init()
790 void setup_Amd7930(struct IsdnCardState *cs) in setup_Amd7930() argument
792 INIT_WORK(&cs->tqueue, Amd7930_bh); in setup_Amd7930()
793 timer_setup(&cs->dbusytimer, dbusy_timer_handler, 0); in setup_Amd7930()