ramips: refresh patches
[oweals/openwrt.git] / target / linux / ar71xx / patches-4.14 / 903-at803x-add-sgmii-aneg-override-pdata.patch
1 --- a/drivers/net/phy/at803x.c
2 +++ b/drivers/net/phy/at803x.c
3 @@ -458,12 +458,15 @@ static void at803x_link_change_notify(st
4  
5  static int at803x_aneg_done(struct phy_device *phydev)
6  {
7 +       struct at803x_platform_data *pdata;
8         int ccr;
9  
10         int aneg_done = genphy_aneg_done(phydev);
11         if (aneg_done != BMSR_ANEGCOMPLETE)
12                 return aneg_done;
13  
14 +       pdata = dev_get_platdata(&phydev->mdio.dev);
15 +
16         /*
17          * in SGMII mode, if copper side autoneg is successful,
18          * also check SGMII side autoneg result
19 @@ -478,7 +481,8 @@ static int at803x_aneg_done(struct phy_d
20         /* check if the SGMII link is OK. */
21         if (!(phy_read(phydev, AT803X_PSSR) & AT803X_PSSR_MR_AN_COMPLETE)) {
22                 pr_warn("803x_aneg_done: SGMII link is not ok\n");
23 -               aneg_done = 0;
24 +               if (!pdata || !pdata->override_sgmii_aneg)
25 +                       aneg_done = 0;
26         }
27         /* switch back to copper page */
28         phy_write(phydev, AT803X_REG_CHIP_CONFIG, ccr | AT803X_BT_BX_REG_SEL);
29 --- a/include/linux/platform_data/phy-at803x.h
30 +++ b/include/linux/platform_data/phy-at803x.h
31 @@ -7,6 +7,7 @@ struct at803x_platform_data {
32         int enable_rgmii_rx_delay:1;
33         int fixup_rgmii_tx_delay:1;
34         int has_reset_gpio:1;
35 +       int override_sgmii_aneg:1;
36         int reset_gpio;
37  };
38