netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode
@ 2010-12-14  7:36 David Lv
  0 siblings, 0 replies; 10+ messages in thread
From: David Lv @ 2010-12-14  7:36 UTC (permalink / raw)
  To: netdev, romieu, DavidLv, ShirleyHu, AndersMa

This patch isn't based on the first patch of the sleep speed 10M.
The VIA velocity card can't be waken up by WOL tool on 1000M full
duplex forced mode.
This patch fixes the bug.
Thanks!

Signed-off-by: David Lv <DavidLv@viatech.com.cn>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
---
 drivers/net/via-velocity.c |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index cab96ad..947af49 100755
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2925,6 +2925,7 @@ static int velocity_set_wol(struct velocity_info *vptr)
 	struct mac_regs __iomem *regs = vptr->mac_regs;
 	static u8 buf[256];
 	int i;
+	u8 GCR;

 	static u32 mask_pattern[2][4] = {
 		{0x00203000, 0x000003C0, 0x00000000, 0x0000000}, /* ARP */
@@ -2968,23 +2969,31 @@ static int velocity_set_wol(struct velocity_info *vptr)

 	writew(0x0FFF, &regs->WOLSRClr);

-	if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
-		if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
-			MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG, vptr->mac_regs);
-
-		MII_REG_BITS_OFF(ADVERTISE_1000FULL | ADVERTISE_1000HALF,
MII_CTRL1000, vptr->mac_regs);
-	}
+	if (SPD_DPX_1000_FULL != pInfo->hw.sOpts.spd_dpx) {
+		if (SPD_DPX_AUTO == pInfo->hw.sOpts.spd_dpx) {
+			if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
+				if (PHYID_GET_PHY_ID(vptr->phy_id) ==
+						PHYID_CICADA_CS8201)
+					MII_REG_BITS_ON(AUXCR_MDPPS,
+					MII_NCONFIG, vptr->mac_regs);
+
+				MII_REG_BITS_OFF(ADVERTISE_1000FULL |
+					ADVERTISE_1000HALF, MII_CTRL1000,
+					vptr->mac_regs);
+			}

-	if (vptr->mii_status & VELOCITY_SPEED_1000)
-		MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR, vptr->mac_regs);
+			if (vptr->mii_status & VELOCITY_SPEED_1000)
+				MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR,
+					vptr->mac_regs);
+		}

-	BYTE_REG_BITS_ON(CHIPGCR_FCMODE, &regs->CHIPGCR);
+		BYTE_REG_BITS_ON(CHIPGCR_FCMODE, &regs->CHIPGCR);

-	{
-		u8 GCR;
-		GCR = readb(&regs->CHIPGCR);
-		GCR = (GCR & ~CHIPGCR_FCGMII) | CHIPGCR_FCFDX;
-		writeb(GCR, &regs->CHIPGCR);
+		{
+			GCR = readb(&regs->CHIPGCR);
+			GCR = (GCR & ~CHIPGCR_FCGMII) | CHIPGCR_FCFDX;
+			writeb(GCR, &regs->CHIPGCR);
+		}
 	}

 	BYTE_REG_BITS_OFF(ISR_PWEI, &regs->ISR);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode
