2008-02-21 13:50:41

by Atsushi Nemoto

[permalink] [raw]
Subject: [PATCH] macb: Fix speed setting

Fix NCFGR.SPD setting on 10Mbps. This bug was introduced by
conversion to generic PHY layer in kernel 2.6.23.

Signed-off-by: Atsushi Nemoto <[email protected]>
---
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 81bf005..1d210ed 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -148,7 +148,7 @@ static void macb_handle_link_change(struct net_device *dev)

if (phydev->duplex)
reg |= MACB_BIT(FD);
- if (phydev->speed)
+ if (phydev->speed == SPEED_100)
reg |= MACB_BIT(SPD);

macb_writel(bp, NCFGR, reg);


2008-02-21 14:13:13

by Haavard Skinnemoen

[permalink] [raw]
Subject: Re: [PATCH] macb: Fix speed setting

On Thu, 21 Feb 2008 22:50:54 +0900 (JST)
Atsushi Nemoto <[email protected]> wrote:

> Fix NCFGR.SPD setting on 10Mbps. This bug was introduced by
> conversion to generic PHY layer in kernel 2.6.23.
>
> Signed-off-by: Atsushi Nemoto <[email protected]>
> ---
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 81bf005..1d210ed 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -148,7 +148,7 @@ static void macb_handle_link_change(struct net_device *dev)
>
> if (phydev->duplex)
> reg |= MACB_BIT(FD);
> - if (phydev->speed)
> + if (phydev->speed == SPEED_100)

I have to admit that even after looking through include/linux/phy.h and
include/linux/mii.h, I don't have the faintest idea what values we can
expect to find in the "speed" field of phydev. The comment above struct
phy_device says that it is used "like in mii_if_info", but struct
mii_if_info doesn't have a "speed" field...

I'm willing to take your word for it, but some documentation would be
really nice...

Haavard

2008-02-21 15:04:20

by Atsushi Nemoto

[permalink] [raw]
Subject: Re: [PATCH] macb: Fix speed setting

On Thu, 21 Feb 2008 15:12:46 +0100, Haavard Skinnemoen <[email protected]> wrote:
> I have to admit that even after looking through include/linux/phy.h and
> include/linux/mii.h, I don't have the faintest idea what values we can
> expect to find in the "speed" field of phydev. The comment above struct
> phy_device says that it is used "like in mii_if_info", but struct
> mii_if_info doesn't have a "speed" field...
>
> I'm willing to take your word for it, but some documentation would be
> really nice...

Well, simple grepping drivers/net/phy

2008-02-21 15:07:23

by Atsushi Nemoto

[permalink] [raw]
Subject: Re: [PATCH] macb: Fix speed setting

Excuse me for sending broken mail...

On Thu, 21 Feb 2008 15:12:46 +0100, Haavard Skinnemoen <[email protected]> wrote:
> I have to admit that even after looking through include/linux/phy.h and
> include/linux/mii.h, I don't have the faintest idea what values we can
> expect to find in the "speed" field of phydev. The comment above struct
> phy_device says that it is used "like in mii_if_info", but struct
> mii_if_info doesn't have a "speed" field...
>
> I'm willing to take your word for it, but some documentation would be
> really nice...

Well, simple grepping drivers/net/phy enlighten us ;)

Anyway, this patch fixes problem with 10Mbps on AT91SAM9260 board.

---
Atsushi Nemoto

2008-02-21 16:39:51

by Haavard Skinnemoen

[permalink] [raw]
Subject: Re: [PATCH] macb: Fix speed setting

On Fri, 22 Feb 2008 00:07:31 +0900 (JST)
Atsushi Nemoto <[email protected]> wrote:

> > I'm willing to take your word for it, but some documentation would be
> > really nice...
>
> Well, simple grepping drivers/net/phy enlighten us ;)

Yeah, the patch certainly looks correct as far as I can tell.

> Anyway, this patch fixes problem with 10Mbps on AT91SAM9260 board.

Thanks. I'll pass it on.

Haavard

2008-02-21 16:41:28

by Haavard Skinnemoen

