Lines Matching +full:probe +full:- +full:reset

1 // SPDX-License-Identifier: GPL-1.0+
2 /* ne.c: A general non-shared-memory NS8390 ethernet driver for linux. */
4 Written 1992-94 by Donald Becker.
12 This driver should work with many programmed-I/O 8390-based ethernet
20 Paul Gortmaker : new reset code, reset card after probe at boot.
23 Paul Gortmaker : Allow users with bad cards to avoid full probe.
24 Paul Gortmaker : PCI probe changes, more PCI cards supported.
26 occur after memory is allocated for dev->priv. Deallocated memory
29 Paul Gortmaker : Discontinued PCI support - use ne2k-pci.c instead.
34 /* Routines for the NatSemi-based designs (NE[12]000). */
65 /* 0xbad = bad sig or no reset ack */
98 that the ne2k probe is the last 8390 based probe to take place (as it
99 is at boot) and so the probe will get confused by any other 8390 cards.
102 /* Do we need a portlist for the ISA auto-probe ? */
106 /* A zero-terminated list of I/O addresses to be probed at boot. */
129 /* A list of bad clones that we none-the-less recognize. */
136 {"NE1000","NE2000-invalid", {0x00, 0x00, 0xd8}}, /* Ancient real NE1000. */
137 {"NN1000", "NN2000", {0x08, 0x03, 0x08}}, /* Outlaw no-name clone. */
138 {"4-DIM8","4-DIM16", {0x00,0x00,0x4d,}}, /* Outlaw 4-Dimension cards. */
139 {"Con-Intl_8", "Con-Intl_16", {0x00, 0x00, 0x24}}, /* Connect Int'nl */
140 {"ET-100","ET-200", {0x00, 0x45, 0x54}}, /* YANG and YA clone */
142 {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */
143 {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */
144 {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */
146 {"RBHMA4X00-RTL8019", "RBHMA4X00-RTL8019", {0x00, 0x60, 0x0a}}, /* Toshiba built-in */
148 {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */
153 /* ---- No user-serviceable parts below ---- */
155 #define NE_BASE (dev->base_addr)
157 #define NE_DATAPORT 0x10 /* NatSemi-defined port window offset. */
158 #define NE_RESET 0x1f /* Issue a read to reset, a write to clear. */
167 # define DCR_VAL 0x48 /* 8-bit mode */
168 #elif defined(CONFIG_ATARI) /* 8-bit mode on Atari, normal on Q40 */
186 /* Probe for various non-shared-memory ethercards.
188 NEx000-clone boards have a Station Address PROM (SAPROM) in the packet
193 Reading the SAPROM from a word-wide card with the 8390 set in byte-wide
196 The probe is also responsible for initializing the card and filling
203 E1010-x starts at 0x100 and ends at 0x8000. ("-x" means "more memory")
205 E2010-x starts at 0x100 and ends at 0xffff. */
209 unsigned long base_addr = dev->base_addr; in do_ne_probe()
211 int orig_irq = dev->irq; in do_ne_probe()
222 else if (base_addr != 0) /* Don't probe at all. */ in do_ne_probe()
223 return -ENXIO; in do_ne_probe()
230 /* Last resort. The semi-risky ISA auto-probe. */ in do_ne_probe()
233 dev->irq = orig_irq; in do_ne_probe()
239 return -ENODEV; in do_ne_probe()
266 dev->base_addr = pnp_port_start(idev, 0); in ne_probe_isapnp()
267 dev->irq = pnp_irq(idev, 0); in ne_probe_isapnp()
271 dev->base_addr, dev->irq); in ne_probe_isapnp()
272 if (ne_probe1(dev, dev->base_addr) != 0) { /* Shouldn't happen. */ in ne_probe_isapnp()
274 "ne.c: Probe of ISAPnP card at %#lx failed.\n", in ne_probe_isapnp()
275 dev->base_addr); in ne_probe_isapnp()
277 return -ENXIO; in ne_probe_isapnp()
287 return -ENODEV; in ne_probe_isapnp()
303 return -EBUSY; in ne_probe1()
307 ret = -ENODEV; in ne_probe1()
322 ret = -ENODEV; in ne_probe1()
330 netdev_info(dev, "NE*000 ethercard probe at %#3lx:", ioaddr); in ne_probe1()
332 /* A user with a poor card that fails to ack the reset, or that in ne_probe1()
335 with an otherwise unused dev->mem_end value of "0xBAD" will in ne_probe1()
336 cause the driver to skip these parts of the probe. */ in ne_probe1()
338 bad_card = ((dev->base_addr != 0) && (dev->mem_end == BAD)); in ne_probe1()
340 /* Reset card. Who knows what dain-bramaged state it was left in. */ in ne_probe1()
345 /* DON'T change these to inb_p/outb_p or reset will fail on clones. */ in ne_probe1()
351 pr_cont(" (warning: no reset ack)"); in ne_probe1()
354 pr_cont(" not found (no reset ack).\n"); in ne_probe1()
355 ret = -ENODEV; in ne_probe1()
371 {0x48, EN0_DCFG}, /* Set byte-wide (0x48) access. */ in ne_probe1()
406 * shouldn't exceed 0x60 in 8-bit mode. in ne_probe1()
408 * the remote byte count registers (otherwise write-only)... in ne_probe1()
410 if ((DCR_VAL & 0x01) == 0 && /* 8-bit mode */ in ne_probe1()
431 name = (wordlength == 2) ? "Ctron-8" : "Ctron-16"; in ne_probe1()
459 ret = -ENXIO; in ne_probe1()
464 ret = -ENXIO; in ne_probe1()
469 if (dev->irq < 2) in ne_probe1()
478 dev->irq = probe_irq_off(cookie); in ne_probe1()
480 pr_cont(" autoirq is %d", dev->irq); in ne_probe1()
481 } else if (dev->irq == 2) in ne_probe1()
484 dev->irq = 9; in ne_probe1()
486 if (! dev->irq) { in ne_probe1()
488 ret = -EAGAIN; in ne_probe1()
494 ret = request_irq(dev->irq, eip_interrupt, 0, name, dev); in ne_probe1()
496 pr_cont(" unable to get IRQ %d (errno=%d).\n", dev->irq, ret); in ne_probe1()
500 dev->base_addr = ioaddr; in ne_probe1()
504 pr_cont("%pM\n", dev->dev_addr); in ne_probe1()
510 /* Use 16-bit mode only if this wasn't overridden by DCR_VAL */ in ne_probe1()
515 /* Allow the packet buffer size to be overridden by know-it-alls. */ in ne_probe1()
525 dev->netdev_ops = &eip_netdev_ops; in ne_probe1()
528 ei_local->msg_enable = ne_msg_enable; in ne_probe1()
533 name, ioaddr, dev->irq); in ne_probe1()
537 free_irq(dev->irq, dev); in ne_probe1()
543 /* Hard reset the card. This used to pause for the same period that a
544 8390 reset command required, but that shouldn't be necessary. */
553 /* DON'T change these to inb_p/outb_p or reset will fail on clones. */ in ne_reset_8390()
574 int nic_base = dev->base_addr; in ne_get_8390_hdr()
602 le16_to_cpus(&hdr->count); in ne_get_8390_hdr()
607 The NEx000 doesn't share the on-board packet memory -- you have to put
616 int nic_base = dev->base_addr; in ne_block_input()
617 char *buf = skb->data; in ne_block_input()
639 buf[count-1] = inb(NE_BASE + NE_DATAPORT); in ne_block_input()
660 -- it's broken for Rx on some cards! */ in ne_block_input()
666 } while (--tries > 0); in ne_block_input()
711 /* Handle the read-before-write bug the same way as the in ne_block_output()
712 Crynwr packet driver -- the NatSemi method doesn't work. in ne_block_output()
756 } while (--tries > 0); in ne_block_output()
784 int err, this_dev = pdev->id; in ne_drv_probe()
789 return -ENOMEM; in ne_drv_probe()
797 dev->base_addr = res->start; in ne_drv_probe()
798 dev->irq = platform_get_irq(pdev, 0); in ne_drv_probe()
802 return -EINVAL; in ne_drv_probe()
804 dev->base_addr = io[this_dev]; in ne_drv_probe()
805 dev->irq = irq[this_dev]; in ne_drv_probe()
806 dev->mem_end = bad[this_dev]; in ne_drv_probe()
808 SET_NETDEV_DEV(dev, &pdev->dev); in ne_drv_probe()
820 io[this_dev] = dev->base_addr; in ne_drv_probe()
821 irq[this_dev] = dev->irq; in ne_drv_probe()
841 free_irq(dev->irq, dev); in ne_drv_remove()
842 release_region(dev->base_addr, NE_IO_EXTENT); in ne_drv_remove()
955 return ERR_PTR(-ENOMEM); in ne_probe()
961 return ERR_PTR(-ENOMEM); in ne_probe()
963 sprintf(dev->name, "eth%d", unit); in ne_probe()
966 io[this_dev] = dev->base_addr; in ne_probe()
967 irq[this_dev] = dev->irq; in ne_probe()
968 bad[this_dev] = dev->mem_end; in ne_probe()
983 return ERR_PTR(-ENODEV); in ne_probe()