@ 2010-12-16  9:33 David Lv
  2010-12-16 18:34 ` Jan Ceuleers
  0 siblings, 1 reply; 10+ messages in thread
From: David Lv @ 2010-12-16  9:33 UTC (permalink / raw)
  To: netdev, romieu

This patch isn't based on the first patch of the sleep speed 10M.
The VIA velocity card can't be waken up by WOL tool on 1000M full
duplex forced mode.
This patch fixes the bug.
Thanks!

Signed-off-by: David Lv <DavidLv@viatech.com.cn>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
---
 drivers/net/via-velocity.c |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index cab96ad..947af49 100755
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2925,6 +2925,7 @@ static int velocity_set_wol(struct velocity_info *vptr)
       struct mac_regs __iomem *regs = vptr->mac_regs;
       static u8 buf[256];
       int i;
+       u8 GCR;

       static u32 mask_pattern[2][4] = {
               {0x00203000, 0x000003C0, 0x00000000, 0x0000000}, /* ARP */
@@ -2968,23 +2969,31 @@ static int velocity_set_wol(struct velocity_info *vptr)

       writew(0x0FFF, &regs->WOLSRClr);

-       if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
-               if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
-                       MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG,
vptr->mac_regs);
-
-               MII_REG_BITS_OFF(ADVERTISE_1000FULL |
ADVERTISE_1000HALF, MII_CTRL1000, vptr->mac_regs);
-       }
+       if (SPD_DPX_1000_FULL != vptr->options.spd_dpx) {
+               if (SPD_DPX_AUTO == vptr->options.spd_dpx) {
+                       if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
+                               if (PHYID_GET_PHY_ID(vptr->phy_id) ==
+                                               PHYID_CICADA_CS8201)
+                                       MII_REG_BITS_ON(AUXCR_MDPPS,
+                                       MII_NCONFIG, vptr->mac_regs);
+
+                               MII_REG_BITS_OFF(ADVERTISE_1000FULL |
+                                       ADVERTISE_1000HALF, MII_CTRL1000,
+                                       vptr->mac_regs);
+                       }

-       if (vptr->mii_status & VELOCITY_SPEED_1000)
-               MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR, vptr->mac_regs);
+                       if (vptr->mii_status & VELOCITY_SPEED_1000)
+                               MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR,
+                                       vptr->mac_regs);
+               }

-       BYTE_REG_BITS_ON(CHIPGCR_FCMODE, &regs->CHIPGCR);
+               BYTE_REG_BITS_ON(CHIPGCR_FCMODE, &regs->CHIPGCR);

-       {
-               u8 GCR;
-               GCR = readb(&regs->CHIPGCR);
-               GCR = (GCR & ~CHIPGCR_FCGMII) | CHIPGCR_FCFDX;
-               writeb(GCR, &regs->CHIPGCR);
+               {
+                       GCR = readb(&regs->CHIPGCR);
+                       GCR = (GCR & ~CHIPGCR_FCGMII) | CHIPGCR_FCFDX;
+                       writeb(GCR, &regs->CHIPGCR);
+               }
       }

       BYTE_REG_BITS_OFF(ISR_PWEI, &regs->ISR);
--
1.7.0.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode
  2010-12-16  9:33 [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode David Lv
@ 2010-12-16 18:34 ` Jan Ceuleers
  2010-12-17  8:25   ` David Lv
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Ceuleers @ 2010-12-16 18:34 UTC (permalink / raw)
  To: David Lv; +Cc: netdev, romieu

On 16/12/10 10:33, David Lv wrote:
> This patch isn't based on the first patch of the sleep speed 10M.
> The VIA velocity card can't be waken up by WOL tool on 1000M full
> duplex forced mode.
> This patch fixes the bug.
> Thanks!

This patch is whitespace-damaged. Your previous version (14 December) 
wasn't. Why did you resend? Is there a difference?

Thx, Jan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode
  2010-12-16 18:34 ` Jan Ceuleers
@ 2010-12-17  8:25   ` David Lv
  2010-12-17 18:50     ` Jan Ceuleers
  2010-12-17 19:57     ` David Miller
  0 siblings, 2 replies; 10+ messages in thread
From: David Lv @ 2010-12-17  8:25 UTC (permalink / raw)
  To: Jan Ceuleers, netdev, romieu

I am very Sorry to cause you some trouble.
There are some differences with this version and previous version.

} else if (SPD_DPX_1000_FULL != pInfo->hw.sOpts.spd_dpx) {
+		if (SPD_DPX_AUTO == pInfo->hw.sOpts.spd_dpx) {

changed to

} else if (SPD_DPX_1000_FULL != vptr->options.spd_dpx) {
+		if (SPD_DPX_AUTO == vptr->options.spd_dpx) {




2010/12/17 Jan Ceuleers <jan.ceuleers@computer.org>:
> On 16/12/10 10:33, David Lv wrote:
>>
>> This patch isn't based on the first patch of the sleep speed 10M.
>> The VIA velocity card can't be waken up by WOL tool on 1000M full
>> duplex forced mode.
>> This patch fixes the bug.
>> Thanks!
>
> This patch is whitespace-damaged. Your previous version (14 December)
> wasn't. Why did you resend? Is there a difference?
>
> Thx, Jan
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode
  2010-12-17  8:25   ` David Lv
@ 2010-12-17 18:50     ` Jan Ceuleers
  2010-12-17 19:57     ` David Miller
  1 sibling, 0 replies; 10+ messages in thread
From: Jan Ceuleers @ 2010-12-17 18:50 UTC (permalink / raw)
  To: David Lv; +Cc: netdev, romieu

