[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250307-dp83822-mac-impedance-v1-2-bdd85a759b45@liebherr.com>
Date: Fri, 07 Mar 2025 11:30:02 +0100
From: Dimitri Fedrau via B4 Relay <devnull+dimitri.fedrau.liebherr.com@...nel.org>
To: 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>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Florian Fainelli <f.fainelli@...il.com>
Cc: netdev@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Dimitri Fedrau <dimitri.fedrau@...bherr.com>,
Dimitri Fedrau <dima.fedrau@...il.com>
Subject: [PATCH net-next 2/3] net: phy: Add helper for getting MAC series
termination resistance
From: Dimitri Fedrau <dimitri.fedrau@...bherr.com>
Add helper which returns the MAC series termination resistance value.
Modifying the resistance to an appropriate value can reduce signal
reflections and therefore improve signal quality.
Signed-off-by: Dimitri Fedrau <dimitri.fedrau@...bherr.com>
---
drivers/net/phy/phy_device.c | 15 +++++++++++++++
include/linux/phy.h | 3 +++
2 files changed, 18 insertions(+)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index b2d32fbc8c8507f6280e4c3c671466f672c1cc8f..575583aa8b4d49bef796e96059e4f0dd56b351f9 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2975,6 +2975,21 @@ int phy_get_tx_amplitude_gain(struct phy_device *phydev, struct device *dev,
}
EXPORT_SYMBOL_GPL(phy_get_tx_amplitude_gain);
+/**
+ * phy_get_mac_series_termination - stores MAC series termination in @val
+ * @phydev: phy_device struct
+ * @dev: pointer to the devices device struct
+ * @val: MAC series termination
+ *
+ * Returns: 0 on success, < 0 on failure
+ */
+int phy_get_mac_series_termination(struct phy_device *phydev,
+ struct device *dev, u32 *val)
+{
+ return phy_get_u32_property(dev, "mac-series-termination-ohms", val);
+}
+EXPORT_SYMBOL_GPL(phy_get_mac_series_termination);
+
static int phy_led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness value)
{
diff --git a/include/linux/phy.h b/include/linux/phy.h
index c4a6385faf41c3156d1a9086eaf5c746640cddbe..633899c4250c91a366849ee0c11d93feec48262f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2052,6 +2052,9 @@ int phy_get_tx_amplitude_gain(struct phy_device *phydev, struct device *dev,
enum ethtool_link_mode_bit_indices linkmode,
u32 *val);
+int phy_get_mac_series_termination(struct phy_device *phydev,
+ struct device *dev, u32 *val);
+
void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_adv,
bool *tx_pause, bool *rx_pause);
--
2.39.5
Powered by blists - more mailing lists