net/pcmcia/3c589_cs: using netdev_info and friends where appropriate
Signed-off-by: Alexander Kurz <linux@kbdbabel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
e6b043d512
commit
f64e96973a
@ -69,24 +69,47 @@
|
|||||||
/* The top five bits written to EL3_CMD are a command, the lower
|
/* The top five bits written to EL3_CMD are a command, the lower
|
||||||
11 bits are the parameter, if applicable. */
|
11 bits are the parameter, if applicable. */
|
||||||
enum c509cmd {
|
enum c509cmd {
|
||||||
TotalReset = 0<<11, SelectWindow = 1<<11, StartCoax = 2<<11,
|
TotalReset = 0<<11,
|
||||||
RxDisable = 3<<11, RxEnable = 4<<11, RxReset = 5<<11, RxDiscard = 8<<11,
|
SelectWindow = 1<<11,
|
||||||
TxEnable = 9<<11, TxDisable = 10<<11, TxReset = 11<<11,
|
StartCoax = 2<<11,
|
||||||
FakeIntr = 12<<11, AckIntr = 13<<11, SetIntrEnb = 14<<11,
|
RxDisable = 3<<11,
|
||||||
SetStatusEnb = 15<<11, SetRxFilter = 16<<11, SetRxThreshold = 17<<11,
|
RxEnable = 4<<11,
|
||||||
SetTxThreshold = 18<<11, SetTxStart = 19<<11, StatsEnable = 21<<11,
|
RxReset = 5<<11,
|
||||||
StatsDisable = 22<<11, StopCoax = 23<<11,
|
RxDiscard = 8<<11,
|
||||||
|
TxEnable = 9<<11,
|
||||||
|
TxDisable = 10<<11,
|
||||||
|
TxReset = 11<<11,
|
||||||
|
FakeIntr = 12<<11,
|
||||||
|
AckIntr = 13<<11,
|
||||||
|
SetIntrEnb = 14<<11,
|
||||||
|
SetStatusEnb = 15<<11,
|
||||||
|
SetRxFilter = 16<<11,
|
||||||
|
SetRxThreshold = 17<<11,
|
||||||
|
SetTxThreshold = 18<<11,
|
||||||
|
SetTxStart = 19<<11,
|
||||||
|
StatsEnable = 21<<11,
|
||||||
|
StatsDisable = 22<<11,
|
||||||
|
StopCoax = 23<<11
|
||||||
};
|
};
|
||||||
|
|
||||||
enum c509status {
|
enum c509status {
|
||||||
IntLatch = 0x0001, AdapterFailure = 0x0002, TxComplete = 0x0004,
|
IntLatch = 0x0001,
|
||||||
TxAvailable = 0x0008, RxComplete = 0x0010, RxEarly = 0x0020,
|
AdapterFailure = 0x0002,
|
||||||
IntReq = 0x0040, StatsFull = 0x0080, CmdBusy = 0x1000
|
TxComplete = 0x0004,
|
||||||
|
TxAvailable = 0x0008,
|
||||||
|
RxComplete = 0x0010,
|
||||||
|
RxEarly = 0x0020,
|
||||||
|
IntReq = 0x0040,
|
||||||
|
StatsFull = 0x0080,
|
||||||
|
CmdBusy = 0x1000
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The SetRxFilter command accepts the following classes: */
|
/* The SetRxFilter command accepts the following classes: */
|
||||||
enum RxFilter {
|
enum RxFilter {
|
||||||
RxStation = 1, RxMulticast = 2, RxBroadcast = 4, RxProm = 8
|
RxStation = 1,
|
||||||
|
RxMulticast = 2,
|
||||||
|
RxBroadcast = 4,
|
||||||
|
RxProm = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Register window 1 offsets, the window used in normal operation. */
|
/* Register window 1 offsets, the window used in normal operation. */
|
||||||
@ -324,11 +347,10 @@ static int tc589_config(struct pcmcia_device *link)
|
|||||||
|
|
||||||
strcpy(lp->node.dev_name, dev->name);
|
strcpy(lp->node.dev_name, dev->name);
|
||||||
|
|
||||||
printk(KERN_INFO "%s: 3Com 3c%s, io %#3lx, irq %d, "
|
netdev_info(dev, "3Com 3c%s, io %#3lx, irq %d, hw_addr %pM\n",
|
||||||
"hw_addr %pM\n",
|
(multi ? "562" : "589"), dev->base_addr, dev->irq,
|
||||||
dev->name, (multi ? "562" : "589"), dev->base_addr, dev->irq,
|
|
||||||
dev->dev_addr);
|
dev->dev_addr);
|
||||||
printk(KERN_INFO " %dK FIFO split %s Rx:Tx, %s xcvr\n",
|
netdev_info(dev, " %dK FIFO split %s Rx:Tx, %s xcvr\n",
|
||||||
(fifo & 7) ? 32 : 8, ram_split[(fifo >> 16) & 3],
|
(fifo & 7) ? 32 : 8, ram_split[(fifo >> 16) & 3],
|
||||||
if_names[dev->if_port]);
|
if_names[dev->if_port]);
|
||||||
return 0;
|
return 0;
|
||||||
@ -385,8 +407,7 @@ static void tc589_wait_for_completion(struct net_device *dev, int cmd)
|
|||||||
while (--i > 0)
|
while (--i > 0)
|
||||||
if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000)) break;
|
if (!(inw(dev->base_addr + EL3_STATUS) & 0x1000)) break;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
printk(KERN_WARNING "%s: command 0x%04x did not complete!\n",
|
netdev_warn(dev, "command 0x%04x did not complete!\n", cmd);
|
||||||
dev->name, cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -435,14 +456,13 @@ static void dump_status(struct net_device *dev)
|
|||||||
{
|
{
|
||||||
unsigned int ioaddr = dev->base_addr;
|
unsigned int ioaddr = dev->base_addr;
|
||||||
EL3WINDOW(1);
|
EL3WINDOW(1);
|
||||||
printk(KERN_INFO " irq status %04x, rx status %04x, tx status "
|
netdev_info(dev, " irq status %04x, rx status %04x, tx status %02x tx free %04x\n",
|
||||||
"%02x tx free %04x\n", inw(ioaddr+EL3_STATUS),
|
inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS),
|
||||||
inw(ioaddr+RX_STATUS), inb(ioaddr+TX_STATUS),
|
inb(ioaddr+TX_STATUS), inw(ioaddr+TX_FREE));
|
||||||
inw(ioaddr+TX_FREE));
|
|
||||||
EL3WINDOW(4);
|
EL3WINDOW(4);
|
||||||
printk(KERN_INFO " diagnostics: fifo %04x net %04x ethernet %04x"
|
netdev_info(dev, " diagnostics: fifo %04x net %04x ethernet %04x media %04x\n",
|
||||||
" media %04x\n", inw(ioaddr+0x04), inw(ioaddr+0x06),
|
inw(ioaddr+0x04), inw(ioaddr+0x06), inw(ioaddr+0x08),
|
||||||
inw(ioaddr+0x08), inw(ioaddr+0x0a));
|
inw(ioaddr+0x0a));
|
||||||
EL3WINDOW(1);
|
EL3WINDOW(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,8 +524,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map)
|
|||||||
if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) {
|
if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) {
|
||||||
if (map->port <= 3) {
|
if (map->port <= 3) {
|
||||||
dev->if_port = map->port;
|
dev->if_port = map->port;
|
||||||
printk(KERN_INFO "%s: switched to %s port\n",
|
netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]);
|
||||||
dev->name, if_names[dev->if_port]);
|
|
||||||
tc589_set_xcvr(dev, dev->if_port);
|
tc589_set_xcvr(dev, dev->if_port);
|
||||||
} else
|
} else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -541,7 +560,7 @@ static void el3_tx_timeout(struct net_device *dev)
|
|||||||
{
|
{
|
||||||
unsigned int ioaddr = dev->base_addr;
|
unsigned int ioaddr = dev->base_addr;
|
||||||
|
|
||||||
printk(KERN_WARNING "%s: Transmit timed out!\n", dev->name);
|
netdev_warn(dev, "Transmit timed out!\n");
|
||||||
dump_status(dev);
|
dump_status(dev);
|
||||||
dev->stats.tx_errors++;
|
dev->stats.tx_errors++;
|
||||||
dev->trans_start = jiffies;
|
dev->trans_start = jiffies;
|
||||||
@ -564,8 +583,7 @@ static void pop_tx_status(struct net_device *dev)
|
|||||||
if (tx_status & 0x30)
|
if (tx_status & 0x30)
|
||||||
tc589_wait_for_completion(dev, TxReset);
|
tc589_wait_for_completion(dev, TxReset);
|
||||||
if (tx_status & 0x38) {
|
if (tx_status & 0x38) {
|
||||||
pr_debug("%s: transmit error: status 0x%02x\n",
|
netdev_dbg(dev, "transmit error: status 0x%02x\n", tx_status);
|
||||||
dev->name, tx_status);
|
|
||||||
outw(TxEnable, ioaddr + EL3_CMD);
|
outw(TxEnable, ioaddr + EL3_CMD);
|
||||||
dev->stats.tx_aborted_errors++;
|
dev->stats.tx_aborted_errors++;
|
||||||
}
|
}
|
||||||
@ -580,9 +598,8 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb,
|
|||||||
struct el3_private *priv = netdev_priv(dev);
|
struct el3_private *priv = netdev_priv(dev);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
pr_debug("%s: el3_start_xmit(length = %ld) called, "
|
netdev_dbg(dev, "el3_start_xmit(length = %ld) called, status %4.4x.\n",
|
||||||
"status %4.4x.\n", dev->name, (long)skb->len,
|
(long)skb->len, inw(ioaddr + EL3_STATUS));
|
||||||
inw(ioaddr + EL3_STATUS));
|
|
||||||
|
|
||||||
spin_lock_irqsave(&priv->lock, flags);
|
spin_lock_irqsave(&priv->lock, flags);
|
||||||
|
|
||||||
@ -622,31 +639,26 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
|
|||||||
|
|
||||||
ioaddr = dev->base_addr;
|
ioaddr = dev->base_addr;
|
||||||
|
|
||||||
pr_debug("%s: interrupt, status %4.4x.\n",
|
netdev_dbg(dev, "interrupt, status %4.4x.\n", inw(ioaddr + EL3_STATUS));
|
||||||
dev->name, inw(ioaddr + EL3_STATUS));
|
|
||||||
|
|
||||||
spin_lock(&lp->lock);
|
spin_lock(&lp->lock);
|
||||||
while ((status = inw(ioaddr + EL3_STATUS)) &
|
while ((status = inw(ioaddr + EL3_STATUS)) &
|
||||||
(IntLatch | RxComplete | StatsFull)) {
|
(IntLatch | RxComplete | StatsFull)) {
|
||||||
if ((status & 0xe000) != 0x2000) {
|
if ((status & 0xe000) != 0x2000) {
|
||||||
pr_debug("%s: interrupt from dead card\n", dev->name);
|
netdev_dbg(dev, "interrupt from dead card\n");
|
||||||
handled = 0;
|
handled = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status & RxComplete)
|
if (status & RxComplete)
|
||||||
el3_rx(dev);
|
el3_rx(dev);
|
||||||
|
|
||||||
if (status & TxAvailable) {
|
if (status & TxAvailable) {
|
||||||
pr_debug(" TX room bit was handled.\n");
|
netdev_dbg(dev, " TX room bit was handled.\n");
|
||||||
/* There's room in the FIFO for a full-sized packet. */
|
/* There's room in the FIFO for a full-sized packet. */
|
||||||
outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
|
outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
|
||||||
netif_wake_queue(dev);
|
netif_wake_queue(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status & TxComplete)
|
if (status & TxComplete)
|
||||||
pop_tx_status(dev);
|
pop_tx_status(dev);
|
||||||
|
|
||||||
if (status & (AdapterFailure | RxEarly | StatsFull)) {
|
if (status & (AdapterFailure | RxEarly | StatsFull)) {
|
||||||
/* Handle all uncommon interrupts. */
|
/* Handle all uncommon interrupts. */
|
||||||
if (status & StatsFull) /* Empty statistics. */
|
if (status & StatsFull) /* Empty statistics. */
|
||||||
@ -660,8 +672,8 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
|
|||||||
EL3WINDOW(4);
|
EL3WINDOW(4);
|
||||||
fifo_diag = inw(ioaddr + 4);
|
fifo_diag = inw(ioaddr + 4);
|
||||||
EL3WINDOW(1);
|
EL3WINDOW(1);
|
||||||
printk(KERN_WARNING "%s: adapter failure, FIFO diagnostic"
|
netdev_warn(dev, "adapter failure, FIFO diagnostic register %04x.\n",
|
||||||
" register %04x.\n", dev->name, fifo_diag);
|
fifo_diag);
|
||||||
if (fifo_diag & 0x0400) {
|
if (fifo_diag & 0x0400) {
|
||||||
/* Tx overrun */
|
/* Tx overrun */
|
||||||
tc589_wait_for_completion(dev, TxReset);
|
tc589_wait_for_completion(dev, TxReset);
|
||||||
@ -676,10 +688,9 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
|
|||||||
outw(AckIntr | AdapterFailure, ioaddr + EL3_CMD);
|
outw(AckIntr | AdapterFailure, ioaddr + EL3_CMD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++i > 10) {
|
if (++i > 10) {
|
||||||
printk(KERN_ERR "%s: infinite loop in interrupt, "
|
netdev_err(dev, "infinite loop in interrupt, status %4.4x.\n",
|
||||||
"status %4.4x.\n", dev->name, status);
|
status);
|
||||||
/* Clear all interrupts */
|
/* Clear all interrupts */
|
||||||
outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
|
outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
|
||||||
break;
|
break;
|
||||||
@ -687,11 +698,10 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id)
|
|||||||
/* Acknowledge the IRQ. */
|
/* Acknowledge the IRQ. */
|
||||||
outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
|
outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
|
||||||
}
|
}
|
||||||
|
|
||||||
lp->last_irq = jiffies;
|
lp->last_irq = jiffies;
|
||||||
spin_unlock(&lp->lock);
|
spin_unlock(&lp->lock);
|
||||||
pr_debug("%s: exiting interrupt, status %4.4x.\n",
|
netdev_dbg(dev, "exiting interrupt, status %4.4x.\n",
|
||||||
dev->name, inw(ioaddr + EL3_STATUS));
|
inw(ioaddr + EL3_STATUS));
|
||||||
return IRQ_RETVAL(handled);
|
return IRQ_RETVAL(handled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -710,7 +720,7 @@ static void media_check(unsigned long arg)
|
|||||||
if ((inw(ioaddr + EL3_STATUS) & IntLatch) &&
|
if ((inw(ioaddr + EL3_STATUS) & IntLatch) &&
|
||||||
(inb(ioaddr + EL3_TIMER) == 0xff)) {
|
(inb(ioaddr + EL3_TIMER) == 0xff)) {
|
||||||
if (!lp->fast_poll)
|
if (!lp->fast_poll)
|
||||||
printk(KERN_WARNING "%s: interrupt(s) dropped!\n", dev->name);
|
netdev_warn(dev, "interrupt(s) dropped!\n");
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
el3_interrupt(dev->irq, dev);
|
el3_interrupt(dev->irq, dev);
|
||||||
@ -747,25 +757,23 @@ static void media_check(unsigned long arg)
|
|||||||
if (media != lp->media_status) {
|
if (media != lp->media_status) {
|
||||||
if ((media & lp->media_status & 0x8000) &&
|
if ((media & lp->media_status & 0x8000) &&
|
||||||
((lp->media_status ^ media) & 0x0800))
|
((lp->media_status ^ media) & 0x0800))
|
||||||
printk(KERN_INFO "%s: %s link beat\n", dev->name,
|
netdev_info(dev, "%s link beat\n",
|
||||||
(lp->media_status & 0x0800 ? "lost" : "found"));
|
(lp->media_status & 0x0800 ? "lost" : "found"));
|
||||||
else if ((media & lp->media_status & 0x4000) &&
|
else if ((media & lp->media_status & 0x4000) &&
|
||||||
((lp->media_status ^ media) & 0x0010))
|
((lp->media_status ^ media) & 0x0010))
|
||||||
printk(KERN_INFO "%s: coax cable %s\n", dev->name,
|
netdev_info(dev, "coax cable %s\n",
|
||||||
(lp->media_status & 0x0010 ? "ok" : "problem"));
|
(lp->media_status & 0x0010 ? "ok" : "problem"));
|
||||||
if (dev->if_port == 0) {
|
if (dev->if_port == 0) {
|
||||||
if (media & 0x8000) {
|
if (media & 0x8000) {
|
||||||
if (media & 0x0800)
|
if (media & 0x0800)
|
||||||
printk(KERN_INFO "%s: flipped to 10baseT\n",
|
netdev_info(dev, "flipped to 10baseT\n");
|
||||||
dev->name);
|
|
||||||
else
|
else
|
||||||
tc589_set_xcvr(dev, 2);
|
tc589_set_xcvr(dev, 2);
|
||||||
} else if (media & 0x4000) {
|
} else if (media & 0x4000) {
|
||||||
if (media & 0x0010)
|
if (media & 0x0010)
|
||||||
tc589_set_xcvr(dev, 1);
|
tc589_set_xcvr(dev, 1);
|
||||||
else
|
else
|
||||||
printk(KERN_INFO "%s: flipped to 10base2\n",
|
netdev_info(dev, "flipped to 10base2\n");
|
||||||
dev->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lp->media_status = media;
|
lp->media_status = media;
|
||||||
@ -805,7 +813,7 @@ static void update_stats(struct net_device *dev)
|
|||||||
{
|
{
|
||||||
unsigned int ioaddr = dev->base_addr;
|
unsigned int ioaddr = dev->base_addr;
|
||||||
|
|
||||||
pr_debug("%s: updating the statistics.\n", dev->name);
|
netdev_dbg(dev, "updating the statistics.\n");
|
||||||
/* Turn off statistics updates while reading. */
|
/* Turn off statistics updates while reading. */
|
||||||
outw(StatsDisable, ioaddr + EL3_CMD);
|
outw(StatsDisable, ioaddr + EL3_CMD);
|
||||||
/* Switch to the stats window, and read everything. */
|
/* Switch to the stats window, and read everything. */
|
||||||
@ -833,8 +841,8 @@ static int el3_rx(struct net_device *dev)
|
|||||||
int worklimit = 32;
|
int worklimit = 32;
|
||||||
short rx_status;
|
short rx_status;
|
||||||
|
|
||||||
pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
|
netdev_dbg(dev, "in rx_packet(), status %4.4x, rx_status %4.4x.\n",
|
||||||
dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
|
inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
|
||||||
while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
|
while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
|
||||||
worklimit > 0) {
|
worklimit > 0) {
|
||||||
worklimit--;
|
worklimit--;
|
||||||
@ -855,7 +863,7 @@ static int el3_rx(struct net_device *dev)
|
|||||||
|
|
||||||
skb = dev_alloc_skb(pkt_len+5);
|
skb = dev_alloc_skb(pkt_len+5);
|
||||||
|
|
||||||
pr_debug(" Receiving packet size %d status %4.4x.\n",
|
netdev_dbg(dev, " Receiving packet size %d status %4.4x.\n",
|
||||||
pkt_len, rx_status);
|
pkt_len, rx_status);
|
||||||
if (skb != NULL) {
|
if (skb != NULL) {
|
||||||
skb_reserve(skb, 2);
|
skb_reserve(skb, 2);
|
||||||
@ -866,8 +874,8 @@ static int el3_rx(struct net_device *dev)
|
|||||||
dev->stats.rx_packets++;
|
dev->stats.rx_packets++;
|
||||||
dev->stats.rx_bytes += pkt_len;
|
dev->stats.rx_bytes += pkt_len;
|
||||||
} else {
|
} else {
|
||||||
pr_debug("%s: couldn't allocate a sk_buff of"
|
netdev_dbg(dev, "couldn't allocate a sk_buff of size %d.\n",
|
||||||
" size %d.\n", dev->name, pkt_len);
|
pkt_len);
|
||||||
dev->stats.rx_dropped++;
|
dev->stats.rx_dropped++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -875,7 +883,7 @@ static int el3_rx(struct net_device *dev)
|
|||||||
tc589_wait_for_completion(dev, RxDiscard);
|
tc589_wait_for_completion(dev, RxDiscard);
|
||||||
}
|
}
|
||||||
if (worklimit == 0)
|
if (worklimit == 0)
|
||||||
printk(KERN_WARNING "%s: too much work in el3_rx!\n", dev->name);
|
netdev_warn(dev, "too much work in el3_rx!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user