kernel: make make patches/files apply/compile for kernel 5.2
[openwrt/staging/mkresin.git] / target / linux / generic / pending-5.2 / 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 @@ -332,8 +332,12 @@ static int at803x_config_init(struct phy
4 ret = at803x_enable_tx_delay(phydev);
5 }
6
7 - if (pdata && pdata->disable_smarteee)
8 + if ((pdata && pdata->disable_smarteee) ||
9 + (phydev->mdio.dev.of_node &&
10 + of_property_read_bool(phydev->mdio.dev.of_node,
11 + "at803x-disable-smarteee"))) {
12 at803x_disable_smarteee(phydev);
13 + }
14
15 return ret;
16 }
17 @@ -373,6 +377,7 @@ static void at803x_link_change_notify(st
18 {
19 struct at803x_priv *priv = phydev->priv;
20 struct at803x_platform_data *pdata;
21 + u8 fixup_rgmii_tx_delay = 0;
22
23 /*
24 * Conduct a hardware reset for AT8030/2 every time a link loss is
25 @@ -398,8 +403,18 @@ static void at803x_link_change_notify(st
26
27 /* enable tx delay for <= 100 MBit, disable for 1000 MBit */
28 pdata = dev_get_platdata(&phydev->mdio.dev);
29 - if (pdata && pdata->fixup_rgmii_tx_delay &&
30 - phydev->speed != priv->prev_speed) {
31 + if (pdata && pdata->fixup_rgmii_tx_delay)
32 + fixup_rgmii_tx_delay = 1;
33 +
34 +#ifdef CONFIG_OF_MDIO
35 + if (phydev->mdio.dev.of_node &&
36 + of_property_read_bool(phydev->mdio.dev.of_node,
37 + "at803x-fixup-rgmii-tx-delay")) {
38 + fixup_rgmii_tx_delay = 1;
39 + }
40 +#endif
41 +
42 + if (fixup_rgmii_tx_delay && phydev->speed != priv->prev_speed) {
43 switch (phydev->speed) {
44 case SPEED_10:
45 case SPEED_100: