1 // SPDX-License-Identifier: GPL-2.0-only
3 * wanXL serial card driver for Linux
6 * Copyright (C) 2003 Krzysztof Halasa <khc@pm.waw.pl>
9 * - Only DTE (external clock) support with NRZ and NRZI encodings
10 * - wanXL100 will require minor driver modifications, no access to hw
13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/slab.h>
18 #include <linux/sched.h>
19 #include <linux/types.h>
20 #include <linux/fcntl.h>
21 #include <linux/string.h>
22 #include <linux/errno.h>
23 #include <linux/init.h>
24 #include <linux/interrupt.h>
25 #include <linux/ioport.h>
26 #include <linux/netdevice.h>
27 #include <linux/hdlc.h>
28 #include <linux/pci.h>
29 #include <linux/dma-mapping.h>
30 #include <linux/delay.h>
35 static const char* version
= "wanXL serial card driver version: 0.48";
37 #define PLX_CTL_RESET 0x40000000 /* adapter reset */
42 /* MAILBOX #1 - PUTS COMMANDS */
43 #define MBX1_CMD_ABORTJ 0x85000000 /* Abort and Jump */
44 #ifdef __LITTLE_ENDIAN
45 #define MBX1_CMD_BSWAP 0x8C000001 /* little-endian Byte Swap Mode */
47 #define MBX1_CMD_BSWAP 0x8C000000 /* big-endian Byte Swap Mode */
50 /* MAILBOX #2 - DRAM SIZE */
51 #define MBX2_MEMSZ_MASK 0xFFFF0000 /* PUTS Memory Size Register mask */
55 struct net_device
*dev
;
57 spinlock_t lock
; /* for wanxl_xmit */
58 int node
; /* physical port #0 - 3 */
59 unsigned int clock_type
;
61 struct sk_buff
*tx_skbs
[TX_BUFFERS
];
66 desc_t rx_descs
[RX_QUEUE_LENGTH
];
67 port_status_t port_status
[4];
72 int n_ports
; /* 1, 2 or 4 ports */
75 u8 __iomem
*plx
; /* PLX PCI9060 virtual base address */
76 struct pci_dev
*pdev
; /* for pci_name(pdev) */
78 struct sk_buff
*rx_skbs
[RX_QUEUE_LENGTH
];
79 struct card_status
*status
; /* shared between host and card */
80 dma_addr_t status_address
;
81 struct port ports
[]; /* 1 - 4 port structures follow */
86 static inline struct port
*dev_to_port(struct net_device
*dev
)
88 return (struct port
*)dev_to_hdlc(dev
)->priv
;
92 static inline port_status_t
*get_status(struct port
*port
)
94 return &port
->card
->status
->port_status
[port
->node
];
99 static inline dma_addr_t
pci_map_single_debug(struct pci_dev
*pdev
, void *ptr
,
100 size_t size
, int direction
)
102 dma_addr_t addr
= dma_map_single(&pdev
->dev
, ptr
, size
, direction
);
103 if (addr
+ size
> 0x100000000LL
)
104 pr_crit("%s: pci_map_single() returned memory at 0x%llx!\n",
105 pci_name(pdev
), (unsigned long long)addr
);
109 #undef pci_map_single
110 #define pci_map_single pci_map_single_debug
114 /* Cable and/or personality module change interrupt service */
115 static inline void wanxl_cable_intr(struct port
*port
)
117 u32 value
= get_status(port
)->cable
;
119 const char *cable
, *pm
, *dte
= "", *dsr
= "", *dcd
= "";
121 switch(value
& 0x7) {
122 case STATUS_CABLE_V35
: cable
= "V.35"; break;
123 case STATUS_CABLE_X21
: cable
= "X.21"; break;
124 case STATUS_CABLE_V24
: cable
= "V.24"; break;
125 case STATUS_CABLE_EIA530
: cable
= "EIA530"; break;
126 case STATUS_CABLE_NONE
: cable
= "no"; break;
127 default: cable
= "invalid";
130 switch((value
>> STATUS_CABLE_PM_SHIFT
) & 0x7) {
131 case STATUS_CABLE_V35
: pm
= "V.35"; break;
132 case STATUS_CABLE_X21
: pm
= "X.21"; break;
133 case STATUS_CABLE_V24
: pm
= "V.24"; break;
134 case STATUS_CABLE_EIA530
: pm
= "EIA530"; break;
135 case STATUS_CABLE_NONE
: pm
= "no personality"; valid
= 0; break;
136 default: pm
= "invalid personality"; valid
= 0;
140 if ((value
& 7) == ((value
>> STATUS_CABLE_PM_SHIFT
) & 7)) {
141 dsr
= (value
& STATUS_CABLE_DSR
) ? ", DSR ON" :
143 dcd
= (value
& STATUS_CABLE_DCD
) ? ", carrier ON" :
146 dte
= (value
& STATUS_CABLE_DCE
) ? " DCE" : " DTE";
148 netdev_info(port
->dev
, "%s%s module, %s cable%s%s\n",
149 pm
, dte
, cable
, dsr
, dcd
);
151 if (value
& STATUS_CABLE_DCD
)
152 netif_carrier_on(port
->dev
);
154 netif_carrier_off(port
->dev
);
159 /* Transmit complete interrupt service */
160 static inline void wanxl_tx_intr(struct port
*port
)
162 struct net_device
*dev
= port
->dev
;
164 desc_t
*desc
= &get_status(port
)->tx_descs
[port
->tx_in
];
165 struct sk_buff
*skb
= port
->tx_skbs
[port
->tx_in
];
167 switch (desc
->stat
) {
170 netif_wake_queue(dev
);
173 case PACKET_UNDERRUN
:
174 dev
->stats
.tx_errors
++;
175 dev
->stats
.tx_fifo_errors
++;
179 dev
->stats
.tx_packets
++;
180 dev
->stats
.tx_bytes
+= skb
->len
;
182 desc
->stat
= PACKET_EMPTY
; /* Free descriptor */
183 dma_unmap_single(&port
->card
->pdev
->dev
, desc
->address
,
184 skb
->len
, DMA_TO_DEVICE
);
185 dev_consume_skb_irq(skb
);
186 port
->tx_in
= (port
->tx_in
+ 1) % TX_BUFFERS
;
192 /* Receive complete interrupt service */
193 static inline void wanxl_rx_intr(struct card
*card
)
196 while (desc
= &card
->status
->rx_descs
[card
->rx_in
],
197 desc
->stat
!= PACKET_EMPTY
) {
198 if ((desc
->stat
& PACKET_PORT_MASK
) > card
->n_ports
)
199 pr_crit("%s: received packet for nonexistent port\n",
200 pci_name(card
->pdev
));
202 struct sk_buff
*skb
= card
->rx_skbs
[card
->rx_in
];
203 struct port
*port
= &card
->ports
[desc
->stat
&
205 struct net_device
*dev
= port
->dev
;
208 dev
->stats
.rx_dropped
++;
210 dma_unmap_single(&card
->pdev
->dev
,
211 desc
->address
, BUFFER_LENGTH
,
213 skb_put(skb
, desc
->length
);
216 printk(KERN_DEBUG
"%s RX(%i):", dev
->name
,
220 dev
->stats
.rx_packets
++;
221 dev
->stats
.rx_bytes
+= skb
->len
;
222 skb
->protocol
= hdlc_type_trans(skb
, dev
);
228 skb
= dev_alloc_skb(BUFFER_LENGTH
);
229 desc
->address
= skb
?
230 dma_map_single(&card
->pdev
->dev
,
233 DMA_FROM_DEVICE
) : 0;
234 card
->rx_skbs
[card
->rx_in
] = skb
;
237 desc
->stat
= PACKET_EMPTY
; /* Free descriptor */
238 card
->rx_in
= (card
->rx_in
+ 1) % RX_QUEUE_LENGTH
;
244 static irqreturn_t
wanxl_intr(int irq
, void* dev_id
)
246 struct card
*card
= dev_id
;
252 while((stat
= readl(card
->plx
+ PLX_DOORBELL_FROM_CARD
)) != 0) {
254 writel(stat
, card
->plx
+ PLX_DOORBELL_FROM_CARD
);
256 for (i
= 0; i
< card
->n_ports
; i
++) {
257 if (stat
& (1 << (DOORBELL_FROM_CARD_TX_0
+ i
)))
258 wanxl_tx_intr(&card
->ports
[i
]);
259 if (stat
& (1 << (DOORBELL_FROM_CARD_CABLE_0
+ i
)))
260 wanxl_cable_intr(&card
->ports
[i
]);
262 if (stat
& (1 << DOORBELL_FROM_CARD_RX
))
266 return IRQ_RETVAL(handled
);
271 static netdev_tx_t
wanxl_xmit(struct sk_buff
*skb
, struct net_device
*dev
)
273 struct port
*port
= dev_to_port(dev
);
276 spin_lock(&port
->lock
);
278 desc
= &get_status(port
)->tx_descs
[port
->tx_out
];
279 if (desc
->stat
!= PACKET_EMPTY
) {
280 /* should never happen - previous xmit should stop queue */
282 printk(KERN_DEBUG
"%s: transmitter buffer full\n", dev
->name
);
284 netif_stop_queue(dev
);
285 spin_unlock(&port
->lock
);
286 return NETDEV_TX_BUSY
; /* request packet to be queued */
290 printk(KERN_DEBUG
"%s TX(%i):", dev
->name
, skb
->len
);
294 port
->tx_skbs
[port
->tx_out
] = skb
;
295 desc
->address
= dma_map_single(&port
->card
->pdev
->dev
, skb
->data
,
296 skb
->len
, DMA_TO_DEVICE
);
297 desc
->length
= skb
->len
;
298 desc
->stat
= PACKET_FULL
;
299 writel(1 << (DOORBELL_TO_CARD_TX_0
+ port
->node
),
300 port
->card
->plx
+ PLX_DOORBELL_TO_CARD
);
302 port
->tx_out
= (port
->tx_out
+ 1) % TX_BUFFERS
;
304 if (get_status(port
)->tx_descs
[port
->tx_out
].stat
!= PACKET_EMPTY
) {
305 netif_stop_queue(dev
);
307 printk(KERN_DEBUG
"%s: transmitter buffer full\n", dev
->name
);
311 spin_unlock(&port
->lock
);
317 static int wanxl_attach(struct net_device
*dev
, unsigned short encoding
,
318 unsigned short parity
)
320 struct port
*port
= dev_to_port(dev
);
322 if (encoding
!= ENCODING_NRZ
&&
323 encoding
!= ENCODING_NRZI
)
326 if (parity
!= PARITY_NONE
&&
327 parity
!= PARITY_CRC32_PR1_CCITT
&&
328 parity
!= PARITY_CRC16_PR1_CCITT
&&
329 parity
!= PARITY_CRC32_PR0_CCITT
&&
330 parity
!= PARITY_CRC16_PR0_CCITT
)
333 get_status(port
)->encoding
= encoding
;
334 get_status(port
)->parity
= parity
;
340 static int wanxl_ioctl(struct net_device
*dev
, struct ifreq
*ifr
, int cmd
)
342 const size_t size
= sizeof(sync_serial_settings
);
343 sync_serial_settings line
;
344 struct port
*port
= dev_to_port(dev
);
346 if (cmd
!= SIOCWANDEV
)
347 return hdlc_ioctl(dev
, ifr
, cmd
);
349 switch (ifr
->ifr_settings
.type
) {
351 ifr
->ifr_settings
.type
= IF_IFACE_SYNC_SERIAL
;
352 if (ifr
->ifr_settings
.size
< size
) {
353 ifr
->ifr_settings
.size
= size
; /* data size wanted */
356 memset(&line
, 0, sizeof(line
));
357 line
.clock_type
= get_status(port
)->clocking
;
361 if (copy_to_user(ifr
->ifr_settings
.ifs_ifsu
.sync
, &line
, size
))
365 case IF_IFACE_SYNC_SERIAL
:
366 if (!capable(CAP_NET_ADMIN
))
368 if (dev
->flags
& IFF_UP
)
371 if (copy_from_user(&line
, ifr
->ifr_settings
.ifs_ifsu
.sync
,
375 if (line
.clock_type
!= CLOCK_EXT
&&
376 line
.clock_type
!= CLOCK_TXFROMRX
)
377 return -EINVAL
; /* No such clock setting */
379 if (line
.loopback
!= 0)
382 get_status(port
)->clocking
= line
.clock_type
;
386 return hdlc_ioctl(dev
, ifr
, cmd
);
392 static int wanxl_open(struct net_device
*dev
)
394 struct port
*port
= dev_to_port(dev
);
395 u8 __iomem
*dbr
= port
->card
->plx
+ PLX_DOORBELL_TO_CARD
;
396 unsigned long timeout
;
399 if (get_status(port
)->open
) {
400 netdev_err(dev
, "port already open\n");
403 if ((i
= hdlc_open(dev
)) != 0)
406 port
->tx_in
= port
->tx_out
= 0;
407 for (i
= 0; i
< TX_BUFFERS
; i
++)
408 get_status(port
)->tx_descs
[i
].stat
= PACKET_EMPTY
;
409 /* signal the card */
410 writel(1 << (DOORBELL_TO_CARD_OPEN_0
+ port
->node
), dbr
);
412 timeout
= jiffies
+ HZ
;
414 if (get_status(port
)->open
) {
415 netif_start_queue(dev
);
418 } while (time_after(timeout
, jiffies
));
420 netdev_err(dev
, "unable to open port\n");
421 /* ask the card to close the port, should it be still alive */
422 writel(1 << (DOORBELL_TO_CARD_CLOSE_0
+ port
->node
), dbr
);
428 static int wanxl_close(struct net_device
*dev
)
430 struct port
*port
= dev_to_port(dev
);
431 unsigned long timeout
;
435 /* signal the card */
436 writel(1 << (DOORBELL_TO_CARD_CLOSE_0
+ port
->node
),
437 port
->card
->plx
+ PLX_DOORBELL_TO_CARD
);
439 timeout
= jiffies
+ HZ
;
441 if (!get_status(port
)->open
)
443 } while (time_after(timeout
, jiffies
));
445 if (get_status(port
)->open
)
446 netdev_err(dev
, "unable to close port\n");
448 netif_stop_queue(dev
);
450 for (i
= 0; i
< TX_BUFFERS
; i
++) {
451 desc_t
*desc
= &get_status(port
)->tx_descs
[i
];
453 if (desc
->stat
!= PACKET_EMPTY
) {
454 desc
->stat
= PACKET_EMPTY
;
455 dma_unmap_single(&port
->card
->pdev
->dev
,
456 desc
->address
, port
->tx_skbs
[i
]->len
,
458 dev_kfree_skb(port
->tx_skbs
[i
]);
466 static struct net_device_stats
*wanxl_get_stats(struct net_device
*dev
)
468 struct port
*port
= dev_to_port(dev
);
470 dev
->stats
.rx_over_errors
= get_status(port
)->rx_overruns
;
471 dev
->stats
.rx_frame_errors
= get_status(port
)->rx_frame_errors
;
472 dev
->stats
.rx_errors
= dev
->stats
.rx_over_errors
+
473 dev
->stats
.rx_frame_errors
;
479 static int wanxl_puts_command(struct card
*card
, u32 cmd
)
481 unsigned long timeout
= jiffies
+ 5 * HZ
;
483 writel(cmd
, card
->plx
+ PLX_MAILBOX_1
);
485 if (readl(card
->plx
+ PLX_MAILBOX_1
) == 0)
489 }while (time_after(timeout
, jiffies
));
496 static void wanxl_reset(struct card
*card
)
498 u32 old_value
= readl(card
->plx
+ PLX_CONTROL
) & ~PLX_CTL_RESET
;
500 writel(0x80, card
->plx
+ PLX_MAILBOX_0
);
501 writel(old_value
| PLX_CTL_RESET
, card
->plx
+ PLX_CONTROL
);
502 readl(card
->plx
+ PLX_CONTROL
); /* wait for posted write */
504 writel(old_value
, card
->plx
+ PLX_CONTROL
);
505 readl(card
->plx
+ PLX_CONTROL
); /* wait for posted write */
510 static void wanxl_pci_remove_one(struct pci_dev
*pdev
)
512 struct card
*card
= pci_get_drvdata(pdev
);
515 for (i
= 0; i
< card
->n_ports
; i
++) {
516 unregister_hdlc_device(card
->ports
[i
].dev
);
517 free_netdev(card
->ports
[i
].dev
);
520 /* unregister and free all host resources */
522 free_irq(card
->irq
, card
);
526 for (i
= 0; i
< RX_QUEUE_LENGTH
; i
++)
527 if (card
->rx_skbs
[i
]) {
528 dma_unmap_single(&card
->pdev
->dev
,
529 card
->status
->rx_descs
[i
].address
,
530 BUFFER_LENGTH
, DMA_FROM_DEVICE
);
531 dev_kfree_skb(card
->rx_skbs
[i
]);
538 dma_free_coherent(&pdev
->dev
, sizeof(struct card_status
),
539 card
->status
, card
->status_address
);
541 pci_release_regions(pdev
);
542 pci_disable_device(pdev
);
547 #include "wanxlfw.inc"
549 static const struct net_device_ops wanxl_ops
= {
550 .ndo_open
= wanxl_open
,
551 .ndo_stop
= wanxl_close
,
552 .ndo_start_xmit
= hdlc_start_xmit
,
553 .ndo_do_ioctl
= wanxl_ioctl
,
554 .ndo_get_stats
= wanxl_get_stats
,
557 static int 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 __iomem
*mem
; /* memory virtual base addr */
569 pr_info_once("%s\n", version
);
572 i
= pci_enable_device(pdev
);
576 /* QUICC can only access first 256 MB of host RAM directly,
577 but PLX9060 DMA does 32-bits for actual packet data transfers */
579 /* FIXME when PCI/DMA subsystems are fixed.
580 We set both dma_mask and consistent_dma_mask to 28 bits
581 and pray pci_alloc_consistent() will use this info. It should
582 work on most platforms */
583 if (dma_set_coherent_mask(&pdev
->dev
, DMA_BIT_MASK(28)) ||
584 dma_set_mask(&pdev
->dev
, DMA_BIT_MASK(28))) {
585 pr_err("No usable DMA configuration\n");
586 pci_disable_device(pdev
);
590 i
= pci_request_regions(pdev
, "wanXL");
592 pci_disable_device(pdev
);
596 switch (pdev
->device
) {
597 case PCI_DEVICE_ID_SBE_WANXL100
: ports
= 1; break;
598 case PCI_DEVICE_ID_SBE_WANXL200
: ports
= 2; break;
602 card
= kzalloc(struct_size(card
, ports
, ports
), GFP_KERNEL
);
604 pci_release_regions(pdev
);
605 pci_disable_device(pdev
);
609 pci_set_drvdata(pdev
, card
);
612 card
->status
= dma_alloc_coherent(&pdev
->dev
,
613 sizeof(struct card_status
),
614 &card
->status_address
, GFP_KERNEL
);
615 if (card
->status
== NULL
) {
616 wanxl_pci_remove_one(pdev
);
621 printk(KERN_DEBUG
"wanXL %s: pci_alloc_consistent() returned memory"
622 " at 0x%LX\n", pci_name(pdev
),
623 (unsigned long long)card
->status_address
);
626 /* FIXME when PCI/DMA subsystems are fixed.
627 We set both dma_mask and consistent_dma_mask back to 32 bits
628 to indicate the card can do 32-bit DMA addressing */
629 if (dma_set_coherent_mask(&pdev
->dev
, DMA_BIT_MASK(32)) ||
630 dma_set_mask(&pdev
->dev
, DMA_BIT_MASK(32))) {
631 pr_err("No usable DMA configuration\n");
632 wanxl_pci_remove_one(pdev
);
636 /* set up PLX mapping */
637 plx_phy
= pci_resource_start(pdev
, 0);
639 card
->plx
= ioremap(plx_phy
, 0x70);
641 pr_err("ioremap() failed\n");
642 wanxl_pci_remove_one(pdev
);
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 pr_warn("%s: timeout waiting for PUTS to complete\n",
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 pr_warn("%s: PUTS test 0x%X failed\n",
666 pci_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 pr_warn("%s: no enough on-board RAM (%u bytes detected, %u bytes required)\n",
685 pci_name(pdev
), ramsize
,
687 (TX_BUFFERS
+ RX_BUFFERS
) * BUFFER_LENGTH
* ports
);
688 wanxl_pci_remove_one(pdev
);
692 if (wanxl_puts_command(card
, MBX1_CMD_BSWAP
)) {
693 pr_warn("%s: unable to Set Byte Swap Mode\n", pci_name(pdev
));
694 wanxl_pci_remove_one(pdev
);
698 for (i
= 0; i
< RX_QUEUE_LENGTH
; i
++) {
699 struct sk_buff
*skb
= dev_alloc_skb(BUFFER_LENGTH
);
700 card
->rx_skbs
[i
] = skb
;
702 card
->status
->rx_descs
[i
].address
=
703 dma_map_single(&card
->pdev
->dev
, skb
->data
,
704 BUFFER_LENGTH
, DMA_FROM_DEVICE
);
707 mem
= ioremap(mem_phy
, PDM_OFFSET
+ sizeof(firmware
));
709 pr_err("ioremap() failed\n");
710 wanxl_pci_remove_one(pdev
);
714 for (i
= 0; i
< sizeof(firmware
); i
+= 4)
715 writel(ntohl(*(__be32
*)(firmware
+ i
)), mem
+ PDM_OFFSET
+ i
);
717 for (i
= 0; i
< ports
; i
++)
718 writel(card
->status_address
+
719 (void *)&card
->status
->port_status
[i
] -
720 (void *)card
->status
, mem
+ PDM_OFFSET
+ 4 + i
* 4);
721 writel(card
->status_address
, mem
+ PDM_OFFSET
+ 20);
722 writel(PDM_OFFSET
, mem
);
725 writel(0, card
->plx
+ PLX_MAILBOX_5
);
727 if (wanxl_puts_command(card
, MBX1_CMD_ABORTJ
)) {
728 pr_warn("%s: unable to Abort and Jump\n", pci_name(pdev
));
729 wanxl_pci_remove_one(pdev
);
733 timeout
= jiffies
+ 5 * HZ
;
735 if ((stat
= readl(card
->plx
+ PLX_MAILBOX_5
)) != 0)
738 }while (time_after(timeout
, jiffies
));
741 pr_warn("%s: timeout while initializing card firmware\n",
743 wanxl_pci_remove_one(pdev
);
751 pr_info("%s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n",
752 pci_name(pdev
), plx_phy
, ramsize
/ 1024, mem_phy
, pdev
->irq
);
755 if (request_irq(pdev
->irq
, wanxl_intr
, IRQF_SHARED
, "wanXL", card
)) {
756 pr_warn("%s: could not allocate IRQ%i\n",
757 pci_name(pdev
), pdev
->irq
);
758 wanxl_pci_remove_one(pdev
);
761 card
->irq
= pdev
->irq
;
763 for (i
= 0; i
< ports
; i
++) {
765 struct port
*port
= &card
->ports
[i
];
766 struct net_device
*dev
= alloc_hdlcdev(port
);
768 pr_err("%s: unable to allocate memory\n",
770 wanxl_pci_remove_one(pdev
);
775 hdlc
= dev_to_hdlc(dev
);
776 spin_lock_init(&port
->lock
);
777 dev
->tx_queue_len
= 50;
778 dev
->netdev_ops
= &wanxl_ops
;
779 hdlc
->attach
= wanxl_attach
;
780 hdlc
->xmit
= wanxl_xmit
;
783 get_status(port
)->clocking
= CLOCK_EXT
;
784 if (register_hdlc_device(dev
)) {
785 pr_err("%s: unable to register hdlc device\n",
788 wanxl_pci_remove_one(pdev
);
794 pr_info("%s: port", pci_name(pdev
));
795 for (i
= 0; i
< ports
; i
++)
796 pr_cont("%s #%i: %s",
797 i
? "," : "", i
, card
->ports
[i
].dev
->name
);
800 for (i
= 0; i
< ports
; i
++)
801 wanxl_cable_intr(&card
->ports
[i
]); /* get carrier status etc.*/
806 static const struct pci_device_id wanxl_pci_tbl
[] = {
807 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL100
, PCI_ANY_ID
,
808 PCI_ANY_ID
, 0, 0, 0 },
809 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL200
, PCI_ANY_ID
,
810 PCI_ANY_ID
, 0, 0, 0 },
811 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL400
, PCI_ANY_ID
,
812 PCI_ANY_ID
, 0, 0, 0 },
817 static struct pci_driver wanxl_pci_driver
= {
819 .id_table
= wanxl_pci_tbl
,
820 .probe
= wanxl_pci_init_one
,
821 .remove
= wanxl_pci_remove_one
,
825 static int __init
wanxl_init_module(void)
828 pr_info("%s\n", version
);
830 return pci_register_driver(&wanxl_pci_driver
);
833 static void __exit
wanxl_cleanup_module(void)
835 pci_unregister_driver(&wanxl_pci_driver
);
839 MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
840 MODULE_DESCRIPTION("SBE Inc. wanXL serial port driver");
841 MODULE_LICENSE("GPL v2");
842 MODULE_DEVICE_TABLE(pci
, wanxl_pci_tbl
);
844 module_init(wanxl_init_module
);
845 module_exit(wanxl_cleanup_module
);