[permalink] [raw]
Subject: [PATCH] macb: Fix speed setting

From: Atsushi Nemoto <[email protected]>

Fix NCFGR.SPD setting on 10Mbps. This bug was introduced by
conversion to generic PHY layer in kernel 2.6.23.

Signed-off-by: Atsushi Nemoto <[email protected]>
Signed-off-by: Haavard Skinnemoen <[email protected]>
---
drivers/net/macb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 81bf005..1d210ed 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -148,7 +148,7 @@ static void macb_handle_link_change(struct net_device *dev)

if (phydev->duplex)
reg |= MACB_BIT(FD);
- if (phydev->speed)
+ if (phydev->speed == SPEED_100)
reg |= MACB_BIT(SPD);

macb_writel(bp, NCFGR, reg);
--
1.5.4.1

2008-02-22 09:06:23

by Haavard Skinnemoen

[permalink] [raw]
Subject: Re: [PATCH] macb: Fix speed setting

On Thu, 21 Feb 2008 17:41:05 +0100
Haavard Skinnemoen <[email protected]> wrote:

> From: Atsushi Nemoto <[email protected]>
>
> Fix NCFGR.SPD setting on 10Mbps. This bug was introduced by
> conversion to generic PHY layer in kernel 2.6.23.
>
> Signed-off-by: Atsushi Nemoto <[email protected]>
> Signed-off-by: Haavard Skinnemoen <[email protected]>
> ---

Btw, in case it wasn't clear, I want this to go into your "fixes" queue
and merged before 2.6.25 since it fixes a bug that prevents the driver
from working on 10Mbps networks. I'll send the patch to the stable team
after it hits mainline.

Thanks!

Haavard

2008-02-23 08:06:51

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] macb: Fix speed setting

On Thu, 21 Feb 2008 17:41:05 +0100 Haavard Skinnemoen <[email protected]> wrote:

> From: Atsushi Nemoto <[email protected]>
>
> Fix NCFGR.SPD setting on 10Mbps. This bug was introduced by
> conversion to generic PHY layer in kernel 2.6.23.

So.. shouldn't we fix it in 2.6.23.x and 2.6.24.x?

> Signed-off-by: Atsushi Nemoto <[email protected]>
> Signed-off-by: Haavard Skinnemoen <[email protected]>
> ---
> drivers/net/macb.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 81bf005..1d210ed 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -148,7 +148,7 @@ static void macb_handle_link_change(struct net_device *dev)
>
> if (phydev->duplex)
> reg |= MACB_BIT(FD);
> - if (phydev->speed)
> + if (phydev->speed == SPEED_100)
> reg |= MACB_BIT(SPD);
>
> macb_writel(bp, NCFGR, reg);

2008-02-24 00:50:45

by Haavard Skinnemoen

[permalink] [raw]
Subject: Re: [PATCH] macb: Fix speed setting

On Sat, 23 Feb 2008 00:03:23 -0800
Andrew Morton <[email protected]> wrote:

> On Thu, 21 Feb 2008 17:41:05 +0100 Haavard Skinnemoen <[email protected]> wrote:
>
> > From: Atsushi Nemoto <[email protected]>
> >
> > Fix NCFGR.SPD setting on 10Mbps. This bug was introduced by
> > conversion to generic PHY layer in kernel 2.6.23.
>
> So.. shouldn't we fix it in 2.6.23.x and 2.6.24.x?

Absolutely. I'll send it to the stable team after it hits mainline.

Haavard

2008-02-24 05:12:10

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] macb: Fix speed setting

Atsushi Nemoto wrote:
> Fix NCFGR.SPD setting on 10Mbps. This bug was introduced by
> conversion to generic PHY layer in kernel 2.6.23.
>
> Signed-off-by: Atsushi Nemoto <[email protected]>
> ---
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 81bf005..1d210ed 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -148,7 +148,7 @@ static void macb_handle_link_change(struct net_device *dev)
>
> if (phydev->duplex)
> reg |= MACB_BIT(FD);
> - if (phydev->speed)
> + if (phydev->speed == SPEED_100)
> reg |= MACB_BIT(SPD);

applied