[U-Boot] [PATCH 5/9] phy: atheros: don't overwrite debug register values

Michael Walle michael at walle.cc
Sat Oct 26 00:26:26 UTC 2019


Instead of doing a hard write, do a read-modify-write.

Signed-off-by: Michael Walle <michael at walle.cc>
---
 drivers/net/phy/atheros.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c
index 113374f03f..4b7a1fb9c4 100644
--- a/drivers/net/phy/atheros.c
+++ b/drivers/net/phy/atheros.c
@@ -12,10 +12,10 @@
 #define AR803x_PHY_DEBUG_DATA_REG	0x1e
 
 #define AR803x_DEBUG_REG_5		0x5
-#define AR803x_RGMII_TX_CLK_DLY		0x100
+#define AR803x_RGMII_TX_CLK_DLY		BIT(8)
 
 #define AR803x_DEBUG_REG_0		0x0
-#define AR803x_RGMII_RX_CLK_DLY		0x8000
+#define AR803x_RGMII_RX_CLK_DLY		BIT(15)
 
 static int ar803x_debug_reg_read(struct phy_device *phydev, u16 reg)
 {
@@ -74,16 +74,16 @@ static int ar803x_delay_config(struct phy_device *phydev)
 
 	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
 	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
-		ret = ar803x_debug_reg_write(phydev, AR803x_DEBUG_REG_5,
-					     AR803x_RGMII_TX_CLK_DLY);
+		ret = ar803x_debug_reg_mask(phydev, AR803x_DEBUG_REG_5,
+					    0, AR803x_RGMII_TX_CLK_DLY);
 		if (ret < 0)
 			return ret;
 	}
 
 	if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
 	    phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
-		ret = ar803x_debug_reg_write(phydev, AR803x_DEBUG_REG_0,
-					     AR803x_RGMII_RX_CLK_DLY);
+		ret = ar803x_debug_reg_mask(phydev, AR803x_DEBUG_REG_0,
+					    0, AR803x_RGMII_RX_CLK_DLY);
 		if (ret < 0)
 			return ret;
 	}
-- 
2.20.1



More information about the U-Boot mailing list