diff mbox series

[netdev,v6,3/3] net/8390: apne.c - autoprobe 100 Mbit mode in apne.c driver

Message ID 1624145073-12674-4-git-send-email-schmitzmic@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series None | expand

Commit Message

Michael Schmitz June 19, 2021, 11:24 p.m. UTC
Add experimental autoprobe code to detect 16 bit/100 MBit
cards to the APNE driver. Autoprobe uses the same code utilized
in apne_probe1 to identify the 8390 chip - failure to identify
the chip in 8 bit mode will switch the PCMCIA interface to 16
bit mode. This code is still untested!

This patch depends on patch "m68k: io_mm.h - add APNE 100
MBit support" sent to linux-m68k, and must not be applied
before that one!

CC: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/1622958877-2026-1-git-send-email-schmitzmic@gmail.com
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
---
 drivers/net/ethernet/8390/apne.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/8390/apne.c b/drivers/net/ethernet/8390/apne.c
index 4dd721e..ec165f8 100644
--- a/drivers/net/ethernet/8390/apne.c
+++ b/drivers/net/ethernet/8390/apne.c
@@ -156,6 +156,22 @@  struct net_device * __init apne_probe(int unit)
 		return ERR_PTR(-ENODEV);
 	}
 
+	/* Reset card. Who knows what dain-bramaged state it was left in. */
+	{
+		unsigned long reset_end_time = jiffies + msecs_to_jiffies(20);
+
+		outb(inb(IOBASE + NE_RESET), IOBASE + NE_RESET);
+
+		while ((inb(IOBASE + NE_EN0_ISR) & ENISR_RESET) == 0)
+			if (time_after(jiffies, reset_end_time)) {
+				pr_info("Card not found (no reset ack).\n");
+				isa_type = ISA_TYPE_AG16;
+				break;
+			}
+
+		outb(0xff, IOBASE + NE_EN0_ISR);		/* Ack all intr. */
+	}
+
 	dev = alloc_ei_netdev();
 	if (!dev)
 		return ERR_PTR(-ENOMEM);