On 17/12/10 09:25, David Lv wrote:
> I am very Sorry to cause you some trouble.

David, I'm not complaining; just trying to help.

> There are some differences with this version and previous version.

In that case you will need to resubmit it (without the whitespace 
damage) for David Miller to be able to apply it.

HTH, Jan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode
  2010-12-17  8:25   ` David Lv
  2010-12-17 18:50     ` Jan Ceuleers
@ 2010-12-17 19:57     ` David Miller
  1 sibling, 0 replies; 10+ messages in thread
From: David Miller @ 2010-12-17 19:57 UTC (permalink / raw)
  To: davidlv.linux; +Cc: jan.ceuleers, netdev, romieu

From: David Lv <davidlv.linux@gmail.com>
Date: Fri, 17 Dec 2010 16:25:55 +0800

> I am very Sorry to cause you some trouble.
> There are some differences with this version and previous version.
> 
> } else if (SPD_DPX_1000_FULL != pInfo->hw.sOpts.spd_dpx) {
> +		if (SPD_DPX_AUTO == pInfo->hw.sOpts.spd_dpx) {
> 
> changed to
> 
> } else if (SPD_DPX_1000_FULL != vptr->options.spd_dpx) {
> +		if (SPD_DPX_AUTO == vptr->options.spd_dpx) {

Can you please also fix up the indentation of the code you
are adding?  The indentation of MII_REG_BITS_ON() when you split
it up into multiple lines looks terrible.

I know you want to prevent long lines, but the result is worse
than a long line.

The indentation is much deeper now because you're putting already
deeply indented code under a new conditional, the 1000_FULL test.

So to keep this from looking ugly you have two choices:

1) Use goto:

	if (SPD_DPX_1000_FULL == pInfo->hw.sOpts.spd_dpx)
		goto skip;

	existing code...

	skip:

2) Put the inner logic into a helper function, and call that when
   the new conditional passes.

Thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode.
@ 2011-01-20 14:59 Francois Romieu
  2011-01-21  0:56 ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Francois Romieu @ 2011-01-20 14:59 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, David Lv

The VIA velocity card can't be waken up by WOL tool on 1000M full
duplex forced mode. This patch fixes the bug.

Signed-off-by: David Lv <DavidLv@viatech.com.cn>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
---
 drivers/net/via-velocity.c |    9 +++++++++
 drivers/net/via-velocity.h |    8 ++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 09cac70..0d6fec6 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2923,6 +2923,7 @@ static u16 wol_calc_crc(int size, u8 *pattern, u8 *mask_pattern)
 static int velocity_set_wol(struct velocity_info *vptr)
 {
 	struct mac_regs __iomem *regs = vptr->mac_regs;
+	enum speed_opt spd_dpx = vptr->options.spd_dpx;
 	static u8 buf[256];
 	int i;
 
@@ -2968,6 +2969,12 @@ static int velocity_set_wol(struct velocity_info *vptr)
 
 	writew(0x0FFF, &regs->WOLSRClr);
 
+	if (spd_dpx == SPD_DPX_1000_FULL)
+		goto mac_done;
+
+	if (spd_dpx != SPD_DPX_AUTO)
+		goto advertise_done;
+
 	if (vptr->mii_status & VELOCITY_AUTONEG_ENABLE) {
 		if (PHYID_GET_PHY_ID(vptr->phy_id) == PHYID_CICADA_CS8201)
 			MII_REG_BITS_ON(AUXCR_MDPPS, MII_NCONFIG, vptr->mac_regs);
@@ -2978,6 +2985,7 @@ static int velocity_set_wol(struct velocity_info *vptr)
 	if (vptr->mii_status & VELOCITY_SPEED_1000)
 		MII_REG_BITS_ON(BMCR_ANRESTART, MII_BMCR, vptr->mac_regs);
 
+advertise_done:
 	BYTE_REG_BITS_ON(CHIPGCR_FCMODE, &regs->CHIPGCR);
 
 	{
@@ -2987,6 +2995,7 @@ static int velocity_set_wol(struct velocity_info *vptr)
 		writeb(GCR, &regs->CHIPGCR);
 	}
 
+mac_done:
 	BYTE_REG_BITS_OFF(ISR_PWEI, &regs->ISR);
 	/* Turn on SWPTAG just before entering power mode */
 	BYTE_REG_BITS_ON(STICKHW_SWPTAG, &regs->STICKHW);
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index aa2e69b..d722753 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -361,7 +361,7 @@ enum  velocity_owner {
 #define MAC_REG_CHIPGSR     0x9C
 #define MAC_REG_TESTCFG     0x9D
 #define MAC_REG_DEBUG       0x9E
-#define MAC_REG_CHIPGCR     0x9F
+#define MAC_REG_CHIPGCR     0x9F	/* Chip Operation and Diagnostic Control */
 #define MAC_REG_WOLCR0_SET  0xA0
 #define MAC_REG_WOLCR1_SET  0xA1
 #define MAC_REG_PWCFG_SET   0xA2
@@ -848,10 +848,10 @@ enum  velocity_owner {
  *	Bits in CHIPGCR register
  */
 
-#define CHIPGCR_FCGMII      0x80	/* enable GMII mode */
-#define CHIPGCR_FCFDX       0x40
+#define CHIPGCR_FCGMII      0x80	/* force GMII (else MII only) */
+#define CHIPGCR_FCFDX       0x40	/* force full duplex */
 #define CHIPGCR_FCRESV      0x20
-#define CHIPGCR_FCMODE      0x10
+#define CHIPGCR_FCMODE      0x10	/* enable MAC forced mode */
 #define CHIPGCR_LPSOPT      0x08
 #define CHIPGCR_TM1US       0x04
 #define CHIPGCR_TM0US       0x02
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode.
  2011-01-20 14:59 Francois Romieu
@ 2011-01-21  0:56 ` David Miller
  2011-03-23 10:07   ` David Lv
  0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2011-01-21  0:56 UTC (permalink / raw)
  To: romieu; +Cc: netdev, DavidLv

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Thu, 20 Jan 2011 15:59:33 +0100

> The VIA velocity card can't be waken up by WOL tool on 1000M full
> duplex forced mode. This patch fixes the bug.
> 
> Signed-off-by: David Lv <DavidLv@viatech.com.cn>
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>

Applied.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode.
  2011-01-21  0:56 ` David Miller
