netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] net: phy: marvell: fix set downshift params
@ 2021-04-22 10:46 Maxim Kochetkov
  2021-04-22 10:46 ` [PATCH 1/2] net: phy: marvell: fix m88e1011_set_downshift Maxim Kochetkov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Maxim Kochetkov @ 2021-04-22 10:46 UTC (permalink / raw)
  To: netdev; +Cc: andrew, hkallweit1, linux, davem, kuba, f.fainelli,
	Maxim Kochetkov

Changing downshift params without software reset has no effect,
so call genphy_soft_reset() after change downshift params.

Maxim Kochetkov (2):
  net: phy: marvell: fix m88e1011_set_downshift
  net: phy: marvell: fix m88e1111_set_downshift

 drivers/net/phy/marvell.c | 52 ++++++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 20 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] net: phy: marvell: fix m88e1011_set_downshift
  2021-04-22 10:46 [PATCH 0/2] net: phy: marvell: fix set downshift params Maxim Kochetkov
@ 2021-04-22 10:46 ` Maxim Kochetkov
  2021-04-22 12:30   ` Andrew Lunn
  2021-04-22 10:46 ` [PATCH 2/2] net: phy: marvell: fix m88e1111_set_downshift Maxim Kochetkov
  2021-04-22 20:30 ` [PATCH 0/2] net: phy: marvell: fix set downshift params patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Maxim Kochetkov @ 2021-04-22 10:46 UTC (permalink / raw)
  To: netdev; +Cc: andrew, hkallweit1, linux, davem, kuba, f.fainelli,
	Maxim Kochetkov

Changing downshift params without software reset has no effect,
so call genphy_soft_reset() after change downshift params.

As the datasheet says:
Changes to these bits are disruptive to the normal operation therefore,
any changes to these registers must be followed by software reset
to take effect.

Fixes: 911af5e149bb ("net: phy: marvell: fix downshift function naming")
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
 drivers/net/phy/marvell.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index e2b2b20c0dc5..5fd5f4986644 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1036,22 +1036,28 @@ static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data)
 
 static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt)
 {
-	int val;
+	int val, err;
 
 	if (cnt > MII_M1011_PHY_SCR_DOWNSHIFT_MAX)
 		return -E2BIG;
 
-	if (!cnt)
-		return phy_clear_bits(phydev, MII_M1011_PHY_SCR,
-				      MII_M1011_PHY_SCR_DOWNSHIFT_EN);
+	if (!cnt) {
+		err = phy_clear_bits(phydev, MII_M1011_PHY_SCR,
+				     MII_M1011_PHY_SCR_DOWNSHIFT_EN);
+	} else {
+		val = MII_M1011_PHY_SCR_DOWNSHIFT_EN;
+		val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1);
 
-	val = MII_M1011_PHY_SCR_DOWNSHIFT_EN;
-	val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1);
+		err = phy_modify(phydev, MII_M1011_PHY_SCR,
+				 MII_M1011_PHY_SCR_DOWNSHIFT_EN |
+				 MII_M1011_PHY_SCR_DOWNSHIFT_MASK,
+				 val);
+	}
 
-	return phy_modify(phydev, MII_M1011_PHY_SCR,
-			  MII_M1011_PHY_SCR_DOWNSHIFT_EN |
-			  MII_M1011_PHY_SCR_DOWNSHIFT_MASK,
-			  val);
+	if (err < 0)
+		return err;
+
+	return genphy_soft_reset(phydev);
 }
 
 static int m88e1011_get_tunable(struct phy_device *phydev,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] net: phy: marvell: fix m88e1111_set_downshift
  2021-04-22 10:46 [PATCH 0/2] net: phy: marvell: fix set downshift params Maxim Kochetkov
  2021-04-22 10:46 ` [PATCH 1/2] net: phy: marvell: fix m88e1011_set_downshift Maxim Kochetkov
