ramips: fix Tenbay T-MB5EU v1 Wireless MAC
[openwrt/staging/mkresin.git] / target / linux / ramips / patches-5.4 / 991-at803x.patch
index 6e178b80cee0e4ee095b5a9b0717018dd548f130..a0d9a03fcffed53eba56c1192aa4893b3222371c 100644 (file)
@@ -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)
-@@ -274,12 +285,73 @@ static int at803x_resume(struct phy_devi
+@@ -274,18 +285,80 @@ static int at803x_resume(struct phy_devi
        return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0);
  }
  
@@ -105,7 +105,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
  {
        struct device *dev = &phydev->mdio.dev;
        struct at803x_priv *priv;
-       int ret;
+       int ret = 0;
  
 +      if (at803x_mode(phydev) == AT803X_MODE_FIBER) {
 +              ret = phy_sfp_probe(phydev, &at803x_sfp_ops);
@@ -116,7 +116,38 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
-@@ -415,6 +487,10 @@ static int at803x_read_status(struct phy
+       phydev->priv = priv;
++#if 0
+       /* Some bootloaders leave the fiber page selected.
+        * Switch to the copper page, as otherwise we read
+        * the PHY capabilities from the fiber side.
+@@ -295,6 +368,7 @@ static int at803x_probe(struct phy_devic
+               ret = at803x_write_page(phydev, AT803X_PAGE_COPPER);
+               mutex_unlock(&phydev->mdio.bus->mdio_lock);
+       }
++#endif
+       return ret;
+ }
+@@ -419,6 +493,7 @@ static int at803x_get_features(struct ph
+       if (err)
+               return err;
++#if 0
+       if (!(phydev->phy_id & phydev->drv->phy_id_mask) == (ATH8031_PHY_ID & phydev->drv->phy_id_mask))
+               return 0;
+@@ -436,6 +511,7 @@ static int at803x_get_features(struct ph
+        */
+       linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
+                          phydev->supported);
++#endif
+       return 0;
+ }
+@@ -443,6 +519,10 @@ static int at803x_read_status(struct phy
  {
        int ss, err, old_link = phydev->link;
  
@@ -127,7 +158,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)
-@@ -469,6 +545,19 @@ static int at803x_read_status(struct phy
+@@ -497,6 +577,19 @@ static int at803x_read_status(struct phy
        return 0;
  }
  
@@ -147,7 +178,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
  static struct phy_driver at803x_driver[] = {
  {
        /* ATHEROS 8035 */
-@@ -504,6 +593,7 @@ static struct phy_driver at803x_driver[]
+@@ -532,6 +625,7 @@ static struct phy_driver at803x_driver[]
        /* ATHEROS 8031 */
        .phy_id                 = ATH8031_PHY_ID,
        .name                   = "Atheros 8031 ethernet",