[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250408063136.5463-2-wsa+renesas@sang-engineering.com>
Date: Tue, 8 Apr 2025 08:30:56 +0200
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: linux-renesas-soc@...r.kernel.org
Cc: Wolfram Sang <wsa+renesas@...g-engineering.com>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org
Subject: [RFC PATCH net-next] net: phy: marvell: support DT configurations with only two LEDs
The Renesas RZ/N1-extension board also connects only two out of three
LED outputs from the Marvell PHY to the actual LEDs. The already
existing setting MARVELL_PHY_LED0_LINK_LED1_ACTIVE fits this scenario,
but a device flag cannot be used because the PHYs use a generic MDIO bus
on which also PHYs from other vendors reside. So, the driver is updated
to count the number of LED nodes in DT. If the number is 2, the
alternative LED configuration is used, otherwise the default one.
Signed-off-by: Wolfram Sang <wsa+renesas@...g-engineering.com>
---
Is this a proper approach? FYI I double checked that
of_get_child_count() is NULL safe.
drivers/net/phy/marvell.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 623292948fa7..b967b4fcd25a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -843,7 +843,8 @@ static int m88e1510_config_aneg(struct phy_device *phydev)
static void marvell_config_led(struct phy_device *phydev)
{
u16 def_config;
- int err;
+ int num_leds, err;
+ struct device_node *np_leds;
switch (MARVELL_PHY_FAMILY_ID(phydev->phy_id)) {
/* Default PHY LED config: LED[0] .. Link, LED[1] .. Activity */
@@ -857,7 +858,9 @@ static void marvell_config_led(struct phy_device *phydev)
* LED[2] .. Blink, Activity
*/
case MARVELL_PHY_FAMILY_ID(MARVELL_PHY_ID_88E1510):
- if (phydev->dev_flags & MARVELL_PHY_LED0_LINK_LED1_ACTIVE)
+ np_leds = of_find_node_by_name(phydev->mdio.dev.of_node, "leds");
+ num_leds = of_get_child_count(np_leds);
+ if (phydev->dev_flags & MARVELL_PHY_LED0_LINK_LED1_ACTIVE || num_leds == 2)
def_config = MII_88E1510_PHY_LED0_LINK_LED1_ACTIVE;
else
def_config = MII_88E1510_PHY_LED_DEF;
--
2.47.2
Powered by blists - more mailing lists