2007-08-22 09:02:50

by Willy Tarreau

[permalink] [raw]
Subject: [2.6.20.17 review 35/58] forcedeth bug fix: realtek phy

This patch contains errata fixes for the realtek phy. It only renamed the
defines to be phy specific.

Signed-off-by: Ayaz Abdulla <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Willy Tarreau <[email protected]>
---
drivers/net/forcedeth.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index c383dc3..dbfdbed 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -554,6 +554,7 @@ union ring_type {
#define PHY_OUI_MARVELL 0x5043
#define PHY_OUI_CICADA 0x03f1
#define PHY_OUI_VITESSE 0x01c1
+#define PHY_OUI_REALTEK 0x01c1
#define PHYID1_OUI_MASK 0x03ff
#define PHYID1_OUI_SHFT 6
#define PHYID2_OUI_MASK 0xfc00
@@ -583,6 +584,13 @@ union ring_type {
#define PHY_VITESSE_INIT8 0x0100
#define PHY_VITESSE_INIT9 0x8f82
#define PHY_VITESSE_INIT10 0x0
+#define PHY_REALTEK_INIT_REG1 0x1f
+#define PHY_REALTEK_INIT_REG2 0x19
+#define PHY_REALTEK_INIT_REG3 0x13
+#define PHY_REALTEK_INIT1 0x0000
+#define PHY_REALTEK_INIT2 0x8e00
+#define PHY_REALTEK_INIT3 0x0001
+#define PHY_REALTEK_INIT4 0xad17

#define PHY_GIGABIT 0x0100

@@ -1106,6 +1114,28 @@ static int phy_init(struct net_device *dev)
return PHY_ERROR;
}
}
+ if (np->phy_oui == PHY_OUI_REALTEK) {
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG2, PHY_REALTEK_INIT2)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT3)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG3, PHY_REALTEK_INIT4)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ }

/* set advertise register */
reg = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
@@ -1242,6 +1272,30 @@ static int phy_init(struct net_device *dev)
return PHY_ERROR;
}
}
+ if (np->phy_oui == PHY_OUI_REALTEK) {
+ /* reset could have cleared these out, set them back */
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG2, PHY_REALTEK_INIT2)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT3)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG3, PHY_REALTEK_INIT4)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
+ printk(KERN_INFO "%s: phy init failed.
", pci_name(np->pci_dev));
+ return PHY_ERROR;
+ }
+ }
+
/* some phys clear out pause advertisment on reset, set it back */
mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg);

--
1.5.2.5

--


2007-08-22 15:57:16

by Chuck Ebbert

[permalink] [raw]
Subject: Re: [2.6.20.17 review 35/58] forcedeth bug fix: realtek phy

