// SPDX-License-Identifier: GPL-2.0-only /* * Support for ColdFire CPU based boards using a NS8390 Ethernet device. * * Derived from the many other 8390 drivers. * * (C) Copyright 2012, Greg Ungerer <gerg@uclinux.org> *
*/
#define NESM_START_PG 0x40 /* First page of TX buffer */ #define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */
#ifdef NE2000_ODDOFFSET /* * A lot of the ColdFire boards use a separate address region for odd offset * register addresses. The following functions convert and map as required. * Note that the data port accesses are treated a little differently, and * always accessed via the insX/outsX functions.
*/ staticinline u32 NE_PTR(u32 addr)
{ if (addr & 1) return addr - 1 + NE2000_ODDOFFSET; return addr;
}
/* * 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 mcf8390_reset_8390(struct net_device *dev)
{ unsignedlong reset_start_time = jiffies;
u32 addr = dev->base_addr; struct ei_device *ei_local = netdev_priv(dev);
netif_dbg(ei_local, hw, dev, "resetting the 8390 t=%ld...\n", jiffies);
/* This check _should_not_ be necessary, omit eventually. */ while ((ei_inb(addr + 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;
}
}
ei_outb(ENISR_RESET, addr + NE_EN0_ISR);
}
/* * This *shouldn't* happen. * If it does, it's the last thing you'll see
*/ staticvoid mcf8390_dmaing_err(constchar *func, struct net_device *dev, struct ei_device *ei_local)
{
netdev_err(dev, "%s: DMAing conflict [DMAstat:%d][irqlock:%d]\n",
func, ei_local->dmaing, ei_local->irqlock);
}
/* * 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 mcf8390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
{ struct ei_device *ei_local = netdev_priv(dev);
u32 addr = dev->base_addr;
if (ei_local->dmaing) {
mcf8390_dmaing_err(__func__, dev, ei_local); 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 mcf8390_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
{ struct ei_device *ei_local = netdev_priv(dev);
u32 addr = dev->base_addr; char *buf = skb->data;
if (ei_local->dmaing) {
mcf8390_dmaing_err(__func__, dev, ei_local); return;
}
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.