generic: backport at803x fixes
[openwrt/staging/wigyori.git] / target / linux / ramips / patches-5.4 / 991-at803x.patch
index 95411211b2d3f5951431f0396871f5e182fc3667..29e79e65d71e395844af06f749239ef6cc0b3663 100644 (file)
@@ -23,7 +23,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
  
  #define AT803X_SPECIFIC_STATUS                        0x11
  #define AT803X_SS_SPEED_MASK                  (3 << 14)
-@@ -53,9 +55,18 @@
+@@ -52,9 +54,18 @@
  
  #define AT803X_MODE_CFG_MASK                  0x0F
  #define AT803X_MODE_CFG_SGMII                 0x01
@@ -42,7 +42,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
  
  #define AT803X_DEBUG_REG_0                    0x00
  #define AT803X_DEBUG_RX_CLK_DLY_EN            BIT(15)
-@@ -243,10 +254,72 @@ static int at803x_resume(struct phy_devi
+@@ -274,12 +285,73 @@ static int at803x_resume(struct phy_devi
        return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0);
  }
  
@@ -105,17 +105,18 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
  {
        struct device *dev = &phydev->mdio.dev;
        struct at803x_priv *priv;
-+      int ret;
-+
+       int ret;
 +      if (at803x_mode(phydev) == AT803X_MODE_FIBER) {
 +              ret = phy_sfp_probe(phydev, &at803x_sfp_ops);
 +              if (ret < 0)
 +                      return ret;
 +      }
++
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
-@@ -394,6 +467,10 @@ static int at803x_read_status(struct phy
+               return -ENOMEM;
+@@ -415,6 +487,10 @@ static int at803x_read_status(struct phy
  {
        int ss, err, old_link = phydev->link;
  
@@ -126,7 +127,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
        /* Update the link, but return if there was an error */
        err = genphy_update_link(phydev);
        if (err)
-@@ -448,6 +525,19 @@ static int at803x_read_status(struct phy
+@@ -469,6 +545,19 @@ static int at803x_read_status(struct phy
        return 0;
  }
  
@@ -146,7 +147,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
  static struct phy_driver at803x_driver[] = {
  {
        /* ATHEROS 8035 */
-@@ -461,6 +551,7 @@ static struct phy_driver at803x_driver[]
+@@ -482,6 +571,7 @@ static struct phy_driver at803x_driver[]
        .suspend                = at803x_suspend,
        .resume                 = at803x_resume,
        /* PHY_GBIT_FEATURES */