diff mbox

via-velocity: fix the WOL bug on 1000M full duplex forced mode

Message ID AANLkTi=-MRrH1nCcbzqUMoP1sd=7opNGAz7KwmdoMmjA@mail.gmail.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

David Lv Dec. 16, 2010, 9:33 a.m. UTC
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(-)


       BYTE_REG_BITS_OFF(ISR_PWEI, &regs->ISR);
--
1.7.0.4
--
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

Comments

Jan Ceuleers Dec. 16, 2010, 6:34 p.m. UTC | #1
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
--
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
David Lv Dec. 17, 2010, 8:25 a.m. UTC | #2
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
>
--
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
Jan Ceuleers Dec. 17, 2010, 6:50 p.m. UTC | #3
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
--
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
David Miller Dec. 17, 2010, 7:57 p.m. UTC | #4
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.
--
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
diff mbox

Patch

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);
+               }
       }