All of lore.kernel.org
 help / color / mirror / Atom feed
From: f.fainelli@gmail.com (Florian Fainelli)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH] net: phy: realtek: fix RTL8211F interrupt mode
Date: Sun, 12 Nov 2017 10:29:24 -0800	[thread overview]
Message-ID: <3a460dee-e714-e430-ce34-44c55d8a7490@gmail.com> (raw)
In-Reply-To: <66991733-9d1a-dbd2-9857-bba1ffca1cf8@gmail.com>

Hi Heiner,

On 11/12/2017 07:16 AM, Heiner Kallweit wrote:
> After commit b94d22d94ad22 "ARM64: dts: meson-gx: add external PHY
> interrupt on some platforms" ethernet stopped working on my Odroid-C2
> which has a RTL8211F phy.
> 
> It turned out that no interrupts were triggered. Further analysis
> showed the register INER can't be altered on page 0.
> Because register INSR needs to be accessed via page 0xa43 I assumed
> that register INER needs to be accessed via some page too.
> Some brute force check resulted in page 0xa42 being the right one.
> 
> With this patch the phy is working properly in interrupt mode.

What would be the appropriate Fixes: tag for that patch?

> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/phy/realtek.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index d4670ecdb..eda0a6e86 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -115,11 +115,13 @@ static int rtl8211f_config_intr(struct phy_device *phydev)
>  {
>  	int err;
>  
> +	phy_write(phydev, RTL821x_PAGE_SELECT, 0xa42);
>  	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
>  		err = phy_write(phydev, RTL821x_INER,
>  				RTL8211F_INER_LINK_STATUS);
>  	else
>  		err = phy_write(phydev, RTL821x_INER, 0);
> +	phy_write(phydev, RTL821x_PAGE_SELECT, 0);
>  
>  	return err;
>  }
> 

-- 
Florian

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"open list:ARM/Amlogic Meson..."
	<linux-amlogic@lists.infradead.org>,
	Shengzhou Liu <Shengzhou.Liu@freescale.com>,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH] net: phy: realtek: fix RTL8211F interrupt mode
Date: Sun, 12 Nov 2017 10:29:24 -0800	[thread overview]
Message-ID: <3a460dee-e714-e430-ce34-44c55d8a7490@gmail.com> (raw)
In-Reply-To: <66991733-9d1a-dbd2-9857-bba1ffca1cf8@gmail.com>

Hi Heiner,

On 11/12/2017 07:16 AM, Heiner Kallweit wrote:
> After commit b94d22d94ad22 "ARM64: dts: meson-gx: add external PHY
> interrupt on some platforms" ethernet stopped working on my Odroid-C2
> which has a RTL8211F phy.
> 
> It turned out that no interrupts were triggered. Further analysis
> showed the register INER can't be altered on page 0.
> Because register INSR needs to be accessed via page 0xa43 I assumed
> that register INER needs to be accessed via some page too.
> Some brute force check resulted in page 0xa42 being the right one.
> 
> With this patch the phy is working properly in interrupt mode.

What would be the appropriate Fixes: tag for that patch?

> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/phy/realtek.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index d4670ecdb..eda0a6e86 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -115,11 +115,13 @@ static int rtl8211f_config_intr(struct phy_device *phydev)
>  {
>  	int err;
>  
> +	phy_write(phydev, RTL821x_PAGE_SELECT, 0xa42);
>  	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
>  		err = phy_write(phydev, RTL821x_INER,
>  				RTL8211F_INER_LINK_STATUS);
>  	else
>  		err = phy_write(phydev, RTL821x_INER, 0);
> +	phy_write(phydev, RTL821x_PAGE_SELECT, 0);
>  
>  	return err;
>  }
> 

-- 
Florian

  parent reply	other threads:[~2017-11-12 18:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-12 15:16 [PATCH] net: phy: realtek: fix RTL8211F interrupt mode Heiner Kallweit
2017-11-12 15:16 ` Heiner Kallweit
2017-11-12 18:25 ` Andrew Lunn
2017-11-12 18:25   ` Andrew Lunn
2017-11-12 18:36   ` Jerome Brunet
2017-11-12 18:36     ` Jerome Brunet
2017-11-12 20:06     ` Andrew Lunn
2017-11-12 20:06       ` Andrew Lunn
2017-11-12 20:10       ` Jerome Brunet
2017-11-12 20:10         ` Jerome Brunet
2017-11-12 18:29 ` Florian Fainelli [this message]
2017-11-12 18:29   ` Florian Fainelli
2017-11-12 18:39   ` Jerome Brunet
2017-11-12 18:39     ` Jerome Brunet
2017-11-13 16:36 ` Jerome Brunet
2017-11-13 16:36   ` Jerome Brunet
2017-11-14 12:34 ` David Miller
2017-11-14 12:34   ` David Miller
2017-12-02 17:14 ` Martin Blumenstingl
2017-12-02 17:14   ` Martin Blumenstingl

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=3a460dee-e714-e430-ce34-44c55d8a7490@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=linus-amlogic@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.