// SPDX-License-Identifier: GPL-2.0-only /* * Amiga Linux/m68k and Linux/PPC Zorro NS8390 Ethernet Driver * * (C) Copyright 1998-2000 by some Elitist 680x0 Users(TM) * * --------------------------------------------------------------------------- * * This program is based on all the other NE2000 drivers for Linux * * --------------------------------------------------------------------------- * * The Ariadne II and X-Surf are Zorro-II boards containing Realtek RTL8019AS * Ethernet Controllers.
*/
/* Hard reset the card. This used to pause for the same period that a * 8390 reset command required, but that shouldn't be necessary.
*/ staticvoid zorro8390_reset_8390(struct net_device *dev)
{ unsignedlong reset_start_time = jiffies; struct ei_device *ei_local = netdev_priv(dev);
/* This check _should_not_ be necessary, omit eventually. */ while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RESET) == 0) if (time_after(jiffies, reset_start_time + 2 * HZ / 100)) {
netdev_warn(dev, "%s: did not complete\n", __func__); break;
}
z_writeb(ENISR_RESET, NE_BASE + NE_EN0_ISR); /* Ack intr */
}
/* Grab the 8390 specific header. Similar to the block_input routine, but * we don't need to be concerned with ring wrap as the header will be at * the start of a page, so we optimize accordingly.
*/ staticvoid zorro8390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{ int nic_base = dev->base_addr; int cnt; short *ptrs;
/* This *shouldn't* happen. * If it does, it's the last thing you'll see
*/ if (ei_status.dmaing) {
netdev_warn(dev, "%s: DMAing conflict [DMAstat:%d][irqlock:%d]\n",
__func__, ei_status.dmaing, ei_status.irqlock); return;
}
/* Block input and output, similar to the Crynwr packet driver. * If you are porting to a new ethercard, look at the packet driver source * for hints. The NEx000 doesn't share the on-board packet memory -- * you have to put the packet out through the "remote DMA" dataport * using z_writeb.
*/ staticvoid zorro8390_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
{ int nic_base = dev->base_addr; char *buf = skb->data; short *ptrs; int cnt;
staticvoid zorro8390_block_output(struct net_device *dev, int count, constunsignedchar *buf, constint start_page)
{ int nic_base = NE_BASE; unsignedlong dma_start; short *ptrs; int cnt;
/* Round the count up for word writes. Do we need to do this? * What effect will an odd byte count have on the 8390? * I should check someday.
*/ if (count & 0x01)
count++;
/* This *shouldn't* happen. * If it does, it's the last thing you'll see
*/ if (ei_status.dmaing) {
netdev_err(dev, "%s: DMAing conflict [DMAstat:%d][irqlock:%d]\n",
__func__, ei_status.dmaing, ei_status.irqlock); return;
}
ei_status.dmaing |= 0x01; /* We should already be in page 0, but to be safe... */
z_writeb(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base + NE_CMD);
z_writeb(ENISR_RDC, nic_base + NE_EN0_ISR);
/* Now the normal output. */
z_writeb(count & 0xff, nic_base + NE_EN0_RCNTLO);
z_writeb(count >> 8, nic_base + NE_EN0_RCNTHI);
z_writeb(0x00, nic_base + NE_EN0_RSARLO);
z_writeb(start_page, nic_base + NE_EN0_RSARHI);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.