On 08/22/2007 05:39 AM, Willy Tarreau wrote:
> This patch contains errata fixes for the realtek phy. It only renamed the
> defines to be phy specific.
>
> Signed-off-by: Ayaz Abdulla <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Willy Tarreau <[email protected]>
> ---
> drivers/net/forcedeth.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 54 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
> index c383dc3..dbfdbed 100644
> --- a/drivers/net/forcedeth.c
> +++ b/drivers/net/forcedeth.c
> @@ -554,6 +554,7 @@ union ring_type {
> #define PHY_OUI_MARVELL 0x5043
> #define PHY_OUI_CICADA 0x03f1
> #define PHY_OUI_VITESSE 0x01c1
> +#define PHY_OUI_REALTEK 0x01c1
> #define PHYID1_OUI_MASK 0x03ff
> #define PHYID1_OUI_SHFT 6
> #define PHYID2_OUI_MASK 0xfc00

Realtek is 0x0732

This is still wrong upstream -- what happened to the patch to fix it?


2007-08-22 16:23:47

by Willy Tarreau

[permalink] [raw]
Subject: Re: [2.6.20.17 review 35/58] forcedeth bug fix: realtek phy

On Wed, Aug 22, 2007 at 11:56:42AM -0400, Chuck Ebbert wrote:
> On 08/22/2007 05:39 AM, Willy Tarreau wrote:
> > This patch contains errata fixes for the realtek phy. It only renamed the
> > defines to be phy specific.
> >
> > Signed-off-by: Ayaz Abdulla <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
> > Signed-off-by: Willy Tarreau <[email protected]>
> > ---
> > drivers/net/forcedeth.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++
> > 1 files changed, 54 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
> > index c383dc3..dbfdbed 100644
> > --- a/drivers/net/forcedeth.c
> > +++ b/drivers/net/forcedeth.c
> > @@ -554,6 +554,7 @@ union ring_type {
> > #define PHY_OUI_MARVELL 0x5043
> > #define PHY_OUI_CICADA 0x03f1
> > #define PHY_OUI_VITESSE 0x01c1
> > +#define PHY_OUI_REALTEK 0x01c1
> > #define PHYID1_OUI_MASK 0x03ff
> > #define PHYID1_OUI_SHFT 6
> > #define PHYID2_OUI_MASK 0xfc00
>
> Realtek is 0x0732
>
> This is still wrong upstream -- what happened to the patch to fix it?

Good catch, thanks Chuck! I've already seen the fix somewhere, I believe it
was on netdev, though I'm not sure. I'm fixing the patch in place right now.
I can add your signoff if you want.

Cheers,
Willy

2007-08-22 18:15:27

by Prakash Punnoor

[permalink] [raw]
Subject: Re: [2.6.20.17 review 35/58] forcedeth bug fix: realtek phy

Hi,

even if Greg is waiting for some special invitation
(http://lkml.org/lkml/2007/8/14/229), I suggest putting this patch by Ayaz on
top:

http://lkml.org/lkml/2007/8/10/296

Perhaps Ayaz wants to give Greg the clarification he needs... :sigh:

bye,

Prakash


On the day of Wednesday 22 August 2007 Willy Tarreau hast written:
> This patch contains errata fixes for the realtek phy. It only renamed the
> defines to be phy specific.
>
> Signed-off-by: Ayaz Abdulla <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Willy Tarreau <[email protected]>
> ---
> drivers/net/forcedeth.c | 54
> +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 54
> insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
> index c383dc3..dbfdbed 100644
> --- a/drivers/net/forcedeth.c
> +++ b/drivers/net/forcedeth.c
> @@ -554,6 +554,7 @@ union ring_type {
> #define PHY_OUI_MARVELL 0x5043
> #define PHY_OUI_CICADA 0x03f1
> #define PHY_OUI_VITESSE 0x01c1
> +#define PHY_OUI_REALTEK 0x01c1
> #define PHYID1_OUI_MASK 0x03ff
> #define PHYID1_OUI_SHFT 6
> #define PHYID2_OUI_MASK 0xfc00
> @@ -583,6 +584,13 @@ union ring_type {
> #define PHY_VITESSE_INIT8 0x0100
> #define PHY_VITESSE_INIT9 0x8f82
> #define PHY_VITESSE_INIT10 0x0
> +#define PHY_REALTEK_INIT_REG1 0x1f
> +#define PHY_REALTEK_INIT_REG2 0x19
> +#define PHY_REALTEK_INIT_REG3 0x13
> +#define PHY_REALTEK_INIT1 0x0000
> +#define PHY_REALTEK_INIT2 0x8e00
> +#define PHY_REALTEK_INIT3 0x0001
> +#define PHY_REALTEK_INIT4 0xad17
>
> #define PHY_GIGABIT 0x0100
>
> @@ -1106,6 +1114,28 @@ static int phy_init(struct net_device *dev)
> return PHY_ERROR;
> }
> }
> + if (np->phy_oui == PHY_OUI_REALTEK) {
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG2, PHY_REALTEK_INIT2))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT3))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG3, PHY_REALTEK_INIT4))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + }
>
> /* set advertise register */
> reg = mii_rw(dev, np->phyaddr, MII_ADVERTISE, MII_READ);
> @@ -1242,6 +1272,30 @@ static int phy_init(struct net_device *dev)
> return PHY_ERROR;
> }
> }
> + if (np->phy_oui == PHY_OUI_REALTEK) {
> + /* reset could have cleared these out, set them back */
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG2, PHY_REALTEK_INIT2))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT3))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG3, PHY_REALTEK_INIT4))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1))
> { + printk(KERN_INFO "%s: phy init failed.
> ", pci_name(np->pci_dev));
> + return PHY_ERROR;
> + }
> + }
> +
> /* some phys clear out pause advertisment on reset, set it back */
> mii_rw(dev, np->phyaddr, MII_ADVERTISE, reg);
>
> --
> 1.5.2.5



