Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/2] net:phy:dp83867:implement the binding for status led
@ 2021-08-09 8:55 chaochao2021666
2021-08-09 9:59 ` Russell King (Oracle)
0 siblings, 1 reply; 2+ messages in thread
From: chaochao2021666 @ 2021-08-09 8:55 UTC (permalink / raw)
To: andrew, hkallweit1, linux, davem
Cc: kuba, netdev, linux-kernel, devicetree, Chao Zeng
From: Chao Zeng <chao.zeng@siemens.com>
the DP83867 has different function option for the status led.
It is possible to set the status led for different function
Signed-off-by: Chao Zeng <chao.zeng@siemens.com>
---
drivers/net/phy/dp83867.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 6bbc81ad295f..71dc3101ce28 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -148,6 +148,10 @@
/* FLD_THR_CFG */
#define DP83867_FLD_THR_CFG_ENERGY_LOST_THR_MASK 0x7
+/* Led Configuration */
+#define DP83867_LEDCR_1 0x0018
+#define LED_GPIO_NUM_SEL 0x4
+
enum {
DP83867_PORT_MIRROING_KEEP,
DP83867_PORT_MIRROING_EN,
@@ -527,6 +531,9 @@ static int dp83867_of_init(struct phy_device *phydev)
struct device *dev = &phydev->mdio.dev;
struct device_node *of_node = dev->of_node;
int ret;
+ u32 led_conf;
+ u32 led_select_value;
+ int index;
if (!of_node)
return -ENODEV;
@@ -614,6 +621,19 @@ static int dp83867_of_init(struct phy_device *phydev)
return -EINVAL;
}
+ /* Optional LED configuration */
+ for (index = 0; index < LED_GPIO_NUM_SEL; index++) {
+ ret = of_property_read_u32_index(of_node, "ti,led-sel",
+ index, &led_select_value);
+ if (ret < 0) {
+ phydev_info(phydev, "Use default value for led configuration\n");
+ return -EINVAL;
+ }
+ led_conf = led_conf << 4 | led_select_value;
+ }
+
+ phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_LEDCR_1, led_conf);
+
return 0;
}
#else
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] net:phy:dp83867:implement the binding for status led
2021-08-09 8:55 [PATCH 2/2] net:phy:dp83867:implement the binding for status led chaochao2021666
@ 2021-08-09 9:59 ` Russell King (Oracle)
0 siblings, 0 replies; 2+ messages in thread
From: Russell King (Oracle) @ 2021-08-09 9:59 UTC (permalink / raw)
To: chaochao2021666
Cc: andrew, hkallweit1, davem, kuba, netdev, linux-kernel,
devicetree, Chao Zeng
On Mon, Aug 09, 2021 at 04:55:10PM +0800, chaochao2021666@163.com wrote:
> From: Chao Zeng <chao.zeng@siemens.com>
>
> the DP83867 has different function option for the status led.
> It is possible to set the status led for different function
>
> Signed-off-by: Chao Zeng <chao.zeng@siemens.com>
Private properties for status LEDs are no longer permitted for new code.
Instead, there is work ongoing to add LED subsystem support for PHY
status indicators, a recent patch set can be found here:
https://lore.kernel.org/netdev/20210602144439.4d20b295@dellmb/T/
You may be interested in helping this effort along.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-09 9:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 8:55 [PATCH 2/2] net:phy:dp83867:implement the binding for status led chaochao2021666
2021-08-09 9:59 ` Russell King (Oracle)
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).