public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mans@mansr•com>
To: Andre Edich <andre.edich@microchip•com>
Cc: <netdev@vger•kernel.org>, <UNGLinuxDriver@microchip•com>,
	<Parthiban.Veerasooran@microchip•com>
Subject: Re: [PATCH net-next] net: phy: lan87xx: fix access to wrong register of LAN87xx
Date: Tue, 30 Mar 2021 13:01:33 +0100	[thread overview]
Message-ID: <yw1x35wcg89u.fsf@mansr.com> (raw)
In-Reply-To: <20210329094536.3118619-1-andre.edich@microchip.com> (Andre Edich's message of "Mon, 29 Mar 2021 11:45:36 +0200")

Andre Edich <andre.edich@microchip•com> writes:

> The function lan87xx_config_aneg_ext was introduced to configure
> LAN95xxA but as well writes to undocumented register of LAN87xx.
> This fix prevents that access.
>
> The function lan87xx_config_aneg_ext gets more suitable for the new
> behavior name.
>
> Reported-by: Måns Rullgård <mans@mansr•com>
> Fixes: 05b35e7eb9a1 ("smsc95xx: add phylib support")
> Signed-off-by: Andre Edich <andre.edich@microchip•com>
> ---
>  drivers/net/phy/smsc.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

I can confirm that this fixes the problem I was seeing.

> diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
> index ddb78fb4d6dc..d8cac02a79b9 100644
> --- a/drivers/net/phy/smsc.c
> +++ b/drivers/net/phy/smsc.c
> @@ -185,10 +185,13 @@ static int lan87xx_config_aneg(struct phy_device *phydev)
>  	return genphy_config_aneg(phydev);
>  }
>
> -static int lan87xx_config_aneg_ext(struct phy_device *phydev)
> +static int lan95xx_config_aneg_ext(struct phy_device *phydev)
>  {
>  	int rc;
>
> +	if (phydev->phy_id != 0x0007c0f0) /* not (LAN9500A or LAN9505A) */
> +		return lan87xx_config_aneg(phydev);
> +
>  	/* Extend Manual AutoMDIX timer */
>  	rc = phy_read(phydev, PHY_EDPD_CONFIG);
>  	if (rc < 0)
> @@ -441,7 +444,7 @@ static struct phy_driver smsc_phy_driver[] = {
>  	.read_status	= lan87xx_read_status,
>  	.config_init	= smsc_phy_config_init,
>  	.soft_reset	= smsc_phy_reset,
> -	.config_aneg	= lan87xx_config_aneg_ext,
> +	.config_aneg	= lan95xx_config_aneg_ext,
>
>  	/* IRQ related */
>  	.config_intr	= smsc_phy_config_intr,
> -- 
>
> 2.28.0
>

-- 
Måns Rullgård

  parent reply	other threads:[~2021-03-30 12:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29  9:45 [PATCH net-next] net: phy: lan87xx: fix access to wrong register of LAN87xx Andre Edich
2021-03-29 11:19 ` Måns Rullgård
2021-03-29 12:07   ` Andre.Edich
2021-03-29 17:40     ` Måns Rullgård
2021-03-30 12:01 ` Måns Rullgård [this message]
2021-03-30 20:20 ` patchwork-bot+netdevbpf

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=yw1x35wcg89u.fsf@mansr.com \
    --to=mans@mansr$(echo .)com \
    --cc=Parthiban.Veerasooran@microchip$(echo .)com \
    --cc=UNGLinuxDriver@microchip$(echo .)com \
    --cc=andre.edich@microchip$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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