lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  9 Aug 2021 16:55:10 +0800
From:   chaochao2021666@....com
To:     andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
        davem@...emloft.net
Cc:     kuba@...nel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        Chao Zeng <chao.zeng@...mens.com>
Subject: [PATCH 2/2] net:phy:dp83867:implement the binding for status led

From: Chao Zeng <chao.zeng@...mens.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@...mens.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