@ 2011-03-23 10:07   ` David Lv
  2011-03-23 19:25     ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: David Lv @ 2011-03-23 10:07 UTC (permalink / raw)
  To: David Miller, netdev, DavidLv

Hi, David. I haven't found out this patch code in the mainline of 2.6.38.
Could you help me check it?
Thanks!


Best regards



2011/1/21 David Miller <davem@davemloft.net>:
> From: Francois Romieu <romieu@fr.zoreil.com>
> Date: Thu, 20 Jan 2011 15:59:33 +0100
>
>> The VIA velocity card can't be waken up by WOL tool on 1000M full
>> duplex forced mode. This patch fixes the bug.
>>
>> Signed-off-by: David Lv <DavidLv@viatech.com.cn>
>> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
>
> Applied.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode.
  2011-03-23 10:07   ` David Lv
@ 2011-03-23 19:25     ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2011-03-23 19:25 UTC (permalink / raw)
  To: davidlv.linux; +Cc: netdev, DavidLv

From: David Lv <davidlv.linux@gmail.com>
Date: Wed, 23 Mar 2011 18:07:54 +0800

> Hi, David. I haven't found out this patch code in the mainline of 2.6.38.
> Could you help me check it?

It's there in Linus's tree, it did not make it into 2.6.38:

commit 2ffa007eaa01cf5fedd6a71f7d43854339a831ee
Author: françois romieu <romieu@fr.zoreil.com>
Date:   Thu Jan 20 04:59:33 2011 +0000

    via-velocity: fix the WOL bug on 1000M full duplex forced mode.
    
    The VIA velocity card can't be waken up by WOL tool on 1000M full
    duplex forced mode. This patch fixes the bug.
    
    Signed-off-by: David Lv <DavidLv@viatech.com.cn>
    Acked-by: Francois Romieu <romieu@fr.zoreil.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-03-23 19:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16  9:33 [PATCH] via-velocity: fix the WOL bug on 1000M full duplex forced mode David Lv
2010-12-16 18:34 ` Jan Ceuleers
2010-12-17  8:25   ` David Lv
2010-12-17 18:50     ` Jan Ceuleers
2010-12-17 19:57     ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2011-01-20 14:59 Francois Romieu
2011-01-21  0:56 ` David Miller
2011-03-23 10:07   ` David Lv
2011-03-23 19:25     ` David Miller
2010-12-14  7:36 David Lv

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).