[parisc-linux-cvs] Re: DIFF 2.4.20-pa18 head.S/tulip phy changes
Grant Grundler
grundler@dsl2.external.hp.com
Fri, 27 Dec 2002 01:43:13 -0700
On Fri, Dec 27, 2002 at 01:06:09AM -0700, Grant Grundler wrote:
> Log message:
> 2.4.20-pa18 misc changes
> head.S - 4x speed up on intializing BSS
> media.c - moved phy recover code to tulip_mii_recover() and added calls
> from a few other places which reset the phy. This has NOT been blessed
> by jgarzik and I just wanted wider exposure for now. Code worked on
> A500 with built-in and add-on cards.
Please point at me for issues with tulip.
I just don't have the breadth of cards to properly test this.
thanks,
grant
Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.377
diff -u -p -r1.377 Makefile
--- Makefile 21 Dec 2002 18:30:42 -0000 1.377
+++ Makefile 27 Dec 2002 08:05:28 -0000
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 20
-EXTRAVERSION = -pa17
+EXTRAVERSION = -pa18
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
Index: arch/parisc/kernel/head.S
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/head.S,v
retrieving revision 1.10
diff -u -p -r1.10 head.S
--- arch/parisc/kernel/head.S 6 Sep 2001 09:44:07 -0000 1.10
+++ arch/parisc/kernel/head.S 27 Dec 2002 08:05:28 -0000
@@ -74,7 +74,7 @@ stext:
ldo R%PA(_end)(%r4),%r4
$bss_loop:
cmpb,<<,n %r3,%r4,$bss_loop
- stb,ma %r0,1(%r3)
+ stw,ma %r0,4(%r3)
/* Save away the arguments the boot loader passed in (32 bit args) */
Index: drivers/net/tulip/media.c
===================================================================
RCS file: /var/cvs/linux/drivers/net/tulip/media.c,v
retrieving revision 1.14
diff -u -p -r1.14 media.c
--- drivers/net/tulip/media.c 14 Oct 2002 23:34:02 -0000 1.14
+++ drivers/net/tulip/media.c 27 Dec 2002 08:05:28 -0000
@@ -173,6 +173,25 @@ void tulip_mdio_write(struct net_device
}
+/*
+ * Reset the phy according to 802.3 spec "22.2.4 Management functions"
+ * References to DP83840A are just for convenience.
+ */
+static void tulip_mii_recover(struct net_device *dev, int phy_num, long ioaddr)
+{
+ int timeout = 20; /* 2 ms */
+
+ inl(ioaddr); /* flush posted writes */
+ udelay(500); /* Sect 3.10.3 in DP83840A.pdf (p39) */
+
+ /* Section 4.2 in DP83840A.pdf (p43) */
+ while (timeout-- &&
+ (tulip_mdio_read (dev, phy_num, MII_BMCR) & BMCR_RESET))
+ udelay(100);
+printk("tulip_mii_recover: %d ms\n", (20 - timeout)*100);
+}
+
+
/* Set up the transceiver control registers for the selected media type. */
void tulip_select_media(struct net_device *dev, int startup)
{
@@ -215,6 +234,8 @@ void tulip_select_media(struct net_devic
dev->name);
for (i = 0; i < rst[0]; i++)
outl(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15);
+ inl(ioaddr + CSR15); /* flush writes */
+ mdelay(1);
}
if (tulip_debug > 1)
printk(KERN_DEBUG "%s: 21143 non-MII %s transceiver control "
@@ -266,9 +287,11 @@ 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) {
for (i = 0; i < reset_length; i++)
outl(get_u16(&reset_sequence[i]) << 16, ioaddr + CSR15);
+ tulip_mii_recover(dev, phy_num, ioaddr+CSR15);
+ }
for (i = 0; i < init_length; i++)
outl(get_u16(&init_sequence[i]) << 16, ioaddr + CSR15);
} else {
@@ -277,20 +300,11 @@ void tulip_select_media(struct net_devic
int reset_length = p[2 + init_length];
misc_info = (u16*)(reset_sequence + reset_length);
if (startup) {
- int timeout = 20; /* 2 ms */
outl(mtable->csr12dir | 0x100, ioaddr + CSR12);
for (i = 0; i < reset_length; i++)
outl(reset_sequence[i], ioaddr + CSR12);
- /* flush posted writes */
- inl(ioaddr + CSR12);
- /* Sect 3.10.3 in DP83840A.pdf (p39) */
- udelay(500);
-
- /* Section 4.2 in DP83840A.pdf (p43) */
- while (timeout-- &&
- (tulip_mdio_read (dev, phy_num, MII_BMCR) & BMCR_RESET))
- udelay(100);
+ tulip_mii_recover(dev, phy_num, ioaddr + CSR12);
}
for (i = 0; i < init_length; i++)
outl(init_sequence[i], ioaddr + CSR12);