* Linux 1.3.0 changes by
* Alan Cox <Alan.Cox@linux.org>
* More debugging, DMA support, currently maintained by
- * Philip Blundell <Philip.Blundell@pobox.com>
+ * Philip Blundell <philb@gnu.org>
* Multicard/soft configurable dma channel/rev 2 hardware support
* by Christopher Collins <ccollins@pcug.org.au>
* Ethtool support (jgarzik), 11/17/2001
#include <linux/spinlock.h>
#include <linux/ethtool.h>
#include <linux/delay.h>
+#include <linux/bitops.h>
#include <asm/uaccess.h>
-#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/dma.h>
outb(val, base_addr + PORT_COMMAND);
}
-static inline unsigned int inw_data(unsigned int base_addr)
-{
- return inw(base_addr + PORT_DATA);
-}
-
-static inline void outw_data(unsigned int val, unsigned int base_addr)
-{
- outw(val, base_addr + PORT_DATA);
-}
-
static inline unsigned int backlog_next(unsigned int n)
{
return (n + 1) % BACKLOG_SIZE;
static int start_receive(struct net_device *, pcb_struct *);
-inline static void adapter_reset(struct net_device *dev)
+static inline void adapter_reset(struct net_device *dev)
{
unsigned long timeout;
elp_device *adapter = dev->priv;
spin_lock_irqsave(&adapter->lock, flags);
adapter->dmaing = 0;
adapter->busy = 0;
-
+
f=claim_dma_lock();
disable_dma(dev->dma);
release_dma_lock(f);
-
+
if (adapter->rx_active)
adapter->rx_active--;
outb_control(adapter->hcr_val & ~(DMAE | TCEN | DIR), dev);
*
******************************************************/
-static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr)
+static irqreturn_t elp_interrupt(int irq, void *dev_id)
{
int len;
int dlen;
dev = dev_id;
adapter = (elp_device *) dev->priv;
-
+
spin_lock(&adapter->lock);
do {
timeout = jiffies + 3*HZ/100;
while ((inb_status(dev->base_addr) & ACRF) != 0 && time_before(jiffies, timeout)) {
if (receive_pcb(dev, &adapter->irx_pcb)) {
- switch (adapter->irx_pcb.command)
+ switch (adapter->irx_pcb.command)
{
case 0:
break;
adapter->send_pcb_semaphore = 0;
adapter->rx_backlog.in = 0;
adapter->rx_backlog.out = 0;
-
+
spin_lock_init(&adapter->lock);
/*
}
adapter->stats.tx_bytes += nlen;
-
+
/*
* send the adapter a transmit packet command. Ignore segment and offset
* and make sure the length is even
outb_control(adapter->hcr_val | DMAE | TCEN, dev);
enable_dma(dev->dma);
release_dma_lock(flags);
-
+
if (elp_debug >= 3)
printk(KERN_DEBUG "%s: DMA transfer started\n", dev->name);
/*
* The upper layer thinks we timed out
*/
-
+
static void elp_timeout(struct net_device *dev)
{
elp_device *adapter = dev->priv;
{
unsigned long flags;
elp_device *adapter = dev->priv;
-
+
spin_lock_irqsave(&adapter->lock, flags);
check_3c505_dma(dev);
printk(KERN_DEBUG "%s: request to send packet of length %d\n", dev->name, (int) skb->len);
netif_stop_queue(dev);
-
+
/*
* send the packet at skb->data for skb->len
*/
debug = level;
}
-static struct ethtool_ops netdev_ethtool_ops = {
+static const struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
.get_msglevel = netdev_get_msglevel,
.set_msglevel = netdev_set_msglevel,
printk(KERN_DEBUG "%s: request to set multicast list\n", dev->name);
spin_lock_irqsave(&adapter->lock, flags);
-
+
if (!(dev->flags & (IFF_PROMISC | IFF_ALLMULTI))) {
/* send a "load multicast list" command to the board, max 10 addrs/cmd */
/* if num_addrs==0 the list will be cleared */
if (orig_HSR & DIR) {
/* If HCR.DIR is up, we pull it down. HSR.DIR should follow. */
outb(0, dev->base_addr + PORT_CONTROL);
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(30*HZ/100);
+ msleep(300);
if (inb_status(addr) & DIR) {
if (elp_debug > 0)
printk(notfound_msg, 2);
} else {
/* If HCR.DIR is down, we pull it up. HSR.DIR should follow. */
outb(DIR, dev->base_addr + PORT_CONTROL);
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(30*HZ/100);
+ msleep(300);
if (!(inb_status(addr) & DIR)) {
if (elp_debug > 0)
printk(notfound_msg, 3);
return err;
}
+#ifndef MODULE
struct net_device * __init elplus_probe(int unit)
{
struct net_device *dev = alloc_etherdev(sizeof(elp_device));
return dev;
}
-#ifdef MODULE
+#else
static struct net_device *dev_3c505[ELP_MAX_CARDS];
static int io[ELP_MAX_CARDS];
static int irq[ELP_MAX_CARDS];
static int dma[ELP_MAX_CARDS];
-MODULE_PARM(io, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i");
-MODULE_PARM(dma, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(dma, int, NULL, 0);
MODULE_PARM_DESC(io, "EtherLink Plus I/O base address(es)");
MODULE_PARM_DESC(irq, "EtherLink Plus IRQ number(s) (assigned)");
MODULE_PARM_DESC(dma, "EtherLink Plus DMA channel(s)");
-int init_module(void)
+int __init init_module(void)
{
int this_dev, found = 0;
return 0;
}
-void cleanup_module(void)
+void __exit cleanup_module(void)
{
int this_dev;