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