• Home
  • Raw
  • Download

Lines Matching +full:cs +full:- +full:x

51 W6692Version(struct IsdnCardState *cs, char *s)  in W6692Version()  argument
55 val = cs->readW6692(cs, W_D_RBCH); in W6692Version()
56 printk(KERN_INFO "%s Winbond W6692 version (%x): %s\n", s, val, W6692Ver[(val >> 6) & 3]); in W6692Version()
60 ph_command(struct IsdnCardState *cs, unsigned int command) in ph_command() argument
62 if (cs->debug & L1_DEB_ISAC) in ph_command()
63 debugl1(cs, "ph_command %x", command); in ph_command()
64 cs->writeisac(cs, W_CIX, command); in ph_command()
69 W6692_new_ph(struct IsdnCardState *cs) in W6692_new_ph() argument
71 switch (cs->dc.w6692.ph_state) { in W6692_new_ph()
73 ph_command(cs, W_L1CMD_DRC); in W6692_new_ph()
74 l1_msg(cs, HW_RESET | INDICATION, NULL); in W6692_new_ph()
77 l1_msg(cs, HW_DEACTIVATE | CONFIRM, NULL); in W6692_new_ph()
80 l1_msg(cs, HW_DEACTIVATE | INDICATION, NULL); in W6692_new_ph()
83 l1_msg(cs, HW_POWERUP | CONFIRM, NULL); in W6692_new_ph()
86 l1_msg(cs, HW_RSYNC | INDICATION, NULL); in W6692_new_ph()
89 l1_msg(cs, HW_INFO2 | INDICATION, NULL); in W6692_new_ph()
92 l1_msg(cs, HW_INFO4_P8 | INDICATION, NULL); in W6692_new_ph()
95 l1_msg(cs, HW_INFO4_P10 | INDICATION, NULL); in W6692_new_ph()
105 struct IsdnCardState *cs = in W6692_bh() local
109 if (test_and_clear_bit(D_CLEARBUSY, &cs->event)) { in W6692_bh()
110 if (cs->debug) in W6692_bh()
111 debugl1(cs, "D-Channel Busy cleared"); in W6692_bh()
112 stptr = cs->stlist; in W6692_bh()
114 stptr->l1.l1l2(stptr, PH_PAUSE | CONFIRM, NULL); in W6692_bh()
115 stptr = stptr->next; in W6692_bh()
118 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) in W6692_bh()
119 W6692_new_ph(cs); in W6692_bh()
120 if (test_and_clear_bit(D_RCVBUFREADY, &cs->event)) in W6692_bh()
121 DChannel_proc_rcv(cs); in W6692_bh()
122 if (test_and_clear_bit(D_XMTBUFREADY, &cs->event)) in W6692_bh()
123 DChannel_proc_xmt(cs); in W6692_bh()
125 if (test_and_clear_bit(D_RX_MON1, &cs->event)) in W6692_bh()
126 arcofi_fsm(cs, ARCOFI_RX_END, NULL); in W6692_bh()
127 if (test_and_clear_bit(D_TX_MON1, &cs->event)) in W6692_bh()
128 arcofi_fsm(cs, ARCOFI_TX_END, NULL); in W6692_bh()
133 W6692_empty_fifo(struct IsdnCardState *cs, int count) in W6692_empty_fifo() argument
137 if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO)) in W6692_empty_fifo()
138 debugl1(cs, "W6692_empty_fifo"); in W6692_empty_fifo()
140 if ((cs->rcvidx + count) >= MAX_DFRAME_LEN_L1) { in W6692_empty_fifo()
141 if (cs->debug & L1_DEB_WARN) in W6692_empty_fifo()
142 debugl1(cs, "W6692_empty_fifo overrun %d", in W6692_empty_fifo()
143 cs->rcvidx + count); in W6692_empty_fifo()
144 cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_RACK); in W6692_empty_fifo()
145 cs->rcvidx = 0; in W6692_empty_fifo()
148 ptr = cs->rcvbuf + cs->rcvidx; in W6692_empty_fifo()
149 cs->rcvidx += count; in W6692_empty_fifo()
150 cs->readW6692fifo(cs, ptr, count); in W6692_empty_fifo()
151 cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_RACK); in W6692_empty_fifo()
152 if (cs->debug & L1_DEB_ISAC_FIFO) { in W6692_empty_fifo()
153 char *t = cs->dlog; in W6692_empty_fifo()
157 debugl1(cs, "%s", cs->dlog); in W6692_empty_fifo()
162 W6692_fill_fifo(struct IsdnCardState *cs) in W6692_fill_fifo() argument
167 if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO)) in W6692_fill_fifo()
168 debugl1(cs, "W6692_fill_fifo"); in W6692_fill_fifo()
170 if (!cs->tx_skb) in W6692_fill_fifo()
173 count = cs->tx_skb->len; in W6692_fill_fifo()
182 ptr = cs->tx_skb->data; in W6692_fill_fifo()
183 skb_pull(cs->tx_skb, count); in W6692_fill_fifo()
184 cs->tx_cnt += count; in W6692_fill_fifo()
185 cs->writeW6692fifo(cs, ptr, count); in W6692_fill_fifo()
186 cs->writeW6692(cs, W_D_CMDR, more ? W_D_CMDR_XMS : (W_D_CMDR_XMS | W_D_CMDR_XME)); in W6692_fill_fifo()
187 if (test_and_set_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) { in W6692_fill_fifo()
188 debugl1(cs, "W6692_fill_fifo dbusytimer running"); in W6692_fill_fifo()
189 del_timer(&cs->dbusytimer); in W6692_fill_fifo()
191 cs->dbusytimer.expires = jiffies + ((DBUSY_TIMER_VALUE * HZ) / 1000); in W6692_fill_fifo()
192 add_timer(&cs->dbusytimer); in W6692_fill_fifo()
193 if (cs->debug & L1_DEB_ISAC_FIFO) { in W6692_fill_fifo()
194 char *t = cs->dlog; in W6692_fill_fifo()
198 debugl1(cs, "%s", cs->dlog); in W6692_fill_fifo()
206 struct IsdnCardState *cs = bcs->cs; in W6692B_empty_fifo() local
208 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) in W6692B_empty_fifo()
209 debugl1(cs, "W6692B_empty_fifo"); in W6692B_empty_fifo()
211 if (bcs->hw.w6692.rcvidx + count > HSCX_BUFMAX) { in W6692B_empty_fifo()
212 if (cs->debug & L1_DEB_WARN) in W6692B_empty_fifo()
213 debugl1(cs, "W6692B_empty_fifo: incoming packet too large"); in W6692B_empty_fifo()
214 cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT); in W6692B_empty_fifo()
215 bcs->hw.w6692.rcvidx = 0; in W6692B_empty_fifo()
218 ptr = bcs->hw.w6692.rcvbuf + bcs->hw.w6692.rcvidx; in W6692B_empty_fifo()
219 bcs->hw.w6692.rcvidx += count; in W6692B_empty_fifo()
220 READW6692BFIFO(cs, bcs->channel, ptr, count); in W6692B_empty_fifo()
221 cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT); in W6692B_empty_fifo()
222 if (cs->debug & L1_DEB_HSCX_FIFO) { in W6692B_empty_fifo()
223 char *t = bcs->blog; in W6692B_empty_fifo()
226 bcs->channel + '1', count); in W6692B_empty_fifo()
228 debugl1(cs, "%s", bcs->blog); in W6692B_empty_fifo()
235 struct IsdnCardState *cs = bcs->cs; in W6692B_fill_fifo() local
239 if (!bcs->tx_skb) in W6692B_fill_fifo()
241 if (bcs->tx_skb->len <= 0) in W6692B_fill_fifo()
244 more = (bcs->mode == L1_MODE_TRANS) ? 1 : 0; in W6692B_fill_fifo()
245 if (bcs->tx_skb->len > W_B_FIFO_THRESH) { in W6692B_fill_fifo()
249 count = bcs->tx_skb->len; in W6692B_fill_fifo()
251 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) in W6692B_fill_fifo()
252 debugl1(cs, "W6692B_fill_fifo%s%d", (more ? " " : " last "), count); in W6692B_fill_fifo()
254 ptr = bcs->tx_skb->data; in W6692B_fill_fifo()
255 skb_pull(bcs->tx_skb, count); in W6692B_fill_fifo()
256 bcs->tx_cnt -= count; in W6692B_fill_fifo()
257 bcs->hw.w6692.count += count; in W6692B_fill_fifo()
258 WRITEW6692BFIFO(cs, bcs->channel, ptr, count); in W6692B_fill_fifo()
259cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACT | W_B_CMDR_XMS | (more ? 0 : W_B_CMDR_X… in W6692B_fill_fifo()
260 if (cs->debug & L1_DEB_HSCX_FIFO) { in W6692B_fill_fifo()
261 char *t = bcs->blog; in W6692B_fill_fifo()
264 bcs->channel + '1', count); in W6692B_fill_fifo()
266 debugl1(cs, "%s", bcs->blog); in W6692B_fill_fifo()
271 W6692B_interrupt(struct IsdnCardState *cs, u_char bchan) in W6692B_interrupt() argument
279 bcs = (cs->bcs->channel == bchan) ? cs->bcs : (cs->bcs + 1); in W6692B_interrupt()
280 val = cs->BC_Read_Reg(cs, bchan, W_B_EXIR); in W6692B_interrupt()
281 debugl1(cs, "W6692B chan %d B_EXIR 0x%02X", bchan, val); in W6692B_interrupt()
283 if (!test_bit(BC_FLG_INIT, &bcs->Flag)) { in W6692B_interrupt()
284 debugl1(cs, "W6692B not INIT yet"); in W6692B_interrupt()
288 r = cs->BC_Read_Reg(cs, bchan, W_B_STAR); in W6692B_interrupt()
290 if (cs->debug & L1_DEB_WARN) in W6692B_interrupt()
291 debugl1(cs, "W6692 B STAR %x", r); in W6692B_interrupt()
292 if ((r & W_B_STAR_RDOV) && bcs->mode) in W6692B_interrupt()
293 if (cs->debug & L1_DEB_WARN) in W6692B_interrupt()
294 debugl1(cs, "W6692 B RDOV mode=%d", in W6692B_interrupt()
295 bcs->mode); in W6692B_interrupt()
297 if (cs->debug & L1_DEB_WARN) in W6692B_interrupt()
298 debugl1(cs, "W6692 B CRC error"); in W6692B_interrupt()
299 cs->BC_Write_Reg(cs, bchan, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RRST | W_B_CMDR_RACT); in W6692B_interrupt()
301 count = cs->BC_Read_Reg(cs, bchan, W_B_RBCL) & (W_B_FIFO_THRESH - 1); in W6692B_interrupt()
305 if ((count = bcs->hw.w6692.rcvidx) > 0) { in W6692B_interrupt()
306 if (cs->debug & L1_DEB_HSCX_FIFO) in W6692B_interrupt()
307 debugl1(cs, "W6692 Bchan Frame %d", count); in W6692B_interrupt()
312 bcs->hw.w6692.rcvbuf, in W6692B_interrupt()
314 skb_queue_tail(&bcs->rqueue, skb); in W6692B_interrupt()
318 bcs->hw.w6692.rcvidx = 0; in W6692B_interrupt()
323 r = cs->BC_Read_Reg(cs, bchan, W_B_STAR); in W6692B_interrupt()
325 if (cs->debug & L1_DEB_WARN) in W6692B_interrupt()
326 debugl1(cs, "W6692 B RDOV(RMR) mode=%d", bcs->mode); in W6692B_interrupt()
327 cs->BC_Write_Reg(cs, bchan, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RRST | W_B_CMDR_RACT); in W6692B_interrupt()
328 if (bcs->mode != L1_MODE_TRANS) in W6692B_interrupt()
329 bcs->hw.w6692.rcvidx = 0; in W6692B_interrupt()
331 if (bcs->mode == L1_MODE_TRANS) { in W6692B_interrupt()
336 skb_put_data(skb, bcs->hw.w6692.rcvbuf, in W6692B_interrupt()
338 skb_queue_tail(&bcs->rqueue, skb); in W6692B_interrupt()
340 bcs->hw.w6692.rcvidx = 0; in W6692B_interrupt()
345 cs->BC_Write_Reg(cs, bchan, W_B_CMDR, W_B_CMDR_XRST | W_B_CMDR_RACT); in W6692B_interrupt()
346 if (cs->debug & L1_DEB_WARN) in W6692B_interrupt()
347 debugl1(cs, "W6692 B EXIR %x Lost TX", val); in W6692B_interrupt()
348 if (bcs->mode == 1) in W6692B_interrupt()
354 if (bcs->tx_skb) { in W6692B_interrupt()
355 skb_push(bcs->tx_skb, bcs->hw.w6692.count); in W6692B_interrupt()
356 bcs->tx_cnt += bcs->hw.w6692.count; in W6692B_interrupt()
357 bcs->hw.w6692.count = 0; in W6692B_interrupt()
363 r = cs->BC_Read_Reg(cs, bchan, W_B_STAR); in W6692B_interrupt()
365 if (cs->debug & L1_DEB_WARN) in W6692B_interrupt()
366 debugl1(cs, "W6692 B STAR %x XDOW", r); in W6692B_interrupt()
367 cs->BC_Write_Reg(cs, bchan, W_B_CMDR, W_B_CMDR_XRST | W_B_CMDR_RACT); in W6692B_interrupt()
368 if (bcs->tx_skb && (bcs->mode != 1)) { in W6692B_interrupt()
369 skb_push(bcs->tx_skb, bcs->hw.w6692.count); in W6692B_interrupt()
370 bcs->tx_cnt += bcs->hw.w6692.count; in W6692B_interrupt()
371 bcs->hw.w6692.count = 0; in W6692B_interrupt()
374 if (bcs->tx_skb) { in W6692B_interrupt()
375 if (bcs->tx_skb->len) { in W6692B_interrupt()
379 if (test_bit(FLG_LLI_L1WAKEUP, &bcs->st->lli.flag) && in W6692B_interrupt()
380 (PACKET_NOACK != bcs->tx_skb->pkt_type)) { in W6692B_interrupt()
382 spin_lock_irqsave(&bcs->aclock, flags); in W6692B_interrupt()
383 bcs->ackcnt += bcs->hw.w6692.count; in W6692B_interrupt()
384 spin_unlock_irqrestore(&bcs->aclock, flags); in W6692B_interrupt()
387 dev_kfree_skb_irq(bcs->tx_skb); in W6692B_interrupt()
388 bcs->hw.w6692.count = 0; in W6692B_interrupt()
389 bcs->tx_skb = NULL; in W6692B_interrupt()
392 if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) { in W6692B_interrupt()
393 bcs->hw.w6692.count = 0; in W6692B_interrupt()
394 test_and_set_bit(BC_FLG_BUSY, &bcs->Flag); in W6692B_interrupt()
397 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in W6692B_interrupt()
406 struct IsdnCardState *cs = dev_id; in W6692_interrupt() local
413 spin_lock_irqsave(&cs->lock, flags); in W6692_interrupt()
414 val = cs->readW6692(cs, W_ISTA); in W6692_interrupt()
416 spin_unlock_irqrestore(&cs->lock, flags); in W6692_interrupt()
420 if (cs->debug & L1_DEB_ISAC) in W6692_interrupt()
421 debugl1(cs, "W6692 ISTA %x", val); in W6692_interrupt()
424 exval = cs->readW6692(cs, W_D_RSTA); in W6692_interrupt()
427 if (cs->debug & L1_DEB_WARN) in W6692_interrupt()
428 debugl1(cs, "W6692 RDOV"); in W6692_interrupt()
430 if (cs->debug & L1_DEB_WARN) in W6692_interrupt()
431 debugl1(cs, "W6692 D-channel CRC error"); in W6692_interrupt()
433 if (cs->debug & L1_DEB_WARN) in W6692_interrupt()
434 debugl1(cs, "W6692 D-channel ABORT"); in W6692_interrupt()
435 cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_RACK | W_D_CMDR_RRST); in W6692_interrupt()
437 count = cs->readW6692(cs, W_D_RBCL) & (W_D_FIFO_THRESH - 1); in W6692_interrupt()
440 W6692_empty_fifo(cs, count); in W6692_interrupt()
441 if ((count = cs->rcvidx) > 0) { in W6692_interrupt()
442 cs->rcvidx = 0; in W6692_interrupt()
446 skb_put_data(skb, cs->rcvbuf, count); in W6692_interrupt()
447 skb_queue_tail(&cs->rq, skb); in W6692_interrupt()
451 cs->rcvidx = 0; in W6692_interrupt()
452 schedule_event(cs, D_RCVBUFREADY); in W6692_interrupt()
455 W6692_empty_fifo(cs, W_D_FIFO_THRESH); in W6692_interrupt()
458 if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) in W6692_interrupt()
459 del_timer(&cs->dbusytimer); in W6692_interrupt()
460 if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in W6692_interrupt()
461 schedule_event(cs, D_CLEARBUSY); in W6692_interrupt()
462 if (cs->tx_skb) { in W6692_interrupt()
463 if (cs->tx_skb->len) { in W6692_interrupt()
464 W6692_fill_fifo(cs); in W6692_interrupt()
467 dev_kfree_skb_irq(cs->tx_skb); in W6692_interrupt()
468 cs->tx_cnt = 0; in W6692_interrupt()
469 cs->tx_skb = NULL; in W6692_interrupt()
472 if ((cs->tx_skb = skb_dequeue(&cs->sq))) { in W6692_interrupt()
473 cs->tx_cnt = 0; in W6692_interrupt()
474 W6692_fill_fifo(cs); in W6692_interrupt()
476 schedule_event(cs, D_XMTBUFREADY); in W6692_interrupt()
479 if (val & (W_INT_XINT0 | W_INT_XINT1)) { /* XINT0/1 - never */ in W6692_interrupt()
480 if (cs->debug & L1_DEB_ISAC) in W6692_interrupt()
481 debugl1(cs, "W6692 spurious XINT!"); in W6692_interrupt()
484 exval = cs->readW6692(cs, W_D_EXIR); in W6692_interrupt()
485 if (cs->debug & L1_DEB_WARN) in W6692_interrupt()
486 debugl1(cs, "W6692 D_EXIR %02x", exval); in W6692_interrupt()
488 debugl1(cs, "W6692 D-chan underrun/collision"); in W6692_interrupt()
490 if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) in W6692_interrupt()
491 del_timer(&cs->dbusytimer); in W6692_interrupt()
492 if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in W6692_interrupt()
493 schedule_event(cs, D_CLEARBUSY); in W6692_interrupt()
494 if (cs->tx_skb) { /* Restart frame */ in W6692_interrupt()
495 skb_push(cs->tx_skb, cs->tx_cnt); in W6692_interrupt()
496 cs->tx_cnt = 0; in W6692_interrupt()
497 W6692_fill_fifo(cs); in W6692_interrupt()
500 debugl1(cs, "W6692 XDUN/XCOL no skb"); in W6692_interrupt()
501 cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_XRST); in W6692_interrupt()
505 debugl1(cs, "W6692 D-channel RDOV"); in W6692_interrupt()
506 printk(KERN_WARNING "HiSax: W6692 D-RDOV\n"); in W6692_interrupt()
507 cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_RRST); in W6692_interrupt()
509 if (exval & W_D_EXI_TIN2) { /* TIN2 - never */ in W6692_interrupt()
510 debugl1(cs, "W6692 spurious TIN2 interrupt"); in W6692_interrupt()
512 if (exval & W_D_EXI_MOC) { /* MOC - not supported */ in W6692_interrupt()
513 debugl1(cs, "W6692 spurious MOC interrupt"); in W6692_interrupt()
514 v1 = cs->readW6692(cs, W_MOSR); in W6692_interrupt()
515 debugl1(cs, "W6692 MOSR %02x", v1); in W6692_interrupt()
517 if (exval & W_D_EXI_ISC) { /* ISC - Level1 change */ in W6692_interrupt()
518 v1 = cs->readW6692(cs, W_CIR); in W6692_interrupt()
519 if (cs->debug & L1_DEB_ISAC) in W6692_interrupt()
520 debugl1(cs, "W6692 ISC CIR=0x%02X", v1); in W6692_interrupt()
522 cs->dc.w6692.ph_state = v1 & W_CIR_COD_MASK; in W6692_interrupt()
523 if (cs->debug & L1_DEB_ISAC) in W6692_interrupt()
524 debugl1(cs, "ph_state_change %x", cs->dc.w6692.ph_state); in W6692_interrupt()
525 schedule_event(cs, D_L1STATECHANGE); in W6692_interrupt()
528 v1 = cs->readW6692(cs, W_SQR); in W6692_interrupt()
529 debugl1(cs, "W6692 SCC SQR=0x%02X", v1); in W6692_interrupt()
533 debugl1(cs, "W6692 spurious WEXP interrupt!"); in W6692_interrupt()
536 debugl1(cs, "W6692 spurious TEXP interrupt!"); in W6692_interrupt()
540 debugl1(cs, "W6692 B channel 1 interrupt"); in W6692_interrupt()
541 W6692B_interrupt(cs, 0); in W6692_interrupt()
544 debugl1(cs, "W6692 B channel 2 interrupt"); in W6692_interrupt()
545 W6692B_interrupt(cs, 1); in W6692_interrupt()
547 val = cs->readW6692(cs, W_ISTA); in W6692_interrupt()
549 icnt--; in W6692_interrupt()
554 cs->writeW6692(cs, W_IMASK, 0xff); in W6692_interrupt()
556 spin_unlock_irqrestore(&cs->lock, flags); in W6692_interrupt()
563 struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware; in W6692_l1hw() local
570 if (cs->debug & DEB_DLOG_HEX) in W6692_l1hw()
571 LogFrame(cs, skb->data, skb->len); in W6692_l1hw()
572 if (cs->debug & DEB_DLOG_VERBOSE) in W6692_l1hw()
573 dlogframe(cs, skb, 0); in W6692_l1hw()
574 spin_lock_irqsave(&cs->lock, flags); in W6692_l1hw()
575 if (cs->tx_skb) { in W6692_l1hw()
576 skb_queue_tail(&cs->sq, skb); in W6692_l1hw()
578 if (cs->debug & L1_DEB_LAPD) in W6692_l1hw()
579 Logl2Frame(cs, skb, "PH_DATA Queued", 0); in W6692_l1hw()
582 cs->tx_skb = skb; in W6692_l1hw()
583 cs->tx_cnt = 0; in W6692_l1hw()
585 if (cs->debug & L1_DEB_LAPD) in W6692_l1hw()
586 Logl2Frame(cs, skb, "PH_DATA", 0); in W6692_l1hw()
588 W6692_fill_fifo(cs); in W6692_l1hw()
590 spin_unlock_irqrestore(&cs->lock, flags); in W6692_l1hw()
593 spin_lock_irqsave(&cs->lock, flags); in W6692_l1hw()
594 if (cs->tx_skb) { in W6692_l1hw()
595 if (cs->debug & L1_DEB_WARN) in W6692_l1hw()
596 debugl1(cs, " l2l1 tx_skb exist this shouldn't happen"); in W6692_l1hw()
597 skb_queue_tail(&cs->sq, skb); in W6692_l1hw()
598 spin_unlock_irqrestore(&cs->lock, flags); in W6692_l1hw()
601 if (cs->debug & DEB_DLOG_HEX) in W6692_l1hw()
602 LogFrame(cs, skb->data, skb->len); in W6692_l1hw()
603 if (cs->debug & DEB_DLOG_VERBOSE) in W6692_l1hw()
604 dlogframe(cs, skb, 0); in W6692_l1hw()
605 cs->tx_skb = skb; in W6692_l1hw()
606 cs->tx_cnt = 0; in W6692_l1hw()
608 if (cs->debug & L1_DEB_LAPD) in W6692_l1hw()
609 Logl2Frame(cs, skb, "PH_DATA_PULLED", 0); in W6692_l1hw()
611 W6692_fill_fifo(cs); in W6692_l1hw()
612 spin_unlock_irqrestore(&cs->lock, flags); in W6692_l1hw()
616 if (cs->debug & L1_DEB_LAPD) in W6692_l1hw()
617 debugl1(cs, "-> PH_REQUEST_PULL"); in W6692_l1hw()
619 if (!cs->tx_skb) { in W6692_l1hw()
620 test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags); in W6692_l1hw()
621 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL); in W6692_l1hw()
623 test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags); in W6692_l1hw()
626 spin_lock_irqsave(&cs->lock, flags); in W6692_l1hw()
627 if ((cs->dc.w6692.ph_state == W_L1IND_DRD)) { in W6692_l1hw()
628 ph_command(cs, W_L1CMD_ECK); in W6692_l1hw()
629 spin_unlock_irqrestore(&cs->lock, flags); in W6692_l1hw()
631 ph_command(cs, W_L1CMD_RST); in W6692_l1hw()
632 cs->dc.w6692.ph_state = W_L1CMD_RST; in W6692_l1hw()
633 spin_unlock_irqrestore(&cs->lock, flags); in W6692_l1hw()
634 W6692_new_ph(cs); in W6692_l1hw()
638 spin_lock_irqsave(&cs->lock, flags); in W6692_l1hw()
639 ph_command(cs, W_L1CMD_ECK); in W6692_l1hw()
640 spin_unlock_irqrestore(&cs->lock, flags); in W6692_l1hw()
643 spin_lock_irqsave(&cs->lock, flags); in W6692_l1hw()
644 ph_command(cs, W_L1CMD_AR8); in W6692_l1hw()
645 spin_unlock_irqrestore(&cs->lock, flags); in W6692_l1hw()
656 skb_queue_purge(&cs->rq); in W6692_l1hw()
657 skb_queue_purge(&cs->sq); in W6692_l1hw()
658 if (cs->tx_skb) { in W6692_l1hw()
659 dev_kfree_skb_any(cs->tx_skb); in W6692_l1hw()
660 cs->tx_skb = NULL; in W6692_l1hw()
662 if (test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) in W6692_l1hw()
663 del_timer(&cs->dbusytimer); in W6692_l1hw()
664 if (test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in W6692_l1hw()
665 schedule_event(cs, D_CLEARBUSY); in W6692_l1hw()
668 if (cs->debug & L1_DEB_WARN) in W6692_l1hw()
669 debugl1(cs, "W6692_l1hw unknown %04x", pr); in W6692_l1hw()
675 setstack_W6692(struct PStack *st, struct IsdnCardState *cs) in setstack_W6692() argument
677 st->l1.l1hw = W6692_l1hw; in setstack_W6692()
681 DC_Close_W6692(struct IsdnCardState *cs) in DC_Close_W6692() argument
688 struct IsdnCardState *cs = from_timer(cs, t, dbusytimer); in dbusy_timer_handler() local
693 spin_lock_irqsave(&cs->lock, flags); in dbusy_timer_handler()
694 if (test_bit(FLG_DBUSY_TIMER, &cs->HW_Flags)) { in dbusy_timer_handler()
695 rbch = cs->readW6692(cs, W_D_RBCH); in dbusy_timer_handler()
696 star = cs->readW6692(cs, W_D_STAR); in dbusy_timer_handler()
697 if (cs->debug) in dbusy_timer_handler()
698 debugl1(cs, "D-Channel Busy D_RBCH %02x D_STAR %02x", in dbusy_timer_handler()
700 if (star & W_D_STAR_XBZ) { /* D-Channel Busy */ in dbusy_timer_handler()
701 test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags); in dbusy_timer_handler()
702 stptr = cs->stlist; in dbusy_timer_handler()
704 stptr->l1.l1l2(stptr, PH_PAUSE | INDICATION, NULL); in dbusy_timer_handler()
705 stptr = stptr->next; in dbusy_timer_handler()
709 test_and_clear_bit(FLG_DBUSY_TIMER, &cs->HW_Flags); in dbusy_timer_handler()
710 if (cs->tx_skb) { in dbusy_timer_handler()
711 dev_kfree_skb_any(cs->tx_skb); in dbusy_timer_handler()
712 cs->tx_cnt = 0; in dbusy_timer_handler()
713 cs->tx_skb = NULL; in dbusy_timer_handler()
715 printk(KERN_WARNING "HiSax: W6692 D-Channel Busy no skb\n"); in dbusy_timer_handler()
716 debugl1(cs, "D-Channel Busy no skb"); in dbusy_timer_handler()
718 cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_XRST); /* Transmitter reset */ in dbusy_timer_handler()
719 spin_unlock_irqrestore(&cs->lock, flags); in dbusy_timer_handler()
720 cs->irq_func(cs->irq, cs); in dbusy_timer_handler()
724 spin_unlock_irqrestore(&cs->lock, flags); in dbusy_timer_handler()
730 struct IsdnCardState *cs = bcs->cs; in W6692Bmode() local
732 if (cs->debug & L1_DEB_HSCX) in W6692Bmode()
733 debugl1(cs, "w6692 %c mode %d ichan %d", in W6692Bmode()
735 bcs->mode = mode; in W6692Bmode()
736 bcs->channel = bchan; in W6692Bmode()
737 bcs->hw.w6692.bchan = bchan; in W6692Bmode()
741 cs->BC_Write_Reg(cs, bchan, W_B_MODE, 0); in W6692Bmode()
744 cs->BC_Write_Reg(cs, bchan, W_B_MODE, W_B_MODE_MMS); in W6692Bmode()
747 cs->BC_Write_Reg(cs, bchan, W_B_MODE, W_B_MODE_ITF); in W6692Bmode()
748 cs->BC_Write_Reg(cs, bchan, W_B_ADM1, 0xff); in W6692Bmode()
749 cs->BC_Write_Reg(cs, bchan, W_B_ADM2, 0xff); in W6692Bmode()
753 cs->BC_Write_Reg(cs, bchan, W_B_CMDR, W_B_CMDR_RRST | in W6692Bmode()
755 cs->BC_Write_Reg(cs, bchan, W_B_EXIM, 0x00); in W6692Bmode()
762 struct BCState *bcs = st->l1.bcs; in W6692_l2l1()
767 spin_lock_irqsave(&bcs->cs->lock, flags); in W6692_l2l1()
768 if (bcs->tx_skb) { in W6692_l2l1()
769 skb_queue_tail(&bcs->squeue, skb); in W6692_l2l1()
771 bcs->tx_skb = skb; in W6692_l2l1()
772 test_and_set_bit(BC_FLG_BUSY, &bcs->Flag); in W6692_l2l1()
773 bcs->hw.w6692.count = 0; in W6692_l2l1()
774 bcs->cs->BC_Send_Data(bcs); in W6692_l2l1()
776 spin_unlock_irqrestore(&bcs->cs->lock, flags); in W6692_l2l1()
779 if (bcs->tx_skb) { in W6692_l2l1()
783 spin_lock_irqsave(&bcs->cs->lock, flags); in W6692_l2l1()
784 test_and_set_bit(BC_FLG_BUSY, &bcs->Flag); in W6692_l2l1()
785 bcs->tx_skb = skb; in W6692_l2l1()
786 bcs->hw.w6692.count = 0; in W6692_l2l1()
787 bcs->cs->BC_Send_Data(bcs); in W6692_l2l1()
788 spin_unlock_irqrestore(&bcs->cs->lock, flags); in W6692_l2l1()
791 if (!bcs->tx_skb) { in W6692_l2l1()
792 test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags); in W6692_l2l1()
793 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL); in W6692_l2l1()
795 test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags); in W6692_l2l1()
798 spin_lock_irqsave(&bcs->cs->lock, flags); in W6692_l2l1()
799 test_and_set_bit(BC_FLG_ACTIV, &bcs->Flag); in W6692_l2l1()
800 W6692Bmode(bcs, st->l1.mode, st->l1.bc); in W6692_l2l1()
801 spin_unlock_irqrestore(&bcs->cs->lock, flags); in W6692_l2l1()
808 spin_lock_irqsave(&bcs->cs->lock, flags); in W6692_l2l1()
809 test_and_clear_bit(BC_FLG_ACTIV, &bcs->Flag); in W6692_l2l1()
810 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in W6692_l2l1()
811 W6692Bmode(bcs, 0, st->l1.bc); in W6692_l2l1()
812 spin_unlock_irqrestore(&bcs->cs->lock, flags); in W6692_l2l1()
813 st->l1.l1l2(st, PH_DEACTIVATE | CONFIRM, NULL); in W6692_l2l1()
821 W6692Bmode(bcs, 0, bcs->channel); in close_w6692state()
822 if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) { in close_w6692state()
823 kfree(bcs->hw.w6692.rcvbuf); in close_w6692state()
824 bcs->hw.w6692.rcvbuf = NULL; in close_w6692state()
825 kfree(bcs->blog); in close_w6692state()
826 bcs->blog = NULL; in close_w6692state()
827 skb_queue_purge(&bcs->rqueue); in close_w6692state()
828 skb_queue_purge(&bcs->squeue); in close_w6692state()
829 if (bcs->tx_skb) { in close_w6692state()
830 dev_kfree_skb_any(bcs->tx_skb); in close_w6692state()
831 bcs->tx_skb = NULL; in close_w6692state()
832 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in close_w6692state()
838 open_w6692state(struct IsdnCardState *cs, struct BCState *bcs) in open_w6692state() argument
840 if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) { in open_w6692state()
841 if (!(bcs->hw.w6692.rcvbuf = kmalloc(HSCX_BUFMAX, GFP_ATOMIC))) { in open_w6692state()
844 test_and_clear_bit(BC_FLG_INIT, &bcs->Flag); in open_w6692state()
847 if (!(bcs->blog = kmalloc(MAX_BLOG_SPACE, GFP_ATOMIC))) { in open_w6692state()
849 "HiSax: No memory for bcs->blog\n"); in open_w6692state()
850 test_and_clear_bit(BC_FLG_INIT, &bcs->Flag); in open_w6692state()
851 kfree(bcs->hw.w6692.rcvbuf); in open_w6692state()
852 bcs->hw.w6692.rcvbuf = NULL; in open_w6692state()
855 skb_queue_head_init(&bcs->rqueue); in open_w6692state()
856 skb_queue_head_init(&bcs->squeue); in open_w6692state()
858 bcs->tx_skb = NULL; in open_w6692state()
859 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in open_w6692state()
860 bcs->event = 0; in open_w6692state()
861 bcs->hw.w6692.rcvidx = 0; in open_w6692state()
862 bcs->tx_cnt = 0; in open_w6692state()
869 bcs->channel = st->l1.bc; in setstack_w6692()
870 if (open_w6692state(st->l1.hardware, bcs)) in setstack_w6692()
871 return (-1); in setstack_w6692()
872 st->l1.bcs = bcs; in setstack_w6692()
873 st->l2.l2l1 = W6692_l2l1; in setstack_w6692()
875 bcs->st = st; in setstack_w6692()
880 static void resetW6692(struct IsdnCardState *cs) in resetW6692() argument
882 cs->writeW6692(cs, W_D_CTL, W_D_CTL_SRST); in resetW6692()
884 cs->writeW6692(cs, W_D_CTL, 0x00); in resetW6692()
886 cs->writeW6692(cs, W_IMASK, 0xff); in resetW6692()
887 cs->writeW6692(cs, W_D_SAM, 0xff); in resetW6692()
888 cs->writeW6692(cs, W_D_TAM, 0xff); in resetW6692()
889 cs->writeW6692(cs, W_D_EXIM, 0x00); in resetW6692()
890 cs->writeW6692(cs, W_D_MODE, W_D_MODE_RACT); in resetW6692()
891 cs->writeW6692(cs, W_IMASK, 0x18); in resetW6692()
892 if (cs->subtyp == W6692_USR) { in resetW6692()
897 cs->writeW6692(cs, W_PCTL, 0x80); in resetW6692()
898 cs->writeW6692(cs, W_XDATA, 0x00); in resetW6692()
902 static void initW6692(struct IsdnCardState *cs, int part) in initW6692() argument
905 cs->setstack_d = setstack_W6692; in initW6692()
906 cs->DC_Close = DC_Close_W6692; in initW6692()
907 timer_setup(&cs->dbusytimer, dbusy_timer_handler, 0); in initW6692()
908 resetW6692(cs); in initW6692()
909 ph_command(cs, W_L1CMD_RST); in initW6692()
910 cs->dc.w6692.ph_state = W_L1CMD_RST; in initW6692()
911 W6692_new_ph(cs); in initW6692()
912 ph_command(cs, W_L1CMD_ECK); in initW6692()
914 cs->bcs[0].BC_SetStack = setstack_w6692; in initW6692()
915 cs->bcs[1].BC_SetStack = setstack_w6692; in initW6692()
916 cs->bcs[0].BC_Close = close_w6692state; in initW6692()
917 cs->bcs[1].BC_Close = close_w6692state; in initW6692()
918 W6692Bmode(cs->bcs, 0, 0); in initW6692()
919 W6692Bmode(cs->bcs + 1, 0, 0); in initW6692()
923 cs->writeW6692(cs, W_IMASK, 0x18); in initW6692()
924 cs->writeW6692(cs, W_D_EXIM, 0x00); in initW6692()
925 cs->BC_Write_Reg(cs, 0, W_B_EXIM, 0x00); in initW6692()
926 cs->BC_Write_Reg(cs, 1, W_B_EXIM, 0x00); in initW6692()
927 /* Reset D-chan receiver and transmitter */ in initW6692()
928 cs->writeW6692(cs, W_D_CMDR, W_D_CMDR_RRST | W_D_CMDR_XRST); in initW6692()
935 ReadW6692(struct IsdnCardState *cs, u_char offset) in ReadW6692() argument
937 return (inb(cs->hw.w6692.iobase + offset)); in ReadW6692()
941 WriteW6692(struct IsdnCardState *cs, u_char offset, u_char value) in WriteW6692() argument
943 outb(value, cs->hw.w6692.iobase + offset); in WriteW6692()
947 ReadISACfifo(struct IsdnCardState *cs, u_char *data, int size) in ReadISACfifo() argument
949 insb(cs->hw.w6692.iobase + W_D_RFIFO, data, size); in ReadISACfifo()
953 WriteISACfifo(struct IsdnCardState *cs, u_char *data, int size) in WriteISACfifo() argument
955 outsb(cs->hw.w6692.iobase + W_D_XFIFO, data, size); in WriteISACfifo()
959 ReadW6692B(struct IsdnCardState *cs, int bchan, u_char offset) in ReadW6692B() argument
961 return (inb(cs->hw.w6692.iobase + (bchan ? 0x40 : 0) + offset)); in ReadW6692B()
965 WriteW6692B(struct IsdnCardState *cs, int bchan, u_char offset, u_char value) in WriteW6692B() argument
967 outb(value, cs->hw.w6692.iobase + (bchan ? 0x40 : 0) + offset); in WriteW6692B()
971 w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg) in w6692_card_msg() argument
975 resetW6692(cs); in w6692_card_msg()
978 cs->writeW6692(cs, W_IMASK, 0xff); in w6692_card_msg()
979 release_region(cs->hw.w6692.iobase, 256); in w6692_card_msg()
980 if (cs->subtyp == W6692_USR) { in w6692_card_msg()
981 cs->writeW6692(cs, W_XDATA, 0x04); in w6692_card_msg()
985 initW6692(cs, 3); in w6692_card_msg()
999 struct IsdnCardState *cs = card->cs; in setup_w6692() local
1007 if (cs->typ != ISDN_CTYPE_W6692) in setup_w6692()
1017 cs->subtyp = id_idx; in setup_w6692()
1024 pci_irq = dev_w6692->irq; in setup_w6692()
1029 if (cs->subtyp == W6692_WINBOND) { in setup_w6692()
1030 if ((W6692_SV_USR == dev_w6692->subsystem_vendor) && in setup_w6692()
1031 (W6692_SD_USR == dev_w6692->subsystem_device)) { in setup_w6692()
1032 cs->subtyp = W6692_USR; in setup_w6692()
1040 cs->irq = pci_irq; in setup_w6692()
1041 if (!cs->irq) { in setup_w6692()
1049 cs->hw.w6692.iobase = pci_ioaddr; in setup_w6692()
1050 printk(KERN_INFO "Found: %s %s, I/O base: 0x%x, irq: %d\n", in setup_w6692()
1051 id_list[cs->subtyp].vendor_name, id_list[cs->subtyp].card_name, in setup_w6692()
1053 if (!request_region(cs->hw.w6692.iobase, 256, id_list[cs->subtyp].card_name)) { in setup_w6692()
1055 "HiSax: %s I/O ports %x-%x already in use\n", in setup_w6692()
1056 id_list[cs->subtyp].card_name, in setup_w6692()
1057 cs->hw.w6692.iobase, in setup_w6692()
1058 cs->hw.w6692.iobase + 255); in setup_w6692()
1063 "HiSax: %s config irq:%d I/O:%x\n", in setup_w6692()
1064 id_list[cs->subtyp].card_name, cs->irq, in setup_w6692()
1065 cs->hw.w6692.iobase); in setup_w6692()
1067 INIT_WORK(&cs->tqueue, W6692_bh); in setup_w6692()
1068 cs->readW6692 = &ReadW6692; in setup_w6692()
1069 cs->writeW6692 = &WriteW6692; in setup_w6692()
1070 cs->readisacfifo = &ReadISACfifo; in setup_w6692()
1071 cs->writeisacfifo = &WriteISACfifo; in setup_w6692()
1072 cs->BC_Read_Reg = &ReadW6692B; in setup_w6692()
1073 cs->BC_Write_Reg = &WriteW6692B; in setup_w6692()
1074 cs->BC_Send_Data = &W6692B_fill_fifo; in setup_w6692()
1075 cs->cardmsg = &w6692_card_msg; in setup_w6692()
1076 cs->irq_func = &W6692_interrupt; in setup_w6692()
1077 cs->irq_flags |= IRQF_SHARED; in setup_w6692()
1078 W6692Version(cs, "W6692:"); in setup_w6692()
1079 printk(KERN_INFO "W6692 ISTA=0x%X\n", ReadW6692(cs, W_ISTA)); in setup_w6692()
1080 printk(KERN_INFO "W6692 IMASK=0x%X\n", ReadW6692(cs, W_IMASK)); in setup_w6692()
1081 printk(KERN_INFO "W6692 D_EXIR=0x%X\n", ReadW6692(cs, W_D_EXIR)); in setup_w6692()
1082 printk(KERN_INFO "W6692 D_EXIM=0x%X\n", ReadW6692(cs, W_D_EXIM)); in setup_w6692()
1083 printk(KERN_INFO "W6692 D_RSTA=0x%X\n", ReadW6692(cs, W_D_RSTA)); in setup_w6692()