diff mbox series

[v2] net: phy: marvell: Add errata section 5.1 for Alaska PHY

Message ID 20220516070859.549170-1-sr@denx.de (mailing list archive)
State Accepted
Commit 65a9dedc11d615d8f104a48d38b4fa226967b4ed
Delegated to: Netdev Maintainers
Headers show
Series [v2] net: phy: marvell: Add errata section 5.1 for Alaska PHY | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 3 maintainers not CCed: kuba@kernel.org edumazet@google.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 44 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Stefan Roese May 16, 2022, 7:08 a.m. UTC
From: Leszek Polak <lpolak@arri.de>

As per Errata Section 5.1, if EEE is intended to be used, some register
writes must be done once after every hardware reset. This patch now adds
the necessary register writes as listed in the Marvell errata.

Without this fix we experience ethernet problems on some of our boards
equipped with a new version of this ethernet PHY (different supplier).

The fix applies to Marvell Alaska 88E1510/88E1518/88E1512/88E1514
Rev. A0.

Signed-off-by: Leszek Polak <lpolak@arri.de>
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Marek Behún <kabel@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: David S. Miller <davem@davemloft.net>
---
v2:
- Implement struct with errata reg values and loop over this
  struct instead of using single phy_write() call for each PHY
  reg value, as suggested by Marek

 drivers/net/phy/marvell.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Marek Behún May 16, 2022, 9:25 a.m. UTC | #1
On Mon, 16 May 2022 09:08:59 +0200
Stefan Roese <sr@denx.de> wrote:

