* Patch: link state detection for 8139too against 2.5.41
@ 2002-10-11 23:55 Stefan Rompf
2002-10-12 4:14 ` Donald Becker
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Rompf @ 2002-10-11 23:55 UTC (permalink / raw)
To: jgarzik; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 278 bytes --]
Hi Jeff,
attached you find a patch that enables link state detection for the
8139too driver. It applies cleanly against 2.5.41 and with some line
offset against 2.4.19.
I've written this stuff on a friends' computer using 2.4.18, so it is
only slightly tested.
Cheers, Stefan
[-- Attachment #2: patch-linkstate-8139too-2.5.41 --]
[-- Type: text/plain, Size: 709 bytes --]
--- linux/drivers/net/8139too.c.orig Tue Oct 1 09:05:46 2002
+++ linux/drivers/net/8139too.c Thu Oct 10 00:37:37 2002
@@ -1534,9 +1534,16 @@
struct rtl8139_private *tp,
void *ioaddr)
{
- int mii_lpa;
+ int mii_lpa, mii_bmsr;
mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA);
+ mii_bmsr = mdio_read(dev, tp->phys[0], MII_BMSR);
+
+ if (mii_bmsr & BMSR_LSTATUS && !netif_carrier_ok(dev)) {
+ netif_carrier_on(dev);
+ } else if (netif_carrier_ok(dev)) {
+ netif_carrier_off(dev);
+ }
if (!tp->mii.force_media && mii_lpa != 0xffff) {
int duplex = (mii_lpa & LPA_100FULL)
@@ -1563,7 +1570,7 @@
}
}
- next_tick = HZ * 60;
+ next_tick = HZ * 3;
rtl8139_tune_twister (dev, tp);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Patch: link state detection for 8139too against 2.5.41
2002-10-11 23:55 Patch: link state detection for 8139too against 2.5.41 Stefan Rompf
@ 2002-10-12 4:14 ` Donald Becker
2002-10-13 12:49 ` Stefan Rompf
2002-11-28 4:58 ` Jeff Garzik
0 siblings, 2 replies; 8+ messages in thread
From: Donald Becker @ 2002-10-12 4:14 UTC (permalink / raw)
To: Stefan Rompf; +Cc: jgarzik, netdev
On Sat, 12 Oct 2002, Stefan Rompf wrote:
> Date: Sat, 12 Oct 2002 01:55:04 +0200
> From: Stefan Rompf <srompf@isg.de>
> To: jgarzik@mandrakesoft.com
> Cc: netdev@oss.sgi.com
> Subject: Patch: link state detection for 8139too against 2.5.41
>
> Hi Jeff,
>
> attached you find a patch that enables link state detection for the
> 8139too driver. It applies cleanly against 2.5.41 and with some line
> offset against 2.4.19.
>
> I've written this stuff on a friends' computer using 2.4.18, so it is
> only slightly tested.
Uhmmm, you don't need to poll with the rtl8139. There is a link change
interrupt. Here is the recently added from rtl8139.c
if (status & RxUnderrun){
/* This might actually be a link change event. */
if ((tp->drv_flags & HAS_LNK_CHNG) && link_changed) {
/* Really link-change on new chips. */
int lpar = inw(ioaddr + NWayLPAR);
int duplex = (lpar&0x0100) || (lpar & 0x01C0) == 0x0040
|| tp->duplex_lock;
/* Do not use MII_BMSR as that clears sticky bit. */
if (inw(ioaddr + GPPinData) & 0x0004) {
netif_link_down(dev);
} else
netif_link_up(dev);
if (tp->msg_level & NETIF_MSG_LINK)
printk(KERN_DEBUG "%s: Link changed, link partner "
"%4.4x new duplex %d.\n",
dev->name, lpar, duplex);
tp->full_duplex = duplex;
/* Only count as errors with no link change. */
status &= ~RxUnderrun;
} else {
--
Donald Becker becker@scyld.com
Scyld Computing Corporation http://www.scyld.com
410 Severn Ave. Suite 210 Scyld Beowulf cluster system
Annapolis MD 21403 410-990-9993
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Patch: link state detection for 8139too against 2.5.41
2002-10-12 4:14 ` Donald Becker
@ 2002-10-13 12:49 ` Stefan Rompf
2002-10-14 17:42 ` Jeff Garzik
2002-11-24 12:47 ` Patch: link state detection for 8139too against 2.4.20rc2 / 2.5 Stefan Rompf
2002-11-28 4:58 ` Jeff Garzik
1 sibling, 2 replies; 8+ messages in thread
From: Stefan Rompf @ 2002-10-13 12:49 UTC (permalink / raw)
To: Donald Becker; +Cc: jgarzik, netdev
Hi,
> > I've written this stuff on a friends' computer using 2.4.18, so it is
> > only slightly tested.
>
> Uhmmm, you don't need to poll with the rtl8139. There is a link change
> interrupt. Here is the recently added from rtl8139.c
ok, I'll try this next time I have access to the card.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Patch: link state detection for 8139too against 2.5.41
2002-10-13 12:49 ` Stefan Rompf
@ 2002-10-14 17:42 ` Jeff Garzik
2002-11-24 12:47 ` Patch: link state detection for 8139too against 2.4.20rc2 / 2.5 Stefan Rompf
1 sibling, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2002-10-14 17:42 UTC (permalink / raw)
To: Stefan Rompf; +Cc: Donald Becker, netdev
Take a look at how 8139cp driver does link state... it should be an
also exact copy of 8139cp's code.
(8139cp will eventually get GMII/TBI support, but for now this statement
is correct)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Patch: link state detection for 8139too against 2.4.20rc2 / 2.5
2002-10-13 12:49 ` Stefan Rompf
2002-10-14 17:42 ` Jeff Garzik
@ 2002-11-24 12:47 ` Stefan Rompf
2002-12-09 22:36 ` Stefan Rompf
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Rompf @ 2002-11-24 12:47 UTC (permalink / raw)
To: jgarzik; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
Hi,
> > Uhmmm, you don't need to poll with the rtl8139. There is a link change
> > interrupt. Here is the recently added from rtl8139.c
>
> ok, I'll try this next time I have access to the card.
...that was some days ago. I've seen that Jeff is enhancing the MII
interface library, so I used the functions provided there. Patch is
against 2.4.20rc2 and 2.5 with some offset. Please apply if it looks
good.
Cheers, Stefan
[-- Attachment #2: patch-ls-8139too --]
[-- Type: text/plain, Size: 1326 bytes --]
--- linux/drivers/net/8139too.c.old 2002-11-19 00:32:04.000000000 +0100
+++ linux/drivers/net/8139too.c 2002-11-21 22:32:39.000000000 +0100
@@ -1335,18 +1335,7 @@
struct rtl8139_private *tp = dev->priv;
if (tp->phys[0] >= 0) {
- u16 mii_lpa = mdio_read(dev, tp->phys[0], MII_LPA);
- if (mii_lpa == 0xffff)
- ; /* Not there */
- else if ((mii_lpa & LPA_100FULL) == LPA_100FULL
- || (mii_lpa & 0x00C0) == LPA_10FULL)
- tp->mii.full_duplex = 1;
-
- printk (KERN_INFO"%s: Setting %s%s-duplex based on"
- " auto-negotiated partner ability %4.4x.\n",
- dev->name, mii_lpa == 0 ? "" :
- (mii_lpa & 0x0180) ? "100mbps " : "10mbps ",
- tp->mii.full_duplex ? "full" : "half", mii_lpa);
+ mii_check_media(&tp->mii, 1, 1);
}
}
@@ -1994,18 +1983,7 @@
if ((status & RxUnderrun) && link_changed &&
(tp->drv_flags & HAS_LNK_CHNG)) {
- /* Really link-change on new chips. */
- int lpar = RTL_R16 (NWayLPAR);
- int duplex = (lpar & LPA_100FULL) || (lpar & 0x01C0) == 0x0040
- || tp->mii.force_media;
- if (tp->mii.full_duplex != duplex) {
- tp->mii.full_duplex = duplex;
-#if 0
- RTL_W8 (Cfg9346, Cfg9346_Unlock);
- RTL_W8 (Config1, tp->mii.full_duplex ? 0x60 : 0x20);
- RTL_W8 (Cfg9346, Cfg9346_Lock);
-#endif
- }
+ rtl_check_media(dev);
status &= ~RxUnderrun;
}
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Patch: link state detection for 8139too against 2.4.20rc2 / 2.5
2002-11-24 12:47 ` Patch: link state detection for 8139too against 2.4.20rc2 / 2.5 Stefan Rompf
@ 2002-12-09 22:36 ` Stefan Rompf
2002-12-09 23:25 ` Jeff Garzik
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Rompf @ 2002-12-09 22:36 UTC (permalink / raw)
To: jgarzik; +Cc: netdev
Hi,
Jeff Garzik wrote:
> > ...that was some days ago. I've seen that Jeff is enhancing the MII
> > interface library, so I used the functions provided there. Patch is
> > against 2.4.20rc2 and 2.5 with some offset. Please apply if it looks
> > good.
[...]
> close -- you don't want to unconditionally "initialize" the media
> (mii_check_media second arg).
I've just seen the reason: No need to read the MII_ADVERTISE register
once the structure has been initialized. Expect another patch the next
days.
> the phy code is gonna be pretty darned similar. Eventually the phy code
> needs to move to a common 8139lib.c, because both old-8139 line and
May be. However, I cannot help there. I just have one card of the 8139
family, and all I could produce is some compiles for me stuff -
something that I would not consider helpful.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Patch: link state detection for 8139too against 2.4.20rc2 / 2.5
2002-12-09 22:36 ` Stefan Rompf
@ 2002-12-09 23:25 ` Jeff Garzik
0 siblings, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2002-12-09 23:25 UTC (permalink / raw)
To: Stefan Rompf; +Cc: netdev
On Mon, Dec 09, 2002 at 11:36:11PM +0100, Stefan Rompf wrote:
> Hi,
>
> Jeff Garzik wrote:
>
> > > ...that was some days ago. I've seen that Jeff is enhancing the MII
> > > interface library, so I used the functions provided there. Patch is
> > > against 2.4.20rc2 and 2.5 with some offset. Please apply if it looks
> > > good.
>
> [...]
>
> > close -- you don't want to unconditionally "initialize" the media
> > (mii_check_media second arg).
>
> I've just seen the reason: No need to read the MII_ADVERTISE register
> once the structure has been initialized. Expect another patch the next
> days.
Thanks.
> > the phy code is gonna be pretty darned similar. Eventually the phy code
> > needs to move to a common 8139lib.c, because both old-8139 line and
>
> May be. However, I cannot help there. I just have one card of the 8139
> family, and all I could produce is some compiles for me stuff -
> something that I would not consider helpful.
<shrug> I would consider it helpful. If you are willing to do the
coding and worksforme testing, I can review and do further testing.
Part of the power of open source :)
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Patch: link state detection for 8139too against 2.4.20rc2 / 2.5
2002-10-12 4:14 ` Donald Becker
2002-10-13 12:49 ` Stefan Rompf
@ 2002-11-28 4:58 ` Jeff Garzik
1 sibling, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2002-11-28 4:58 UTC (permalink / raw)
To: Stefan Rompf; +Cc: netdev
Stefan Rompf wrote:
> Hi,
>
>
> >>Uhmmm, you don't need to poll with the rtl8139. There is a link change
> >>interrupt. Here is the recently added from rtl8139.c
> >
> >ok, I'll try this next time I have access to the card.
>
>
> ...that was some days ago. I've seen that Jeff is enhancing the MII
> interface library, so I used the functions provided there. Patch is
> against 2.4.20rc2 and 2.5 with some offset. Please apply if it looks
> good.
>
> Cheers, Stefan
>
>
> ------------------------------------------------------------------------
>
> --- linux/drivers/net/8139too.c.old 2002-11-19 00:32:04.000000000 +0100
> +++ linux/drivers/net/8139too.c 2002-11-21 22:32:39.000000000 +0100
> @@ -1335,18 +1335,7 @@
> struct rtl8139_private *tp = dev->priv;
>
> if (tp->phys[0] >= 0) {
> - u16 mii_lpa = mdio_read(dev, tp->phys[0], MII_LPA);
> - if (mii_lpa == 0xffff)
> - ; /* Not there */
> - else if ((mii_lpa & LPA_100FULL) == LPA_100FULL
> - || (mii_lpa & 0x00C0) == LPA_10FULL)
> - tp->mii.full_duplex = 1;
> -
> - printk (KERN_INFO"%s: Setting %s%s-duplex based on"
> - " auto-negotiated partner ability %4.4x.\n",
> - dev->name, mii_lpa == 0 ? "" :
> - (mii_lpa & 0x0180) ? "100mbps " : "10mbps ",
> - tp->mii.full_duplex ? "full" : "half", mii_lpa);
> + mii_check_media(&tp->mii, 1, 1);
close -- you don't want to unconditionally "initialize" the media
(mii_check_media second arg).
You can also kibbitz from 8139cp.c in 2.4.20-rc4 / 2.5.<recent> because
the phy code is gonna be pretty darned similar. Eventually the phy code
needs to move to a common 8139lib.c, because both old-8139 line and
8139C+ support external MII phys as well as the normal on-chip phy found
in most 8139s.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-12-09 23:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-11 23:55 Patch: link state detection for 8139too against 2.5.41 Stefan Rompf
2002-10-12 4:14 ` Donald Becker
2002-10-13 12:49 ` Stefan Rompf
2002-10-14 17:42 ` Jeff Garzik
2002-11-24 12:47 ` Patch: link state detection for 8139too against 2.4.20rc2 / 2.5 Stefan Rompf
2002-12-09 22:36 ` Stefan Rompf
2002-12-09 23:25 ` Jeff Garzik
2002-11-28 4:58 ` Jeff Garzik
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).