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]
Message-Id: <20220420124053.853891-5-kai.heng.feng@canonical.com>
Date:   Wed, 20 Apr 2022 20:40:51 +0800
From:   Kai-Heng Feng <kai.heng.feng@...onical.com>
To:     andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
        peppe.cavallaro@...com, alexandre.torgue@...s.st.com,
        joabreu@...opsys.com, davem@...emloft.net, kuba@...nel.org,
        pabeni@...hat.com
Cc:     Kai-Heng Feng <kai.heng.feng@...onical.com>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 4/5] net: phy: marvell: Add LED accessors for Marvell 88E1510

Implement get_led_config() and set_led_config() callbacks so phy core
can use firmware LED as platform requested.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com>
---
 drivers/net/phy/marvell.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 2702faf7b0f60..c5f13e09b0692 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -750,6 +750,30 @@ static int m88e1510_config_aneg(struct phy_device *phydev)
 	return err;
 }
 
+static int marvell_get_led_config(struct phy_device *phydev)
+{
+	int led;
+
+	led = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, MII_PHY_LED_CTRL);
+	if (led < 0) {
+		phydev_warn(phydev, "Fail to get marvell phy LED.\n");
+		led = 0;
+	}
+
+	return led;
+}
+
+static void marvell_set_led_config(struct phy_device *phydev, int led_config)
+{
+	int err;
+
+	err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, MII_PHY_LED_CTRL,
+			      led_config);
+
+	if (err < 0)
+		phydev_warn(phydev, "Fail to set marvell phy LED.\n");
+}
+
 static void marvell_config_led(struct phy_device *phydev)
 {
 	u16 def_config;
@@ -3139,6 +3163,8 @@ static struct phy_driver marvell_drivers[] = {
 		.cable_test_start = marvell_vct7_cable_test_start,
 		.cable_test_tdr_start = marvell_vct5_cable_test_tdr_start,
 		.cable_test_get_status = marvell_vct7_cable_test_get_status,
+		.get_led_config = marvell_get_led_config,
+		.set_led_config = marvell_set_led_config,
 	},
 	{
 		.phy_id = MARVELL_PHY_ID_88E1540,
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