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