--
(?= =?)
//\ Prakash Punnoor /\\
V_/ \_V


Attachments:
(No filename) (4.03 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-08-22 20:56:12

by Willy Tarreau

[permalink] [raw]
Subject: Re: [2.6.20.17 review 35/58] forcedeth bug fix: realtek phy

On Wed, Aug 22, 2007 at 08:15:03PM +0200, Prakash Punnoor wrote:
> Hi,
>
> even if Greg is waiting for some special invitation
> (http://lkml.org/lkml/2007/8/14/229), I suggest putting this patch by Ayaz on
> top:
>
> http://lkml.org/lkml/2007/8/10/296

That's what I prepare first, but then noticed it's not in mainline.

> Perhaps Ayaz wants to give Greg the clarification he needs... :sigh:

He should, as the fix is not in mainline either :-(
I don't think Greg asks for specific clarification, just a plain patch
with a short commit log on its own which does not include remains of
older mails.

I'm holding up the patch until I get confirmation that it is *at least*
queued for mainline, otherwise it will definitely be missing from
mainline.

Thanks Prakash for the pointers above.
Willy

2007-08-22 23:17:36

by Greg KH

[permalink] [raw]
Subject: Re: [2.6.20.17 review 35/58] forcedeth bug fix: realtek phy

On Wed, Aug 22, 2007 at 10:42:25PM +0200, Willy Tarreau wrote:
> On Wed, Aug 22, 2007 at 08:15:03PM +0200, Prakash Punnoor wrote:
> > Hi,
> >
> > even if Greg is waiting for some special invitation
> > (http://lkml.org/lkml/2007/8/14/229), I suggest putting this patch by Ayaz on
> > top:
> >
> > http://lkml.org/lkml/2007/8/10/296
>
> That's what I prepare first, but then noticed it's not in mainline.
>
> > Perhaps Ayaz wants to give Greg the clarification he needs... :sigh:
>
> He should, as the fix is not in mainline either :-(
> I don't think Greg asks for specific clarification, just a plain patch
> with a short commit log on its own which does not include remains of
> older mails.

Exactly, that is what I am waiting for.

And also I need the change to go into mainline first, as we can not
diverge with the -stable releases.

thanks,

greg k-h

2007-08-23 15:51:22

by Prakash Punnoor

[permalink] [raw]
Subject: Re: [2.6.20.17 review 35/58] forcedeth bug fix: realtek phy

On the day of Thursday 23 August 2007 Greg KH hast written:
> On Wed, Aug 22, 2007 at 10:42:25PM +0200, Willy Tarreau wrote:
> > On Wed, Aug 22, 2007 at 08:15:03PM +0200, Prakash Punnoor wrote:
> > > Hi,
> > >
> > > even if Greg is waiting for some special invitation
> > > (http://lkml.org/lkml/2007/8/14/229), I suggest putting this patch by
> > > Ayaz on top:
> > >
> > > http://lkml.org/lkml/2007/8/10/296
> >
> > That's what I prepare first, but then noticed it's not in mainline.
> >
> > > Perhaps Ayaz wants to give Greg the clarification he needs... :sigh:
> >
> > He should, as the fix is not in mainline either :-(
> > I don't think Greg asks for specific clarification, just a plain patch
> > with a short commit log on its own which does not include remains of
> > older mails.
>
> Exactly, that is what I am waiting for.
>
> And also I need the change to go into mainline first, as we can not
> diverge with the -stable releases.

Can we get that into mainline then? I haven't seen forcedeth in MAINTAINERS,
so I added netdev to the cc list.

bye,
--
(?= =?)
//\ Prakash Punnoor /\\
V_/ \_V


Attachments:
(No filename) (1.11 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-08-23 18:07:40

by Greg KH

[permalink] [raw]
Subject: Re: [stable] [2.6.20.17 review 35/58] forcedeth bug fix: realtek phy

On Thu, Aug 23, 2007 at 05:50:41PM +0200, Prakash Punnoor wrote:
> On the day of Thursday 23 August 2007 Greg KH hast written:
> > On Wed, Aug 22, 2007 at 10:42:25PM +0200, Willy Tarreau wrote:
> > > On Wed, Aug 22, 2007 at 08:15:03PM +0200, Prakash Punnoor wrote:
> > > > Hi,
> > > >
> > > > even if Greg is waiting for some special invitation
> > > > (http://lkml.org/lkml/2007/8/14/229), I suggest putting this patch by
> > > > Ayaz on top:
> > > >
> > > > http://lkml.org/lkml/2007/8/10/296
> > >
> > > That's what I prepare first, but then noticed it's not in mainline.
> > >
> > > > Perhaps Ayaz wants to give Greg the clarification he needs... :sigh:
> > >
> > > He should, as the fix is not in mainline either :-(
> > > I don't think Greg asks for specific clarification, just a plain patch
> > > with a short commit log on its own which does not include remains of
> > > older mails.
> >
> > Exactly, that is what I am waiting for.
> >
> > And also I need the change to go into mainline first, as we can not
> > diverge with the -stable releases.
>
> Can we get that into mainline then? I haven't seen forcedeth in MAINTAINERS,
> so I added netdev to the cc list.

It might help if someone sends a real patch that can be applied :)

thanks,

greg k-h

2007-08-23 19:45:39

by Willy Tarreau

[permalink] [raw]
Subject: [PATCH] fix realtek phy id in forcedeth

Hi Greg,

On Thu, Aug 23, 2007 at 09:55:13AM -0700, Greg KH wrote:
> It might help if someone sends a real patch that can be applied :)

This is getting really silly now :-) We're all wasting more time
wondering who will send the patch than posting it. I've lost, I got
fed up first, so here it is. Please apply to mainline then stable.

Thanks,
Willy

--

>From a0e2922b99eedd9863232368ea2afe072c52783e Mon Sep 17 00:00:00 2001
From: Willy Tarreau <[email protected]>
Date: Thu, 23 Aug 2007 21:35:41 +0200
Subject: [PATCH] fix realtek phy id in forcedeth

As noticed by Chuck Ebbert, commit c5e3ae8823693b260ce1f217adca8add1bc0b3de
introduced a copy-paste typo, as realtek phy is 0x732 and not 0x1c1. Obvious
fix below suggested by Ayaz Abdulla.

Signed-off-by: Willy Tarreau <[email protected]>
Cc: Ayaz Abdulla <[email protected]>
Cc: Chuck Ebbert <[email protected]>
---
drivers/net/forcedeth.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 10f4e3b..1938d6d 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -552,7 +552,7 @@ union ring_type {
#define PHY_OUI_MARVELL 0x5043
#define PHY_OUI_CICADA 0x03f1
#define PHY_OUI_VITESSE 0x01c1
-#define PHY_OUI_REALTEK 0x01c1
+#define PHY_OUI_REALTEK 0x0732
#define PHYID1_OUI_MASK 0x03ff
#define PHYID1_OUI_SHFT 6
#define PHYID2_OUI_MASK 0xfc00
--
1.5.2.5

2007-08-25 04:02:13

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] fix realtek phy id in forcedeth

Willy Tarreau wrote:
> Hi Greg,
>
> On Thu, Aug 23, 2007 at 09:55:13AM -0700, Greg KH wrote:
>> It might help if someone sends a real patch that can be applied :)
>
> This is getting really silly now :-) We're all wasting more time
> wondering who will send the patch than posting it. I've lost, I got
> fed up first, so here it is. Please apply to mainline then stable.
>
> Thanks,
> Willy
>
> --
>
>>From a0e2922b99eedd9863232368ea2afe072c52783e Mon Sep 17 00:00:00 2001
> From: Willy Tarreau <[email protected]>
> Date: Thu, 23 Aug 2007 21:35:41 +0200
> Subject: [PATCH] fix realtek phy id in forcedeth
>
> As noticed by Chuck Ebbert, commit c5e3ae8823693b260ce1f217adca8add1bc0b3de
> introduced a copy-paste typo, as realtek phy is 0x732 and not 0x1c1. Obvious
> fix below suggested by Ayaz Abdulla.
>
> Signed-off-by: Willy Tarreau <[email protected]>
> Cc: Ayaz Abdulla <[email protected]>
> Cc: Chuck Ebbert <[email protected]>
> ---
> drivers/net/forcedeth.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)

applied