[U-Boot] [PATCH 04/12] Net: phy: ti: Fix fifo_depth register write

Janine Hagemann j.hagemann at phytec.de
Thu Jun 14 09:48:48 UTC 2018


The register was not read before the writing, so the
previous value was overwritten.

Signed-off-by: Janine Hagemann <j.hagemann at phytec.de>
---
 drivers/net/phy/ti.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
index 8f3ed8a..d7ae881 100644
--- a/drivers/net/phy/ti.c
+++ b/drivers/net/phy/ti.c
@@ -51,6 +51,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 /* PHY CTRL bits */
 #define DP83867_PHYCR_FIFO_DEPTH_SHIFT		14
+#define DP83867_PHYCR_FIFO_DEPTH_MASK	(3 << 14)
+#define DP83867_PHYCR_RESERVED_MASK	BIT(11)
 #define DP83867_MDI_CROSSOVER		5
 #define DP83867_MDI_CROSSOVER_AUTO	2
 #define DP83867_MDI_CROSSOVER_MDIX	2
@@ -233,9 +235,14 @@ static int dp83867_config(struct phy_device *phydev)
 		  val | DP83867_SW_RESTART);
 
 	if (phy_interface_is_rgmii(phydev)) {
+		val = phy_read(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL);
+		if (val < 0)
+			return val;
+		val &= ~DP83867_PHYCR_FIFO_DEPTH_MASK;
+		val |= (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT);
 		ret = phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL,
-			(DP83867_MDI_CROSSOVER_AUTO << DP83867_MDI_CROSSOVER) |
-			(dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT));
+				val);
+
 		if (ret)
 			goto err_out;
 	} else if (phy_interface_is_sgmii(phydev)) {
-- 
2.7.4



More information about the U-Boot mailing list