patch-2.3.46 linux/drivers/net/pcmcia/3c574_cs.c
Next file: linux/drivers/net/pcmcia/3c589_cs.c
Previous file: linux/drivers/net/ltpc.c
Back to the patch index
Back to the overall index
- Lines: 292
- Date:
Tue Feb 15 08:53:46 2000
- Orig file:
v2.3.45/linux/drivers/net/pcmcia/3c574_cs.c
- Orig date:
Sun Feb 13 19:29:04 2000
diff -u --recursive --new-file v2.3.45/linux/drivers/net/pcmcia/3c574_cs.c linux/drivers/net/pcmcia/3c574_cs.c
@@ -105,11 +105,6 @@
MODULE_PARM(irq_list, "1-4i");
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(full_duplex, "i");
-#ifdef BROKEN_FEATURES
-MODULE_PARM(use_fifo_buffer, "i");
-MODULE_PARM(use_memory_ops, "i");
-MODULE_PARM(no_wait, "i");
-#endif
/* Now-standard PC card module parameters. */
static u_int irq_mask = 0xdeb8; /* IRQ3,4,5,7,9,10,11,12,14,15 */
@@ -124,16 +119,6 @@
/* Force full duplex modes? */
static int full_duplex = 0;
-#ifdef BROKEN_FEATURES
-/* Performance features: best left disabled. */
-/* Set to buffer all Tx/RxFIFO accesses. */
-static int use_fifo_buffer = 0;
-/* Set iff memory ops are faster than I/O ops. */
-static int use_memory_ops = 0;
-/* Set iff disabling the WAIT signal is reliable and faster. */
-static int no_wait = 0;
-#endif
-
/* To minimize the size of the driver source and make the driver more
readable not all constants are symbolically defined.
You'll need the manual if you want to understand driver details anyway. */
@@ -484,27 +469,6 @@
CS_CHECK(RequestIRQ, link->handle, &link->irq);
CS_CHECK(RequestConfiguration, link->handle, &link->conf);
- dev->mem_start = 0;
-#ifdef BROKEN_FEATURES
- if (use_memory_ops) {
- win_req_t req;
- memreq_t mem;
- req.Attributes = WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM |
- WIN_ENABLE | WIN_USE_WAIT;
- req.Base = 0;
- req.Size = 0x1000;
- req.AccessSpeed = 0;
- link->win = (window_handle_t)link->handle;
- i = CardServices(RequestWindow, &link->win, &req);
- if (i == CS_SUCCESS) {
- mem.Page = mem.CardOffset = 0;
- CardServices(MapMemPage, link->win, &mem);
- dev->mem_start = (long)(ioremap(req.Base, 0x1000)) + 0x800;
- } else
- cs_error(link->handle, RequestWindow, i);
- }
-#endif
-
dev->irq = link->irq.AssignedIRQ;
dev->base_addr = link->io.BasePort1;
@@ -551,10 +515,6 @@
for (i = 0; i < 6; i++)
printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : ".\n"));
- if (dev->mem_start)
- printk(KERN_INFO" Acceleration window at memory base %#lx.\n",
- dev->mem_start);
-
{
u_char mcr, *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
union wn3_config config;
@@ -629,8 +589,6 @@
static void tc574_release(u_long arg)
{
dev_link_t *link = (dev_link_t *)arg;
- struct el3_private *lp = link->priv;
- struct net_device *dev = &lp->dev;
DEBUG(0, "3c574_release(0x%p)\n", link);
@@ -644,10 +602,6 @@
CardServices(ReleaseConfiguration, link->handle);
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
- if (link->win) {
- iounmap((void *)(dev->mem_start - 0x800));
- CardServices(ReleaseWindow, link->win);
- }
link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING);
@@ -674,6 +628,7 @@
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) {
netif_stop_queue (dev);
+ clear_bit(LINK_STATE_START, &dev->state);
link->release.expires = jiffies + HZ/20;
add_timer(&link->release);
}
@@ -689,6 +644,7 @@
if (link->state & DEV_CONFIG) {
if (link->open) {
netif_stop_queue (dev);
+ clear_bit(LINK_STATE_START, &dev->state);
}
CardServices(ReleaseConfiguration, link->handle);
}
@@ -701,6 +657,7 @@
CardServices(RequestConfiguration, link->handle, &link->conf);
if (link->open) {
tc574_reset(dev);
+ set_bit(LINK_STATE_START, &dev->state);
netif_start_queue (dev);
}
}
@@ -837,19 +794,6 @@
wait_for_completion(dev, TotalReset|0x10);
-#ifdef BROKEN_FEATURES
- /* Set the PIO ctrl bits in the PC card LAN COR using Runner window 1. */
- if (dev->mem_start || no_wait) {
- u8 lan_cor;
- outw(1<<11, ioaddr + RunnerRdCtrl);
- lan_cor = inw(ioaddr) & ~0x30;
- if (dev->mem_start) /* Iff use_memory_ops worked! */
- lan_cor |= 0x10;
- if (no_wait)
- lan_cor |= 0x20;
- outw(lan_cor, ioaddr);
- }
-#endif
/* Clear any transactions in progress. */
outw(0, ioaddr + RunnerWrCtrl);
outw(0, ioaddr + RunnerRdCtrl);
@@ -883,10 +827,10 @@
inb(ioaddr + i);
inw(ioaddr + 10);
inw(ioaddr + 12);
-
EL3WINDOW(4);
- /* New: On the Vortex/Odie we must also clear the BadSSD counter.. */
inb(ioaddr + 12);
+ inb(ioaddr + 13);
+
/* .. enable any extra statistics bits.. */
outw(0x0040, ioaddr + Wn4_NetDiag);
/* .. re-sync MII and re-fill what NWay is advertising. */
@@ -974,9 +918,6 @@
static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
ioaddr_t ioaddr = dev->base_addr;
-#ifdef BROKEN_FEATURES
- long flags = 0;
-#endif
DEBUG(3, "%s: el3_start_xmit(length = %ld) called, "
"status %4.4x.\n", dev->name, (long)skb->len,
@@ -984,38 +925,9 @@
netif_stop_queue (dev);
-#ifdef BROKEN_FEATURES
- if (use_fifo_buffer) {
- /* Avoid other accesses to the chip while RunnerWrCtrl is non-zero. */
- spin_lock_irqsave(&lp->lock, flags);
- outw((((skb->len + 7)>>2)<<1), ioaddr + RunnerWrCtrl);
- DEBUG(0, "TxFree %x, tx length %x, RunnerWrCtrl is %4.4x.\n",
- inw(ioaddr+TxFree), skb->len, inw(ioaddr+RunnerWrCtrl));
- }
-
- /* Put out the doubleword header... */
- /* ... and the packet rounded to a doubleword. */
- if (dev->mem_start) {
- writew(skb->len, (void *)dev->mem_start);
- writew(0, (void *)dev->mem_start);
- copy_to_pc((void*)dev->mem_start, skb->data, (skb->len+3)&~3);
- } else {
- outw(skb->len, ioaddr + TX_FIFO);
- outw(0, ioaddr + TX_FIFO);
- outsl(ioaddr + TX_FIFO, skb->data, (skb->len+3)>>2);
- }
-
- if (use_fifo_buffer) {
- DEBUG(0, " RunnerWr/RdCtrl is %4.4x/%4.4x, TxFree %x.\n",
- inw(ioaddr + RunnerWrCtrl), inw(ioaddr + RunnerRdCtrl),
- inw(ioaddr + TxFree));
- spin_unlock_irqrestore (&lp->lock, flags);
- }
-#else
outw(skb->len, ioaddr + TX_FIFO);
outw(0, ioaddr + TX_FIFO);
outsl(ioaddr + TX_FIFO, skb->data, (skb->len+3)>>2);
-#endif
dev->trans_start = jiffies;
@@ -1041,27 +953,24 @@
ioaddr_t ioaddr, status;
int work_budget = max_interrupt_work;
- if (lp == NULL)
+ if (!test_bit(LINK_STATE_START, &dev->state))
return;
spin_lock (&lp->lock);
ioaddr = dev->base_addr;
-#ifdef PCMCIA_DEBUG
DEBUG(3, "%s: interrupt, status %4.4x.\n",
dev->name, inw(ioaddr + EL3_STATUS));
-#endif
while ((status = inw(ioaddr + EL3_STATUS)) &
(IntLatch | RxComplete | RxEarly | StatsFull)) {
-#if 0
- if ((dev->start == 0) || ((status & 0xe000) != 0x2000)) {
+ if (!test_bit(LINK_STATE_START, &dev->state) ||
+ ((status & 0xe000) != 0x2000)) {
DEBUG(1, "%s: Interrupt from dead card\n", dev->name);
break;
}
-#endif
if (status & RxComplete)
work_budget = el3_rx(dev, work_budget);
@@ -1119,10 +1028,8 @@
outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
}
-#ifdef PCMCIA_DEBUG
DEBUG(3, "%s: exiting interrupt, status %4.4x.\n",
dev->name, inw(ioaddr + EL3_STATUS));
-#endif
spin_unlock (&lp->lock);
}
@@ -1140,9 +1047,8 @@
u_long flags;
u_short /* cable, */ media, partner;
-#if 0
- if (dev->start == 0) goto reschedule;
-#endif
+ if (!test_bit(LINK_STATE_START, &dev->state))
+ goto reschedule;
/* Check for pending interrupt with expired latency timer: with
this, we can limp along even if the interrupt is blocked */
@@ -1253,6 +1159,12 @@
EL3WINDOW(4);
inb(ioaddr + 12);
+ {
+ u8 up = inb(ioaddr + 13);
+ lp->stats.rx_bytes += (up & 0x0f) << 16;
+ lp->stats.tx_bytes += (up & 0xf0) << 12;
+ }
+
EL3WINDOW(1);
}
@@ -1289,30 +1201,8 @@
skb->dev = dev;
skb_reserve(skb, 2);
-#ifdef BROKEN_FEATURES
- if (use_fifo_buffer) {
- outw(((pkt_len+3)>>2)<<1, ioaddr + RunnerRdCtrl);
- DEBUG(0,"Start Rx %x -- RunnerRdCtrl is %4.4x.\n",
- pkt_len, inw(ioaddr + RunnerRdCtrl));
- }
- if (dev->mem_start) {
- copy_from_pc(skb_put(skb, pkt_len),
- (void*)dev->mem_start, (pkt_len+3)&~3);
- } else {
- insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len),
- ((pkt_len+3)>>2));
- }
- if (use_fifo_buffer) {
- DEBUG(0," RunnerRdCtrl is now %4.4x.\n",
- inw(ioaddr + RunnerRdCtrl));
- outw(0, ioaddr + RunnerRdCtrl);
- DEBUG(0, " Rx packet with data %2.2x:%2.2x:%2.2x\n",
- skb->head[0], skb->head[1], skb->head[2]);
- }
-#else
insl(ioaddr+RX_FIFO, skb_put(skb, pkt_len),
((pkt_len+3)>>2));
-#endif
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen (who was at: [email protected])