From: Jim Gifford <maillist@jg555.com>
To: Linux MIPS List <linux-mips@linux-mips.org>
Subject: Tulip RaQ2 64 Bit Fix
Date: Sun, 04 Dec 2005 21:18:23 -0800 [thread overview]
Message-ID: <4393CD9F.3090305@jg555.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 435 bytes --]
The attached patch allows the tulip driver to work with the RaQ2's
network adapter. Without the patch under a 64 bit build, it will never
negotiate and will drop packets. This driver is part of Linux Parisc, by
Grant Grundler. It's currently in -mm, but Jeff Garzick will not apply
it to the main tree.
When Grant modified this driver, he used the manufactures specs on the
tulip chip.
--
----
Jim Gifford
maillist@jg555.com
[-- Attachment #2: tulip.patch --]
[-- Type: text/x-diff, Size: 4679 bytes --]
diff -Naur linux-mips-2.6.14.orig/drivers/net/tulip/21142.c linux-mips-2.6.14/drivers/net/tulip/21142.c
--- linux-mips-2.6.14.orig/drivers/net/tulip/21142.c 2005-11-17 11:43:12.000000000 -0800
+++ linux-mips-2.6.14/drivers/net/tulip/21142.c 2005-11-17 21:52:47.000000000 -0800
@@ -172,7 +172,7 @@
int i;
for (i = 0; i < tp->mtable->leafcount; i++)
if (tp->mtable->mleaf[i].media == dev->if_port) {
- int startup = ! ((tp->chip_id == DC21143 && (tp->revision == 48 || tp->revision == 65)));
+ int startup = ! ((tp->chip_id == DC21143 && tp->revision == 65));
tp->cur_index = i;
tulip_select_media(dev, startup);
setup_done = 1;
diff -Naur linux-mips-2.6.14.orig/drivers/net/tulip/media.c linux-mips-2.6.14/drivers/net/tulip/media.c
--- linux-mips-2.6.14.orig/drivers/net/tulip/media.c 2005-11-17 11:43:13.000000000 -0800
+++ linux-mips-2.6.14/drivers/net/tulip/media.c 2005-11-17 21:52:47.000000000 -0800
@@ -44,8 +44,10 @@
/* MII transceiver control section.
Read and write the MII registers using software-generated serial
- MDIO protocol. See the MII specifications or DP83840A data sheet
- for details. */
+ MDIO protocol.
+ See IEEE 802.3-2002.pdf (Section 2, Chapter "22.2.4 Management functions")
+ or DP83840A data sheet for more details.
+ */
int tulip_mdio_read(struct net_device *dev, int phy_id, int location)
{
@@ -261,24 +263,56 @@
u16 *reset_sequence = &((u16*)(p+3))[init_length];
int reset_length = p[2 + init_length*2];
misc_info = reset_sequence + reset_length;
- if (startup)
+ if (startup) {
+ int timeout = 10; /* max 1 ms */
for (i = 0; i < reset_length; i++)
iowrite32(get_u16(&reset_sequence[i]) << 16, ioaddr + CSR15);
+
+ /* flush posted writes */
+ ioread32(ioaddr + CSR15);
+
+ /* Sect 3.10.3 in DP83840A.pdf (p39) */
+ udelay(500);
+
+ /* Section 4.2 in DP83840A.pdf (p43) */
+ /* and IEEE 802.3 "22.2.4.1.1 Reset" */
+ while (timeout-- &&
+ (tulip_mdio_read (dev, phy_num, MII_BMCR) & BMCR_RESET))
+ udelay(100);
+ }
for (i = 0; i < init_length; i++)
iowrite32(get_u16(&init_sequence[i]) << 16, ioaddr + CSR15);
+
+ ioread32(ioaddr + CSR15); /* flush posted writes */
} else {
u8 *init_sequence = p + 2;
u8 *reset_sequence = p + 3 + init_length;
int reset_length = p[2 + init_length];
misc_info = (u16*)(reset_sequence + reset_length);
if (startup) {
+ int timeout = 10; /* max 1 ms */
iowrite32(mtable->csr12dir | 0x100, ioaddr + CSR12);
for (i = 0; i < reset_length; i++)
iowrite32(reset_sequence[i], ioaddr + CSR12);
+
+ /* flush posted writes */
+ ioread32(ioaddr + CSR12);
+
+ /* Sect 3.10.3 in DP83840A.pdf (p39) */
+ udelay(500);
+
+ /* Section 4.2 in DP83840A.pdf (p43) */
+ /* and IEEE 802.3 "22.2.4.1.1 Reset" */
+ while (timeout-- &&
+ (tulip_mdio_read (dev, phy_num, MII_BMCR) & BMCR_RESET))
+ udelay(100);
}
for (i = 0; i < init_length; i++)
iowrite32(init_sequence[i], ioaddr + CSR12);
+
+ ioread32(ioaddr + CSR12); /* flush posted writes */
}
+
tmp_info = get_u16(&misc_info[1]);
if (tmp_info)
tp->advertising[phy_num] = tmp_info | 1;
diff -Naur linux-mips-2.6.14.orig/drivers/net/tulip/tulip_core.c linux-mips-2.6.14/drivers/net/tulip/tulip_core.c
--- linux-mips-2.6.14.orig/drivers/net/tulip/tulip_core.c 2005-11-17 11:43:13.000000000 -0800
+++ linux-mips-2.6.14/drivers/net/tulip/tulip_core.c 2005-11-17 21:52:47.000000000 -0800
@@ -22,7 +22,7 @@
#else
#define DRV_VERSION "1.1.13"
#endif
-#define DRV_RELDATE "May 11, 2002"
+#define DRV_RELDATE "December 15, 2004"
#include <linux/module.h>
@@ -148,7 +148,7 @@
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM | HAS_PCI_MWI, tulip_timer },
/* DC21142, DC21143 */
- { "Digital DS21143 Tulip", 128, 0x0801fbff,
+ { "Digital DS21142/DS21143 Tulip", 128, 0x0801fbff,
HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII | HAS_ACPI | HAS_NWAY
| HAS_INTR_MITIGATION | HAS_PCI_MWI, t21142_timer },
diff -Naur linux-mips-2.6.14.orig/drivers/net/tulip/tulip.h linux-mips-2.6.14/drivers/net/tulip/tulip.h
--- linux-mips-2.6.14.orig/drivers/net/tulip/tulip.h 2005-11-17 11:43:13.000000000 -0800
+++ linux-mips-2.6.14/drivers/net/tulip/tulip.h 2005-11-17 21:52:47.000000000 -0800
@@ -474,8 +474,11 @@
udelay(10);
if (!i)
- printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed\n",
- pci_name(tp->pdev));
+ printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed"
+ " (CSR5 0x%x CSR6 0x%x)\n",
+ pci_name(tp->pdev),
+ ioread32(ioaddr + CSR5),
+ ioread32(ioaddr + CSR6));
}
}
next reply other threads:[~2005-12-05 5:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-05 5:18 Jim Gifford [this message]
2005-12-05 11:44 ` Tulip RaQ2 64 Bit Fix Ralf Baechle
2006-01-16 16:03 ` Martin Michlmayr
2006-01-16 16:27 ` Jim Gifford
2006-01-16 16:58 ` Martin Michlmayr
2006-01-17 1:23 ` Andrew Morton
2006-01-17 1:36 ` Jeff Garzik
2006-01-17 2:35 ` Grant Grundler
2006-01-17 2:29 ` Andrew Morton
2006-01-17 2:29 ` Andrew Morton
2006-01-16 20:35 ` Grant Grundler
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=4393CD9F.3090305@jg555.com \
--to=maillist@jg555.com \
--cc=linux-mips@linux-mips.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