Skip to content

Commit

Permalink
ramips: fix AR8033 fiber operation
Browse files Browse the repository at this point in the history
It was reported AR8033 did not work in fiber operation mode on the ER-X.

While the earlier attempt of fixing this mitigated the issue of 1000
Base-X link mode not being supported, it also switched to the copper
page, breaking fiber operation altogether.

Extend the hack adding fiber operation so it does not switch to the
copper page. Also remove the part where the supported link mode bit for
1000 Base-X is removed, as this is required for fiber operation.

Signed-off-by: David Bauer <mail@david-bauer.net>
  • Loading branch information
blocktrron committed Jun 27, 2021
1 parent 1f5afba commit 54ed38d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 7 deletions.
38 changes: 35 additions & 3 deletions target/linux/ramips/patches-5.10/710-at803x.patch
Expand Up @@ -118,7 +118,23 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -744,6 +818,10 @@ static int at803x_read_status(struct phy
@@ -554,6 +628,7 @@ static int at803x_probe(struct phy_devic
return ret;
}

+#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.
@@ -565,6 +640,7 @@ static int at803x_probe(struct phy_devic
if (ret)
goto err;
}
+#endif

return 0;

@@ -744,6 +820,10 @@ static int at803x_read_status(struct phy
{
int ss, err, old_link = phydev->link;

Expand All @@ -129,7 +145,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)
@@ -844,6 +922,12 @@ static int at803x_config_aneg(struct phy
@@ -844,6 +924,12 @@ static int at803x_config_aneg(struct phy
{
int ret;

Expand All @@ -142,7 +158,23 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
ret = at803x_config_mdix(phydev, phydev->mdix_ctrl);
if (ret < 0)
return ret;
@@ -1145,6 +1229,7 @@ static struct phy_driver at803x_driver[]
@@ -943,6 +1029,7 @@ static int at803x_get_features(struct ph
if (err)
return err;

+#if 0
if (!at803x_match_phy_id(phydev, ATH8031_PHY_ID))
return 0;

@@ -960,6 +1047,7 @@ static int at803x_get_features(struct ph
*/
linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
phydev->supported);
+#endif
return 0;
}

@@ -1173,6 +1261,7 @@ static struct phy_driver at803x_driver[]
/* Qualcomm Atheros AR8031/AR8033 */
PHY_ID_MATCH_EXACT(ATH8031_PHY_ID),
.name = "Qualcomm Atheros AR8031/AR8033",
Expand Down
39 changes: 35 additions & 4 deletions target/linux/ramips/patches-5.4/991-at803x.patch
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;

Expand All @@ -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;
}

Expand All @@ -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",
Expand Down

0 comments on commit 54ed38d

Please sign in to comment.