22 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24 #include <linux/module.h>
25 #include <linux/kernel.h>
26 #include <linux/errno.h>
29 #include <linux/netdevice.h>
38 #define EI_SHIFT(x) (ei_local->reg_offset[x])
39 #define ei_inb(port) in_8(port)
40 #define ei_outb(val, port) out_8(port, val)
41 #define ei_inb_p(port) in_8(port)
42 #define ei_outb_p(val, port) out_8(port, val)
49 #define DRV_NAME "zorro8390"
51 #define NE_BASE (dev->base_addr)
52 #define NE_CMD (0x00 * 2)
53 #define NE_DATAPORT (0x10 * 2)
54 #define NE_RESET (0x1f * 2)
56 #define NE_IO_EXTENT (0x20 * 2)
58 #define NE_EN0_ISR (0x07 * 2)
59 #define NE_EN0_DCFG (0x0e * 2)
61 #define NE_EN0_RSARLO (0x08 * 2)
62 #define NE_EN0_RSARHI (0x09 * 2)
63 #define NE_EN0_RCNTLO (0x0a * 2)
64 #define NE_EN0_RXCR (0x0c * 2)
65 #define NE_EN0_TXCR (0x0d * 2)
66 #define NE_EN0_RCNTHI (0x0b * 2)
67 #define NE_EN0_IMR (0x0f * 2)
69 #define NESM_START_PG 0x40
70 #define NESM_STOP_PG 0x80
72 #define WORDSWAP(a) ((((a) >> 8) & 0xff) | ((a) << 8))
88 unsigned long reset_start_time =
jiffies;
91 netdev_dbg(dev,
"resetting - t=%ld...\n", jiffies);
100 if (
time_after(jiffies, reset_start_time + 2 *
HZ / 100)) {
101 netdev_warn(dev,
"%s: did not complete\n", __func__);
111 static void zorro8390_get_8390_hdr(
struct net_device *dev,
122 netdev_err(dev,
"%s: DMAing conflict [DMAstat:%d][irqlock:%d]\n",
137 for (cnt = 0; cnt < sizeof(struct e8390_pkt_hdr) >> 1; cnt++)
165 netdev_err(dev,
"%s: DMAing conflict [DMAstat:%d][irqlock:%d]\n",
178 for (cnt = 0; cnt < count >> 1; cnt++)
187 static void zorro8390_block_output(
struct net_device *dev,
int count,
188 const unsigned char *buf,
189 const int start_page)
207 netdev_err(dev,
"%s: DMAing conflict [DMAstat:%d][irqlock:%d]\n",
225 for (cnt = 0; cnt < count >> 1; cnt++)
233 netdev_err(dev,
"timeout waiting for Tx RDC\n");
234 zorro8390_reset_8390(dev);
243 static int zorro8390_open(
struct net_device *dev)
249 static int zorro8390_close(
struct net_device *dev)
257 static void __devexit zorro8390_remove_one(
struct zorro_dev *z)
259 struct net_device *dev = zorro_get_drvdata(z);
275 .ndo_open = zorro8390_open,
276 .ndo_stop = zorro8390_close,
284 #ifdef CONFIG_NET_POLL_CONTROLLER
291 unsigned long ioaddr)
295 unsigned char SA_prom[32];
296 int start_page, stop_page;
297 static u32 zorro8390_offsets[16] = {
298 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
299 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
304 unsigned long reset_start_time =
jiffies;
310 reset_start_time + 2 *
HZ / 100)) {
311 netdev_warn(dev,
"not found (no reset ack)\n");
325 static const struct {
346 ioaddr + program_seq[i].
offset);
348 for (i = 0; i < 16; i++) {
379 ei_status.reset_8390 = zorro8390_reset_8390;
380 ei_status.block_input = zorro8390_block_input;
381 ei_status.block_output = zorro8390_block_output;
382 ei_status.get_8390_hdr = zorro8390_get_8390_hdr;
383 ei_status.reg_offset = zorro8390_offsets;
393 netdev_info(dev,
"%s at 0x%08lx, Ethernet Address %pM\n",
399 static int __devinit zorro8390_init_one(
struct zorro_dev *z,
403 unsigned long board, ioaddr;
407 if (z->id == cards[i].id)
412 board = z->resource.start;
413 ioaddr = board +
cards[
i].offset;
421 err = zorro8390_init(dev, board, cards[i].name,
ZTWO_VADDR(ioaddr));
427 zorro_set_drvdata(z, dev);
431 static struct zorro_driver zorro8390_driver = {
433 .id_table = zorro8390_zorro_tbl,
434 .probe = zorro8390_init_one,
438 static int __init zorro8390_init_module(
void)
443 static void __exit zorro8390_cleanup_module(
void)