2 * w6692.c mISDN driver for Winbond w6692 based cards
4 * Author Karsten Keil <kkeil@suse.de>
5 * based on the w6692 I4L driver from Petr Novak <petr.novak@i.cz>
7 * Copyright 2009 by Karsten Keil <keil@isdn4linux.de>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <linux/interrupt.h>
25 #include <linux/module.h>
26 #include <linux/pci.h>
27 #include <linux/delay.h>
28 #include <linux/mISDNhw.h>
29 #include <linux/slab.h>
32 #define W6692_REV "2.0"
34 #define DBUSY_TIMER_VALUE 80
42 /* private data in the PCI devices list */
48 static const struct w6692map w6692_map
[] =
50 {W6692_ASUS
, "Dynalink/AsusCom IS64PH"},
51 {W6692_WINBOND
, "Winbond W6692"},
52 {W6692_USR
, "USR W6692"}
55 #ifndef PCI_VENDOR_ID_USR
56 #define PCI_VENDOR_ID_USR 0x16ec
57 #define PCI_DEVICE_ID_USR_6692 0x3409
63 struct timer_list timer
;
68 struct list_head list
;
70 char name
[MISDN_MAX_IDLEN
];
74 u32 fmask
; /* feature mask - bit set per card nr */
76 spinlock_t lock
; /* hw lock */
82 struct w6692_ch bc
[2];
87 static LIST_HEAD(Cards
);
88 static DEFINE_RWLOCK(card_lock
); /* protect Cards */
96 _set_debug(struct w6692_hw
*card
)
98 card
->dch
.debug
= debug
;
99 card
->bc
[0].bch
.debug
= debug
;
100 card
->bc
[1].bch
.debug
= debug
;
104 set_debug(const char *val
, const struct kernel_param
*kp
)
107 struct w6692_hw
*card
;
109 ret
= param_set_uint(val
, kp
);
111 read_lock(&card_lock
);
112 list_for_each_entry(card
, &Cards
, list
)
114 read_unlock(&card_lock
);
119 MODULE_AUTHOR("Karsten Keil");
120 MODULE_LICENSE("GPL v2");
121 MODULE_VERSION(W6692_REV
);
122 module_param_call(debug
, set_debug
, param_get_uint
, &debug
, S_IRUGO
| S_IWUSR
);
123 MODULE_PARM_DESC(debug
, "W6692 debug mask");
124 module_param(led
, uint
, S_IRUGO
| S_IWUSR
);
125 MODULE_PARM_DESC(led
, "W6692 LED support bitmask (one bit per card)");
126 module_param(pots
, uint
, S_IRUGO
| S_IWUSR
);
127 MODULE_PARM_DESC(pots
, "W6692 POTS support bitmask (one bit per card)");
130 ReadW6692(struct w6692_hw
*card
, u8 offset
)
132 return inb(card
->addr
+ offset
);
136 WriteW6692(struct w6692_hw
*card
, u8 offset
, u8 value
)
138 outb(value
, card
->addr
+ offset
);
142 ReadW6692B(struct w6692_ch
*bc
, u8 offset
)
144 return inb(bc
->addr
+ offset
);
148 WriteW6692B(struct w6692_ch
*bc
, u8 offset
, u8 value
)
150 outb(value
, bc
->addr
+ offset
);
154 enable_hwirq(struct w6692_hw
*card
)
156 WriteW6692(card
, W_IMASK
, card
->imask
);
160 disable_hwirq(struct w6692_hw
*card
)
162 WriteW6692(card
, W_IMASK
, 0xff);
165 static const char *W6692Ver
[] = {"V00", "V01", "V10", "V11"};
168 W6692Version(struct w6692_hw
*card
)
172 val
= ReadW6692(card
, W_D_RBCH
);
173 pr_notice("%s: Winbond W6692 version: %s\n", card
->name
,
174 W6692Ver
[(val
>> 6) & 3]);
178 w6692_led_handler(struct w6692_hw
*card
, int on
)
180 if ((!(card
->fmask
& led
)) || card
->subtype
== W6692_USR
)
183 card
->xdata
&= 0xfb; /* LED ON */
184 WriteW6692(card
, W_XDATA
, card
->xdata
);
186 card
->xdata
|= 0x04; /* LED OFF */
187 WriteW6692(card
, W_XDATA
, card
->xdata
);
192 ph_command(struct w6692_hw
*card
, u8 cmd
)
194 pr_debug("%s: ph_command %x\n", card
->name
, cmd
);
195 WriteW6692(card
, W_CIX
, cmd
);
199 W6692_new_ph(struct w6692_hw
*card
)
201 if (card
->state
== W_L1CMD_RST
)
202 ph_command(card
, W_L1CMD_DRC
);
203 schedule_event(&card
->dch
, FLG_PHCHANGE
);
207 W6692_ph_bh(struct dchannel
*dch
)
209 struct w6692_hw
*card
= dch
->hw
;
211 switch (card
->state
) {
214 l1_event(dch
->l1
, HW_RESET_IND
);
218 l1_event(dch
->l1
, HW_DEACT_CNF
);
222 l1_event(dch
->l1
, HW_DEACT_IND
);
226 l1_event(dch
->l1
, HW_POWERUP_IND
);
229 if (dch
->state
<= 5) {
231 l1_event(dch
->l1
, ANYSIGNAL
);
234 l1_event(dch
->l1
, LOSTFRAMING
);
239 l1_event(dch
->l1
, INFO2
);
243 l1_event(dch
->l1
, INFO4_P8
);
247 l1_event(dch
->l1
, INFO4_P10
);
250 pr_debug("%s: TE unknown state %02x dch state %02x\n",
251 card
->name
, card
->state
, dch
->state
);
254 pr_debug("%s: TE newstate %02x\n", card
->name
, dch
->state
);
258 W6692_empty_Dfifo(struct w6692_hw
*card
, int count
)
260 struct dchannel
*dch
= &card
->dch
;
263 pr_debug("%s: empty_Dfifo %d\n", card
->name
, count
);
265 dch
->rx_skb
= mI_alloc_skb(card
->dch
.maxlen
, GFP_ATOMIC
);
267 pr_info("%s: D receive out of memory\n", card
->name
);
268 WriteW6692(card
, W_D_CMDR
, W_D_CMDR_RACK
);
272 if ((dch
->rx_skb
->len
+ count
) >= dch
->maxlen
) {
273 pr_debug("%s: empty_Dfifo overrun %d\n", card
->name
,
274 dch
->rx_skb
->len
+ count
);
275 WriteW6692(card
, W_D_CMDR
, W_D_CMDR_RACK
);
278 ptr
= skb_put(dch
->rx_skb
, count
);
279 insb(card
->addr
+ W_D_RFIFO
, ptr
, count
);
280 WriteW6692(card
, W_D_CMDR
, W_D_CMDR_RACK
);
281 if (debug
& DEBUG_HW_DFIFO
) {
282 snprintf(card
->log
, 63, "D-recv %s %d ",
284 print_hex_dump_bytes(card
->log
, DUMP_PREFIX_OFFSET
, ptr
, count
);
289 W6692_fill_Dfifo(struct w6692_hw
*card
)
291 struct dchannel
*dch
= &card
->dch
;
294 u8 cmd
= W_D_CMDR_XMS
;
296 pr_debug("%s: fill_Dfifo\n", card
->name
);
299 count
= dch
->tx_skb
->len
- dch
->tx_idx
;
302 if (count
> W_D_FIFO_THRESH
)
303 count
= W_D_FIFO_THRESH
;
306 ptr
= dch
->tx_skb
->data
+ dch
->tx_idx
;
307 dch
->tx_idx
+= count
;
308 outsb(card
->addr
+ W_D_XFIFO
, ptr
, count
);
309 WriteW6692(card
, W_D_CMDR
, cmd
);
310 if (test_and_set_bit(FLG_BUSY_TIMER
, &dch
->Flags
)) {
311 pr_debug("%s: fill_Dfifo dbusytimer running\n", card
->name
);
312 del_timer(&dch
->timer
);
314 dch
->timer
.expires
= jiffies
+ ((DBUSY_TIMER_VALUE
* HZ
) / 1000);
315 add_timer(&dch
->timer
);
316 if (debug
& DEBUG_HW_DFIFO
) {
317 snprintf(card
->log
, 63, "D-send %s %d ",
319 print_hex_dump_bytes(card
->log
, DUMP_PREFIX_OFFSET
, ptr
, count
);
324 d_retransmit(struct w6692_hw
*card
)
326 struct dchannel
*dch
= &card
->dch
;
328 if (test_and_clear_bit(FLG_BUSY_TIMER
, &dch
->Flags
))
329 del_timer(&dch
->timer
);
331 if (test_and_clear_bit(FLG_L1_BUSY
, &dch
->Flags
))
332 dchannel_sched_event(dch
, D_CLEARBUSY
);
334 if (test_bit(FLG_TX_BUSY
, &dch
->Flags
)) {
337 W6692_fill_Dfifo(card
);
338 } else if (dch
->tx_skb
) { /* should not happen */
339 pr_info("%s: %s without TX_BUSY\n", card
->name
, __func__
);
340 test_and_set_bit(FLG_TX_BUSY
, &dch
->Flags
);
342 W6692_fill_Dfifo(card
);
344 pr_info("%s: XDU no TX_BUSY\n", card
->name
);
345 if (get_next_dframe(dch
))
346 W6692_fill_Dfifo(card
);
351 handle_rxD(struct w6692_hw
*card
) {
355 stat
= ReadW6692(card
, W_D_RSTA
);
356 if (stat
& (W_D_RSTA_RDOV
| W_D_RSTA_CRCE
| W_D_RSTA_RMB
)) {
357 if (stat
& W_D_RSTA_RDOV
) {
358 pr_debug("%s: D-channel RDOV\n", card
->name
);
359 #ifdef ERROR_STATISTIC
363 if (stat
& W_D_RSTA_CRCE
) {
364 pr_debug("%s: D-channel CRC error\n", card
->name
);
365 #ifdef ERROR_STATISTIC
369 if (stat
& W_D_RSTA_RMB
) {
370 pr_debug("%s: D-channel ABORT\n", card
->name
);
371 #ifdef ERROR_STATISTIC
375 if (card
->dch
.rx_skb
)
376 dev_kfree_skb(card
->dch
.rx_skb
);
377 card
->dch
.rx_skb
= NULL
;
378 WriteW6692(card
, W_D_CMDR
, W_D_CMDR_RACK
| W_D_CMDR_RRST
);
380 count
= ReadW6692(card
, W_D_RBCL
) & (W_D_FIFO_THRESH
- 1);
382 count
= W_D_FIFO_THRESH
;
383 W6692_empty_Dfifo(card
, count
);
384 recv_Dchannel(&card
->dch
);
389 handle_txD(struct w6692_hw
*card
) {
390 if (test_and_clear_bit(FLG_BUSY_TIMER
, &card
->dch
.Flags
))
391 del_timer(&card
->dch
.timer
);
392 if (card
->dch
.tx_skb
&& card
->dch
.tx_idx
< card
->dch
.tx_skb
->len
) {
393 W6692_fill_Dfifo(card
);
395 if (card
->dch
.tx_skb
)
396 dev_kfree_skb(card
->dch
.tx_skb
);
397 if (get_next_dframe(&card
->dch
))
398 W6692_fill_Dfifo(card
);
403 handle_statusD(struct w6692_hw
*card
)
405 struct dchannel
*dch
= &card
->dch
;
408 exval
= ReadW6692(card
, W_D_EXIR
);
410 pr_debug("%s: D_EXIR %02x\n", card
->name
, exval
);
411 if (exval
& (W_D_EXI_XDUN
| W_D_EXI_XCOL
)) {
412 /* Transmit underrun/collision */
413 pr_debug("%s: D-channel underrun/collision\n", card
->name
);
414 #ifdef ERROR_STATISTIC
419 if (exval
& W_D_EXI_RDOV
) { /* RDOV */
420 pr_debug("%s: D-channel RDOV\n", card
->name
);
421 WriteW6692(card
, W_D_CMDR
, W_D_CMDR_RRST
);
423 if (exval
& W_D_EXI_TIN2
) /* TIN2 - never */
424 pr_debug("%s: spurious TIN2 interrupt\n", card
->name
);
425 if (exval
& W_D_EXI_MOC
) { /* MOC - not supported */
426 v1
= ReadW6692(card
, W_MOSR
);
427 pr_debug("%s: spurious MOC interrupt MOSR %02x\n",
430 if (exval
& W_D_EXI_ISC
) { /* ISC - Level1 change */
431 cir
= ReadW6692(card
, W_CIR
);
432 pr_debug("%s: ISC CIR %02X\n", card
->name
, cir
);
433 if (cir
& W_CIR_ICC
) {
434 v1
= cir
& W_CIR_COD_MASK
;
435 pr_debug("%s: ph_state_change %x -> %x\n", card
->name
,
438 if (card
->fmask
& led
) {
442 w6692_led_handler(card
, 1);
445 w6692_led_handler(card
, 0);
451 if (cir
& W_CIR_SCC
) {
452 v1
= ReadW6692(card
, W_SQR
);
453 pr_debug("%s: SCC SQR %02X\n", card
->name
, v1
);
456 if (exval
& W_D_EXI_WEXP
)
457 pr_debug("%s: spurious WEXP interrupt!\n", card
->name
);
458 if (exval
& W_D_EXI_TEXP
)
459 pr_debug("%s: spurious TEXP interrupt!\n", card
->name
);
463 W6692_empty_Bfifo(struct w6692_ch
*wch
, int count
)
465 struct w6692_hw
*card
= wch
->bch
.hw
;
469 pr_debug("%s: empty_Bfifo %d\n", card
->name
, count
);
470 if (unlikely(wch
->bch
.state
== ISDN_P_NONE
)) {
471 pr_debug("%s: empty_Bfifo ISDN_P_NONE\n", card
->name
);
472 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RACK
| W_B_CMDR_RACT
);
474 skb_trim(wch
->bch
.rx_skb
, 0);
477 if (test_bit(FLG_RX_OFF
, &wch
->bch
.Flags
)) {
478 wch
->bch
.dropcnt
+= count
;
479 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RACK
| W_B_CMDR_RACT
);
482 maxlen
= bchannel_get_rxbuf(&wch
->bch
, count
);
484 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RACK
| W_B_CMDR_RACT
);
486 skb_trim(wch
->bch
.rx_skb
, 0);
487 pr_warning("%s.B%d: No bufferspace for %d bytes\n",
488 card
->name
, wch
->bch
.nr
, count
);
491 ptr
= skb_put(wch
->bch
.rx_skb
, count
);
492 insb(wch
->addr
+ W_B_RFIFO
, ptr
, count
);
493 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RACK
| W_B_CMDR_RACT
);
494 if (debug
& DEBUG_HW_DFIFO
) {
495 snprintf(card
->log
, 63, "B%1d-recv %s %d ",
496 wch
->bch
.nr
, card
->name
, count
);
497 print_hex_dump_bytes(card
->log
, DUMP_PREFIX_OFFSET
, ptr
, count
);
502 W6692_fill_Bfifo(struct w6692_ch
*wch
)
504 struct w6692_hw
*card
= wch
->bch
.hw
;
505 int count
, fillempty
= 0;
506 u8
*ptr
, cmd
= W_B_CMDR_RACT
| W_B_CMDR_XMS
;
508 pr_debug("%s: fill Bfifo\n", card
->name
);
509 if (!wch
->bch
.tx_skb
) {
510 if (!test_bit(FLG_TX_EMPTY
, &wch
->bch
.Flags
))
513 count
= W_B_FIFO_THRESH
;
516 count
= wch
->bch
.tx_skb
->len
- wch
->bch
.tx_idx
;
519 ptr
= wch
->bch
.tx_skb
->data
+ wch
->bch
.tx_idx
;
521 if (count
> W_B_FIFO_THRESH
)
522 count
= W_B_FIFO_THRESH
;
523 else if (test_bit(FLG_HDLC
, &wch
->bch
.Flags
))
526 pr_debug("%s: fill Bfifo%d/%d\n", card
->name
,
527 count
, wch
->bch
.tx_idx
);
528 wch
->bch
.tx_idx
+= count
;
531 outsb(wch
->addr
+ W_B_XFIFO
, ptr
, MISDN_BCH_FILL_SIZE
);
532 count
-= MISDN_BCH_FILL_SIZE
;
535 outsb(wch
->addr
+ W_B_XFIFO
, ptr
, count
);
537 WriteW6692B(wch
, W_B_CMDR
, cmd
);
538 if ((debug
& DEBUG_HW_BFIFO
) && !fillempty
) {
539 snprintf(card
->log
, 63, "B%1d-send %s %d ",
540 wch
->bch
.nr
, card
->name
, count
);
541 print_hex_dump_bytes(card
->log
, DUMP_PREFIX_OFFSET
, ptr
, count
);
547 setvolume(struct w6692_ch
*wch
, int mic
, struct sk_buff
*skb
)
549 struct w6692_hw
*card
= wch
->bch
.hw
;
550 u16
*vol
= (u16
*)skb
->data
;
553 if ((!(card
->fmask
& pots
)) ||
554 !test_bit(FLG_TRANSPARENT
, &wch
->bch
.Flags
))
569 WriteW6692(card
, W_XADDR
, card
->xaddr
);
574 enable_pots(struct w6692_ch
*wch
)
576 struct w6692_hw
*card
= wch
->bch
.hw
;
578 if ((!(card
->fmask
& pots
)) ||
579 !test_bit(FLG_TRANSPARENT
, &wch
->bch
.Flags
))
581 wch
->b_mode
|= W_B_MODE_EPCM
| W_B_MODE_BSW0
;
582 WriteW6692B(wch
, W_B_MODE
, wch
->b_mode
);
583 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RRST
| W_B_CMDR_XRST
);
584 card
->pctl
|= ((wch
->bch
.nr
& 2) ? W_PCTL_PCX
: 0);
585 WriteW6692(card
, W_PCTL
, card
->pctl
);
591 disable_pots(struct w6692_ch
*wch
)
593 struct w6692_hw
*card
= wch
->bch
.hw
;
595 if (!(card
->fmask
& pots
))
597 wch
->b_mode
&= ~(W_B_MODE_EPCM
| W_B_MODE_BSW0
);
598 WriteW6692B(wch
, W_B_MODE
, wch
->b_mode
);
599 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RRST
| W_B_CMDR_RACT
|
605 w6692_mode(struct w6692_ch
*wch
, u32 pr
)
607 struct w6692_hw
*card
;
610 pr_debug("%s: B%d protocol %x-->%x\n", card
->name
,
611 wch
->bch
.nr
, wch
->bch
.state
, pr
);
614 if ((card
->fmask
& pots
) && (wch
->b_mode
& W_B_MODE_EPCM
))
617 mISDN_clear_bchannel(&wch
->bch
);
618 WriteW6692B(wch
, W_B_MODE
, wch
->b_mode
);
619 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RRST
| W_B_CMDR_XRST
);
620 test_and_clear_bit(FLG_HDLC
, &wch
->bch
.Flags
);
621 test_and_clear_bit(FLG_TRANSPARENT
, &wch
->bch
.Flags
);
624 wch
->b_mode
= W_B_MODE_MMS
;
625 WriteW6692B(wch
, W_B_MODE
, wch
->b_mode
);
626 WriteW6692B(wch
, W_B_EXIM
, 0);
627 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RRST
| W_B_CMDR_RACT
|
629 test_and_set_bit(FLG_TRANSPARENT
, &wch
->bch
.Flags
);
632 wch
->b_mode
= W_B_MODE_ITF
;
633 WriteW6692B(wch
, W_B_MODE
, wch
->b_mode
);
634 WriteW6692B(wch
, W_B_ADM1
, 0xff);
635 WriteW6692B(wch
, W_B_ADM2
, 0xff);
636 WriteW6692B(wch
, W_B_EXIM
, 0);
637 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RRST
| W_B_CMDR_RACT
|
639 test_and_set_bit(FLG_HDLC
, &wch
->bch
.Flags
);
642 pr_info("%s: protocol %x not known\n", card
->name
, pr
);
650 send_next(struct w6692_ch
*wch
)
652 if (wch
->bch
.tx_skb
&& wch
->bch
.tx_idx
< wch
->bch
.tx_skb
->len
) {
653 W6692_fill_Bfifo(wch
);
656 dev_kfree_skb(wch
->bch
.tx_skb
);
657 if (get_next_bframe(&wch
->bch
)) {
658 W6692_fill_Bfifo(wch
);
659 test_and_clear_bit(FLG_TX_EMPTY
, &wch
->bch
.Flags
);
660 } else if (test_bit(FLG_TX_EMPTY
, &wch
->bch
.Flags
)) {
661 W6692_fill_Bfifo(wch
);
667 W6692B_interrupt(struct w6692_hw
*card
, int ch
)
669 struct w6692_ch
*wch
= &card
->bc
[ch
];
673 stat
= ReadW6692B(wch
, W_B_EXIR
);
674 pr_debug("%s: B%d EXIR %02x\n", card
->name
, wch
->bch
.nr
, stat
);
675 if (stat
& W_B_EXI_RME
) {
676 star
= ReadW6692B(wch
, W_B_STAR
);
677 if (star
& (W_B_STAR_RDOV
| W_B_STAR_CRCE
| W_B_STAR_RMB
)) {
678 if ((star
& W_B_STAR_RDOV
) &&
679 test_bit(FLG_ACTIVE
, &wch
->bch
.Flags
)) {
680 pr_debug("%s: B%d RDOV proto=%x\n", card
->name
,
681 wch
->bch
.nr
, wch
->bch
.state
);
682 #ifdef ERROR_STATISTIC
686 if (test_bit(FLG_HDLC
, &wch
->bch
.Flags
)) {
687 if (star
& W_B_STAR_CRCE
) {
688 pr_debug("%s: B%d CRC error\n",
689 card
->name
, wch
->bch
.nr
);
690 #ifdef ERROR_STATISTIC
694 if (star
& W_B_STAR_RMB
) {
695 pr_debug("%s: B%d message abort\n",
696 card
->name
, wch
->bch
.nr
);
697 #ifdef ERROR_STATISTIC
702 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RACK
|
703 W_B_CMDR_RRST
| W_B_CMDR_RACT
);
705 skb_trim(wch
->bch
.rx_skb
, 0);
707 count
= ReadW6692B(wch
, W_B_RBCL
) &
708 (W_B_FIFO_THRESH
- 1);
710 count
= W_B_FIFO_THRESH
;
711 W6692_empty_Bfifo(wch
, count
);
712 recv_Bchannel(&wch
->bch
, 0, false);
715 if (stat
& W_B_EXI_RMR
) {
716 if (!(stat
& W_B_EXI_RME
))
717 star
= ReadW6692B(wch
, W_B_STAR
);
718 if (star
& W_B_STAR_RDOV
) {
719 pr_debug("%s: B%d RDOV proto=%x\n", card
->name
,
720 wch
->bch
.nr
, wch
->bch
.state
);
721 #ifdef ERROR_STATISTIC
724 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RACK
|
725 W_B_CMDR_RRST
| W_B_CMDR_RACT
);
727 W6692_empty_Bfifo(wch
, W_B_FIFO_THRESH
);
728 if (test_bit(FLG_TRANSPARENT
, &wch
->bch
.Flags
))
729 recv_Bchannel(&wch
->bch
, 0, false);
732 if (stat
& W_B_EXI_RDOV
) {
733 /* only if it is not handled yet */
734 if (!(star
& W_B_STAR_RDOV
)) {
735 pr_debug("%s: B%d RDOV IRQ proto=%x\n", card
->name
,
736 wch
->bch
.nr
, wch
->bch
.state
);
737 #ifdef ERROR_STATISTIC
740 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_RACK
|
741 W_B_CMDR_RRST
| W_B_CMDR_RACT
);
744 if (stat
& W_B_EXI_XFR
) {
745 if (!(stat
& (W_B_EXI_RME
| W_B_EXI_RMR
))) {
746 star
= ReadW6692B(wch
, W_B_STAR
);
747 pr_debug("%s: B%d star %02x\n", card
->name
,
750 if (star
& W_B_STAR_XDOW
) {
751 pr_warning("%s: B%d XDOW proto=%x\n", card
->name
,
752 wch
->bch
.nr
, wch
->bch
.state
);
753 #ifdef ERROR_STATISTIC
756 WriteW6692B(wch
, W_B_CMDR
, W_B_CMDR_XRST
|
759 if (wch
->bch
.tx_skb
) {
760 if (!test_bit(FLG_TRANSPARENT
, &wch
->bch
.Flags
))
765 if (star
& W_B_STAR_XDOW
)
766 return; /* handle XDOW only once */
768 if (stat
& W_B_EXI_XDUN
) {
769 pr_warning("%s: B%d XDUN proto=%x\n", card
->name
,
770 wch
->bch
.nr
, wch
->bch
.state
);
771 #ifdef ERROR_STATISTIC
774 /* resend - no XRST needed */
775 if (wch
->bch
.tx_skb
) {
776 if (!test_bit(FLG_TRANSPARENT
, &wch
->bch
.Flags
))
778 } else if (test_bit(FLG_FILLEMPTY
, &wch
->bch
.Flags
)) {
779 test_and_set_bit(FLG_TX_EMPTY
, &wch
->bch
.Flags
);
786 w6692_irq(int intno
, void *dev_id
)
788 struct w6692_hw
*card
= dev_id
;
791 spin_lock(&card
->lock
);
792 ista
= ReadW6692(card
, W_ISTA
);
793 if ((ista
| card
->imask
) == card
->imask
) {
794 /* possible a shared IRQ reqest */
795 spin_unlock(&card
->lock
);
799 pr_debug("%s: ista %02x\n", card
->name
, ista
);
800 ista
&= ~card
->imask
;
801 if (ista
& W_INT_B1_EXI
)
802 W6692B_interrupt(card
, 0);
803 if (ista
& W_INT_B2_EXI
)
804 W6692B_interrupt(card
, 1);
805 if (ista
& W_INT_D_RME
)
807 if (ista
& W_INT_D_RMR
)
808 W6692_empty_Dfifo(card
, W_D_FIFO_THRESH
);
809 if (ista
& W_INT_D_XFR
)
811 if (ista
& W_INT_D_EXI
)
812 handle_statusD(card
);
813 if (ista
& (W_INT_XINT0
| W_INT_XINT1
)) /* XINT0/1 - never */
814 pr_debug("%s: W6692 spurious XINT!\n", card
->name
);
815 /* End IRQ Handler */
816 spin_unlock(&card
->lock
);
821 dbusy_timer_handler(struct timer_list
*t
)
823 struct dchannel
*dch
= from_timer(dch
, t
, timer
);
824 struct w6692_hw
*card
= dch
->hw
;
828 if (test_bit(FLG_BUSY_TIMER
, &dch
->Flags
)) {
829 spin_lock_irqsave(&card
->lock
, flags
);
830 rbch
= ReadW6692(card
, W_D_RBCH
);
831 star
= ReadW6692(card
, W_D_STAR
);
832 pr_debug("%s: D-Channel Busy RBCH %02x STAR %02x\n",
833 card
->name
, rbch
, star
);
834 if (star
& W_D_STAR_XBZ
) /* D-Channel Busy */
835 test_and_set_bit(FLG_L1_BUSY
, &dch
->Flags
);
837 /* discard frame; reset transceiver */
838 test_and_clear_bit(FLG_BUSY_TIMER
, &dch
->Flags
);
842 pr_info("%s: W6692 D-Channel Busy no tx_idx\n",
844 /* Transmitter reset */
845 WriteW6692(card
, W_D_CMDR
, W_D_CMDR_XRST
);
847 spin_unlock_irqrestore(&card
->lock
, flags
);
851 static void initW6692(struct w6692_hw
*card
)
855 timer_setup(&card
->dch
.timer
, dbusy_timer_handler
, 0);
856 w6692_mode(&card
->bc
[0], ISDN_P_NONE
);
857 w6692_mode(&card
->bc
[1], ISDN_P_NONE
);
858 WriteW6692(card
, W_D_CTL
, 0x00);
860 WriteW6692(card
, W_D_SAM
, 0xff);
861 WriteW6692(card
, W_D_TAM
, 0xff);
862 WriteW6692(card
, W_D_MODE
, W_D_MODE_RACT
);
863 card
->state
= W_L1CMD_RST
;
864 ph_command(card
, W_L1CMD_RST
);
865 ph_command(card
, W_L1CMD_ECK
);
866 /* enable all IRQ but extern */
868 WriteW6692(card
, W_D_EXIM
, 0x00);
869 WriteW6692B(&card
->bc
[0], W_B_EXIM
, 0);
870 WriteW6692B(&card
->bc
[1], W_B_EXIM
, 0);
871 /* Reset D-chan receiver and transmitter */
872 WriteW6692(card
, W_D_CMDR
, W_D_CMDR_RRST
| W_D_CMDR_XRST
);
873 /* Reset B-chan receiver and transmitter */
874 WriteW6692B(&card
->bc
[0], W_B_CMDR
, W_B_CMDR_RRST
| W_B_CMDR_XRST
);
875 WriteW6692B(&card
->bc
[1], W_B_CMDR
, W_B_CMDR_RRST
| W_B_CMDR_XRST
);
876 /* enable peripheral */
877 if (card
->subtype
== W6692_USR
) {
878 /* seems that USR implemented some power control features
879 * Pin 79 is connected to the oscilator circuit so we
880 * have to handle it here
884 WriteW6692(card
, W_PCTL
, card
->pctl
);
885 WriteW6692(card
, W_XDATA
, card
->xdata
);
887 card
->pctl
= W_PCTL_OE5
| W_PCTL_OE4
| W_PCTL_OE2
|
888 W_PCTL_OE1
| W_PCTL_OE0
;
889 card
->xaddr
= 0x00;/* all sw off */
890 if (card
->fmask
& pots
)
891 card
->xdata
|= 0x06; /* POWER UP/ LED OFF / ALAW */
892 if (card
->fmask
& led
)
893 card
->xdata
|= 0x04; /* LED OFF */
894 if ((card
->fmask
& pots
) || (card
->fmask
& led
)) {
895 WriteW6692(card
, W_PCTL
, card
->pctl
);
896 WriteW6692(card
, W_XADDR
, card
->xaddr
);
897 WriteW6692(card
, W_XDATA
, card
->xdata
);
898 val
= ReadW6692(card
, W_XADDR
);
899 if (debug
& DEBUG_HW
)
900 pr_notice("%s: W_XADDR=%02x\n",
907 reset_w6692(struct w6692_hw
*card
)
909 WriteW6692(card
, W_D_CTL
, W_D_CTL_SRST
);
911 WriteW6692(card
, W_D_CTL
, 0);
915 init_card(struct w6692_hw
*card
)
920 spin_lock_irqsave(&card
->lock
, flags
);
922 spin_unlock_irqrestore(&card
->lock
, flags
);
923 if (request_irq(card
->irq
, w6692_irq
, IRQF_SHARED
, card
->name
, card
)) {
924 pr_info("%s: couldn't get interrupt %d\n", card
->name
,
929 spin_lock_irqsave(&card
->lock
, flags
);
932 spin_unlock_irqrestore(&card
->lock
, flags
);
934 msleep_interruptible(10);
935 if (debug
& DEBUG_HW
)
936 pr_notice("%s: IRQ %d count %d\n", card
->name
,
937 card
->irq
, card
->irqcnt
);
939 pr_info("%s: IRQ(%d) getting no IRQs during init %d\n",
940 card
->name
, card
->irq
, 3 - cnt
);
945 free_irq(card
->irq
, card
);
950 w6692_l2l1B(struct mISDNchannel
*ch
, struct sk_buff
*skb
)
952 struct bchannel
*bch
= container_of(ch
, struct bchannel
, ch
);
953 struct w6692_ch
*bc
= container_of(bch
, struct w6692_ch
, bch
);
954 struct w6692_hw
*card
= bch
->hw
;
956 struct mISDNhead
*hh
= mISDN_HEAD_P(skb
);
961 spin_lock_irqsave(&card
->lock
, flags
);
962 ret
= bchannel_senddata(bch
, skb
);
963 if (ret
> 0) { /* direct TX */
965 W6692_fill_Bfifo(bc
);
967 spin_unlock_irqrestore(&card
->lock
, flags
);
969 case PH_ACTIVATE_REQ
:
970 spin_lock_irqsave(&card
->lock
, flags
);
971 if (!test_and_set_bit(FLG_ACTIVE
, &bch
->Flags
))
972 ret
= w6692_mode(bc
, ch
->protocol
);
975 spin_unlock_irqrestore(&card
->lock
, flags
);
977 _queue_data(ch
, PH_ACTIVATE_IND
, MISDN_ID_ANY
, 0,
980 case PH_DEACTIVATE_REQ
:
981 spin_lock_irqsave(&card
->lock
, flags
);
982 mISDN_clear_bchannel(bch
);
983 w6692_mode(bc
, ISDN_P_NONE
);
984 spin_unlock_irqrestore(&card
->lock
, flags
);
985 _queue_data(ch
, PH_DEACTIVATE_IND
, MISDN_ID_ANY
, 0,
990 pr_info("%s: %s unknown prim(%x,%x)\n",
991 card
->name
, __func__
, hh
->prim
, hh
->id
);
1000 channel_bctrl(struct bchannel
*bch
, struct mISDN_ctrl_req
*cq
)
1002 return mISDN_ctrl_bchannel(bch
, cq
);
1006 open_bchannel(struct w6692_hw
*card
, struct channel_req
*rq
)
1008 struct bchannel
*bch
;
1010 if (rq
->adr
.channel
== 0 || rq
->adr
.channel
> 2)
1012 if (rq
->protocol
== ISDN_P_NONE
)
1014 bch
= &card
->bc
[rq
->adr
.channel
- 1].bch
;
1015 if (test_and_set_bit(FLG_OPEN
, &bch
->Flags
))
1016 return -EBUSY
; /* b-channel can be only open once */
1017 bch
->ch
.protocol
= rq
->protocol
;
1023 channel_ctrl(struct w6692_hw
*card
, struct mISDN_ctrl_req
*cq
)
1028 case MISDN_CTRL_GETOP
:
1029 cq
->op
= MISDN_CTRL_L1_TIMER3
;
1031 case MISDN_CTRL_L1_TIMER3
:
1032 ret
= l1_event(card
->dch
.l1
, HW_TIMER3_VALUE
| (cq
->p1
& 0xff));
1035 pr_info("%s: unknown CTRL OP %x\n", card
->name
, cq
->op
);
1043 w6692_bctrl(struct mISDNchannel
*ch
, u32 cmd
, void *arg
)
1045 struct bchannel
*bch
= container_of(ch
, struct bchannel
, ch
);
1046 struct w6692_ch
*bc
= container_of(bch
, struct w6692_ch
, bch
);
1047 struct w6692_hw
*card
= bch
->hw
;
1051 pr_debug("%s: %s cmd:%x %p\n", card
->name
, __func__
, cmd
, arg
);
1054 test_and_clear_bit(FLG_OPEN
, &bch
->Flags
);
1055 cancel_work_sync(&bch
->workq
);
1056 spin_lock_irqsave(&card
->lock
, flags
);
1057 mISDN_clear_bchannel(bch
);
1058 w6692_mode(bc
, ISDN_P_NONE
);
1059 spin_unlock_irqrestore(&card
->lock
, flags
);
1060 ch
->protocol
= ISDN_P_NONE
;
1062 module_put(THIS_MODULE
);
1065 case CONTROL_CHANNEL
:
1066 ret
= channel_bctrl(bch
, arg
);
1069 pr_info("%s: %s unknown prim(%x)\n",
1070 card
->name
, __func__
, cmd
);
1076 w6692_l2l1D(struct mISDNchannel
*ch
, struct sk_buff
*skb
)
1078 struct mISDNdevice
*dev
= container_of(ch
, struct mISDNdevice
, D
);
1079 struct dchannel
*dch
= container_of(dev
, struct dchannel
, dev
);
1080 struct w6692_hw
*card
= container_of(dch
, struct w6692_hw
, dch
);
1082 struct mISDNhead
*hh
= mISDN_HEAD_P(skb
);
1088 spin_lock_irqsave(&card
->lock
, flags
);
1089 ret
= dchannel_senddata(dch
, skb
);
1090 if (ret
> 0) { /* direct TX */
1091 id
= hh
->id
; /* skb can be freed */
1092 W6692_fill_Dfifo(card
);
1094 spin_unlock_irqrestore(&card
->lock
, flags
);
1095 queue_ch_frame(ch
, PH_DATA_CNF
, id
, NULL
);
1097 spin_unlock_irqrestore(&card
->lock
, flags
);
1099 case PH_ACTIVATE_REQ
:
1100 ret
= l1_event(dch
->l1
, hh
->prim
);
1102 case PH_DEACTIVATE_REQ
:
1103 test_and_clear_bit(FLG_L2_ACTIVATED
, &dch
->Flags
);
1104 ret
= l1_event(dch
->l1
, hh
->prim
);
1114 w6692_l1callback(struct dchannel
*dch
, u32 cmd
)
1116 struct w6692_hw
*card
= container_of(dch
, struct w6692_hw
, dch
);
1119 pr_debug("%s: cmd(%x) state(%02x)\n", card
->name
, cmd
, card
->state
);
1122 spin_lock_irqsave(&card
->lock
, flags
);
1123 ph_command(card
, W_L1CMD_AR8
);
1124 spin_unlock_irqrestore(&card
->lock
, flags
);
1127 spin_lock_irqsave(&card
->lock
, flags
);
1128 ph_command(card
, W_L1CMD_AR10
);
1129 spin_unlock_irqrestore(&card
->lock
, flags
);
1132 spin_lock_irqsave(&card
->lock
, flags
);
1133 if (card
->state
!= W_L1IND_DRD
)
1134 ph_command(card
, W_L1CMD_RST
);
1135 ph_command(card
, W_L1CMD_ECK
);
1136 spin_unlock_irqrestore(&card
->lock
, flags
);
1139 skb_queue_purge(&dch
->squeue
);
1141 dev_kfree_skb(dch
->tx_skb
);
1146 dev_kfree_skb(dch
->rx_skb
);
1149 test_and_clear_bit(FLG_TX_BUSY
, &dch
->Flags
);
1150 if (test_and_clear_bit(FLG_BUSY_TIMER
, &dch
->Flags
))
1151 del_timer(&dch
->timer
);
1153 case HW_POWERUP_REQ
:
1154 spin_lock_irqsave(&card
->lock
, flags
);
1155 ph_command(card
, W_L1CMD_ECK
);
1156 spin_unlock_irqrestore(&card
->lock
, flags
);
1158 case PH_ACTIVATE_IND
:
1159 test_and_set_bit(FLG_ACTIVE
, &dch
->Flags
);
1160 _queue_data(&dch
->dev
.D
, cmd
, MISDN_ID_ANY
, 0, NULL
,
1163 case PH_DEACTIVATE_IND
:
1164 test_and_clear_bit(FLG_ACTIVE
, &dch
->Flags
);
1165 _queue_data(&dch
->dev
.D
, cmd
, MISDN_ID_ANY
, 0, NULL
,
1169 pr_debug("%s: %s unknown command %x\n", card
->name
,
1177 open_dchannel(struct w6692_hw
*card
, struct channel_req
*rq
, void *caller
)
1179 pr_debug("%s: %s dev(%d) open from %p\n", card
->name
, __func__
,
1180 card
->dch
.dev
.id
, caller
);
1181 if (rq
->protocol
!= ISDN_P_TE_S0
)
1183 if (rq
->adr
.channel
== 1)
1184 /* E-Channel not supported */
1186 rq
->ch
= &card
->dch
.dev
.D
;
1187 rq
->ch
->protocol
= rq
->protocol
;
1188 if (card
->dch
.state
== 7)
1189 _queue_data(rq
->ch
, PH_ACTIVATE_IND
, MISDN_ID_ANY
,
1190 0, NULL
, GFP_KERNEL
);
1195 w6692_dctrl(struct mISDNchannel
*ch
, u32 cmd
, void *arg
)
1197 struct mISDNdevice
*dev
= container_of(ch
, struct mISDNdevice
, D
);
1198 struct dchannel
*dch
= container_of(dev
, struct dchannel
, dev
);
1199 struct w6692_hw
*card
= container_of(dch
, struct w6692_hw
, dch
);
1200 struct channel_req
*rq
;
1203 pr_debug("%s: DCTRL: %x %p\n", card
->name
, cmd
, arg
);
1207 if (rq
->protocol
== ISDN_P_TE_S0
)
1208 err
= open_dchannel(card
, rq
, __builtin_return_address(0));
1210 err
= open_bchannel(card
, rq
);
1213 if (!try_module_get(THIS_MODULE
))
1214 pr_info("%s: cannot get module\n", card
->name
);
1217 pr_debug("%s: dev(%d) close from %p\n", card
->name
,
1218 dch
->dev
.id
, __builtin_return_address(0));
1219 module_put(THIS_MODULE
);
1221 case CONTROL_CHANNEL
:
1222 err
= channel_ctrl(card
, arg
);
1225 pr_debug("%s: unknown DCTRL command %x\n", card
->name
, cmd
);
1232 setup_w6692(struct w6692_hw
*card
)
1236 if (!request_region(card
->addr
, 256, card
->name
)) {
1237 pr_info("%s: config port %x-%x already in use\n", card
->name
,
1238 card
->addr
, card
->addr
+ 255);
1242 card
->bc
[0].addr
= card
->addr
;
1243 card
->bc
[1].addr
= card
->addr
+ 0x40;
1244 val
= ReadW6692(card
, W_ISTA
);
1245 if (debug
& DEBUG_HW
)
1246 pr_notice("%s ISTA=%02x\n", card
->name
, val
);
1247 val
= ReadW6692(card
, W_IMASK
);
1248 if (debug
& DEBUG_HW
)
1249 pr_notice("%s IMASK=%02x\n", card
->name
, val
);
1250 val
= ReadW6692(card
, W_D_EXIR
);
1251 if (debug
& DEBUG_HW
)
1252 pr_notice("%s D_EXIR=%02x\n", card
->name
, val
);
1253 val
= ReadW6692(card
, W_D_EXIM
);
1254 if (debug
& DEBUG_HW
)
1255 pr_notice("%s D_EXIM=%02x\n", card
->name
, val
);
1256 val
= ReadW6692(card
, W_D_RSTA
);
1257 if (debug
& DEBUG_HW
)
1258 pr_notice("%s D_RSTA=%02x\n", card
->name
, val
);
1263 release_card(struct w6692_hw
*card
)
1267 spin_lock_irqsave(&card
->lock
, flags
);
1268 disable_hwirq(card
);
1269 w6692_mode(&card
->bc
[0], ISDN_P_NONE
);
1270 w6692_mode(&card
->bc
[1], ISDN_P_NONE
);
1271 if ((card
->fmask
& led
) || card
->subtype
== W6692_USR
) {
1272 card
->xdata
|= 0x04; /* LED OFF */
1273 WriteW6692(card
, W_XDATA
, card
->xdata
);
1275 spin_unlock_irqrestore(&card
->lock
, flags
);
1276 free_irq(card
->irq
, card
);
1277 l1_event(card
->dch
.l1
, CLOSE_CHANNEL
);
1278 mISDN_unregister_device(&card
->dch
.dev
);
1279 release_region(card
->addr
, 256);
1280 mISDN_freebchannel(&card
->bc
[1].bch
);
1281 mISDN_freebchannel(&card
->bc
[0].bch
);
1282 mISDN_freedchannel(&card
->dch
);
1283 write_lock_irqsave(&card_lock
, flags
);
1284 list_del(&card
->list
);
1285 write_unlock_irqrestore(&card_lock
, flags
);
1286 pci_disable_device(card
->pdev
);
1287 pci_set_drvdata(card
->pdev
, NULL
);
1292 setup_instance(struct w6692_hw
*card
)
1297 snprintf(card
->name
, MISDN_MAX_IDLEN
- 1, "w6692.%d", w6692_cnt
+ 1);
1298 write_lock_irqsave(&card_lock
, flags
);
1299 list_add_tail(&card
->list
, &Cards
);
1300 write_unlock_irqrestore(&card_lock
, flags
);
1301 card
->fmask
= (1 << w6692_cnt
);
1303 spin_lock_init(&card
->lock
);
1304 mISDN_initdchannel(&card
->dch
, MAX_DFRAME_LEN_L1
, W6692_ph_bh
);
1305 card
->dch
.dev
.Dprotocols
= (1 << ISDN_P_TE_S0
);
1306 card
->dch
.dev
.D
.send
= w6692_l2l1D
;
1307 card
->dch
.dev
.D
.ctrl
= w6692_dctrl
;
1308 card
->dch
.dev
.Bprotocols
= (1 << (ISDN_P_B_RAW
& ISDN_P_B_MASK
)) |
1309 (1 << (ISDN_P_B_HDLC
& ISDN_P_B_MASK
));
1310 card
->dch
.hw
= card
;
1311 card
->dch
.dev
.nrbchan
= 2;
1312 for (i
= 0; i
< 2; i
++) {
1313 mISDN_initbchannel(&card
->bc
[i
].bch
, MAX_DATA_MEM
,
1315 card
->bc
[i
].bch
.hw
= card
;
1316 card
->bc
[i
].bch
.nr
= i
+ 1;
1317 card
->bc
[i
].bch
.ch
.nr
= i
+ 1;
1318 card
->bc
[i
].bch
.ch
.send
= w6692_l2l1B
;
1319 card
->bc
[i
].bch
.ch
.ctrl
= w6692_bctrl
;
1320 set_channelmap(i
+ 1, card
->dch
.dev
.channelmap
);
1321 list_add(&card
->bc
[i
].bch
.ch
.list
, &card
->dch
.dev
.bchannels
);
1323 err
= setup_w6692(card
);
1326 err
= mISDN_register_device(&card
->dch
.dev
, &card
->pdev
->dev
,
1330 err
= init_card(card
);
1333 err
= create_l1(&card
->dch
, w6692_l1callback
);
1336 pr_notice("W6692 %d cards installed\n", w6692_cnt
);
1340 free_irq(card
->irq
, card
);
1342 mISDN_unregister_device(&card
->dch
.dev
);
1344 release_region(card
->addr
, 256);
1346 mISDN_freebchannel(&card
->bc
[1].bch
);
1347 mISDN_freebchannel(&card
->bc
[0].bch
);
1348 mISDN_freedchannel(&card
->dch
);
1349 write_lock_irqsave(&card_lock
, flags
);
1350 list_del(&card
->list
);
1351 write_unlock_irqrestore(&card_lock
, flags
);
1357 w6692_probe(struct pci_dev
*pdev
, const struct pci_device_id
*ent
)
1360 struct w6692_hw
*card
;
1361 struct w6692map
*m
= (struct w6692map
*)ent
->driver_data
;
1363 card
= kzalloc(sizeof(struct w6692_hw
), GFP_KERNEL
);
1365 pr_info("No kmem for w6692 card\n");
1369 card
->subtype
= m
->subtype
;
1370 err
= pci_enable_device(pdev
);
1376 printk(KERN_INFO
"mISDN_w6692: found adapter %s at %s\n",
1377 m
->name
, pci_name(pdev
));
1379 card
->addr
= pci_resource_start(pdev
, 1);
1380 card
->irq
= pdev
->irq
;
1381 pci_set_drvdata(pdev
, card
);
1382 err
= setup_instance(card
);
1384 pci_set_drvdata(pdev
, NULL
);
1389 w6692_remove_pci(struct pci_dev
*pdev
)
1391 struct w6692_hw
*card
= pci_get_drvdata(pdev
);
1397 pr_notice("%s: drvdata already removed\n", __func__
);
1400 static const struct pci_device_id w6692_ids
[] = {
1401 { PCI_VENDOR_ID_DYNALINK
, PCI_DEVICE_ID_DYNALINK_IS64PH
,
1402 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (ulong
)&w6692_map
[0]},
1403 { PCI_VENDOR_ID_WINBOND2
, PCI_DEVICE_ID_WINBOND2_6692
,
1404 PCI_VENDOR_ID_USR
, PCI_DEVICE_ID_USR_6692
, 0, 0,
1405 (ulong
)&w6692_map
[2]},
1406 { PCI_VENDOR_ID_WINBOND2
, PCI_DEVICE_ID_WINBOND2_6692
,
1407 PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, (ulong
)&w6692_map
[1]},
1410 MODULE_DEVICE_TABLE(pci
, w6692_ids
);
1412 static struct pci_driver w6692_driver
= {
1414 .probe
= w6692_probe
,
1415 .remove
= w6692_remove_pci
,
1416 .id_table
= w6692_ids
,
1419 static int __init
w6692_init(void)
1423 pr_notice("Winbond W6692 PCI driver Rev. %s\n", W6692_REV
);
1425 err
= pci_register_driver(&w6692_driver
);
1429 static void __exit
w6692_cleanup(void)
1431 pci_unregister_driver(&w6692_driver
);
1434 module_init(w6692_init
);
1435 module_exit(w6692_cleanup
);