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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/slab.h>
21 #include <linux/sched.h>
22 #include <linux/types.h>
23 #include <linux/fcntl.h>
24 #include <linux/string.h>
25 #include <linux/errno.h>
26 #include <linux/init.h>
27 #include <linux/interrupt.h>
28 #include <linux/ioport.h>
29 #include <linux/netdevice.h>
30 #include <linux/hdlc.h>
31 #include <linux/pci.h>
32 #include <linux/dma-mapping.h>
33 #include <linux/delay.h>
38 static const char* version
= "wanXL serial card driver version: 0.48";
40 #define PLX_CTL_RESET 0x40000000 /* adapter reset */
45 /* MAILBOX #1 - PUTS COMMANDS */
46 #define MBX1_CMD_ABORTJ 0x85000000 /* Abort and Jump */
47 #ifdef __LITTLE_ENDIAN
48 #define MBX1_CMD_BSWAP 0x8C000001 /* little-endian Byte Swap Mode */
50 #define MBX1_CMD_BSWAP 0x8C000000 /* big-endian Byte Swap Mode */
53 /* MAILBOX #2 - DRAM SIZE */
54 #define MBX2_MEMSZ_MASK 0xFFFF0000 /* PUTS Memory Size Register mask */
58 struct net_device
*dev
;
60 spinlock_t lock
; /* for wanxl_xmit */
61 int node
; /* physical port #0 - 3 */
62 unsigned int clock_type
;
64 struct sk_buff
*tx_skbs
[TX_BUFFERS
];
69 desc_t rx_descs
[RX_QUEUE_LENGTH
];
70 port_status_t port_status
[4];
74 typedef struct card_t
{
75 int n_ports
; /* 1, 2 or 4 ports */
78 u8 __iomem
*plx
; /* PLX PCI9060 virtual base address */
79 struct pci_dev
*pdev
; /* for pci_name(pdev) */
81 struct sk_buff
*rx_skbs
[RX_QUEUE_LENGTH
];
82 card_status_t
*status
; /* shared between host and card */
83 dma_addr_t status_address
;
84 port_t ports
[0]; /* 1 - 4 port_t structures follow */
89 static inline port_t
* dev_to_port(struct net_device
*dev
)
91 return (port_t
*)dev_to_hdlc(dev
)->priv
;
95 static inline port_status_t
* get_status(port_t
*port
)
97 return &port
->card
->status
->port_status
[port
->node
];
102 static inline dma_addr_t
pci_map_single_debug(struct pci_dev
*pdev
, void *ptr
,
103 size_t size
, int direction
)
105 dma_addr_t addr
= pci_map_single(pdev
, ptr
, size
, direction
);
106 if (addr
+ size
> 0x100000000LL
)
107 pr_crit("%s: pci_map_single() returned memory at 0x%llx!\n",
108 pci_name(pdev
), (unsigned long long)addr
);
112 #undef pci_map_single
113 #define pci_map_single pci_map_single_debug
117 /* Cable and/or personality module change interrupt service */
118 static inline void wanxl_cable_intr(port_t
*port
)
120 u32 value
= get_status(port
)->cable
;
122 const char *cable
, *pm
, *dte
= "", *dsr
= "", *dcd
= "";
124 switch(value
& 0x7) {
125 case STATUS_CABLE_V35
: cable
= "V.35"; break;
126 case STATUS_CABLE_X21
: cable
= "X.21"; break;
127 case STATUS_CABLE_V24
: cable
= "V.24"; break;
128 case STATUS_CABLE_EIA530
: cable
= "EIA530"; break;
129 case STATUS_CABLE_NONE
: cable
= "no"; break;
130 default: cable
= "invalid";
133 switch((value
>> STATUS_CABLE_PM_SHIFT
) & 0x7) {
134 case STATUS_CABLE_V35
: pm
= "V.35"; break;
135 case STATUS_CABLE_X21
: pm
= "X.21"; break;
136 case STATUS_CABLE_V24
: pm
= "V.24"; break;
137 case STATUS_CABLE_EIA530
: pm
= "EIA530"; break;
138 case STATUS_CABLE_NONE
: pm
= "no personality"; valid
= 0; break;
139 default: pm
= "invalid personality"; valid
= 0;
143 if ((value
& 7) == ((value
>> STATUS_CABLE_PM_SHIFT
) & 7)) {
144 dsr
= (value
& STATUS_CABLE_DSR
) ? ", DSR ON" :
146 dcd
= (value
& STATUS_CABLE_DCD
) ? ", carrier ON" :
149 dte
= (value
& STATUS_CABLE_DCE
) ? " DCE" : " DTE";
151 netdev_info(port
->dev
, "%s%s module, %s cable%s%s\n",
152 pm
, dte
, cable
, dsr
, dcd
);
154 if (value
& STATUS_CABLE_DCD
)
155 netif_carrier_on(port
->dev
);
157 netif_carrier_off(port
->dev
);
162 /* Transmit complete interrupt service */
163 static inline void wanxl_tx_intr(port_t
*port
)
165 struct net_device
*dev
= port
->dev
;
167 desc_t
*desc
= &get_status(port
)->tx_descs
[port
->tx_in
];
168 struct sk_buff
*skb
= port
->tx_skbs
[port
->tx_in
];
170 switch (desc
->stat
) {
173 netif_wake_queue(dev
);
176 case PACKET_UNDERRUN
:
177 dev
->stats
.tx_errors
++;
178 dev
->stats
.tx_fifo_errors
++;
182 dev
->stats
.tx_packets
++;
183 dev
->stats
.tx_bytes
+= skb
->len
;
185 desc
->stat
= PACKET_EMPTY
; /* Free descriptor */
186 pci_unmap_single(port
->card
->pdev
, desc
->address
, skb
->len
,
188 dev_kfree_skb_irq(skb
);
189 port
->tx_in
= (port
->tx_in
+ 1) % TX_BUFFERS
;
195 /* Receive complete interrupt service */
196 static inline void wanxl_rx_intr(card_t
*card
)
199 while (desc
= &card
->status
->rx_descs
[card
->rx_in
],
200 desc
->stat
!= PACKET_EMPTY
) {
201 if ((desc
->stat
& PACKET_PORT_MASK
) > card
->n_ports
)
202 pr_crit("%s: received packet for nonexistent port\n",
203 pci_name(card
->pdev
));
205 struct sk_buff
*skb
= card
->rx_skbs
[card
->rx_in
];
206 port_t
*port
= &card
->ports
[desc
->stat
&
208 struct net_device
*dev
= port
->dev
;
211 dev
->stats
.rx_dropped
++;
213 pci_unmap_single(card
->pdev
, desc
->address
,
216 skb_put(skb
, desc
->length
);
219 printk(KERN_DEBUG
"%s RX(%i):", dev
->name
,
223 dev
->stats
.rx_packets
++;
224 dev
->stats
.rx_bytes
+= skb
->len
;
225 skb
->protocol
= hdlc_type_trans(skb
, dev
);
231 skb
= dev_alloc_skb(BUFFER_LENGTH
);
232 desc
->address
= skb
?
233 pci_map_single(card
->pdev
, skb
->data
,
235 PCI_DMA_FROMDEVICE
) : 0;
236 card
->rx_skbs
[card
->rx_in
] = skb
;
239 desc
->stat
= PACKET_EMPTY
; /* Free descriptor */
240 card
->rx_in
= (card
->rx_in
+ 1) % RX_QUEUE_LENGTH
;
246 static irqreturn_t
wanxl_intr(int irq
, void* dev_id
)
248 card_t
*card
= dev_id
;
254 while((stat
= readl(card
->plx
+ PLX_DOORBELL_FROM_CARD
)) != 0) {
256 writel(stat
, card
->plx
+ PLX_DOORBELL_FROM_CARD
);
258 for (i
= 0; i
< card
->n_ports
; i
++) {
259 if (stat
& (1 << (DOORBELL_FROM_CARD_TX_0
+ i
)))
260 wanxl_tx_intr(&card
->ports
[i
]);
261 if (stat
& (1 << (DOORBELL_FROM_CARD_CABLE_0
+ i
)))
262 wanxl_cable_intr(&card
->ports
[i
]);
264 if (stat
& (1 << DOORBELL_FROM_CARD_RX
))
268 return IRQ_RETVAL(handled
);
273 static netdev_tx_t
wanxl_xmit(struct sk_buff
*skb
, struct net_device
*dev
)
275 port_t
*port
= dev_to_port(dev
);
278 spin_lock(&port
->lock
);
280 desc
= &get_status(port
)->tx_descs
[port
->tx_out
];
281 if (desc
->stat
!= PACKET_EMPTY
) {
282 /* should never happen - previous xmit should stop queue */
284 printk(KERN_DEBUG
"%s: transmitter buffer full\n", dev
->name
);
286 netif_stop_queue(dev
);
287 spin_unlock(&port
->lock
);
288 return NETDEV_TX_BUSY
; /* request packet to be queued */
292 printk(KERN_DEBUG
"%s TX(%i):", dev
->name
, skb
->len
);
296 port
->tx_skbs
[port
->tx_out
] = skb
;
297 desc
->address
= pci_map_single(port
->card
->pdev
, skb
->data
, skb
->len
,
299 desc
->length
= skb
->len
;
300 desc
->stat
= PACKET_FULL
;
301 writel(1 << (DOORBELL_TO_CARD_TX_0
+ port
->node
),
302 port
->card
->plx
+ PLX_DOORBELL_TO_CARD
);
304 port
->tx_out
= (port
->tx_out
+ 1) % TX_BUFFERS
;
306 if (get_status(port
)->tx_descs
[port
->tx_out
].stat
!= PACKET_EMPTY
) {
307 netif_stop_queue(dev
);
309 printk(KERN_DEBUG
"%s: transmitter buffer full\n", dev
->name
);
313 spin_unlock(&port
->lock
);
319 static int wanxl_attach(struct net_device
*dev
, unsigned short encoding
,
320 unsigned short parity
)
322 port_t
*port
= dev_to_port(dev
);
324 if (encoding
!= ENCODING_NRZ
&&
325 encoding
!= ENCODING_NRZI
)
328 if (parity
!= PARITY_NONE
&&
329 parity
!= PARITY_CRC32_PR1_CCITT
&&
330 parity
!= PARITY_CRC16_PR1_CCITT
&&
331 parity
!= PARITY_CRC32_PR0_CCITT
&&
332 parity
!= PARITY_CRC16_PR0_CCITT
)
335 get_status(port
)->encoding
= encoding
;
336 get_status(port
)->parity
= parity
;
342 static int wanxl_ioctl(struct net_device
*dev
, struct ifreq
*ifr
, int cmd
)
344 const size_t size
= sizeof(sync_serial_settings
);
345 sync_serial_settings line
;
346 port_t
*port
= dev_to_port(dev
);
348 if (cmd
!= SIOCWANDEV
)
349 return hdlc_ioctl(dev
, ifr
, cmd
);
351 switch (ifr
->ifr_settings
.type
) {
353 ifr
->ifr_settings
.type
= IF_IFACE_SYNC_SERIAL
;
354 if (ifr
->ifr_settings
.size
< size
) {
355 ifr
->ifr_settings
.size
= size
; /* data size wanted */
358 memset(&line
, 0, sizeof(line
));
359 line
.clock_type
= get_status(port
)->clocking
;
363 if (copy_to_user(ifr
->ifr_settings
.ifs_ifsu
.sync
, &line
, size
))
367 case IF_IFACE_SYNC_SERIAL
:
368 if (!capable(CAP_NET_ADMIN
))
370 if (dev
->flags
& IFF_UP
)
373 if (copy_from_user(&line
, ifr
->ifr_settings
.ifs_ifsu
.sync
,
377 if (line
.clock_type
!= CLOCK_EXT
&&
378 line
.clock_type
!= CLOCK_TXFROMRX
)
379 return -EINVAL
; /* No such clock setting */
381 if (line
.loopback
!= 0)
384 get_status(port
)->clocking
= line
.clock_type
;
388 return hdlc_ioctl(dev
, ifr
, cmd
);
394 static int wanxl_open(struct net_device
*dev
)
396 port_t
*port
= dev_to_port(dev
);
397 u8 __iomem
*dbr
= port
->card
->plx
+ PLX_DOORBELL_TO_CARD
;
398 unsigned long timeout
;
401 if (get_status(port
)->open
) {
402 netdev_err(dev
, "port already open\n");
405 if ((i
= hdlc_open(dev
)) != 0)
408 port
->tx_in
= port
->tx_out
= 0;
409 for (i
= 0; i
< TX_BUFFERS
; i
++)
410 get_status(port
)->tx_descs
[i
].stat
= PACKET_EMPTY
;
411 /* signal the card */
412 writel(1 << (DOORBELL_TO_CARD_OPEN_0
+ port
->node
), dbr
);
414 timeout
= jiffies
+ HZ
;
416 if (get_status(port
)->open
) {
417 netif_start_queue(dev
);
420 } while (time_after(timeout
, jiffies
));
422 netdev_err(dev
, "unable to open port\n");
423 /* ask the card to close the port, should it be still alive */
424 writel(1 << (DOORBELL_TO_CARD_CLOSE_0
+ port
->node
), dbr
);
430 static int wanxl_close(struct net_device
*dev
)
432 port_t
*port
= dev_to_port(dev
);
433 unsigned long timeout
;
437 /* signal the card */
438 writel(1 << (DOORBELL_TO_CARD_CLOSE_0
+ port
->node
),
439 port
->card
->plx
+ PLX_DOORBELL_TO_CARD
);
441 timeout
= jiffies
+ HZ
;
443 if (!get_status(port
)->open
)
445 } while (time_after(timeout
, jiffies
));
447 if (get_status(port
)->open
)
448 netdev_err(dev
, "unable to close port\n");
450 netif_stop_queue(dev
);
452 for (i
= 0; i
< TX_BUFFERS
; i
++) {
453 desc_t
*desc
= &get_status(port
)->tx_descs
[i
];
455 if (desc
->stat
!= PACKET_EMPTY
) {
456 desc
->stat
= PACKET_EMPTY
;
457 pci_unmap_single(port
->card
->pdev
, desc
->address
,
458 port
->tx_skbs
[i
]->len
,
460 dev_kfree_skb(port
->tx_skbs
[i
]);
468 static struct net_device_stats
*wanxl_get_stats(struct net_device
*dev
)
470 port_t
*port
= dev_to_port(dev
);
472 dev
->stats
.rx_over_errors
= get_status(port
)->rx_overruns
;
473 dev
->stats
.rx_frame_errors
= get_status(port
)->rx_frame_errors
;
474 dev
->stats
.rx_errors
= dev
->stats
.rx_over_errors
+
475 dev
->stats
.rx_frame_errors
;
481 static int wanxl_puts_command(card_t
*card
, u32 cmd
)
483 unsigned long timeout
= jiffies
+ 5 * HZ
;
485 writel(cmd
, card
->plx
+ PLX_MAILBOX_1
);
487 if (readl(card
->plx
+ PLX_MAILBOX_1
) == 0)
491 }while (time_after(timeout
, jiffies
));
498 static void wanxl_reset(card_t
*card
)
500 u32 old_value
= readl(card
->plx
+ PLX_CONTROL
) & ~PLX_CTL_RESET
;
502 writel(0x80, card
->plx
+ PLX_MAILBOX_0
);
503 writel(old_value
| PLX_CTL_RESET
, card
->plx
+ PLX_CONTROL
);
504 readl(card
->plx
+ PLX_CONTROL
); /* wait for posted write */
506 writel(old_value
, card
->plx
+ PLX_CONTROL
);
507 readl(card
->plx
+ PLX_CONTROL
); /* wait for posted write */
512 static void wanxl_pci_remove_one(struct pci_dev
*pdev
)
514 card_t
*card
= pci_get_drvdata(pdev
);
517 for (i
= 0; i
< card
->n_ports
; i
++) {
518 unregister_hdlc_device(card
->ports
[i
].dev
);
519 free_netdev(card
->ports
[i
].dev
);
522 /* unregister and free all host resources */
524 free_irq(card
->irq
, card
);
528 for (i
= 0; i
< RX_QUEUE_LENGTH
; i
++)
529 if (card
->rx_skbs
[i
]) {
530 pci_unmap_single(card
->pdev
,
531 card
->status
->rx_descs
[i
].address
,
532 BUFFER_LENGTH
, PCI_DMA_FROMDEVICE
);
533 dev_kfree_skb(card
->rx_skbs
[i
]);
540 pci_free_consistent(pdev
, sizeof(card_status_t
),
541 card
->status
, card
->status_address
);
543 pci_release_regions(pdev
);
544 pci_disable_device(pdev
);
545 pci_set_drvdata(pdev
, NULL
);
550 #include "wanxlfw.inc"
552 static const struct net_device_ops wanxl_ops
= {
553 .ndo_open
= wanxl_open
,
554 .ndo_stop
= wanxl_close
,
555 .ndo_change_mtu
= hdlc_change_mtu
,
556 .ndo_start_xmit
= hdlc_start_xmit
,
557 .ndo_do_ioctl
= wanxl_ioctl
,
558 .ndo_get_stats
= wanxl_get_stats
,
561 static int __devinit
wanxl_pci_init_one(struct pci_dev
*pdev
,
562 const struct pci_device_id
*ent
)
566 unsigned long timeout
;
567 u32 plx_phy
; /* PLX PCI base address */
568 u32 mem_phy
; /* memory PCI base addr */
569 u8 __iomem
*mem
; /* memory virtual base addr */
570 int i
, ports
, alloc_size
;
573 pr_info_once("%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
, DMA_BIT_MASK(28)) ||
588 pci_set_dma_mask(pdev
, DMA_BIT_MASK(28))) {
589 pr_err("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
= kzalloc(alloc_size
, GFP_KERNEL
);
608 pci_release_regions(pdev
);
609 pci_disable_device(pdev
);
613 pci_set_drvdata(pdev
, card
);
616 card
->status
= pci_alloc_consistent(pdev
, sizeof(card_status_t
),
617 &card
->status_address
);
618 if (card
->status
== NULL
) {
619 wanxl_pci_remove_one(pdev
);
624 printk(KERN_DEBUG
"wanXL %s: pci_alloc_consistent() returned memory"
625 " at 0x%LX\n", pci_name(pdev
),
626 (unsigned long long)card
->status_address
);
629 /* FIXME when PCI/DMA subsystems are fixed.
630 We set both dma_mask and consistent_dma_mask back to 32 bits
631 to indicate the card can do 32-bit DMA addressing */
632 if (pci_set_consistent_dma_mask(pdev
, DMA_BIT_MASK(32)) ||
633 pci_set_dma_mask(pdev
, DMA_BIT_MASK(32))) {
634 pr_err("No usable DMA configuration\n");
635 wanxl_pci_remove_one(pdev
);
639 /* set up PLX mapping */
640 plx_phy
= pci_resource_start(pdev
, 0);
642 card
->plx
= ioremap_nocache(plx_phy
, 0x70);
644 pr_err("ioremap() failed\n");
645 wanxl_pci_remove_one(pdev
);
649 #if RESET_WHILE_LOADING
653 timeout
= jiffies
+ 20 * HZ
;
654 while ((stat
= readl(card
->plx
+ PLX_MAILBOX_0
)) != 0) {
655 if (time_before(timeout
, jiffies
)) {
656 pr_warn("%s: timeout waiting for PUTS to complete\n",
658 wanxl_pci_remove_one(pdev
);
662 switch(stat
& 0xC0) {
663 case 0x00: /* hmm - PUTS completed with non-zero code? */
664 case 0x80: /* PUTS still testing the hardware */
668 pr_warn("%s: PUTS test 0x%X failed\n",
669 pci_name(pdev
), stat
& 0x30);
670 wanxl_pci_remove_one(pdev
);
677 /* get on-board memory size (PUTS detects no more than 4 MB) */
678 ramsize
= readl(card
->plx
+ PLX_MAILBOX_2
) & MBX2_MEMSZ_MASK
;
680 /* set up on-board RAM mapping */
681 mem_phy
= pci_resource_start(pdev
, 2);
684 /* sanity check the board's reported memory size */
685 if (ramsize
< BUFFERS_ADDR
+
686 (TX_BUFFERS
+ RX_BUFFERS
) * BUFFER_LENGTH
* ports
) {
687 pr_warn("%s: no enough on-board RAM (%u bytes detected, %u bytes required)\n",
688 pci_name(pdev
), ramsize
,
690 (TX_BUFFERS
+ RX_BUFFERS
) * BUFFER_LENGTH
* ports
);
691 wanxl_pci_remove_one(pdev
);
695 if (wanxl_puts_command(card
, MBX1_CMD_BSWAP
)) {
696 pr_warn("%s: unable to Set Byte Swap Mode\n", pci_name(pdev
));
697 wanxl_pci_remove_one(pdev
);
701 for (i
= 0; i
< RX_QUEUE_LENGTH
; i
++) {
702 struct sk_buff
*skb
= dev_alloc_skb(BUFFER_LENGTH
);
703 card
->rx_skbs
[i
] = skb
;
705 card
->status
->rx_descs
[i
].address
=
706 pci_map_single(card
->pdev
, skb
->data
,
711 mem
= ioremap_nocache(mem_phy
, PDM_OFFSET
+ sizeof(firmware
));
713 pr_err("ioremap() failed\n");
714 wanxl_pci_remove_one(pdev
);
718 for (i
= 0; i
< sizeof(firmware
); i
+= 4)
719 writel(ntohl(*(__be32
*)(firmware
+ i
)), mem
+ PDM_OFFSET
+ i
);
721 for (i
= 0; i
< ports
; i
++)
722 writel(card
->status_address
+
723 (void *)&card
->status
->port_status
[i
] -
724 (void *)card
->status
, mem
+ PDM_OFFSET
+ 4 + i
* 4);
725 writel(card
->status_address
, mem
+ PDM_OFFSET
+ 20);
726 writel(PDM_OFFSET
, mem
);
729 writel(0, card
->plx
+ PLX_MAILBOX_5
);
731 if (wanxl_puts_command(card
, MBX1_CMD_ABORTJ
)) {
732 pr_warn("%s: unable to Abort and Jump\n", pci_name(pdev
));
733 wanxl_pci_remove_one(pdev
);
738 timeout
= jiffies
+ 5 * HZ
;
740 if ((stat
= readl(card
->plx
+ PLX_MAILBOX_5
)) != 0)
743 }while (time_after(timeout
, jiffies
));
746 pr_warn("%s: timeout while initializing card firmware\n",
748 wanxl_pci_remove_one(pdev
);
756 pr_info("%s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n",
757 pci_name(pdev
), plx_phy
, ramsize
/ 1024, mem_phy
, pdev
->irq
);
760 if (request_irq(pdev
->irq
, wanxl_intr
, IRQF_SHARED
, "wanXL", card
)) {
761 pr_warn("%s: could not allocate IRQ%i\n",
762 pci_name(pdev
), pdev
->irq
);
763 wanxl_pci_remove_one(pdev
);
766 card
->irq
= pdev
->irq
;
768 for (i
= 0; i
< ports
; i
++) {
770 port_t
*port
= &card
->ports
[i
];
771 struct net_device
*dev
= alloc_hdlcdev(port
);
773 pr_err("%s: unable to allocate memory\n",
775 wanxl_pci_remove_one(pdev
);
780 hdlc
= dev_to_hdlc(dev
);
781 spin_lock_init(&port
->lock
);
782 dev
->tx_queue_len
= 50;
783 dev
->netdev_ops
= &wanxl_ops
;
784 hdlc
->attach
= wanxl_attach
;
785 hdlc
->xmit
= wanxl_xmit
;
788 get_status(port
)->clocking
= CLOCK_EXT
;
789 if (register_hdlc_device(dev
)) {
790 pr_err("%s: unable to register hdlc device\n",
793 wanxl_pci_remove_one(pdev
);
799 pr_info("%s: port", pci_name(pdev
));
800 for (i
= 0; i
< ports
; i
++)
801 pr_cont("%s #%i: %s",
802 i
? "," : "", i
, card
->ports
[i
].dev
->name
);
805 for (i
= 0; i
< ports
; i
++)
806 wanxl_cable_intr(&card
->ports
[i
]); /* get carrier status etc.*/
811 static DEFINE_PCI_DEVICE_TABLE(wanxl_pci_tbl
) = {
812 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL100
, PCI_ANY_ID
,
813 PCI_ANY_ID
, 0, 0, 0 },
814 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL200
, PCI_ANY_ID
,
815 PCI_ANY_ID
, 0, 0, 0 },
816 { PCI_VENDOR_ID_SBE
, PCI_DEVICE_ID_SBE_WANXL400
, PCI_ANY_ID
,
817 PCI_ANY_ID
, 0, 0, 0 },
822 static struct pci_driver wanxl_pci_driver
= {
824 .id_table
= wanxl_pci_tbl
,
825 .probe
= wanxl_pci_init_one
,
826 .remove
= wanxl_pci_remove_one
,
830 static int __init
wanxl_init_module(void)
833 pr_info("%s\n", version
);
835 return pci_register_driver(&wanxl_pci_driver
);
838 static void __exit
wanxl_cleanup_module(void)
840 pci_unregister_driver(&wanxl_pci_driver
);
844 MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
845 MODULE_DESCRIPTION("SBE Inc. wanXL serial port driver");
846 MODULE_LICENSE("GPL v2");
847 MODULE_DEVICE_TABLE(pci
, wanxl_pci_tbl
);
849 module_init(wanxl_init_module
);
850 module_exit(wanxl_cleanup_module
);