> From: Leszek Polak <lpolak@arri.de>
> 
> As per Errata Section 5.1, if EEE is intended to be used, some register
> writes must be done once after every hardware reset. This patch now adds
> the necessary register writes as listed in the Marvell errata.
> 
> Without this fix we experience ethernet problems on some of our boards
> equipped with a new version of this ethernet PHY (different supplier).
> 
> The fix applies to Marvell Alaska 88E1510/88E1518/88E1512/88E1514
> Rev. A0.
> 
> Signed-off-by: Leszek Polak <lpolak@arri.de>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Marek Behún <kabel@kernel.org>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: David S. Miller <davem@davemloft.net>
> ---
> v2:
> - Implement struct with errata reg values and loop over this
>   struct instead of using single phy_write() call for each PHY
>   reg value, as suggested by Marek
> 
>  drivers/net/phy/marvell.c | 37 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index 2702faf7b0f6..41353f615a66 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -1177,7 +1177,44 @@ static int m88e1318_config_init(struct phy_device *phydev)
>  
>  static int m88e1510_config_init(struct phy_device *phydev)
>  {
> +	static const struct {
> +		u16 reg17, reg16;
> +	} errata_vals[] = {
> +		{ 0x214b, 0x2144 },
> +		{ 0x0c28, 0x2146 },
> +		{ 0xb233, 0x214d },
> +		{ 0xcc0c, 0x2159 },
> +	};
>  	int err;
> +	int i;
> +
> +	/* As per Marvell Release Notes - Alaska 88E1510/88E1518/88E1512/
> +	 * 88E1514 Rev A0, Errata Section 5.1:
> +	 * If EEE is intended to be used, the following register writes
> +	 * must be done once after every hardware reset.
> +	 */
> +	err = marvell_set_page(phydev, 0x00FF);
> +	if (err < 0)
> +		return err;
> +
> +	for (i = 0; i < ARRAY_SIZE(errata_vals); ++i) {
> +		err = phy_write(phydev, 17, errata_vals[i].reg17);
> +		if (err)
> +			return err;
> +		err = phy_write(phydev, 16, errata_vals[i].reg16);
> +		if (err)
> +			return err;
> +	}
> +
> +	err = marvell_set_page(phydev, 0x00FB);
> +	if (err < 0)
> +		return err;
> +	err = phy_write(phydev, 07, 0xC00D);
> +	if (err < 0)
> +		return err;
> +	err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
> +	if (err < 0)
> +		return err;
>  
>  	/* SGMII-to-Copper mode initialization */
>  	if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {

Reviewed-by: Marek Behún <kabel@kernel.org>
Andrew Lunn May 16, 2022, 11:57 a.m. UTC | #2
On Mon, May 16, 2022 at 09:08:59AM +0200, Stefan Roese wrote:
> From: Leszek Polak <lpolak@arri.de>
> 
> As per Errata Section 5.1, if EEE is intended to be used, some register
> writes must be done once after every hardware reset. This patch now adds
> the necessary register writes as listed in the Marvell errata.
> 
> Without this fix we experience ethernet problems on some of our boards
> equipped with a new version of this ethernet PHY (different supplier).
> 
> The fix applies to Marvell Alaska 88E1510/88E1518/88E1512/88E1514
> Rev. A0.
> 
> Signed-off-by: Leszek Polak <lpolak@arri.de>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Marek Behún <kabel@kernel.org>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: David S. Miller <davem@davemloft.net>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Paolo Abeni May 17, 2022, 11:01 a.m. UTC | #3
Hello,

On Mon, 2022-05-16 at 09:08 +0200, Stefan Roese wrote:
> From: Leszek Polak <lpolak@arri.de>
> 
> As per Errata Section 5.1, if EEE is intended to be used, some register
> writes must be done once after every hardware reset. This patch now adds
> the necessary register writes as listed in the Marvell errata.
> 
> Without this fix we experience ethernet problems on some of our boards
> equipped with a new version of this ethernet PHY (different supplier).
> 
> The fix applies to Marvell Alaska 88E1510/88E1518/88E1512/88E1514
> Rev. A0.
> 
> Signed-off-by: Leszek Polak <lpolak@arri.de>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Marek Behún <kabel@kernel.org>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: David S. Miller <davem@davemloft.net>

It's not clear to me if you are targeting -net or net-next, could you
please clarify? In case this is for -net, please add a suitable fixes
tag, thanks!

/P
Stefan Roese May 17, 2022, 11:21 a.m. UTC | #4
Hi Paolo,

On 17.05.22 13:01, Paolo Abeni wrote:
> Hello,
> 
> On Mon, 2022-05-16 at 09:08 +0200, Stefan Roese wrote:
>> From: Leszek Polak <lpolak@arri.de>
>>
>> As per Errata Section 5.1, if EEE is intended to be used, some register
>> writes must be done once after every hardware reset. This patch now adds
>> the necessary register writes as listed in the Marvell errata.
>>
>> Without this fix we experience ethernet problems on some of our boards
>> equipped with a new version of this ethernet PHY (different supplier).
>>
>> The fix applies to Marvell Alaska 88E1510/88E1518/88E1512/88E1514
>> Rev. A0.
>>
>> Signed-off-by: Leszek Polak <lpolak@arri.de>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: Marek Behún <kabel@kernel.org>
>> Cc: Andrew Lunn <andrew@lunn.ch>
>> Cc: Heiner Kallweit <hkallweit1@gmail.com>
>> Cc: Russell King <linux@armlinux.org.uk>
>> Cc: David S. Miller <davem@davemloft.net>
> 
> It's not clear to me if you are targeting -net or net-next, could you
> please clarify? In case this is for -net, please add a suitable fixes
> tag, thanks!

Sorry for not being clear on this. net-next is good AFAICT.

Should I re-submit to net-next?

Thanks,
Stefan
Paolo Abeni May 17, 2022, 11:45 a.m. UTC | #5
On Tue, 2022-05-17 at 13:21 +0200, Stefan Roese wrote:
> On 17.05.22 13:01, Paolo Abeni wrote:
> > On Mon, 2022-05-16 at 09:08 +0200, Stefan Roese wrote:
> > > From: Leszek Polak <lpolak@arri.de>
> > > 
> > > As per Errata Section 5.1, if EEE is intended to be used, some register
> > > writes must be done once after every hardware reset. This patch now adds
> > > the necessary register writes as listed in the Marvell errata.
> > > 
> > > Without this fix we experience ethernet problems on some of our boards
> > > equipped with a new version of this ethernet PHY (different supplier).
> > > 
> > > The fix applies to Marvell Alaska 88E1510/88E1518/88E1512/88E1514
> > > Rev. A0.
> > > 
> > > Signed-off-by: Leszek Polak <lpolak@arri.de>
> > > Signed-off-by: Stefan Roese <sr@denx.de>
> > > Cc: Marek Behún <kabel@kernel.org>
> > > Cc: Andrew Lunn <andrew@lunn.ch>
> > > Cc: Heiner Kallweit <hkallweit1@gmail.com>
> > > Cc: Russell King <linux@armlinux.org.uk>
> > > Cc: David S. Miller <davem@davemloft.net>
> > 
> > It's not clear to me if you are targeting -net or net-next, could you
> > please clarify? In case this is for -net, please add a suitable fixes
> > tag, thanks!
> 
> Sorry for not being clear on this. net-next is good AFAICT.
> 
> Should I re-submit to net-next?

Not needed, I'm applying it. 

Thanks!

Paolo
patchwork-bot+netdevbpf@kernel.org May 17, 2022, 1:20 p.m. UTC | #6
Hello:

This patch was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 16 May 2022 09:08:59 +0200 you wrote:
> From: Leszek Polak <lpolak@arri.de>
> 
> As per Errata Section 5.1, if EEE is intended to be used, some register
> writes must be done once after every hardware reset. This patch now adds
> the necessary register writes as listed in the Marvell errata.
> 
> Without this fix we experience ethernet problems on some of our boards
> equipped with a new version of this ethernet PHY (different supplier).
> 
> [...]

Here is the summary with links:
  - [v2] net: phy: marvell: Add errata section 5.1 for Alaska PHY
    https://git.kernel.org/netdev/net-next/c/65a9dedc11d6

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 2702faf7b0f6..41353f615a66 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1177,7 +1177,44 @@  static int m88e1318_config_init(struct phy_device *phydev)
 
 static int m88e1510_config_init(struct phy_device *phydev)
 {
+	static const struct {
+		u16 reg17, reg16;
+	} errata_vals[] = {
+		{ 0x214b, 0x2144 },
+		{ 0x0c28, 0x2146 },
+		{ 0xb233, 0x214d },
+		{ 0xcc0c, 0x2159 },
+	};
 	int err;
+	int i;
+
+	/* As per Marvell Release Notes - Alaska 88E1510/88E1518/88E1512/
+	 * 88E1514 Rev A0, Errata Section 5.1:
+	 * If EEE is intended to be used, the following register writes
+	 * must be done once after every hardware reset.
+	 */
+	err = marvell_set_page(phydev, 0x00FF);
+	if (err < 0)
+		return err;
+
+	for (i = 0; i < ARRAY_SIZE(errata_vals); ++i) {
+		err = phy_write(phydev, 17, errata_vals[i].reg17);
+		if (err)
+			return err;
+		err = phy_write(phydev, 16, errata_vals[i].reg16);
+		if (err)
+			return err;
+	}
+
+	err = marvell_set_page(phydev, 0x00FB);
+	if (err < 0)
+		return err;
+	err = phy_write(phydev, 07, 0xC00D);
+	if (err < 0)
+		return err;
+	err = marvell_set_page(phydev, MII_MARVELL_COPPER_PAGE);
+	if (err < 0)
+		return err;
 
 	/* SGMII-to-Copper mode initialization */
 	if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {