public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: linux-m68k@vger.kernel.org, geert@linux-m68k.org
Cc: alex@kazik.de, Michael Schmitz <schmitzmic@gmail.com>,
	netdev@vger.kernel.org
Subject: [PATCH netdev v6 3/3] net/8390: apne.c - autoprobe 100 Mbit mode in apne.c driver
Date: Sun, 20 Jun 2021 11:24:33 +1200	[thread overview]
Message-ID: <1624145073-12674-4-git-send-email-schmitzmic@gmail.com> (raw)
In-Reply-To: <1624145073-12674-1-git-send-email-schmitzmic@gmail.com>

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 --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);
-- 
2.7.4


  parent reply	other threads:[~2021-06-19 23:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19 23:24 [PATCH v6 0/3] Add APNE PCMCIA 100 Mbit support Michael Schmitz
2021-06-19 23:24 ` [PATCH v6 1/3] m68k: io_mm.h - add APNE 100 MBit support Michael Schmitz
2021-06-19 23:24 ` [PATCH netdev v6 2/3] net/8390: apne.c - add 100 Mbit support to apne.c driver Michael Schmitz
2021-06-19 23:24 ` Michael Schmitz [this message]
2021-06-20  8:30 ` [PATCH v6 0/3] Add APNE PCMCIA 100 Mbit support ALeX Kazik
2021-06-20 19:27   ` Michael Schmitz
2021-06-20 21:55     ` ALeX Kazik
2021-06-20 23:47       ` Michael Schmitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1624145073-12674-4-git-send-email-schmitzmic@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=alex@kazik.de \
    --cc=geert@linux-m68k.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox