com90xx.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. /*
  2. * Linux ARCnet driver - COM90xx chipset (memory-mapped buffers)
  3. *
  4. * Written 1994-1999 by Avery Pennarun.
  5. * Written 1999 by Martin Mares <mj@ucw.cz>.
  6. * Derived from skeleton.c by Donald Becker.
  7. *
  8. * Special thanks to Contemporary Controls, Inc. (www.ccontrols.com)
  9. * for sponsoring the further development of this driver.
  10. *
  11. * **********************
  12. *
  13. * The original copyright of skeleton.c was as follows:
  14. *
  15. * skeleton.c Written 1993 by Donald Becker.
  16. * Copyright 1993 United States Government as represented by the
  17. * Director, National Security Agency. This software may only be used
  18. * and distributed according to the terms of the GNU General Public License as
  19. * modified by SRC, incorporated herein by reference.
  20. *
  21. * **********************
  22. *
  23. * For more details, see drivers/net/arcnet.c
  24. *
  25. * **********************
  26. */
  27. #include <linux/module.h>
  28. #include <linux/moduleparam.h>
  29. #include <linux/init.h>
  30. #include <linux/ioport.h>
  31. #include <linux/delay.h>
  32. #include <linux/netdevice.h>
  33. #include <asm/io.h>
  34. #include <linux/arcdevice.h>
  35. #define VERSION "arcnet: COM90xx chipset support\n"
  36. /* Define this to speed up the autoprobe by assuming if only one io port and
  37. * shmem are left in the list at Stage 5, they must correspond to each
  38. * other.
  39. *
  40. * This is undefined by default because it might not always be true, and the
  41. * extra check makes the autoprobe even more careful. Speed demons can turn
  42. * it on - I think it should be fine if you only have one ARCnet card
  43. * installed.
  44. *
  45. * If no ARCnet cards are installed, this delay never happens anyway and thus
  46. * the option has no effect.
  47. */
  48. #undef FAST_PROBE
  49. /* Internal function declarations */
  50. static int com90xx_found(int ioaddr, int airq, u_long shmem);
  51. static void com90xx_command(struct net_device *dev, int command);
  52. static int com90xx_status(struct net_device *dev);
  53. static void com90xx_setmask(struct net_device *dev, int mask);
  54. static int com90xx_reset(struct net_device *dev, int really_reset);
  55. static void com90xx_copy_to_card(struct net_device *dev, int bufnum, int offset,
  56. void *buf, int count);
  57. static void com90xx_copy_from_card(struct net_device *dev, int bufnum, int offset,
  58. void *buf, int count);
  59. /* Known ARCnet cards */
  60. static struct net_device *cards[16];
  61. static int numcards;
  62. /* Handy defines for ARCnet specific stuff */
  63. /* The number of low I/O ports used by the card */
  64. #define ARCNET_TOTAL_SIZE 16
  65. /* Amount of I/O memory used by the card */
  66. #define BUFFER_SIZE (512)
  67. #define MIRROR_SIZE (BUFFER_SIZE*4)
  68. /* COM 9026 controller chip --> ARCnet register addresses */
  69. #define _INTMASK (ioaddr+0) /* writable */
  70. #define _STATUS (ioaddr+0) /* readable */
  71. #define _COMMAND (ioaddr+1) /* writable, returns random vals on read (?) */
  72. #define _CONFIG (ioaddr+2) /* Configuration register */
  73. #define _RESET (ioaddr+8) /* software reset (on read) */
  74. #define _MEMDATA (ioaddr+12) /* Data port for IO-mapped memory */
  75. #define _ADDR_HI (ioaddr+15) /* Control registers for said */
  76. #define _ADDR_LO (ioaddr+14)
  77. #undef ASTATUS
  78. #undef ACOMMAND
  79. #undef AINTMASK
  80. #define ASTATUS() inb(_STATUS)
  81. #define ACOMMAND(cmd) outb((cmd),_COMMAND)
  82. #define AINTMASK(msk) outb((msk),_INTMASK)
  83. static int com90xx_skip_probe __initdata = 0;
  84. /* Module parameters */
  85. static int io; /* use the insmod io= irq= shmem= options */
  86. static int irq;
  87. static int shmem;
  88. static char device[9]; /* use eg. device=arc1 to change name */
  89. module_param(io, int, 0);
  90. module_param(irq, int, 0);
  91. module_param(shmem, int, 0);
  92. module_param_string(device, device, sizeof(device), 0);
  93. static void __init com90xx_probe(void)
  94. {
  95. int count, status, ioaddr, numprint, airq, openparen = 0;
  96. unsigned long airqmask;
  97. int ports[(0x3f0 - 0x200) / 16 + 1] =
  98. {0};
  99. u_long shmems[(0xFF800 - 0xA0000) / 2048 + 1] =
  100. {0};
  101. int numports, numshmems, *port;
  102. u_long *p;
  103. if (!io && !irq && !shmem && !*device && com90xx_skip_probe)
  104. return;
  105. BUGLVL(D_NORMAL) printk(VERSION);
  106. /* set up the arrays where we'll store the possible probe addresses */
  107. numports = numshmems = 0;
  108. if (io)
  109. ports[numports++] = io;
  110. else
  111. for (count = 0x200; count <= 0x3f0; count += 16)
  112. ports[numports++] = count;
  113. if (shmem)
  114. shmems[numshmems++] = shmem;
  115. else
  116. for (count = 0xA0000; count <= 0xFF800; count += 2048)
  117. shmems[numshmems++] = count;
  118. /* Stage 1: abandon any reserved ports, or ones with status==0xFF
  119. * (empty), and reset any others by reading the reset port.
  120. */
  121. numprint = -1;
  122. for (port = &ports[0]; port - ports < numports; port++) {
  123. numprint++;
  124. numprint %= 8;
  125. if (!numprint) {
  126. BUGMSG2(D_INIT, "\n");
  127. BUGMSG2(D_INIT, "S1: ");
  128. }
  129. BUGMSG2(D_INIT, "%Xh ", *port);
  130. ioaddr = *port;
  131. if (!request_region(*port, ARCNET_TOTAL_SIZE, "arcnet (90xx)")) {
  132. BUGMSG2(D_INIT_REASONS, "(request_region)\n");
  133. BUGMSG2(D_INIT_REASONS, "S1: ");
  134. BUGLVL(D_INIT_REASONS) numprint = 0;
  135. *port-- = ports[--numports];
  136. continue;
  137. }
  138. if (ASTATUS() == 0xFF) {
  139. BUGMSG2(D_INIT_REASONS, "(empty)\n");
  140. BUGMSG2(D_INIT_REASONS, "S1: ");
  141. BUGLVL(D_INIT_REASONS) numprint = 0;
  142. release_region(*port, ARCNET_TOTAL_SIZE);
  143. *port-- = ports[--numports];
  144. continue;
  145. }
  146. inb(_RESET); /* begin resetting card */
  147. BUGMSG2(D_INIT_REASONS, "\n");
  148. BUGMSG2(D_INIT_REASONS, "S1: ");
  149. BUGLVL(D_INIT_REASONS) numprint = 0;
  150. }
  151. BUGMSG2(D_INIT, "\n");
  152. if (!numports) {
  153. BUGMSG2(D_NORMAL, "S1: No ARCnet cards found.\n");
  154. return;
  155. }
  156. /* Stage 2: we have now reset any possible ARCnet cards, so we can't
  157. * do anything until they finish. If D_INIT, print the list of
  158. * cards that are left.
  159. */
  160. numprint = -1;
  161. for (port = &ports[0]; port < ports + numports; port++) {
  162. numprint++;
  163. numprint %= 8;
  164. if (!numprint) {
  165. BUGMSG2(D_INIT, "\n");
  166. BUGMSG2(D_INIT, "S2: ");
  167. }
  168. BUGMSG2(D_INIT, "%Xh ", *port);
  169. }
  170. BUGMSG2(D_INIT, "\n");
  171. mdelay(RESETtime);
  172. /* Stage 3: abandon any shmem addresses that don't have the signature
  173. * 0xD1 byte in the right place, or are read-only.
  174. */
  175. numprint = -1;
  176. for (p = &shmems[0]; p < shmems + numshmems; p++) {
  177. u_long ptr = *p;
  178. numprint++;
  179. numprint %= 8;
  180. if (!numprint) {
  181. BUGMSG2(D_INIT, "\n");
  182. BUGMSG2(D_INIT, "S3: ");
  183. }
  184. BUGMSG2(D_INIT, "%lXh ", *p);
  185. if (!request_mem_region(*p, BUFFER_SIZE, "arcnet (90xx)")) {
  186. BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n");
  187. BUGMSG2(D_INIT_REASONS, "Stage 3: ");
  188. BUGLVL(D_INIT_REASONS) numprint = 0;
  189. *p-- = shmems[--numshmems];
  190. continue;
  191. }
  192. if (isa_readb(ptr) != TESTvalue) {
  193. BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n",
  194. isa_readb(ptr), TESTvalue);
  195. BUGMSG2(D_INIT_REASONS, "S3: ");
  196. BUGLVL(D_INIT_REASONS) numprint = 0;
  197. release_mem_region(*p, BUFFER_SIZE);
  198. *p-- = shmems[--numshmems];
  199. continue;
  200. }
  201. /* By writing 0x42 to the TESTvalue location, we also make
  202. * sure no "mirror" shmem areas show up - if they occur
  203. * in another pass through this loop, they will be discarded
  204. * because *cptr != TESTvalue.
  205. */
  206. isa_writeb(0x42, ptr);
  207. if (isa_readb(ptr) != 0x42) {
  208. BUGMSG2(D_INIT_REASONS, "(read only)\n");
  209. BUGMSG2(D_INIT_REASONS, "S3: ");
  210. release_mem_region(*p, BUFFER_SIZE);
  211. *p-- = shmems[--numshmems];
  212. continue;
  213. }
  214. BUGMSG2(D_INIT_REASONS, "\n");
  215. BUGMSG2(D_INIT_REASONS, "S3: ");
  216. BUGLVL(D_INIT_REASONS) numprint = 0;
  217. }
  218. BUGMSG2(D_INIT, "\n");
  219. if (!numshmems) {
  220. BUGMSG2(D_NORMAL, "S3: No ARCnet cards found.\n");
  221. for (port = &ports[0]; port < ports + numports; port++)
  222. release_region(*port, ARCNET_TOTAL_SIZE);
  223. return;
  224. }
  225. /* Stage 4: something of a dummy, to report the shmems that are
  226. * still possible after stage 3.
  227. */
  228. numprint = -1;
  229. for (p = &shmems[0]; p < shmems + numshmems; p++) {
  230. numprint++;
  231. numprint %= 8;
  232. if (!numprint) {
  233. BUGMSG2(D_INIT, "\n");
  234. BUGMSG2(D_INIT, "S4: ");
  235. }
  236. BUGMSG2(D_INIT, "%lXh ", *p);
  237. }
  238. BUGMSG2(D_INIT, "\n");
  239. /* Stage 5: for any ports that have the correct status, can disable
  240. * the RESET flag, and (if no irq is given) generate an autoirq,
  241. * register an ARCnet device.
  242. *
  243. * Currently, we can only register one device per probe, so quit
  244. * after the first one is found.
  245. */
  246. numprint = -1;
  247. for (port = &ports[0]; port < ports + numports; port++) {
  248. int found = 0;
  249. numprint++;
  250. numprint %= 8;
  251. if (!numprint) {
  252. BUGMSG2(D_INIT, "\n");
  253. BUGMSG2(D_INIT, "S5: ");
  254. }
  255. BUGMSG2(D_INIT, "%Xh ", *port);
  256. ioaddr = *port;
  257. status = ASTATUS();
  258. if ((status & 0x9D)
  259. != (NORXflag | RECONflag | TXFREEflag | RESETflag)) {
  260. BUGMSG2(D_INIT_REASONS, "(status=%Xh)\n", status);
  261. BUGMSG2(D_INIT_REASONS, "S5: ");
  262. BUGLVL(D_INIT_REASONS) numprint = 0;
  263. release_region(*port, ARCNET_TOTAL_SIZE);
  264. *port-- = ports[--numports];
  265. continue;
  266. }
  267. ACOMMAND(CFLAGScmd | RESETclear | CONFIGclear);
  268. status = ASTATUS();
  269. if (status & RESETflag) {
  270. BUGMSG2(D_INIT_REASONS, " (eternal reset, status=%Xh)\n",
  271. status);
  272. BUGMSG2(D_INIT_REASONS, "S5: ");
  273. BUGLVL(D_INIT_REASONS) numprint = 0;
  274. release_region(*port, ARCNET_TOTAL_SIZE);
  275. *port-- = ports[--numports];
  276. continue;
  277. }
  278. /* skip this completely if an IRQ was given, because maybe
  279. * we're on a machine that locks during autoirq!
  280. */
  281. if (!irq) {
  282. /* if we do this, we're sure to get an IRQ since the
  283. * card has just reset and the NORXflag is on until
  284. * we tell it to start receiving.
  285. */
  286. airqmask = probe_irq_on();
  287. AINTMASK(NORXflag);
  288. udelay(1);
  289. AINTMASK(0);
  290. airq = probe_irq_off(airqmask);
  291. if (airq <= 0) {
  292. BUGMSG2(D_INIT_REASONS, "(airq=%d)\n", airq);
  293. BUGMSG2(D_INIT_REASONS, "S5: ");
  294. BUGLVL(D_INIT_REASONS) numprint = 0;
  295. release_region(*port, ARCNET_TOTAL_SIZE);
  296. *port-- = ports[--numports];
  297. continue;
  298. }
  299. } else {
  300. airq = irq;
  301. }
  302. BUGMSG2(D_INIT, "(%d,", airq);
  303. openparen = 1;
  304. /* Everything seems okay. But which shmem, if any, puts
  305. * back its signature byte when the card is reset?
  306. *
  307. * If there are multiple cards installed, there might be
  308. * multiple shmems still in the list.
  309. */
  310. #ifdef FAST_PROBE
  311. if (numports > 1 || numshmems > 1) {
  312. inb(_RESET);
  313. mdelay(RESETtime);
  314. } else {
  315. /* just one shmem and port, assume they match */
  316. isa_writeb(TESTvalue, shmems[0]);
  317. }
  318. #else
  319. inb(_RESET);
  320. mdelay(RESETtime);
  321. #endif
  322. for (p = &shmems[0]; p < shmems + numshmems; p++) {
  323. u_long ptr = *p;
  324. if (isa_readb(ptr) == TESTvalue) { /* found one */
  325. BUGMSG2(D_INIT, "%lXh)\n", *p);
  326. openparen = 0;
  327. /* register the card */
  328. if (com90xx_found(*port, airq, *p) == 0)
  329. found = 1;
  330. numprint = -1;
  331. /* remove shmem from the list */
  332. *p = shmems[--numshmems];
  333. break; /* go to the next I/O port */
  334. } else {
  335. BUGMSG2(D_INIT_REASONS, "%Xh-", isa_readb(ptr));
  336. }
  337. }
  338. if (openparen) {
  339. BUGLVL(D_INIT) printk("no matching shmem)\n");
  340. BUGLVL(D_INIT_REASONS) printk("S5: ");
  341. BUGLVL(D_INIT_REASONS) numprint = 0;
  342. }
  343. if (!found)
  344. release_region(*port, ARCNET_TOTAL_SIZE);
  345. *port-- = ports[--numports];
  346. }
  347. BUGLVL(D_INIT_REASONS) printk("\n");
  348. /* Now put back TESTvalue on all leftover shmems. */
  349. for (p = &shmems[0]; p < shmems + numshmems; p++) {
  350. isa_writeb(TESTvalue, *p);
  351. release_mem_region(*p, BUFFER_SIZE);
  352. }
  353. }
  354. /* Set up the struct net_device associated with this card. Called after
  355. * probing succeeds.
  356. */
  357. static int __init com90xx_found(int ioaddr, int airq, u_long shmem)
  358. {
  359. struct net_device *dev = NULL;
  360. struct arcnet_local *lp;
  361. u_long first_mirror, last_mirror;
  362. int mirror_size;
  363. /* allocate struct net_device */
  364. dev = alloc_arcdev(device);
  365. if (!dev) {
  366. BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n");
  367. release_mem_region(shmem, BUFFER_SIZE);
  368. return -ENOMEM;
  369. }
  370. lp = dev->priv;
  371. /* find the real shared memory start/end points, including mirrors */
  372. /* guess the actual size of one "memory mirror" - the number of
  373. * bytes between copies of the shared memory. On most cards, it's
  374. * 2k (or there are no mirrors at all) but on some, it's 4k.
  375. */
  376. mirror_size = MIRROR_SIZE;
  377. if (isa_readb(shmem) == TESTvalue
  378. && isa_readb(shmem - mirror_size) != TESTvalue
  379. && isa_readb(shmem - 2 * mirror_size) == TESTvalue)
  380. mirror_size *= 2;
  381. first_mirror = last_mirror = shmem;
  382. while (isa_readb(first_mirror) == TESTvalue)
  383. first_mirror -= mirror_size;
  384. first_mirror += mirror_size;
  385. while (isa_readb(last_mirror) == TESTvalue)
  386. last_mirror += mirror_size;
  387. last_mirror -= mirror_size;
  388. dev->mem_start = first_mirror;
  389. dev->mem_end = last_mirror + MIRROR_SIZE - 1;
  390. release_mem_region(shmem, BUFFER_SIZE);
  391. if (!request_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1, "arcnet (90xx)"))
  392. goto err_free_dev;
  393. /* reserve the irq */
  394. if (request_irq(airq, &arcnet_interrupt, 0, "arcnet (90xx)", dev)) {
  395. BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", airq);
  396. goto err_release_mem;
  397. }
  398. dev->irq = airq;
  399. /* Initialize the rest of the device structure. */
  400. lp->card_name = "COM90xx";
  401. lp->hw.command = com90xx_command;
  402. lp->hw.status = com90xx_status;
  403. lp->hw.intmask = com90xx_setmask;
  404. lp->hw.reset = com90xx_reset;
  405. lp->hw.owner = THIS_MODULE;
  406. lp->hw.copy_to_card = com90xx_copy_to_card;
  407. lp->hw.copy_from_card = com90xx_copy_from_card;
  408. lp->mem_start = ioremap(dev->mem_start, dev->mem_end - dev->mem_start + 1);
  409. if (!lp->mem_start) {
  410. BUGMSG(D_NORMAL, "Can't remap device memory!\n");
  411. goto err_free_irq;
  412. }
  413. /* get and check the station ID from offset 1 in shmem */
  414. dev->dev_addr[0] = readb(lp->mem_start + 1);
  415. dev->base_addr = ioaddr;
  416. BUGMSG(D_NORMAL, "COM90xx station %02Xh found at %03lXh, IRQ %d, "
  417. "ShMem %lXh (%ld*%xh).\n",
  418. dev->dev_addr[0],
  419. dev->base_addr, dev->irq, dev->mem_start,
  420. (dev->mem_end - dev->mem_start + 1) / mirror_size, mirror_size);
  421. if (register_netdev(dev))
  422. goto err_unmap;
  423. cards[numcards++] = dev;
  424. return 0;
  425. err_unmap:
  426. iounmap(lp->mem_start);
  427. err_free_irq:
  428. free_irq(dev->irq, dev);
  429. err_release_mem:
  430. release_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1);
  431. err_free_dev:
  432. free_netdev(dev);
  433. return -EIO;
  434. }
  435. static void com90xx_command(struct net_device *dev, int cmd)
  436. {
  437. short ioaddr = dev->base_addr;
  438. ACOMMAND(cmd);
  439. }
  440. static int com90xx_status(struct net_device *dev)
  441. {
  442. short ioaddr = dev->base_addr;
  443. return ASTATUS();
  444. }
  445. static void com90xx_setmask(struct net_device *dev, int mask)
  446. {
  447. short ioaddr = dev->base_addr;
  448. AINTMASK(mask);
  449. }
  450. /*
  451. * Do a hardware reset on the card, and set up necessary registers.
  452. *
  453. * This should be called as little as possible, because it disrupts the
  454. * token on the network (causes a RECON) and requires a significant delay.
  455. *
  456. * However, it does make sure the card is in a defined state.
  457. */
  458. int com90xx_reset(struct net_device *dev, int really_reset)
  459. {
  460. struct arcnet_local *lp = dev->priv;
  461. short ioaddr = dev->base_addr;
  462. BUGMSG(D_INIT, "Resetting (status=%02Xh)\n", ASTATUS());
  463. if (really_reset) {
  464. /* reset the card */
  465. inb(_RESET);
  466. mdelay(RESETtime);
  467. }
  468. ACOMMAND(CFLAGScmd | RESETclear); /* clear flags & end reset */
  469. ACOMMAND(CFLAGScmd | CONFIGclear);
  470. /* don't do this until we verify that it doesn't hurt older cards! */
  471. /* outb(inb(_CONFIG) | ENABLE16flag, _CONFIG); */
  472. /* verify that the ARCnet signature byte is present */
  473. if (readb(lp->mem_start) != TESTvalue) {
  474. if (really_reset)
  475. BUGMSG(D_NORMAL, "reset failed: TESTvalue not present.\n");
  476. return 1;
  477. }
  478. /* enable extended (512-byte) packets */
  479. ACOMMAND(CONFIGcmd | EXTconf);
  480. /* clean out all the memory to make debugging make more sense :) */
  481. BUGLVL(D_DURING)
  482. memset_io(lp->mem_start, 0x42, 2048);
  483. /* done! return success. */
  484. return 0;
  485. }
  486. static void com90xx_copy_to_card(struct net_device *dev, int bufnum, int offset,
  487. void *buf, int count)
  488. {
  489. struct arcnet_local *lp = dev->priv;
  490. void __iomem *memaddr = lp->mem_start + bufnum * 512 + offset;
  491. TIME("memcpy_toio", count, memcpy_toio(memaddr, buf, count));
  492. }
  493. static void com90xx_copy_from_card(struct net_device *dev, int bufnum, int offset,
  494. void *buf, int count)
  495. {
  496. struct arcnet_local *lp = dev->priv;
  497. void __iomem *memaddr = lp->mem_start + bufnum * 512 + offset;
  498. TIME("memcpy_fromio", count, memcpy_fromio(buf, memaddr, count));
  499. }
  500. MODULE_LICENSE("GPL");
  501. static int __init com90xx_init(void)
  502. {
  503. if (irq == 2)
  504. irq = 9;
  505. com90xx_probe();
  506. if (!numcards)
  507. return -EIO;
  508. return 0;
  509. }
  510. static void __exit com90xx_exit(void)
  511. {
  512. struct net_device *dev;
  513. struct arcnet_local *lp;
  514. int count;
  515. for (count = 0; count < numcards; count++) {
  516. dev = cards[count];
  517. lp = dev->priv;
  518. unregister_netdev(dev);
  519. free_irq(dev->irq, dev);
  520. iounmap(lp->mem_start);
  521. release_region(dev->base_addr, ARCNET_TOTAL_SIZE);
  522. release_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1);
  523. free_netdev(dev);
  524. }
  525. }
  526. module_init(com90xx_init);
  527. module_exit(com90xx_exit);
  528. #ifndef MODULE
  529. static int __init com90xx_setup(char *s)
  530. {
  531. int ints[8];
  532. s = get_options(s, 8, ints);
  533. if (!ints[0] && !*s) {
  534. printk("com90xx: Disabled.\n");
  535. return 1;
  536. }
  537. switch (ints[0]) {
  538. default: /* ERROR */
  539. printk("com90xx: Too many arguments.\n");
  540. case 3: /* Mem address */
  541. shmem = ints[3];
  542. case 2: /* IRQ */
  543. irq = ints[2];
  544. case 1: /* IO address */
  545. io = ints[1];
  546. }
  547. if (*s)
  548. snprintf(device, sizeof(device), "%s", s);
  549. return 1;
  550. }
  551. __setup("com90xx=", com90xx_setup);
  552. #endif