@ 2021-04-22 10:46 ` Maxim Kochetkov
  2021-04-22 12:31   ` Andrew Lunn
  2021-04-22 20:30 ` [PATCH 0/2] net: phy: marvell: fix set downshift params patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Maxim Kochetkov @ 2021-04-22 10:46 UTC (permalink / raw)
  To: netdev; +Cc: andrew, hkallweit1, linux, davem, kuba, f.fainelli,
	Maxim Kochetkov

Changing downshift params without software reset has no effect,
so call genphy_soft_reset() after change downshift params.

As the datasheet says:
Changes to these bits are disruptive to the normal operation therefore,
any changes to these registers must be followed by software reset
to take effect.

Fixes: 5c6bc5199b5d ("net: phy: marvell: add downshift support for M88E1111")
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
 drivers/net/phy/marvell.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 5fd5f4986644..a61fde7013bd 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -978,22 +978,28 @@ static int m88e1111_get_downshift(struct phy_device *phydev, u8 *data)
 
 static int m88e1111_set_downshift(struct phy_device *phydev, u8 cnt)
 {
-	int val;
+	int val, err;
 
 	if (cnt > MII_M1111_PHY_EXT_CR_DOWNSHIFT_MAX)
 		return -E2BIG;
 
-	if (!cnt)
-		return phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR,
-				      MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN);
+	if (!cnt) {
+		err = phy_clear_bits(phydev, MII_M1111_PHY_EXT_CR,
+				     MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN);
+	} else {
+		val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN;
+		val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1);
 
-	val = MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN;
-	val |= FIELD_PREP(MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK, cnt - 1);
+		err = phy_modify(phydev, MII_M1111_PHY_EXT_CR,
+				 MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN |
+				 MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK,
+				 val);
+	}
 
-	return phy_modify(phydev, MII_M1111_PHY_EXT_CR,
-			  MII_M1111_PHY_EXT_CR_DOWNSHIFT_EN |
-			  MII_M1111_PHY_EXT_CR_DOWNSHIFT_MASK,
-			  val);
+	if (err < 0)
+		return err;
+
+	return genphy_soft_reset(phydev);
 }
 
 static int m88e1111_get_tunable(struct phy_device *phydev,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] net: phy: marvell: fix m88e1011_set_downshift
  2021-04-22 10:46 ` [PATCH 1/2] net: phy: marvell: fix m88e1011_set_downshift Maxim Kochetkov
@ 2021-04-22 12:30   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2021-04-22 12:30 UTC (permalink / raw)
  To: Maxim Kochetkov; +Cc: netdev, hkallweit1, linux, davem, kuba, f.fainelli

On Thu, Apr 22, 2021 at 01:46:43PM +0300, Maxim Kochetkov wrote:
> Changing downshift params without software reset has no effect,
> so call genphy_soft_reset() after change downshift params.
> 
> As the datasheet says:
> Changes to these bits are disruptive to the normal operation therefore,
> any changes to these registers must be followed by software reset
> to take effect.
> 
> Fixes: 911af5e149bb ("net: phy: marvell: fix downshift function naming")
> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>

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

    Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] net: phy: marvell: fix m88e1111_set_downshift
  2021-04-22 10:46 ` [PATCH 2/2] net: phy: marvell: fix m88e1111_set_downshift Maxim Kochetkov
@ 2021-04-22 12:31   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2021-04-22 12:31 UTC (permalink / raw)
  To: Maxim Kochetkov; +Cc: netdev, hkallweit1, linux, davem, kuba, f.fainelli

On Thu, Apr 22, 2021 at 01:46:44PM +0300, Maxim Kochetkov wrote:
> Changing downshift params without software reset has no effect,
> so call genphy_soft_reset() after change downshift params.
> 
> As the datasheet says:
> Changes to these bits are disruptive to the normal operation therefore,
> any changes to these registers must be followed by software reset
> to take effect.
> 
> Fixes: 5c6bc5199b5d ("net: phy: marvell: add downshift support for M88E1111")
> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>

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

    Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] net: phy: marvell: fix set downshift params
  2021-04-22 10:46 [PATCH 0/2] net: phy: marvell: fix set downshift params Maxim Kochetkov
  2021-04-22 10:46 ` [PATCH 1/2] net: phy: marvell: fix m88e1011_set_downshift Maxim Kochetkov
  2021-04-22 10:46 ` [PATCH 2/2] net: phy: marvell: fix m88e1111_set_downshift Maxim Kochetkov
@ 2021-04-22 20:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-22 20:30 UTC (permalink / raw)
  To: Maxim Kochetkov
  Cc: netdev, andrew, hkallweit1, linux, davem, kuba, f.fainelli

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Thu, 22 Apr 2021 13:46:42 +0300 you wrote:
> Changing downshift params without software reset has no effect,
> so call genphy_soft_reset() after change downshift params.
> 
> Maxim Kochetkov (2):
>   net: phy: marvell: fix m88e1011_set_downshift
>   net: phy: marvell: fix m88e1111_set_downshift
> 
> [...]

Here is the summary with links:
  - [1/2] net: phy: marvell: fix m88e1011_set_downshift
    https://git.kernel.org/netdev/net/c/990875b299b8
  - [2/2] net: phy: marvell: fix m88e1111_set_downshift
    https://git.kernel.org/netdev/net/c/e7679c55a724

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-22 20:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-22 10:46 [PATCH 0/2] net: phy: marvell: fix set downshift params Maxim Kochetkov
2021-04-22 10:46 ` [PATCH 1/2] net: phy: marvell: fix m88e1011_set_downshift Maxim Kochetkov
2021-04-22 12:30   ` Andrew Lunn
2021-04-22 10:46 ` [PATCH 2/2] net: phy: marvell: fix m88e1111_set_downshift Maxim Kochetkov
2021-04-22 12:31   ` Andrew Lunn
2021-04-22 20:30 ` [PATCH 0/2] net: phy: marvell: fix set downshift params patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).