blob: 4e56aaf2b9843cb633a10cf93c0a4242b270ce8f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Linux ARCnet driver - COM90xx chipset (IO-mapped buffers)
Joe Perchescb334642015-05-05 10:05:47 -07003 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * Written 1997 by David Woodhouse.
5 * Written 1994-1999 by Avery Pennarun.
6 * Written 1999-2000 by Martin Mares <mj@ucw.cz>.
7 * Derived from skeleton.c by Donald Becker.
8 *
9 * Special thanks to Contemporary Controls, Inc. (www.ccontrols.com)
10 * for sponsoring the further development of this driver.
11 *
12 * **********************
13 *
14 * The original copyright of skeleton.c was as follows:
15 *
16 * skeleton.c Written 1993 by Donald Becker.
17 * Copyright 1993 United States Government as represented by the
18 * Director, National Security Agency. This software may only be used
19 * and distributed according to the terms of the GNU General Public License as
20 * modified by SRC, incorporated herein by reference.
21 *
22 * **********************
23 *
24 * For more details, see drivers/net/arcnet.c
25 *
26 * **********************
27 */
Joe Perches05a24b22015-05-05 10:05:56 -070028
29#define pr_fmt(fmt) "arcnet:" KBUILD_MODNAME ": " fmt
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/kernel.h>
32#include <linux/module.h>
33#include <linux/moduleparam.h>
34#include <linux/ioport.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include <linux/delay.h>
36#include <linux/netdevice.h>
37#include <linux/bootmem.h>
38#include <linux/init.h>
Alexey Dobriyana6b7a402011-06-06 10:43:46 +000039#include <linux/interrupt.h>
Joe Perches5e7ef912015-05-05 10:05:51 -070040#include <linux/io.h>
Joe Perches26c6d282015-05-05 10:06:03 -070041
42#include "arcdevice.h"
Joe Perches8e0f2952015-05-05 10:06:13 -070043#include "com9026.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Linus Torvalds1da177e2005-04-16 15:20:36 -070045/* Internal function declarations */
46
47static int com90io_found(struct net_device *dev);
48static void com90io_command(struct net_device *dev, int command);
49static int com90io_status(struct net_device *dev);
50static void com90io_setmask(struct net_device *dev, int mask);
51static int com90io_reset(struct net_device *dev, int really_reset);
52static void com90io_copy_to_card(struct net_device *dev, int bufnum, int offset,
53 void *buf, int count);
Joe Perchesd6d7d3e2015-05-05 10:06:02 -070054static void com90io_copy_from_card(struct net_device *dev, int bufnum,
55 int offset, void *buf, int count);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Linus Torvalds1da177e2005-04-16 15:20:36 -070057/* Handy defines for ARCnet specific stuff */
58
59/* The number of low I/O ports used by the card. */
60#define ARCNET_TOTAL_SIZE 16
61
Linus Torvalds1da177e2005-04-16 15:20:36 -070062/****************************************************************************
63 * *
64 * IO-mapped operation routines *
65 * *
66 ****************************************************************************/
67
68#undef ONE_AT_A_TIME_TX
69#undef ONE_AT_A_TIME_RX
70
71static u_char get_buffer_byte(struct net_device *dev, unsigned offset)
72{
73 int ioaddr = dev->base_addr;
74
Joe Perchesf0b9c272015-05-05 10:06:07 -070075 arcnet_outb(offset >> 8, ioaddr, COM9026_REG_W_ADDR_HI);
76 arcnet_outb(offset & 0xff, ioaddr, COM9026_REG_W_ADDR_LO);
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Joe Perchesf0b9c272015-05-05 10:06:07 -070078 return arcnet_inb(ioaddr, COM9026_REG_RW_MEMDATA);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079}
80
81#ifdef ONE_AT_A_TIME_TX
Joe Perchesd6d7d3e2015-05-05 10:06:02 -070082static void put_buffer_byte(struct net_device *dev, unsigned offset,
83 u_char datum)
Linus Torvalds1da177e2005-04-16 15:20:36 -070084{
85 int ioaddr = dev->base_addr;
86
Joe Perchesf0b9c272015-05-05 10:06:07 -070087 arcnet_outb(offset >> 8, ioaddr, COM9026_REG_W_ADDR_HI);
88 arcnet_outb(offset & 0xff, ioaddr, COM9026_REG_W_ADDR_LO);
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
Joe Perchesf0b9c272015-05-05 10:06:07 -070090 arcnet_outb(datum, ioaddr, COM9026_REG_RW_MEMDATA);
Linus Torvalds1da177e2005-04-16 15:20:36 -070091}
92
93#endif
94
Joe Perchesd6d7d3e2015-05-05 10:06:02 -070095static void get_whole_buffer(struct net_device *dev, unsigned offset,
96 unsigned length, char *dest)
Linus Torvalds1da177e2005-04-16 15:20:36 -070097{
98 int ioaddr = dev->base_addr;
99
Joe Perchesf0b9c272015-05-05 10:06:07 -0700100 arcnet_outb((offset >> 8) | AUTOINCflag, ioaddr, COM9026_REG_W_ADDR_HI);
101 arcnet_outb(offset & 0xff, ioaddr, COM9026_REG_W_ADDR_LO);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102
103 while (length--)
104#ifdef ONE_AT_A_TIME_RX
105 *(dest++) = get_buffer_byte(dev, offset++);
106#else
Joe Perchesf0b9c272015-05-05 10:06:07 -0700107 *(dest++) = arcnet_inb(ioaddr, COM9026_REG_RW_MEMDATA);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108#endif
109}
110
Joe Perchesd6d7d3e2015-05-05 10:06:02 -0700111static void put_whole_buffer(struct net_device *dev, unsigned offset,
112 unsigned length, char *dest)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113{
114 int ioaddr = dev->base_addr;
115
Joe Perchesf0b9c272015-05-05 10:06:07 -0700116 arcnet_outb((offset >> 8) | AUTOINCflag, ioaddr, COM9026_REG_W_ADDR_HI);
117 arcnet_outb(offset & 0xff, ioaddr,COM9026_REG_W_ADDR_LO);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
119 while (length--)
120#ifdef ONE_AT_A_TIME_TX
121 put_buffer_byte(dev, offset++, *(dest++));
122#else
Joe Perchesf0b9c272015-05-05 10:06:07 -0700123 arcnet_outb(*(dest++), ioaddr, COM9026_REG_RW_MEMDATA);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124#endif
125}
126
Joe Perchesf2f0a162015-05-05 10:05:52 -0700127/* We cannot probe for an IO mapped card either, although we can check that
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128 * it's where we were told it was, and even autoirq
129 */
130static int __init com90io_probe(struct net_device *dev)
131{
132 int ioaddr = dev->base_addr, status;
133 unsigned long airqmask;
134
Joe Perches72aeea42015-05-05 10:05:54 -0700135 if (BUGLVL(D_NORMAL)) {
Joe Perches05a24b22015-05-05 10:05:56 -0700136 pr_info("%s\n", "COM90xx IO-mapped mode support (by David Woodhouse et el.)");
137 pr_info("E-mail me if you actually test this driver, please!\n");
Joe Perches72aeea42015-05-05 10:05:54 -0700138 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139
140 if (!ioaddr) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700141 arc_printk(D_NORMAL, dev, "No autoprobe for IO mapped cards; you must specify the base address!\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 return -ENODEV;
143 }
144 if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "com90io probe")) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700145 arc_printk(D_INIT_REASONS, dev, "IO request_region %x-%x failed\n",
146 ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 return -ENXIO;
148 }
Joe Perchesf0b9c272015-05-05 10:06:07 -0700149 if (arcnet_inb(ioaddr, COM9026_REG_R_STATUS) == 0xFF) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700150 arc_printk(D_INIT_REASONS, dev, "IO address %x empty\n",
151 ioaddr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 goto err_out;
153 }
Joe Perchesf0b9c272015-05-05 10:06:07 -0700154 arcnet_inb(ioaddr, COM9026_REG_R_RESET);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 mdelay(RESETtime);
156
Joe Perchesf0b9c272015-05-05 10:06:07 -0700157 status = arcnet_inb(ioaddr, COM9026_REG_R_STATUS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158
159 if ((status & 0x9D) != (NORXflag | RECONflag | TXFREEflag | RESETflag)) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700160 arc_printk(D_INIT_REASONS, dev, "Status invalid (%Xh)\n",
161 status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 goto err_out;
163 }
Joe Perchesa34c0932015-05-05 10:05:55 -0700164 arc_printk(D_INIT_REASONS, dev, "Status after reset: %X\n", status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165
Joe Perchesf0b9c272015-05-05 10:06:07 -0700166 arcnet_outb(CFLAGScmd | RESETclear | CONFIGclear,
167 ioaddr, COM9026_REG_W_COMMAND);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168
Joe Perchesa34c0932015-05-05 10:05:55 -0700169 arc_printk(D_INIT_REASONS, dev, "Status after reset acknowledged: %X\n",
170 status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171
Joe Perchesf0b9c272015-05-05 10:06:07 -0700172 status = arcnet_inb(ioaddr, COM9026_REG_R_STATUS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173
174 if (status & RESETflag) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700175 arc_printk(D_INIT_REASONS, dev, "Eternal reset (status=%Xh)\n",
176 status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 goto err_out;
178 }
Joe Perchesf0b9c272015-05-05 10:06:07 -0700179 arcnet_outb((0x16 | IOMAPflag) & ~ENABLE16flag,
180 ioaddr, COM9026_REG_RW_CONFIG);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181
182 /* Read first loc'n of memory */
183
Joe Perchesf0b9c272015-05-05 10:06:07 -0700184 arcnet_outb(AUTOINCflag, ioaddr, COM9026_REG_W_ADDR_HI);
185 arcnet_outb(0, ioaddr, COM9026_REG_W_ADDR_LO);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186
Joe Perchesf0b9c272015-05-05 10:06:07 -0700187 status = arcnet_inb(ioaddr, COM9026_REG_RW_MEMDATA);
Joe Perches97464ed2015-05-05 10:05:59 -0700188 if (status != 0xd1) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700189 arc_printk(D_INIT_REASONS, dev, "Signature byte not found (%Xh instead).\n",
190 status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 goto err_out;
192 }
193 if (!dev->irq) {
Joe Perchesf2f0a162015-05-05 10:05:52 -0700194 /* if we do this, we're sure to get an IRQ since the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 * card has just reset and the NORXflag is on until
196 * we tell it to start receiving.
197 */
198
199 airqmask = probe_irq_on();
Joe Perchesf0b9c272015-05-05 10:06:07 -0700200 arcnet_outb(NORXflag, ioaddr, COM9026_REG_W_INTMASK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 udelay(1);
Joe Perchesf0b9c272015-05-05 10:06:07 -0700202 arcnet_outb(0, ioaddr, COM9026_REG_W_INTMASK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 dev->irq = probe_irq_off(airqmask);
204
Dan Carpenter0a6efc72010-07-17 07:21:28 +0000205 if ((int)dev->irq <= 0) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700206 arc_printk(D_INIT_REASONS, dev, "Autoprobe IRQ failed\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 goto err_out;
208 }
209 }
210 release_region(ioaddr, ARCNET_TOTAL_SIZE); /* end of probing */
211 return com90io_found(dev);
212
213err_out:
214 release_region(ioaddr, ARCNET_TOTAL_SIZE);
215 return -ENODEV;
216}
217
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218/* Set up the struct net_device associated with this card. Called after
219 * probing succeeds.
220 */
221static int __init com90io_found(struct net_device *dev)
222{
223 struct arcnet_local *lp;
224 int ioaddr = dev->base_addr;
225 int err;
226
227 /* Reserve the irq */
Joe Perchesd6d7d3e2015-05-05 10:06:02 -0700228 if (request_irq(dev->irq, arcnet_interrupt, 0,
229 "arcnet (COM90xx-IO)", dev)) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700230 arc_printk(D_NORMAL, dev, "Can't get IRQ %d!\n", dev->irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 return -ENODEV;
232 }
Peter Osterlundfb911ee2005-09-13 01:25:15 -0700233 /* Reserve the I/O region */
Joe Perchesd6d7d3e2015-05-05 10:06:02 -0700234 if (!request_region(dev->base_addr, ARCNET_TOTAL_SIZE,
235 "arcnet (COM90xx-IO)")) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236 free_irq(dev->irq, dev);
237 return -EBUSY;
238 }
239
Wang Chen454d7c92008-11-12 23:37:49 -0800240 lp = netdev_priv(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 lp->card_name = "COM90xx I/O";
242 lp->hw.command = com90io_command;
243 lp->hw.status = com90io_status;
244 lp->hw.intmask = com90io_setmask;
245 lp->hw.reset = com90io_reset;
246 lp->hw.owner = THIS_MODULE;
247 lp->hw.copy_to_card = com90io_copy_to_card;
248 lp->hw.copy_from_card = com90io_copy_from_card;
249
250 lp->config = (0x16 | IOMAPflag) & ~ENABLE16flag;
Joe Perchesf0b9c272015-05-05 10:06:07 -0700251 arcnet_outb(lp->config, ioaddr, COM9026_REG_RW_CONFIG);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252
253 /* get and check the station ID from offset 1 in shmem */
254
255 dev->dev_addr[0] = get_buffer_byte(dev, 1);
256
257 err = register_netdev(dev);
258 if (err) {
Joe Perchesf0b9c272015-05-05 10:06:07 -0700259 arcnet_outb(arcnet_inb(ioaddr, COM9026_REG_RW_CONFIG) & ~IOMAPflag,
260 ioaddr, COM9026_REG_RW_CONFIG);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261 free_irq(dev->irq, dev);
262 release_region(dev->base_addr, ARCNET_TOTAL_SIZE);
263 return err;
264 }
265
Joe Perchesa34c0932015-05-05 10:05:55 -0700266 arc_printk(D_NORMAL, dev, "COM90IO: station %02Xh found at %03lXh, IRQ %d.\n",
267 dev->dev_addr[0], dev->base_addr, dev->irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268
269 return 0;
270}
271
Joe Perchesf2f0a162015-05-05 10:05:52 -0700272/* Do a hardware reset on the card, and set up necessary registers.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 *
274 * This should be called as little as possible, because it disrupts the
275 * token on the network (causes a RECON) and requires a significant delay.
276 *
277 * However, it does make sure the card is in a defined state.
278 */
279static int com90io_reset(struct net_device *dev, int really_reset)
280{
Wang Chen454d7c92008-11-12 23:37:49 -0800281 struct arcnet_local *lp = netdev_priv(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 short ioaddr = dev->base_addr;
283
Joe Perchesa34c0932015-05-05 10:05:55 -0700284 arc_printk(D_INIT, dev, "Resetting %s (status=%02Xh)\n",
Joe Perchesf0b9c272015-05-05 10:06:07 -0700285 dev->name, arcnet_inb(ioaddr, COM9026_REG_R_STATUS));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286
287 if (really_reset) {
288 /* reset the card */
Joe Perchesf0b9c272015-05-05 10:06:07 -0700289 arcnet_inb(ioaddr, COM9026_REG_R_RESET);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 mdelay(RESETtime);
291 }
292 /* Set the thing to IO-mapped, 8-bit mode */
293 lp->config = (0x1C | IOMAPflag) & ~ENABLE16flag;
Joe Perchesf0b9c272015-05-05 10:06:07 -0700294 arcnet_outb(lp->config, ioaddr, COM9026_REG_RW_CONFIG);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295
Joe Perchesf0b9c272015-05-05 10:06:07 -0700296 arcnet_outb(CFLAGScmd | RESETclear, ioaddr, COM9026_REG_W_COMMAND);
297 /* clear flags & end reset */
298 arcnet_outb(CFLAGScmd | CONFIGclear, ioaddr, COM9026_REG_W_COMMAND);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299
300 /* verify that the ARCnet signature byte is present */
301 if (get_buffer_byte(dev, 0) != TESTvalue) {
Joe Perchesa34c0932015-05-05 10:05:55 -0700302 arc_printk(D_NORMAL, dev, "reset failed: TESTvalue not present.\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 return 1;
304 }
305 /* enable extended (512-byte) packets */
Joe Perchesf0b9c272015-05-05 10:06:07 -0700306 arcnet_outb(CONFIGcmd | EXTconf, ioaddr, COM9026_REG_W_COMMAND);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 /* done! return success. */
308 return 0;
309}
310
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311static void com90io_command(struct net_device *dev, int cmd)
312{
313 short ioaddr = dev->base_addr;
314
Joe Perchesf0b9c272015-05-05 10:06:07 -0700315 arcnet_outb(cmd, ioaddr, COM9026_REG_W_COMMAND);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316}
317
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318static int com90io_status(struct net_device *dev)
319{
320 short ioaddr = dev->base_addr;
321
Joe Perchesf0b9c272015-05-05 10:06:07 -0700322 return arcnet_inb(ioaddr, COM9026_REG_R_STATUS);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323}
324
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325static void com90io_setmask(struct net_device *dev, int mask)
326{
327 short ioaddr = dev->base_addr;
328
Joe Perchesf0b9c272015-05-05 10:06:07 -0700329 arcnet_outb(mask, ioaddr, COM9026_REG_W_INTMASK);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330}
331
Joe Perchesd6d7d3e2015-05-05 10:06:02 -0700332static void com90io_copy_to_card(struct net_device *dev, int bufnum,
333 int offset, void *buf, int count)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334{
Joe Perchesa34c0932015-05-05 10:05:55 -0700335 TIME(dev, "put_whole_buffer", count,
336 put_whole_buffer(dev, bufnum * 512 + offset, count, buf));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337}
338
Joe Perchesd6d7d3e2015-05-05 10:06:02 -0700339static void com90io_copy_from_card(struct net_device *dev, int bufnum,
340 int offset, void *buf, int count)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341{
Joe Perchesa34c0932015-05-05 10:05:55 -0700342 TIME(dev, "get_whole_buffer", count,
343 get_whole_buffer(dev, bufnum * 512 + offset, count, buf));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344}
345
346static int io; /* use the insmod io= irq= shmem= options */
347static int irq;
348static char device[9]; /* use eg. device=arc1 to change name */
349
David Howells06a51282017-04-04 16:54:25 +0100350module_param_hw(io, int, ioport, 0);
351module_param_hw(irq, int, irq, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352module_param_string(device, device, sizeof(device), 0);
353MODULE_LICENSE("GPL");
354
355#ifndef MODULE
356static int __init com90io_setup(char *s)
357{
358 int ints[4];
Joe Perches01a1d5a2015-05-05 10:05:48 -0700359
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 s = get_options(s, 4, ints);
361 if (!ints[0])
362 return 0;
363 switch (ints[0]) {
364 default: /* ERROR */
Joe Perches05a24b22015-05-05 10:05:56 -0700365 pr_err("Too many arguments\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366 case 2: /* IRQ */
367 irq = ints[2];
368 case 1: /* IO address */
369 io = ints[1];
370 }
371 if (*s)
372 snprintf(device, sizeof(device), "%s", s);
373 return 1;
374}
375__setup("com90io=", com90io_setup);
376#endif
377
378static struct net_device *my_dev;
379
380static int __init com90io_init(void)
381{
382 struct net_device *dev;
383 int err;
384
385 dev = alloc_arcdev(device);
386 if (!dev)
387 return -ENOMEM;
388
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389 dev->base_addr = io;
390 dev->irq = irq;
391 if (dev->irq == 2)
392 dev->irq = 9;
393
394 err = com90io_probe(dev);
395
396 if (err) {
397 free_netdev(dev);
398 return err;
399 }
400
401 my_dev = dev;
402 return 0;
403}
404
405static void __exit com90io_exit(void)
406{
407 struct net_device *dev = my_dev;
408 int ioaddr = dev->base_addr;
409
410 unregister_netdev(dev);
411
Joe Perchesd6d7d3e2015-05-05 10:06:02 -0700412 /* In case the old driver is loaded later,
413 * set the thing back to MMAP mode
414 */
Joe Perchesf0b9c272015-05-05 10:06:07 -0700415 arcnet_outb(arcnet_inb(ioaddr, COM9026_REG_RW_CONFIG) & ~IOMAPflag,
416 ioaddr, COM9026_REG_RW_CONFIG);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417
418 free_irq(dev->irq, dev);
419 release_region(dev->base_addr, ARCNET_TOTAL_SIZE);
420 free_netdev(dev);
421}
422
423module_init(com90io_init)
424module_exit(com90io_exit)