From nobody Mon Feb 9 06:18:51 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80A5621ADCB; Tue, 8 Apr 2025 07:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744098340; cv=none; b=hcEV0Md7RGlar3SWSuSkrWi6Gjfr4JOu7icR9TfYu6HWgDRJSQs5y2lYoquHY0CEqSDajjdNG4d0HDcq+GcmTXFy8PBBQbrEN9FfMjWdXp/KxxjyxJaWfqts1h237gV+9LeZZu53gtxocv/5Mj5v8kIDnxGDN1ERinjv3p2sLJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744098340; c=relaxed/simple; bh=VWK3OtpuOBXytlc9D3rZd6q4OCon/h/rP9qMtiluY+8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h1BEmMtgNp0GhxZxbclc0jXVcAQcZ5TWLSNtdYmbM/rhoip3xr6oAuntlxFlCIkmcwrWBfnHuKXf6vudmarGWBXld/jfLCzhoRZrzWDKol6T9gGyfsDlrJR5zo89Tr5WyBgMmUSlaML7Sh5dTCupqY8NWKnZX850IO5msDkwNVs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=geDFnaJ/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="geDFnaJ/" Received: by smtp.kernel.org (Postfix) with ESMTPS id F0F41C4CEE9; Tue, 8 Apr 2025 07:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744098340; bh=VWK3OtpuOBXytlc9D3rZd6q4OCon/h/rP9qMtiluY+8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=geDFnaJ/TllxOlvgHN02nQjp9u3c8TL9A4zdY/42INnPToVoasfLiHf2AioEy8ABU KifjKNkCw9Ey9PxrWT6IvOmoiAlm5WiF8tYpQMTJoI0PLz5ZOkwN18Sy0OVwnMpJ9z q+PFkpryGxOUkyl+BAngm31UfSuYz02wZkFirDNby3OetzUR9O20RPFSXZ5fLIwP9A ynvjhYVMt2KI+z2z4BJgsBgiNJCzFEi5O40xmNJkBOBB41MXkRUYa3mqmmPape5+DP 3wZfYwTD4v6i05XewmU3tqk2fWzsFemmN/G6Hm5Troa9Mvi6Qd/498p1wBEXa04Nen VfxRDjHQyIPMQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD64EC369A4; Tue, 8 Apr 2025 07:45:39 +0000 (UTC) From: Dimitri Fedrau via B4 Relay Date: Tue, 08 Apr 2025 09:45:32 +0200 Subject: [PATCH net-next v2 1/3] dt-bindings: net: ethernet-phy: add property mac-termination-ohms Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250408-dp83822-mac-impedance-v2-1-fefeba4a9804@liebherr.com> References: <20250408-dp83822-mac-impedance-v2-0-fefeba4a9804@liebherr.com> In-Reply-To: <20250408-dp83822-mac-impedance-v2-0-fefeba4a9804@liebherr.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Dimitri Fedrau , Dimitri Fedrau X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1744098338; l=1457; i=dimitri.fedrau@liebherr.com; s=20241202; h=from:subject:message-id; bh=iLKP9AOUR9dV2pk730lAoIgqXbD0/33T/ilFfmJ5gKQ=; b=mbgAal4G5f4ZS5fnZUibV4eV7BW0CnS4g0YubRiQPjrskwHuXLtTuSBu/FSSbwF66tDwtn7dc 3gYGJcaQrAvDSue1haoYNILCmxJtIqxboyqSKbLZsnlQpEYREIQbCWU X-Developer-Key: i=dimitri.fedrau@liebherr.com; a=ed25519; pk=rT653x09JSQvotxIqQl4/XiI4AOiBZrdOGvxDUbb5m8= X-Endpoint-Received: by B4 Relay for dimitri.fedrau@liebherr.com/20241202 with auth_id=290 X-Original-From: Dimitri Fedrau Reply-To: dimitri.fedrau@liebherr.com From: Dimitri Fedrau Add property mac-termination-ohms in the device tree bindings for selecting the resistance value of the builtin series termination resistors of the PHY. Changing the resistance to an appropriate value can reduce signal reflections and therefore improve signal quality. Signed-off-by: Dimitri Fedrau --- Documentation/devicetree/bindings/net/ethernet-phy.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Docu= mentation/devicetree/bindings/net/ethernet-phy.yaml index 824bbe4333b7ed95cc39737d3c334a20aa890f01..93574c2726e5b2bc81a2dfb2462= eb73c7cbfe6a8 100644 --- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml @@ -238,6 +238,15 @@ properties: peak-to-peak specified in ANSI X3.263. When omitted, the PHYs default will be left as is. =20 + mac-termination-ohms: + description: + The xMII signals need series termination on the driver side to match= both + the output driver impedance and the line characteristic impedance, to + prevent reflections and EMI problems. Select a resistance value whic= h is + supported by the builtin resistors of the PHY, otherwise the resisto= rs may + have to be placed on board. When omitted, the PHYs default will be l= eft as + is. + leds: type: object =20 --=20 2.39.5 From nobody Mon Feb 9 06:18:51 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80AC722173D; Tue, 8 Apr 2025 07:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744098340; cv=none; b=cyNBHrV4mI2WmMA2RCs0A7v63fkys4cCasEQUtudpJvyn9azxaIn6YdESj4H39cb9wyoVJNSCFah58G/XpUGImmXL+y83CqGNwq77DlvhVv0v+ekL6tFpPVhMwriVTTHSZRI7I/2kV2sIEf1duHbEDLIjD3H3xEtNunyqm3f704= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744098340; c=relaxed/simple; bh=YQ4zPBqKO+TbeflKF81WpWFVnmtHT3kG5mWSk4tlLrM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lOnE2NIDqVbCQVcm3hciVBoEjj9489ic+AG4M1A7xPBO81+4GUF0ZhxZxCswSJ0MHRD9saiHsv6fwDnTbu+V61JcZCGNj9DvZJ4Pn0X1iixtjTDYlGfqAP4VkSB0kDsHANkVwVluYmjU69xYMfijF3h0iqR35DXyncgchMm7Nfo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rOxDV5va; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rOxDV5va" Received: by smtp.kernel.org (Postfix) with ESMTPS id 0BC0DC4CEEC; Tue, 8 Apr 2025 07:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744098340; bh=YQ4zPBqKO+TbeflKF81WpWFVnmtHT3kG5mWSk4tlLrM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=rOxDV5vakHUpoBOuNi7NEhjByf9IG+nD+BdGQFkKxpBkDaaaH+OsCP/ZgEtYGpLGL HFCbAemJxCMmUjAkJ2Th7HwmC51bmv7gSqmT4Z+2a9c0MEF6BfZbXU34TvrHwFsE42 cfby1zZACZdDNQywt39xO6zB2aIbSujrKb9wWQIB2J5Zm/9AwFz9CeC7QcoxK5gt3i Wsw6UmM+VgbI43VredeREb5nIILY4tdnJQCWBCcSE5q9ePd4dtAC2KqZfBu+Sw/g6i A5/vU2CDerzjXtFw1zoPBgsFEpelNyPrfLBRBw9LuARIKX2Tms13ptOzfMrwhdGnHt S04xnWeG1yKhg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED6F4C369A5; Tue, 8 Apr 2025 07:45:39 +0000 (UTC) From: Dimitri Fedrau via B4 Relay Date: Tue, 08 Apr 2025 09:45:33 +0200 Subject: [PATCH net-next v2 2/3] net: phy: Add helper for getting MAC termination resistance Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250408-dp83822-mac-impedance-v2-2-fefeba4a9804@liebherr.com> References: <20250408-dp83822-mac-impedance-v2-0-fefeba4a9804@liebherr.com> In-Reply-To: <20250408-dp83822-mac-impedance-v2-0-fefeba4a9804@liebherr.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Dimitri Fedrau , Dimitri Fedrau X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1744098338; l=1963; i=dimitri.fedrau@liebherr.com; s=20241202; h=from:subject:message-id; bh=3rPSnMTtXUybCDZzRHxcQdj0rW3ShNxaNA2Hqxzp20o=; b=RzeHcv3bxb4pNq+oou9OTP8EPu91EcvX4bUD80IzWFxMsMqw06vIkTHvLevnaltX76Yo2Vzcw 8eEEn1Yr9/xD5DcfxkUVa3A8JqvCmq0ZyIL6WzTlaMBB1o2McbWVFQf X-Developer-Key: i=dimitri.fedrau@liebherr.com; a=ed25519; pk=rT653x09JSQvotxIqQl4/XiI4AOiBZrdOGvxDUbb5m8= X-Endpoint-Received: by B4 Relay for dimitri.fedrau@liebherr.com/20241202 with auth_id=290 X-Original-From: Dimitri Fedrau Reply-To: dimitri.fedrau@liebherr.com From: Dimitri Fedrau Add helper which returns the MAC termination resistance value. Modifying the resistance to an appropriate value can reduce signal reflections and therefore improve signal quality. Signed-off-by: Dimitri Fedrau Reviewed-by: Russell King (Oracle) --- 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 675fbd225378796085cdc6c92ee2d7e9bff0b6f6..6bd888a7ad14f0e71670e43cf0d= d7ecebc2b23b9 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2948,6 +2948,21 @@ int phy_get_tx_amplitude_gain(struct phy_device *phy= dev, struct device *dev, } EXPORT_SYMBOL_GPL(phy_get_tx_amplitude_gain); =20 +/** + * phy_get_mac_termination - stores MAC termination in @val + * @phydev: phy_device struct + * @dev: pointer to the devices device struct + * @val: MAC termination + * + * Returns: 0 on success, < 0 on failure + */ +int phy_get_mac_termination(struct phy_device *phydev, struct device *dev, + u32 *val) +{ + return phy_get_u32_property(dev, "mac-termination-ohms", val); +} +EXPORT_SYMBOL_GPL(phy_get_mac_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 a2bfae80c44975db013760413867cebdf20c8216..63d237763f842e80d04bb534e32= cd42110129e41 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -2046,6 +2046,9 @@ int phy_get_tx_amplitude_gain(struct phy_device *phyd= ev, struct device *dev, enum ethtool_link_mode_bit_indices linkmode, u32 *val); =20 +int phy_get_mac_termination(struct phy_device *phydev, struct device *dev, + u32 *val); + void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_ad= v, bool *tx_pause, bool *rx_pause); =20 --=20 2.39.5 From nobody Mon Feb 9 06:18:51 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6DE625F79E; Tue, 8 Apr 2025 07:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744098340; cv=none; b=OsnF1RGR5sDL3EYUY/S4XFKqXt3AVQ+K9HJ55KvgmIk6EuxFQq41C2dQKfZGb7ojHEoLby2vT5YYLuFprSOFp1WJaeXChryDXr5qT6hJptL7o5cyuRUeAZlK+7qULaRTWizPIeMtIFTCfOBydoYoxs0QTSyG2Kj7HKQ4s7De3hE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744098340; c=relaxed/simple; bh=B84DeuW12H5b3bBfEOf4ObuDbt+tx3UhEmjpcBCFxDg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mZRDKBwCZCHbNgYdxSa1b5PDsZO8pXdoQC32lNzL7OSRdRU4m5T0BfUAT0zwWmA7555Nv3OeYSuSFJuwD1Bufigcw8N5Fy3VQ1HintyrmtaOzsG8tyEtHvszKSji35tREO3wcxgH0Uvrd/+x6sAvZvUYKAt2A5DQ3JQm75GqLtY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L5OLauJX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L5OLauJX" Received: by smtp.kernel.org (Postfix) with ESMTPS id 25DB7C4CEED; Tue, 8 Apr 2025 07:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744098340; bh=B84DeuW12H5b3bBfEOf4ObuDbt+tx3UhEmjpcBCFxDg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=L5OLauJXElm0ow49GaNBkFnUvt+9nWlP7IEW0cFkJUZkSW1NMyh4WTrxLMJpUI6Nb PKWYQb3uH2vfxVrUr4mi1CwdgC5FoyybDdqvXOF1Qrz0THOGFUmeg7dPK7yVVDGcmL RdhySwi/KoUM71SbMPiGFKb+yoXkJ4mYEO2nfkUML18AINmjhVia/fos8Hys+4Jl8A P1foODHpdYRllVEiVK/ldgu5PFxzyCGVdFLnyLg5p5oWVB0d4syodyLQgm7mGuJrd1 5qqTgpBRhyUW29z0zVmifFCHVcMbZSh0ggSwltUufyJyCK2e0PriAcze40SxfnhD1B AfLG7NOX7AU4Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 183EFC369A1; Tue, 8 Apr 2025 07:45:40 +0000 (UTC) From: Dimitri Fedrau via B4 Relay Date: Tue, 08 Apr 2025 09:45:34 +0200 Subject: [PATCH net-next v2 3/3] net: phy: dp83822: Add support for changing the MAC termination Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250408-dp83822-mac-impedance-v2-3-fefeba4a9804@liebherr.com> References: <20250408-dp83822-mac-impedance-v2-0-fefeba4a9804@liebherr.com> In-Reply-To: <20250408-dp83822-mac-impedance-v2-0-fefeba4a9804@liebherr.com> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Dimitri Fedrau , Dimitri Fedrau X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1744098338; l=3142; i=dimitri.fedrau@liebherr.com; s=20241202; h=from:subject:message-id; bh=uqjFbEaYL6in0znuVFxVSZRGnoMMf/E8l1gq/kbmCFc=; b=RcUpgLTX51RLZ/1goSlYifFqe2FHeIkjOLMB9SMHeSorYgXKQHJidYLmXNRTaWG4m5M+9L9gV lDaiQXMWPdRBdMXKsEuO71hSj4zPWLtofUQOZCvE3uRHD8hCPCG6aAo X-Developer-Key: i=dimitri.fedrau@liebherr.com; a=ed25519; pk=rT653x09JSQvotxIqQl4/XiI4AOiBZrdOGvxDUbb5m8= X-Endpoint-Received: by B4 Relay for dimitri.fedrau@liebherr.com/20241202 with auth_id=290 X-Original-From: Dimitri Fedrau Reply-To: dimitri.fedrau@liebherr.com From: Dimitri Fedrau The dp83822 provides the possibility to set the resistance value of the the MAC termination. Modifying the resistance to an appropriate value can reduce signal reflections and therefore improve signal quality. Signed-off-by: Dimitri Fedrau Reviewed-by: Russell King (Oracle) --- drivers/net/phy/dp83822.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c index 14f36154963841dff98be5af4dfbd2760325c13d..490c9f4e5d4e4dc866ef99f426f= 7497b5e1b49b4 100644 --- a/drivers/net/phy/dp83822.c +++ b/drivers/net/phy/dp83822.c @@ -33,6 +33,7 @@ #define MII_DP83822_MLEDCR 0x25 #define MII_DP83822_LDCTRL 0x403 #define MII_DP83822_LEDCFG1 0x460 +#define MII_DP83822_IOCTRL 0x461 #define MII_DP83822_IOCTRL1 0x462 #define MII_DP83822_IOCTRL2 0x463 #define MII_DP83822_GENCFG 0x465 @@ -118,6 +119,9 @@ #define DP83822_LEDCFG1_LED1_CTRL GENMASK(11, 8) #define DP83822_LEDCFG1_LED3_CTRL GENMASK(7, 4) =20 +/* IOCTRL bits */ +#define DP83822_IOCTRL_MAC_IMPEDANCE_CTRL GENMASK(4, 1) + /* IOCTRL1 bits */ #define DP83822_IOCTRL1_GPIO3_CTRL GENMASK(10, 8) #define DP83822_IOCTRL1_GPIO3_CTRL_LED3 BIT(0) @@ -202,6 +206,7 @@ struct dp83822_private { u32 gpio2_clk_out; bool led_pin_enable[DP83822_MAX_LED_PINS]; int tx_amplitude_100base_tx_index; + int mac_termination_index; }; =20 static int dp83822_config_wol(struct phy_device *phydev, @@ -533,6 +538,12 @@ static int dp83822_config_init(struct phy_device *phyd= ev) FIELD_PREP(DP83822_100BASE_TX_LINE_DRIVER_SWING, dp83822->tx_amplitude_100base_tx_index)); =20 + if (dp83822->mac_termination_index >=3D 0) + phy_modify_mmd(phydev, MDIO_MMD_VEND2, MII_DP83822_IOCTRL, + DP83822_IOCTRL_MAC_IMPEDANCE_CTRL, + FIELD_PREP(DP83822_IOCTRL_MAC_IMPEDANCE_CTRL, + dp83822->mac_termination_index)); + err =3D dp83822_config_init_leds(phydev); if (err) return err; @@ -736,6 +747,10 @@ static const u32 tx_amplitude_100base_tx_gain[] =3D { 93, 95, 97, 98, 100, 102, 103, 105, }; =20 +static const u32 mac_termination[] =3D { + 99, 91, 84, 78, 73, 69, 65, 61, 58, 55, 53, 50, 48, 46, 44, 43, +}; + static int dp83822_of_init_leds(struct phy_device *phydev) { struct device_node *node =3D phydev->mdio.dev.of_node; @@ -852,6 +867,23 @@ static int dp83822_of_init(struct phy_device *phydev) } } =20 + ret =3D phy_get_mac_termination(phydev, dev, &val); + if (!ret) { + for (i =3D 0; i < ARRAY_SIZE(mac_termination); i++) { + if (mac_termination[i] =3D=3D val) { + dp83822->mac_termination_index =3D i; + break; + } + } + + if (dp83822->mac_termination_index < 0) { + phydev_err(phydev, + "Invalid value for mac-termination-ohms property (%u)\n", + val); + return -EINVAL; + } + } + return dp83822_of_init_leds(phydev); } =20 @@ -931,6 +963,7 @@ static int dp8382x_probe(struct phy_device *phydev) return -ENOMEM; =20 dp83822->tx_amplitude_100base_tx_index =3D -1; + dp83822->mac_termination_index =3D -1; phydev->priv =3D dp83822; =20 return 0; --=20 2.39.5