aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-4.19/736-net-phy-at803x-allow-to-configure-via-dt.patch
blob: 496700f37710c31159be823177772281b109ede7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -329,6 +329,14 @@ static int at803x_config_init(struct phy
 				AT803X_DEBUG_TX_CLK_DLY_EN, 0);
 	}
 
+#ifdef CONFIG_OF_MDIO
+	if (phydev->mdio.dev.of_node &&
+		of_property_read_bool(phydev->mdio.dev.of_node,
+				      "at803x-disable-smarteee")) {
+		at803x_disable_smarteee(phydev);
+	}
+#endif
+
 	return 0;
 }
 
@@ -367,6 +375,7 @@ static void at803x_link_change_notify(st
 {
 	struct at803x_priv *priv = phydev->priv;
 	struct at803x_platform_data *pdata;
+	u8 fixup_rgmii_tx_delay = 0;
 	pdata = dev_get_platdata(&phydev->mdio.dev);
 
 	/*
@@ -396,8 +405,19 @@ static void at803x_link_change_notify(st
 	} else {
 		priv->phy_reset = false;
 	}
-	if (pdata && pdata->fixup_rgmii_tx_delay &&
-	    phydev->speed != priv->prev_speed) {
+
+	if (pdata && pdata->fixup_rgmii_tx_delay)
+		fixup_rgmii_tx_delay = 1;
+
+#ifdef CONFIG_OF_MDIO
+	if (phydev->mdio.dev.of_node &&
+		of_property_read_bool(phydev->mdio.dev.of_node,
+				      "at803x-fixup-rgmii-tx-delay")) {
+			fixup_rgmii_tx_delay = 1;
+	}
+#endif
+
+	if (fixup_rgmii_tx_delay && phydev->speed != priv->prev_speed) {
 		switch (phydev->speed) {
 		case SPEED_10:
 		case SPEED_100: