From: Kyle McMartin <kyle@parisc-linux.org>
To: netdev@vger.kernel.org
Cc: grundler@parisc-linux.org, val_henson@linux.intel.com, akpm@osdl.org
Subject: [PATCH 1/9] [TULIP] Fix PHY init and reset
Date: Mon, 07 Aug 2006 20:53:24 +0000 [thread overview]
Message-ID: <11549840122892-git-send-email-kyle@parisc-linux.org> (raw)
In-Reply-To: <20060807204418.GE401@athena.road.mcmartin.ca>
From: Grant Grundler <grundler@parisc-linux.org>
A whole slew of fixes for tulip_select_media for:
- Flush posted MMIO writes as per PCI spec
- Polling the reset bit (bit 15) is required to determine when
the "init" sequence can be sent.
This fixes tulip on HP PA-RISC systems, which use DP83840A and
LXT971D PHYs. Tested for several years on a variety of HP PA-RISC
systems.
[Initial work done by Grant Grundler, DS21142 support added by
Thibaut Varene.]
Signed-off-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: Thibaut Varene <varenet@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
---
drivers/net/tulip/media.c | 40 +++++++++++++++++++++++++++++++++++++---
1 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c
index e9bc2a9..5093d87 100644
--- a/drivers/net/tulip/media.c
+++ b/drivers/net/tulip/media.c
@@ -44,8 +44,10 @@ static const unsigned char comet_miireg2
/* 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 @@ void tulip_select_media(struct net_devic
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;
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;
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;
--
1.4.1.1
next prev parent reply other threads:[~2006-08-07 20:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-07 20:44 [PATCH 0/9] tulip patches from parisc-linux Kyle McMartin
2006-08-07 20:53 ` Kyle McMartin [this message]
2006-08-07 20:53 ` [PATCH 2/9] [TULIP] Print physical address in tulip_init_one Kyle McMartin
2006-08-07 20:53 ` [PATCH 3/9] [TULIP] Make tulip_stop_rxtx() failure case slightly more informative Kyle McMartin
2006-08-07 20:53 ` [PATCH 4/9] [TULIP] Clean tulip.h so it can be used by winbond-840.c Kyle McMartin
2006-08-07 20:53 ` [PATCH 5/9] [TULIP] Flush MMIO writes in reset sequence Kyle McMartin
2006-08-07 20:53 ` [PATCH 6/9] [TULIP] Fix IRQ/DMA race Kyle McMartin
2006-08-07 20:53 ` [PATCH 7/9] [TULIP] Defer tulip_select_media() to process context Kyle McMartin
2006-08-07 20:53 ` [PATCH 8/9] [TULIP] Make DS21143 printout match lspci output Kyle McMartin
2006-08-07 20:53 ` [PATCH 9/9] [TULIP] Fix section mismatch in de2104x.c Kyle McMartin
2006-08-09 5:37 ` Jeff Garzik
2006-08-09 5:36 ` [PATCH 8/9] [TULIP] Make DS21143 printout match lspci output Jeff Garzik
2006-08-09 5:35 ` [PATCH 6/9] [TULIP] Fix IRQ/DMA race Jeff Garzik
2006-08-09 6:44 ` Valerie Henson
2006-08-09 5:33 ` [PATCH 5/9] [TULIP] Flush MMIO writes in reset sequence Jeff Garzik
2006-08-09 5:33 ` [PATCH 4/9] [TULIP] Clean tulip.h so it can be used by winbond-840.c Jeff Garzik
2006-08-09 15:00 ` Grant Grundler
2006-08-10 12:26 ` Jeff Garzik
2006-08-09 5:30 ` [PATCH 3/9] [TULIP] Make tulip_stop_rxtx() failure case slightly more informative Jeff Garzik
2006-08-09 5:29 ` [PATCH 1/9] [TULIP] Fix PHY init and reset Jeff Garzik
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=11549840122892-git-send-email-kyle@parisc-linux.org \
--to=kyle@parisc-linux.org \
--cc=akpm@osdl.org \
--cc=grundler@parisc-linux.org \
--cc=netdev@vger.kernel.org \
--cc=val_henson@linux.intel.com \
/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;
as well as URLs for NNTP newsgroup(s).