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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Aug 2020 09:21:46 +0200
From:   Matthias Schiffer <matthias.schiffer@...tq-group.com>
To:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Rob Herring <robh+dt@...nel.org>, Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>
Cc:     Dan Murphy <dmurphy@...com>, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Matthias Schiffer <matthias.schiffer@...tq-group.com>
Subject: [PATCH net-next 2/2] net: phy: dp83867: apply ti,led-function and ti,led-ctrl to registers

These DT bindings are already in use by the imx7-mba7 DTS, but they were
not supported by the PHY driver so far.

Signed-off-by: Matthias Schiffer <matthias.schiffer@...tq-group.com>
---
 drivers/net/phy/dp83867.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index f3c04981b8da..972824e25c1c 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -26,6 +26,8 @@
 #define MII_DP83867_MICR	0x12
 #define MII_DP83867_ISR		0x13
 #define DP83867_CFG2		0x14
+#define DP83867_LEDCR1		0x18
+#define DP83867_LEDCR2		0x19
 #define DP83867_CFG3		0x1e
 #define DP83867_CTRL		0x1f
 
@@ -163,6 +165,8 @@ struct dp83867_private {
 	u32 rx_fifo_depth;
 	int io_impedance;
 	int port_mirroring;
+	u32 led_function;
+	u32 led_ctrl;
 	bool rxctrl_strap_quirk;
 	bool set_clk_output;
 	u32 clk_output_sel;
@@ -583,6 +587,27 @@ static int dp83867_of_init(struct phy_device *phydev)
 		return -EINVAL;
 	}
 
+	ret = of_property_read_u32(of_node, "ti,led-function",
+				   &dp83867->led_function);
+	if (ret) {
+		dp83867->led_function = U32_MAX;
+	} else if (dp83867->led_function > U16_MAX) {
+		phydev_err(phydev,
+			   "ti,led-function value %x out of range\n",
+			   dp83867->led_function);
+		return -EINVAL;
+	}
+
+	ret = of_property_read_u32(of_node, "ti,led-ctrl", &dp83867->led_ctrl);
+	if (ret) {
+		dp83867->led_ctrl = U32_MAX;
+	} else if (dp83867->led_ctrl > U16_MAX) {
+		phydev_err(phydev,
+			   "ti,led-ctrl value %x out of range\n",
+			   dp83867->led_ctrl);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 #else
@@ -788,6 +813,11 @@ static int dp83867_config_init(struct phy_device *phydev)
 			       mask, val);
 	}
 
+	if (dp83867->led_function != U32_MAX)
+		phy_write(phydev, DP83867_LEDCR1, dp83867->led_function);
+	if (dp83867->led_ctrl != U32_MAX)
+		phy_write(phydev, DP83867_LEDCR2, dp83867->led_ctrl);
+
 	return 0;
 }
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