public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Dan Murphy <dmurphy@ti.com>, andrew@lunn.ch, f.fainelli@gmail.com
Cc: linux@armlinux.org.uk, davem@davemloft.net,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org, afd@ti.com
Subject: Re: [PATCH net 1/2] net: phy: DP83822: Fix WoL in config init to be disabled
Date: Thu, 23 Apr 2020 19:02:44 +0200	[thread overview]
Message-ID: <487889d0-d2e4-ddd4-b199-c621b2826601@gmail.com> (raw)
In-Reply-To: <20200423163947.18313-2-dmurphy@ti.com>

On 23.04.2020 18:39, Dan Murphy wrote:
> The WoL feature should be disabled when config_init is called and the
> feature should turned on or off  when set_wol is called.
> 
> In addition updated the calls to modify the registers to use the set_bit
> and clear_bit function calls.
> 
> Fixes: 3b427751a9d0 ("net: phy: DP83822 initial driver submission")
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  drivers/net/phy/dp83822.c | 30 ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
> index fe9aa3ad52a7..40fdfd043947 100644
> --- a/drivers/net/phy/dp83822.c
> +++ b/drivers/net/phy/dp83822.c
> @@ -137,16 +137,19 @@ static int dp83822_set_wol(struct phy_device *phydev,
>  			value &= ~DP83822_WOL_SECURE_ON;
>  		}
>  
> -		value |= (DP83822_WOL_EN | DP83822_WOL_INDICATION_SEL |
> -			  DP83822_WOL_CLR_INDICATION);
> -		phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
> -			      value);
> +		/* Clear any pending WoL interrupt */
> +		phy_read(phydev, MII_DP83822_MISR2);
> +
> +		value |= DP83822_WOL_EN | DP83822_WOL_INDICATION_SEL |
> +			DP83822_WOL_CLR_INDICATION;
> +
> +		return phy_set_bits_mmd(phydev, DP83822_DEVADDR,
> +					MII_DP83822_WOL_CFG, value);

The switch to phy_set_bits_mmd() doesn't seem to be correct here.
So far bit DP83822_WOL_MAGIC_EN is cleared if WAKE_MAGIC isn't set.
Similar for bit DP83822_WOL_SECURE_ON. With your change they don't
get cleared any longer.

>  	} else {
> -		value = phy_read_mmd(phydev, DP83822_DEVADDR,
> -				     MII_DP83822_WOL_CFG);
> -		value &= ~DP83822_WOL_EN;
> -		phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
> -			      value);
> +		value = DP83822_WOL_EN | DP83822_WOL_CLR_INDICATION;
> +
You clear one bit more than before. The reason for this may be worth a note
in the commit message.

> +		return phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
> +					  MII_DP83822_WOL_CFG, value);
>  	}
>  
>  	return 0;
> @@ -258,12 +261,11 @@ static int dp83822_config_intr(struct phy_device *phydev)
>  
>  static int dp83822_config_init(struct phy_device *phydev)
>  {
> -	int value;
> -
> -	value = DP83822_WOL_MAGIC_EN | DP83822_WOL_SECURE_ON | DP83822_WOL_EN;
> +	int value = DP83822_WOL_EN | DP83822_WOL_MAGIC_EN |
> +		    DP83822_WOL_SECURE_ON;
>  
> -	return phy_write_mmd(phydev, DP83822_DEVADDR, MII_DP83822_WOL_CFG,
> -	      value);
> +	return phy_clear_bits_mmd(phydev, DP83822_DEVADDR,
> +				  MII_DP83822_WOL_CFG, value);
>  }
>  
>  static int dp83822_phy_reset(struct phy_device *phydev)
> 


  reply	other threads:[~2020-04-23 17:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 16:39 [PATCH net 0/2] WoL fixes for DP83822 and DP83tc811 Dan Murphy
2020-04-23 16:39 ` [PATCH net 1/2] net: phy: DP83822: Fix WoL in config init to be disabled Dan Murphy
2020-04-23 17:02   ` Heiner Kallweit [this message]
2020-04-23 17:49     ` Dan Murphy
2020-04-23 16:39 ` [PATCH net 2/2] net: phy: DP83TC811: " Dan Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=487889d0-d2e4-ddd4-b199-c621b2826601@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=afd@ti.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dmurphy@ti.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox