Lines Matching +full:probe +full:- +full:reset
1 /* ne.c: A general non-shared-memory NS8390 ethernet driver for linux. */
3 Written 1992-94 by Donald Becker.
14 This driver should work with many programmed-I/O 8390-based ethernet
22 Paul Gortmaker : new reset code, reset card after probe at boot.
25 Paul Gortmaker : Allow users with bad cards to avoid full probe.
26 Paul Gortmaker : PCI probe changes, more PCI cards supported.
28 occur after memory is allocated for dev->priv. Deallocated memory
31 Paul Gortmaker : Discontinued PCI support - use ne2k-pci.c instead.
36 /* Routines for the NatSemi-based designs (NE[12]000). */
66 /* 0xbad = bad sig or no reset ack */
99 that the ne2k probe is the last 8390 based probe to take place (as it
100 is at boot) and so the probe will get confused by any other 8390 cards.
103 /* Do we need a portlist for the ISA auto-probe ? */
107 /* A zero-terminated list of I/O addresses to be probed at boot. */
130 /* A list of bad clones that we none-the-less recognize. */
137 {"NE1000","NE2000-invalid", {0x00, 0x00, 0xd8}}, /* Ancient real NE1000. */
138 {"NN1000", "NN2000", {0x08, 0x03, 0x08}}, /* Outlaw no-name clone. */
139 {"4-DIM8","4-DIM16", {0x00,0x00,0x4d,}}, /* Outlaw 4-Dimension cards. */
140 {"Con-Intl_8", "Con-Intl_16", {0x00, 0x00, 0x24}}, /* Connect Int'nl */
141 {"ET-100","ET-200", {0x00, 0x45, 0x54}}, /* YANG and YA clone */
143 {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */
144 {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */
145 {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */
147 {"RBHMA4X00-RTL8019", "RBHMA4X00-RTL8019", {0x00, 0x60, 0x0a}}, /* Toshiba built-in */
149 {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */
154 /* ---- No user-serviceable parts below ---- */
156 #define NE_BASE (dev->base_addr)
158 #define NE_DATAPORT 0x10 /* NatSemi-defined port window offset. */
159 #define NE_RESET 0x1f /* Issue a read to reset, a write to clear. */
168 # define DCR_VAL 0x48 /* 8-bit mode */
169 #elif defined(CONFIG_ATARI) /* 8-bit mode on Atari, normal on Q40 */
187 /* Probe for various non-shared-memory ethercards.
189 NEx000-clone boards have a Station Address PROM (SAPROM) in the packet
194 Reading the SAPROM from a word-wide card with the 8390 set in byte-wide
197 The probe is also responsible for initializing the card and filling
204 E1010-x starts at 0x100 and ends at 0x8000. ("-x" means "more memory")
206 E2010-x starts at 0x100 and ends at 0xffff. */
210 unsigned long base_addr = dev->base_addr; in do_ne_probe()
212 int orig_irq = dev->irq; in do_ne_probe()
223 else if (base_addr != 0) /* Don't probe at all. */ in do_ne_probe()
224 return -ENXIO; in do_ne_probe()
231 /* Last resort. The semi-risky ISA auto-probe. */ in do_ne_probe()
234 dev->irq = orig_irq; in do_ne_probe()
240 return -ENODEV; in do_ne_probe()
267 dev->base_addr = pnp_port_start(idev, 0); in ne_probe_isapnp()
268 dev->irq = pnp_irq(idev, 0); in ne_probe_isapnp()
272 dev->base_addr, dev->irq); in ne_probe_isapnp()
273 if (ne_probe1(dev, dev->base_addr) != 0) { /* Shouldn't happen. */ in ne_probe_isapnp()
275 "ne.c: Probe of ISAPnP card at %#lx failed.\n", in ne_probe_isapnp()
276 dev->base_addr); in ne_probe_isapnp()
278 return -ENXIO; in ne_probe_isapnp()
288 return -ENODEV; in ne_probe_isapnp()
304 return -EBUSY; in ne_probe1()
308 ret = -ENODEV; in ne_probe1()
323 ret = -ENODEV; in ne_probe1()
331 netdev_info(dev, "NE*000 ethercard probe at %#3lx:", ioaddr); in ne_probe1()
333 /* A user with a poor card that fails to ack the reset, or that in ne_probe1()
336 with an otherwise unused dev->mem_end value of "0xBAD" will in ne_probe1()
337 cause the driver to skip these parts of the probe. */ in ne_probe1()
339 bad_card = ((dev->base_addr != 0) && (dev->mem_end == BAD)); in ne_probe1()
341 /* Reset card. Who knows what dain-bramaged state it was left in. */ in ne_probe1()
346 /* DON'T change these to inb_p/outb_p or reset will fail on clones. */ in ne_probe1()
352 pr_cont(" (warning: no reset ack)"); in ne_probe1()
355 pr_cont(" not found (no reset ack).\n"); in ne_probe1()
356 ret = -ENODEV; in ne_probe1()
372 {0x48, EN0_DCFG}, /* Set byte-wide (0x48) access. */ in ne_probe1()
407 * shouldn't exceed 0x60 in 8-bit mode. in ne_probe1()
409 * the remote byte count registers (otherwise write-only)... in ne_probe1()
411 if ((DCR_VAL & 0x01) == 0 && /* 8-bit mode */ in ne_probe1()
432 name = (wordlength == 2) ? "Ctron-8" : "Ctron-16"; in ne_probe1()
460 ret = -ENXIO; in ne_probe1()
465 ret = -ENXIO; in ne_probe1()
470 if (dev->irq < 2) in ne_probe1()
479 dev->irq = probe_irq_off(cookie); in ne_probe1()
481 pr_cont(" autoirq is %d", dev->irq); in ne_probe1()
482 } else if (dev->irq == 2) in ne_probe1()
485 dev->irq = 9; in ne_probe1()
487 if (! dev->irq) { in ne_probe1()
489 ret = -EAGAIN; in ne_probe1()
495 ret = request_irq(dev->irq, eip_interrupt, 0, name, dev); in ne_probe1()
497 pr_cont(" unable to get IRQ %d (errno=%d).\n", dev->irq, ret); in ne_probe1()
501 dev->base_addr = ioaddr; in ne_probe1()
504 dev->dev_addr[i] = SA_prom[i]; in ne_probe1()
507 pr_cont("%pM\n", dev->dev_addr); in ne_probe1()
513 /* Use 16-bit mode only if this wasn't overridden by DCR_VAL */ in ne_probe1()
518 /* Allow the packet buffer size to be overridden by know-it-alls. */ in ne_probe1()
528 dev->netdev_ops = &eip_netdev_ops; in ne_probe1()
531 ei_local->msg_enable = ne_msg_enable; in ne_probe1()
536 name, ioaddr, dev->irq); in ne_probe1()
540 free_irq(dev->irq, dev); in ne_probe1()
546 /* Hard reset the card. This used to pause for the same period that a
547 8390 reset command required, but that shouldn't be necessary. */
556 /* DON'T change these to inb_p/outb_p or reset will fail on clones. */ in ne_reset_8390()
577 int nic_base = dev->base_addr; in ne_get_8390_hdr()
605 le16_to_cpus(&hdr->count); in ne_get_8390_hdr()
610 The NEx000 doesn't share the on-board packet memory -- you have to put
619 int nic_base = dev->base_addr; in ne_block_input()
620 char *buf = skb->data; in ne_block_input()
642 buf[count-1] = inb(NE_BASE + NE_DATAPORT); in ne_block_input()
663 -- it's broken for Rx on some cards! */ in ne_block_input()
669 } while (--tries > 0); in ne_block_input()
714 /* Handle the read-before-write bug the same way as the in ne_block_output()
715 Crynwr packet driver -- the NatSemi method doesn't work. in ne_block_output()
759 } while (--tries > 0); in ne_block_output()
787 int err, this_dev = pdev->id; in ne_drv_probe()
792 return -ENOMEM; in ne_drv_probe()
800 dev->base_addr = res->start; in ne_drv_probe()
801 dev->irq = platform_get_irq(pdev, 0); in ne_drv_probe()
805 return -EINVAL; in ne_drv_probe()
807 dev->base_addr = io[this_dev]; in ne_drv_probe()
808 dev->irq = irq[this_dev]; in ne_drv_probe()
809 dev->mem_end = bad[this_dev]; in ne_drv_probe()
811 SET_NETDEV_DEV(dev, &pdev->dev); in ne_drv_probe()
823 io[this_dev] = dev->base_addr; in ne_drv_probe()
824 irq[this_dev] = dev->irq; in ne_drv_probe()
844 free_irq(dev->irq, dev); in ne_drv_remove()
845 release_region(dev->base_addr, NE_IO_EXTENT); in ne_drv_remove()
964 return ERR_PTR(-ENOMEM); in ne_probe()
970 return ERR_PTR(-ENOMEM); in ne_probe()
972 sprintf(dev->name, "eth%d", unit); in ne_probe()
975 io[this_dev] = dev->base_addr; in ne_probe()
976 irq[this_dev] = dev->irq; in ne_probe()
977 bad[this_dev] = dev->mem_end; in ne_probe()
992 return ERR_PTR(-ENODEV); in ne_probe()