From: Thanh Quan <[email protected]>

According to the TI DP83869HM datasheet Revision D (June 2025), section
7.6.1.41 STRAP_STS Register, the STRAP_OPMODE bitmask is bit [11:9].
Fix this.

Fixes: f3e22eea815d ("net: phy: add TI DP83869HM ethernet driver")
Signed-off-by: Thanh Quan <[email protected]>
Signed-off-by: Hai Pham <[email protected]>
Signed-off-by: Marek Vasut <[email protected]> # Use FIELD_GET()
---
Cc: Dominic Rath <[email protected]>
Cc: Hai Pham <[email protected]>
Cc: Jerome Forissier <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: Ramon Fried <[email protected]>
Cc: Thanh Quan <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
---
 drivers/net/phy/dp83869.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c
index b6fb5adae1f..c60fbf26a03 100644
--- a/drivers/net/phy/dp83869.c
+++ b/drivers/net/phy/dp83869.c
@@ -5,6 +5,7 @@
  */
 
 #include <phy.h>
+#include <linux/bitfield.h>
 #include <linux/compat.h>
 #include <malloc.h>
 
@@ -64,7 +65,7 @@
 #define DP83869_RGMII_RX_CLK_DELAY_EN          BIT(0)
 
 /* STRAP_STS1 bits */
-#define DP83869_STRAP_OP_MODE_MASK             GENMASK(2, 0)
+#define DP83869_STRAP_OP_MODE_MASK             GENMASK(11, 9)
 #define DP83869_STRAP_STS1_RESERVED            BIT(11)
 #define DP83869_STRAP_MIRROR_ENABLED           BIT(12)
 
@@ -168,7 +169,7 @@ static int dp83869_set_strapped_mode(struct phy_device 
*phydev)
        if (val < 0)
                return val;
 
-       dp83869->mode = val & DP83869_STRAP_OP_MODE_MASK;
+       dp83869->mode = FIELD_GET(DP83869_STRAP_OP_MODE_MASK, val);
 
        return 0;
 }
-- 
2.51.0

Reply via email to