mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jeremy Linton <jeremy.linton@arm.com>, netdev@vger.kernel.org
Cc: andrew@lunn.ch, f.fainelli@gmail.com, linux@armlinux.org.uk,
	davem@davemloft.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: Fix c45 no phy detected logic
Date: Thu, 14 May 2020 21:59:07 +0200	[thread overview]
Message-ID: <e1826c60-736f-d496-4c4f-7229efee018b@gmail.com> (raw)
In-Reply-To: <20200514170025.1379981-1-jeremy.linton@arm.com>

On 14.05.2020 19:00, Jeremy Linton wrote:
> The commit "disregard Clause 22 registers present bit..." clears
> the low bit of the devices_in_package data which is being used
> in get_phy_c45_ids() to determine if a phy/register is responding
> correctly. That check is against 0x1FFFFFFF, but since the low
> bit is always cleared, the check can never be true. This leads to
> detecting c45 phy devices where none exist.
> 
> Lets fix this by also clearing the low bit in the mask to 0x1FFFFFFE.
> This allows us to continue to autoprobe standards compliant devices
> without also gaining a large number of bogus ones.
> 
> Fixes: 3b5e74e0afe3 ("net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg")
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
>  drivers/net/phy/phy_device.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index ac2784192472..b93d984d35cc 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -723,7 +723,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
>  		if (phy_reg < 0)
>  			return -EIO;
>  
> -		if ((*devs & 0x1fffffff) == 0x1fffffff) {
> +		if ((*devs & 0x1ffffffe) == 0x1ffffffe) {
>  			/*  If mostly Fs, there is no device there,

Looks good to me, it would just be good to extend the comment and explain
why we exclude bit 0 here.


>  			 *  then let's continue to probe more, as some
>  			 *  10G PHYs have zero Devices In package,
> @@ -733,7 +733,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
>  			if (phy_reg < 0)
>  				return -EIO;
>  			/* no device there, let's get out of here */
> -			if ((*devs & 0x1fffffff) == 0x1fffffff) {
> +			if ((*devs & 0x1ffffffe) == 0x1ffffffe) {
>  				*phy_id = 0xffffffff;
>  				return 0;
>  			} else {
> 


  reply	other threads:[~2020-05-14 19:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 17:00 Jeremy Linton
2020-05-14 19:59 ` Heiner Kallweit [this message]
2020-05-14 20:49   ` Jeremy Linton
2020-05-19 16:00 ` Jeremy Linton

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=e1826c60-736f-d496-4c4f-7229efee018b@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=jeremy.linton@arm.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

all inboxes | Powered by JetHome®