linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: marvell: remove LED config override
@ 2016-06-10 17:42 Clemens Gruber
  2016-06-10 18:38 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Clemens Gruber @ 2016-06-10 17:42 UTC (permalink / raw)
  To: netdev; +Cc: Florian Fainelli, linux-kernel, David S . Miller, Clemens Gruber

Configuring the PHY LED registers for the Marvell 88E1510 and others is
not possible, because regardless of the values in marvell,reg-init, it
is later overridden in m88e1121_config_aneg with a non-standard default.

This became visible after we moved the call of marvell_of_reg_init in
commit 79be1a1c9090 ("phy: marvell: Fix and unify reg-init behavior").
Moving it to _config_init was necessary due to the PHY state machine
getting stuck if the PHY interrupts were not enabled early on.
As that default LED configuration is set in _config_aneg, it overrides
the marvell,reg-init configuration from the device tree.

This patch removes this override and allows the user to again set the
PHY LED configuration through marvell,reg-init or if that does not
exist, keep the original defaults as documented in the datasheet.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 drivers/net/phy/marvell.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 280e879..7a94039 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -115,10 +115,6 @@
 #define MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS          BIT(12)
 #define MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE BIT(14)
 
-#define MII_88E1121_PHY_LED_CTRL	16
-#define MII_88E1121_PHY_LED_PAGE	3
-#define MII_88E1121_PHY_LED_DEF		0x0030
-
 #define MII_M1011_PHY_STATUS		0x11
 #define MII_M1011_PHY_STATUS_1000	0x8000
 #define MII_M1011_PHY_STATUS_100	0x4000
@@ -407,15 +403,7 @@ static int m88e1121_config_aneg(struct phy_device *phydev)
 	if (err < 0)
 		return err;
 
-	oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE);
-
-	phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);
-	phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF);
-	phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);
-
-	err = genphy_config_aneg(phydev);
-
-	return err;
+	return genphy_config_aneg(phydev);
 }
 
 static int m88e1318_config_aneg(struct phy_device *phydev)
-- 
2.8.3

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

* Re: [PATCH] phy: marvell: remove LED config override
  2016-06-10 17:42 [PATCH] phy: marvell: remove LED config override Clemens Gruber
@ 2016-06-10 18:38 ` Andrew Lunn
  2016-06-10 20:52   ` Clemens Gruber
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2016-06-10 18:38 UTC (permalink / raw)
  To: Clemens Gruber, Sergei Poselenov
  Cc: netdev, Florian Fainelli, linux-kernel, David S . Miller

On Fri, Jun 10, 2016 at 07:42:52PM +0200, Clemens Gruber wrote:
> Configuring the PHY LED registers for the Marvell 88E1510 and others is
> not possible, because regardless of the values in marvell,reg-init, it
> is later overridden in m88e1121_config_aneg with a non-standard default.
> 
> This became visible after we moved the call of marvell_of_reg_init in
> commit 79be1a1c9090 ("phy: marvell: Fix and unify reg-init behavior").
> Moving it to _config_init was necessary due to the PHY state machine
> getting stuck if the PHY interrupts were not enabled early on.
> As that default LED configuration is set in _config_aneg, it overrides
> the marvell,reg-init configuration from the device tree.
> 
> This patch removes this override and allows the user to again set the
> PHY LED configuration through marvell,reg-init or if that does not
> exist, keep the original defaults as documented in the datasheet.

That override code exists for a reason. I don't like just removing it
without understanding why it is there. Sergei Poselenov added it as
part of the 1121 support. Maybe he knows why it is there?

     Andrew

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

* Re: [PATCH] phy: marvell: remove LED config override
  2016-06-10 18:38 ` Andrew Lunn
@ 2016-06-10 20:52   ` Clemens Gruber
  2016-06-10 21:15     ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Clemens Gruber @ 2016-06-10 20:52 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Florian Fainelli, linux-kernel, David S . Miller,
	Sergei Poselenov

Hi Andrew,

On Fri, Jun 10, 2016 at 08:38:57PM +0200, Andrew Lunn wrote:
> On Fri, Jun 10, 2016 at 07:42:52PM +0200, Clemens Gruber wrote:
> > Configuring the PHY LED registers for the Marvell 88E1510 and others is
> > not possible, because regardless of the values in marvell,reg-init, it
> > is later overridden in m88e1121_config_aneg with a non-standard default.
> > 
> > This became visible after we moved the call of marvell_of_reg_init in
> > commit 79be1a1c9090 ("phy: marvell: Fix and unify reg-init behavior").
> > Moving it to _config_init was necessary due to the PHY state machine
> > getting stuck if the PHY interrupts were not enabled early on.
> > As that default LED configuration is set in _config_aneg, it overrides
> > the marvell,reg-init configuration from the device tree.
> > 
> > This patch removes this override and allows the user to again set the
> > PHY LED configuration through marvell,reg-init or if that does not
> > exist, keep the original defaults as documented in the datasheet.
> 
> That override code exists for a reason. I don't like just removing it
> without understanding why it is there. Sergei Poselenov added it as
> part of the 1121 support. Maybe he knows why it is there?

Maybe because he needed that special LED configuration (LED[0] .. Link,
LED[1] .. Activity) on his board?
On my board it's LED[0] as Activity and LED[1] as Link LED.

We could move that 0x30 LED configuration to .config_init instead of
.config_aneg, so that if nobody configures it with marvell,reg-init, the
behavior does not change. I'd have to create a new .config_init function
for the 1121, 1318 and 1510.

Would you prefer that?

(I thought it would be good to be consistent with the defaults mentioned
in the datasheet, but being backwards-compatible is probably more
important, you are right)

Regards,
Clemens

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

* Re: [PATCH] phy: marvell: remove LED config override
  2016-06-10 20:52   ` Clemens Gruber
@ 2016-06-10 21:15     ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2016-06-10 21:15 UTC (permalink / raw)
  To: Clemens Gruber
  Cc: netdev, Florian Fainelli, linux-kernel, David S . Miller,
	Sergei Poselenov

> We could move that 0x30 LED configuration to .config_init instead of
> .config_aneg, so that if nobody configures it with marvell,reg-init, the
> behavior does not change. I'd have to create a new .config_init function
> for the 1121, 1318 and 1510.
> 
> Would you prefer that?

Hi Clemens

Yes, i would prefer that.

     Thanks
	Andrew

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

end of thread, other threads:[~2016-06-10 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10 17:42 [PATCH] phy: marvell: remove LED config override Clemens Gruber
2016-06-10 18:38 ` Andrew Lunn
2016-06-10 20:52   ` Clemens Gruber
2016-06-10 21:15     ` Andrew Lunn

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).