2 * wanXL serial card driver for Linux
5 * Copyright (C) 2003 Krzysztof Halasa <khc@pm.waw.pl>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2 of the GNU General Public License
9 * as published by the Free Software Foundation.
12 * - Only DTE (external clock) support with NRZ and NRZI encodings
13 * - wanXL100 will require minor driver modifications, no access to hw
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/slab.h>
19 #include <linux/sched.h>
20 #include <linux/types.h>
21 #include <linux/fcntl.h>
22 #include <linux/string.h>
23 #include <linux/errno.h>
24 #include <linux/init.h>
25 #include <linux/ioport.h>
26 #include <linux/netdevice.h>
27 #include <linux/hdlc.h>
28 #include <linux/pci.h>
30 #include <asm/delay.h>
34 static const char* version
= "wanXL serial card driver version: 0.48";
36 #define PLX_CTL_RESET 0x40000000 /* adapter reset */
41 /* MAILBOX #1 - PUTS COMMANDS */
42 #define MBX1_CMD_ABORTJ 0x85000000 /* Abort and Jump */
43 #ifdef __LITTLE_ENDIAN
44 #define MBX1_CMD_BSWAP 0x8C000001 /* little-endian Byte Swap Mode */
46 #define MBX1_CMD_BSWAP 0x8C000000 /* big-endian Byte Swap Mode */
49 /* MAILBOX #2 - DRAM SIZE */
50 #define MBX2_MEMSZ_MASK 0xFFFF0000 /* PUTS Memory Size Register mask */
54 struct net_device
*dev
;
56 spinlock_t lock
; /* for wanxl_xmit */
57 int node
; /* physical port #0 - 3 */
58 unsigned int clock_type
;
60 struct sk_buff
*tx_skbs
[TX_BUFFERS
];
65 desc_t rx_descs
[RX_QUEUE_LENGTH
];
66 port_status_t port_status
[4];
70 typedef struct card_t
{
71 int n_ports
; /* 1, 2 or 4 ports */
74 u8
*plx
; /* PLX PCI9060 virtual base address */
75 struct pci_dev
*pdev
; /* for pdev->slot_name */
77 struct sk_buff
*rx_skbs
[RX_QUEUE_LENGTH
];
78 card_status_t
*status
; /* shared between host and card */
79 dma_addr_t status_address
;
80 port_t ports
[0]; /* 1 - 4 port_t structures follow */
85 static inline port_t
* dev_to_port(struct net_device
*dev
)
87 return (port_t
*)dev_to_hdlc(dev
)->priv
;
91 static inline const char* card_name(struct pci_dev
*pdev
)
93 return pdev
->slot_name
;
97 static inline port_status_t
* get_status(port_t
*port
)
99 return &port
->card
->status
->port_status
[port
->node
];
104 static inline dma_addr_t
pci_map_single_debug(struct pci_dev
*pdev
, void *ptr
,
105 size_t size
, int direction
)
107 dma_addr_t addr
= pci_map_single(pdev
, ptr
, size
, direction
);
108 if (addr
+ size
> 0x100000000LL
)
109 printk(KERN_CRIT
"wanXL %s: pci_map_single() returned memory"
110 " at 0x%LX!\n", card_name(pdev
),
111 (unsigned long long)addr
);
115 #undef pci_map_single
116 #define pci_map_single pci_map_single_debug
120 /* Cable and/or personality module change interrupt service */
121 static inline void wanxl_cable_intr(port_t
*port
)
123 u32 value
= get_status(port
)->cable
;
125 const char *cable
, *pm
, *dte
= "", *dsr
= "", *dcd
= "";
127 switch(value
& 0x7) {
128 case STATUS_CABLE_V35
: cable
= "V.35"; break;
129 case STATUS_CABLE_X21
: cable
= "X.21"; break;
130 case STATUS_CABLE_V24
: cable
= "V.24"; break;
131 case STATUS_CABLE_EIA530
: cable
= "EIA530"; break;
132 case STATUS_CABLE_NONE
: cable
= "no"; break;
133 default: cable
= "invalid";
136 switch((value
>> STATUS_CABLE_PM_SHIFT
) & 0x7) {
137 case STATUS_CABLE_V35
: pm
= "V.35"; break;
138 case STATUS_CABLE_X21
: pm
= "X.21"; break;
139 case STATUS_CABLE_V24
: pm
= "V.24"; break;
140 case STATUS_CABLE_EIA530
: pm
= "EIA530"; break;
141 case STATUS_CABLE_NONE
: pm
= "no personality"; valid
= 0; break;
142 default: pm
= "invalid personality"; valid
= 0;
146 if ((value
& 7) == ((value
>> STATUS_CABLE_PM_SHIFT
) & 7)) {
147 dsr
= (value
& STATUS_CABLE_DSR
) ? ", DSR ON" :
149 dcd
= (value
& STATUS_CABLE_DCD
) ? ", carrier ON" :
152 dte
= (value
& STATUS_CABLE_DCE
) ? " DCE" : " DTE";
154 printk(KERN_INFO
"%s: %s%s module, %s cable%s%s\n",
155 port
->dev
->name
, pm
, dte
, cable
, dsr
, dcd
);
157 hdlc_set_carrier(value
& STATUS_CABLE_DCD
, port
->dev
);
162 /* Transmit complete interrupt service */
163 static inline void wanxl_tx_intr(port_t
*port
)
165 struct net_device
*dev
= port
->dev
;
166 struct net_device_stats
*stats
= hdlc_stats(dev
);
168 desc_t
*desc
= &get_status(port
)->tx_descs
[port
->tx_in
];
169 struct sk_buff
*skb
= port
->tx_skbs
[port
->tx_in
];
171 switch (desc
->stat
) {
174 netif_wake_queue(dev
);
177 case PACKET_UNDERRUN
:
179 stats
->tx_fifo_errors
++;
184 stats
->tx_bytes
+= skb
->len
;
186 desc
->stat
= PACKET_EMPTY
; /* Free descriptor */
187 pci_unmap_single(port
->card
->pdev
, desc
->address
, skb
->len
,
189 dev_kfree_skb_irq(skb
);
190 port
->tx_in
= (port
->tx_in
+ 1) % TX_BUFFERS
;
196 /* Receive complete interrupt service */
197 static inline void wanxl_rx_intr(card_t
*card
)
200 while (desc
= &card
->status
->rx_descs
[card
->rx_in
],
201 desc
->stat
!= PACKET_EMPTY
) {
202 if ((desc
->stat
& PACKET_PORT_MASK
) > card
->n_ports
)
203 printk(KERN_CRIT
"wanXL %s: received packet for"
204 " nonexistent port\n", card_name(card
->pdev
));
206 struct sk_buff
*skb
= card
->rx_skbs
[card
->rx_in
];
207 port_t
*port
= &card
->ports
[desc
->stat
&
209 struct net_device
*dev
= port
->dev
;
210 struct net_device_stats
*stats
= hdlc_stats(dev
);
215 pci_unmap_single(card
->pdev
, desc
->address
,
218 skb_put(skb
, desc
->length
);
221 printk(KERN_DEBUG
"%s RX(%i):", dev
->name
,
226 stats
->rx_bytes
+= skb
->len
;
227 skb
->mac
.raw
= skb
->data
;
229 dev
->last_rx
= jiffies
;
230 skb
->protocol
= hdlc_type_trans(skb
, dev
);
236 skb
= dev_alloc_skb(BUFFER_LENGTH
);
237 desc
->address
= skb
?
238 pci_map_single(card
->pdev
, skb
->data
,
240 PCI_DMA_FROMDEVICE
) : 0;
241 card
->rx_skbs
[card
->rx_in
] = skb
;
244 desc
->stat
= PACKET_EMPTY
; /* Free descriptor */
245 card
->rx_in
= (card
->rx_in
+ 1) % RX_QUEUE_LENGTH
;
251 static irqreturn_t
wanxl_intr(int irq
, void* dev_id
, struct pt_regs
*regs
)
253 card_t
*card
= dev_id
;
259 while((stat
= readl(card
->plx
+ PLX_DOORBELL_FROM_CARD
)) != 0) {
261 writel(stat
, card
->plx
+ PLX_DOORBELL_FROM_CARD
);
263 for (i
= 0; i
< card
->n_ports
; i
++) {
264 if (stat
& (1 << (DOORBELL_FROM_CARD_TX_0
+ i
)))
265 wanxl_tx_intr(&card
->ports
[i
]);
266 if (stat
& (1 << (DOORBELL_FROM_CARD_CABLE_0
+ i
)))
267 wanxl_cable_intr(&card
->ports
[i
]);
269 if (stat
& (1 << DOORBELL_FROM_CARD_RX
))
273 return IRQ_RETVAL(handled
);
278 static int wanxl_xmit(struct sk_buff
*skb
, struct net_device
*dev
)
280 port_t
*port
= dev_to_port(dev
);
283 spin_lock(&port
->lock
);
285 desc
= &get_status(port
)->tx_descs
[port
->tx_out
];
286 if (desc
->stat
!= PACKET_EMPTY
) {
287 /* should never happen - previous xmit should stop queue */
289 printk(KERN_DEBUG
"%s: transmitter buffer full\n", dev
->name
);
291 netif_stop_queue(dev
);
292 spin_unlock_irq(&port
->lock
);
293 return 1; /* request packet to be queued */
297 printk(KERN_DEBUG
"%s TX(%i):", dev
->name
, skb
->len
);
301 port
->tx_skbs
[port
->tx_out
] = skb
;
302 desc
->address
= pci_map_single(port
->card
->pdev
, skb
->data
, skb
->len
,
304 desc
->length
= skb
->len
;
305 desc
->stat
= PACKET_FULL
;
306 writel(1 << (DOORBELL_TO_CARD_TX_0
+ port
->node
),
307 port
->card
->plx
+ PLX_DOORBELL_TO_CARD
);
308 dev
->trans_start
= jiffies
;
310 port
->tx_out
= (port
->tx_out
+ 1) % TX_BUFFERS
;
312 if (get_status(port
)->tx_descs
[port
->tx_out
].stat
!= PACKET_EMPTY
) {
313 netif_stop_queue(dev
);
315 printk(KERN_DEBUG
"%s: transmitter buffer full\n", dev
->name
);
319 spin_unlock(&port
->lock
);
325 static int wanxl_attach(struct net_device
*dev
, unsigned short encoding
,
326 unsigned short parity
)
328 port_t
*port
= dev_to_port(dev
);
330 if (encoding
!= ENCODING_NRZ
&&
331 encoding
!= ENCODING_NRZI
)
334 if (parity
!= PARITY_NONE
&&
335 parity
!= PARITY_CRC32_PR1_CCITT
&&
336 parity
!= PARITY_CRC16_PR1_CCITT
&&
337 parity
!= PARITY_CRC32_PR0_CCITT
&&
338 parity
!= PARITY_CRC16_PR0_CCITT
)
341 get_status(port
)->encoding
= encoding
;
342 get_status(port
)->parity
= parity
;
348 static int wanxl_ioctl(struct net_device
*dev
, struct ifreq
*ifr
, int cmd
)
350 const size_t size
= sizeof(sync_serial_settings
);
351 sync_serial_settings line
;
352 port_t
*port
= dev_to_port(dev
);
354 if (cmd
!= SIOCWANDEV
)
355 return hdlc_ioctl(dev
, ifr
, cmd
);
357 switch (ifr
->ifr_settings
.type
) {
359 ifr
->ifr_settings
.type
= IF_IFACE_SYNC_SERIAL
;
360 if (ifr
->ifr_settings
.size
< size
) {
361 ifr
->ifr_settings
.size
= size
; /* data size wanted */
364 line
.clock_type
= get_status(port
)->clocking
;
368 if (copy_to_user(ifr
->ifr_settings
.ifs_ifsu
.sync
, &line
, size
))
372 case IF_IFACE_SYNC_SERIAL
:
373 if (!capable(CAP_NET_ADMIN
))
375 if (dev
->flags
& IFF_UP
)
378 if (copy_from_user(&line
, ifr
->ifr_settings
.ifs_ifsu
.sync
,
382 if (line
.clock_type
!= CLOCK_EXT
&&
383 line
.clock_type
!= CLOCK_TXFROMRX
)
384 return -EINVAL
; /* No such clock setting */
386 if (line
.loopback
!= 0)
389 get_status(port
)->clocking
= line
.clock_type
;
393 return hdlc_ioctl(dev
, ifr
, cmd
);
399 static int wanxl_open(struct net_device
*dev
)
401 port_t
*port
= dev_to_port(dev
);
402 u8
*dbr
= port
->card
->plx
+ PLX_DOORBELL_TO_CARD
;
403 unsigned long timeout
;
406 if (get_status(port
)->open
) {
407 printk(KERN_ERR
"%s: port already open\n", dev
->name
);
410 if ((i
= hdlc_open(dev
)) != 0)
413 port
->tx_in
= port
->tx_out
= 0;
414 for (i
= 0; i
< TX_BUFFERS
; i
++)
415 get_status(port
)->tx_descs
[i
].stat
= PACKET_EMPTY
;
416 /* signal the card */
417 writel(1 << (DOORBELL_TO_CARD_OPEN_0
+ port
->node
), dbr
);
419 timeout
= jiffies
+ HZ
;
421 if (get_status(port
)->open
) {
422 netif_start_queue(dev
);
425 while (time_after(timeout
, jiffies
));
427 printk(KERN_ERR
"%s: unable to open port\n", dev
->name
);
428 /* ask the card to close the port, should it be still alive */
429 writel(1 << (DOORBELL_TO_CARD_CLOSE_0
+ port
->node
), dbr
);
435 static int wanxl_close(struct net_device
*dev
)
437 port_t
*port
= dev_to_port(dev
);
438 unsigned long timeout
;
442 /* signal the card */
443 writel(1 << (DOORBELL_TO_CARD_CLOSE_0
+ port
->node
),
444 port
->card
->plx
+ PLX_DOORBELL_TO_CARD
);
446 timeout
= jiffies
+ HZ
;
448 if (!get_status(port
)->open
)
450 while (time_after(timeout
, jiffies
));
452 if (get_status(port
)->open
)
453 printk(KERN_ERR
"%s: unable to close port\n", dev
->name
);
455 netif_stop_queue(dev
);
457 for (i
= 0; i
< TX_BUFFERS
; i
++) {
458 desc_t
*desc
= &get_status(port
)->tx_descs
[i
];
460 if (desc
->stat
!= PACKET_EMPTY
) {
461 desc
->stat
= PACKET_EMPTY
;
462 pci_unmap_single(port
->card
->pdev
, desc
->address
,
463 port
->tx_skbs
[i
]->len
,
465 dev_kfree_skb(port
->tx_skbs
[i
]);
473 static struct net_device_stats
*wanxl_get_stats(struct net_device
*dev
)
475 struct net_device_stats
*stats
= hdlc_stats(dev
);
476 port_t
*port
= dev_to_port(dev
);
478 stats
->rx_over_errors
= get_status(port
)->rx_overruns
;
479 stats
->rx_frame_errors
= get_status(port
)->rx_frame_errors
;
480 stats
->rx_errors
= stats
->rx_over_errors
+ stats
->rx_frame_errors
;
486 static int wanxl_puts_command(card_t
*card
, u32 cmd
)
488 unsigned long timeout
= jiffies
+ 5 * HZ
;
490 writel(cmd
, card
->plx
+ PLX_MAILBOX_1
);
492 if (readl(card
->plx
+ PLX_MAILBOX_1
) == 0)
496 }while (time_after(timeout
, jiffies
));
503 static void wanxl_reset(card_t
*card
)
505 u32 old_value
= readl(card
->plx
+ PLX_CONTROL
) & ~PLX_CTL_RESET
;
507 writel(0x80, card
->plx
+ PLX_MAILBOX_0
);
508 writel(old_value
| PLX_CTL_RESET
, card
->plx
+ PLX_CONTROL
);
509 readl(card
->plx
+ PLX_CONTROL
); /* wait for posted write */
511 writel(old_value
, card
->plx
+ PLX_CONTROL
);
512 readl(card
->plx
+ PLX_CONTROL
); /* wait for posted write */
517 static void wanxl_pci_remove_one(struct pci_dev
*pdev
)
519 card_t
*card
= pci_get_drvdata(pdev
);
522 for (i
= 0; i
< card
->n_ports
; i
++) {
523 unregister_hdlc_device(card
->ports
[i
].dev
);
524 free_netdev(card
->ports
[i
].dev
);
527 /* unregister and free all host resources */
529 free_irq(card
->irq
, card
);
533 for (i
= 0; i
< RX_QUEUE_LENGTH
; i
++)
534 if (card
->rx_skbs
[i
]) {
535 pci_unmap_single(card
->pdev
,
536 card
->status
->rx_descs
[i
].address
,
537 BUFFER_LENGTH
, PCI_DMA_FROMDEVICE
);
538 dev_kfree_skb(card
->rx_skbs
[i
]);
545 pci_free_consistent(pdev
, sizeof(card_status_t
),
546 card
->status
, card
->status_address
);
548 pci_release_regions(pdev
);
549 pci_disable_device(pdev
);
550 pci_set_drvdata(pdev
, NULL
);
555 #include "wanxlfw.inc"
557 static int __devinit
wanxl_pci_init_one(struct pci_dev
*pdev
,
558 const struct pci_device_id
*ent
)
562 unsigned long timeout
;
563 u32 plx_phy
; /* PLX PCI base address */
564 u32 mem_phy
; /* memory PCI base addr */
565 u8
*mem
; /* memory virtual base addr */
566 int i
, ports
, alloc_size
;
569 static int printed_version
;
570 if (!printed_version
) {
572 printk(KERN_INFO
"%s\n", version
);
576 i
= pci_enable_device(pdev
);
580 /* QUICC can only access first 256 MB of host RAM directly,
581 but PLX9060 DMA does 32-bits for actual packet data transfers */
583 /* FIXME when PCI/DMA subsystems are fixed.
584 We set both dma_mask and consistent_dma_mask to 28 bits
585 and pray pci_alloc_consistent() will use this info. It should
586 work on most platforms */
587 if (pci_set_consistent_dma_mask(pdev
, 0x0FFFFFFF) ||
588 pci_set_dma_mask(pdev
, 0x0FFFFFFF)) {
589 printk(KERN_ERR
"wanXL: No usable DMA configuration\n");
593 i
= pci_request_regions(pdev
, "wanXL");
595 pci_disable_device(pdev
);
599 switch (pdev
->device
) {
600 case PCI_DEVICE_ID_SBE_WANXL100
: ports
= 1; break;
601 case PCI_DEVICE_ID_SBE_WANXL200
: ports
= 2; break;
605 alloc_size
= sizeof(card_t
) + ports
* sizeof(port_t
);
606 card
= kmalloc(alloc_size
, GFP_KERNEL
);
608 printk(KERN_ERR
"wanXL %s: unable to allocate memory\n",
610 pci_release_regions(pdev
);
611 pci_disable_device(pdev
);
614 memset(card
, 0, alloc_size
);
616 pci_set_drvdata(pdev
, card
);
619 card
->status
= pci_alloc_consistent(pdev
, sizeof(card_status_t
),
620 &card
->status_address
);
621 if (card
->status
== NULL
) {
622 wanxl_pci_remove_one(pdev
);
627 printk(KERN_DEBUG
"wanXL %s: pci_alloc_consistent() returned memory"
628 " at 0x%LX\n", card_name(pdev
),
629 (unsigned long long)card
->status_address
);
632 /* FIXME when PCI/DMA subsystems are fixed.
633 We set both dma_mask and consistent_dma_mask back to 32 bits
634 to indicate the card can do 32-bit DMA addressing */
635 if (pci_set_consistent_dma_mask(pdev
, 0xFFFFFFFF) ||
636 pci_set_dma_mask(pdev
, 0xFFFFFFFF)) {
637 printk(KERN_ERR
"wanXL: No usable DMA configuration\n");
638 wanxl_pci_remove_one(pdev
);
642 /* set up PLX mapping */
643 plx_phy
= pci_resource_start(pdev
, 0);
644 card
->plx
= ioremap_nocache(plx_phy
, 0x70);
646 #if RESET_WHILE_LOADING
650 timeout
= jiffies
+ 20 * HZ
;
651 while ((stat
= readl(card
->plx
+ PLX_MAILBOX_0
)) != 0) {
652 if (time_before(timeout
, jiffies
)) {
653 printk(KERN_WARNING
"wanXL %s: timeout waiting for"
654 " PUTS to complete\n", card_name(pdev
));
655 wanxl_pci_remove_one(pdev
);
659 switch(stat
& 0xC0) {
660 case 0x00: /* hmm - PUTS completed with non-zero code? */
661 case 0x80: /* PUTS still testing the hardware */
665 printk(KERN_WARNING
"wanXL %s: PUTS test 0x%X"
666 " failed\n", card_name(pdev
), stat
& 0x30);
667 wanxl_pci_remove_one(pdev
);
674 /* get on-board memory size (PUTS detects no more than 4 MB) */
675 ramsize
= readl(card
->plx
+ PLX_MAILBOX_2
) & MBX2_MEMSZ_MASK
;
677 /* set up on-board RAM mapping */
678 mem_phy
= pci_resource_start(pdev
, 2);
681 /* sanity check the board's reported memory size */
682 if (ramsize
< BUFFERS_ADDR
+
683 (TX_BUFFERS
+ RX_BUFFERS
) * BUFFER_LENGTH
* ports
) {
684 printk(KERN_WARNING
"wanXL %s: no enough on-board RAM"
685 " (%u bytes detected, %u bytes required)\n",
686 card_name(pdev
), ramsize
, BUFFERS_ADDR
+
687 (TX_BUFFERS
+ RX_BUFFERS
) * BUFFER_LENGTH
* ports
);
688 wanxl_pci_remove_one(pdev
);
692 if (wanxl_puts_command(card
, MBX1_CMD_BSWAP
)) {
693 printk(KERN_WARNING
"wanXL %s: unable to Set Byte Swap"
694 " Mode\n", card_name(pdev
));
695 wanxl_pci_remove_one(pdev
);
699 for (i
= 0; i
< RX_QUEUE_LENGTH
; i
++) {
700 struct sk_buff
*skb
= dev_alloc_skb(BUFFER_LENGTH
);
701 card
->rx_skbs
[i
] = skb
;
703 card
->status
->rx_descs
[i
].address
=
704 pci_map_single(card
->pdev
, skb
->data
,
709 mem
= ioremap_nocache(mem_phy
, PDM_OFFSET
+ sizeof(firmware
));
710 for (i
= 0; i
< sizeof(firmware
); i
+= 4)
711 writel(htonl(*(u32
*)(firmware
+ i
)), mem
+ PDM_OFFSET
+ i
);
713 for (i
= 0; i
< ports
; i
++)
714 writel(card
->status_address
+
715 (void *)&card
->status
->port_status
[i
] -
716 (void *)card
->status
, mem
+ PDM_OFFSET
+ 4 + i
* 4);
717 writel(card
->status_address
, mem
+ PDM_OFFSET
+ 20);
718 writel(PDM_OFFSET
, mem
);
721 writel(0, card
->plx
+ PLX_MAILBOX_5
);
723 if (wanxl_puts_command(card
, MBX1_CMD_ABORTJ
)) {
724 printk(KERN_WARNING
"wanXL %s: unable to Abort and Jump\n",
726 wanxl_pci_remove_one(pdev
);
731 timeout
= jiffies
+ 5 * HZ
;
733 if ((stat
= readl(card
->plx
+ PLX_MAILBOX_5
)) != 0)
736 }while (time_after(timeout
, jiffies
));
739 printk(KERN_WARNING
"wanXL %s: timeout while initializing card"
740 "firmware\n", card_name(pdev
));
741 wanxl_pci_remove_one(pdev
);
749 printk(KERN_INFO
"wanXL %s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n",
750 card_name(pdev
), plx_phy
, ramsize
/ 1024, mem_phy
, pdev
->irq
);
753 if (request_irq(pdev
->irq
, wanxl_intr
, SA_SHIRQ
, "wanXL", card
)) {
754 printk(KERN_WARNING
"wanXL %s: could not allocate IRQ%i.\n",
755 card_name(pdev
), pdev
->irq
);
756 wanxl_pci_remove_one(pdev
);
759 card
->irq
= pdev
->irq
;
761 for (i
= 0; i
< ports
; i
++) {
763 port_t
*port
= &card
->ports
[i
];
764 struct net_device
*dev
= alloc_hdlcdev(port
);
766 printk(KERN_ERR
"wanXL %s: unable to allocate"
767 " memory\n", card_name(pdev
));
768 wanxl_pci_remove_one(pdev
);
773 hdlc
= dev_to_hdlc(dev
);
774 spin_lock_init(&port
->lock
);
775 SET_MODULE_OWNER(dev
);
776 dev
->tx_queue_len
= 50;
777 dev
->do_ioctl
= wanxl_ioctl
;
778 dev
->open
= wanxl_open
;
779 dev
->stop
= wanxl_close
;
780 hdlc
->attach
= wanxl_attach
;
781 hdlc
->xmit
= wanxl_xmit
;
782 dev
->get_stats
= wanxl_get_stats
;
785 get_status(port
)->clocking
= CLOCK_EXT
;
786 if (register_hdlc_device(dev
)) {
787 printk(KERN_ERR
"wanXL %s: unable to register hdlc"
788 " device\n", card_name(pdev
));
790 wanxl_pci_remove_one(pdev
);
796 printk(KERN_INFO
"wanXL %s: port", card_name(pdev
));
797 for (i
= 0; i
< ports
; i
++)
798 printk("%s #%i: %s", i
? "," : "", i
,
799 card
->ports
[i
].dev
->name
);
802 for (i
= 0; i
< ports
; i
++)
803 wanxl_cable_intr(&card
->ports
[i
]); /* get carrier status etc.*/
808 static struct pci_device_id wanxl_pci_tbl
[] __devinitdata
= {
809 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL100
, PCI_ANY_ID
,
810 PCI_ANY_ID
, 0, 0, 0 },
811 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL200
, PCI_ANY_ID
,
812 PCI_ANY_ID
, 0, 0, 0 },
813 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL400
, PCI_ANY_ID
,
814 PCI_ANY_ID
, 0, 0, 0 },
819 static struct pci_driver wanxl_pci_driver
= {
821 .id_table
= wanxl_pci_tbl
,
822 .probe
= wanxl_pci_init_one
,
823 .remove
= wanxl_pci_remove_one
,
827 static int __init
wanxl_init_module(void)
830 printk(KERN_INFO
"%s\n", version
);
832 return pci_module_init(&wanxl_pci_driver
);
835 static void __exit
wanxl_cleanup_module(void)
837 pci_unregister_driver(&wanxl_pci_driver
);
841 MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
842 MODULE_DESCRIPTION("SBE Inc. wanXL serial port driver");
843 MODULE_LICENSE("GPL v2");
844 MODULE_DEVICE_TABLE(pci
, wanxl_pci_tbl
);
846 module_init(wanxl_init_module
);
847 module_exit(wanxl_cleanup_module
);