aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/backport-5.10/775-v5.18-01-net-phy-at803x-move-page-selection-fix-to-config_init.patch
diff options
context:
space:
mode:
authorDaniel Kestrel <kestrel1974@t-online.de>2023-03-17 08:22:06 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2023-04-22 17:21:29 +0200
commit85b2f213c5293f32becc238e7b1b86002e02eda3 (patch)
tree4a57817fa573b103815bb8ffc5e7a3ca86e61ccc /target/linux/generic/backport-5.10/775-v5.18-01-net-phy-at803x-move-page-selection-fix-to-config_init.patch
parentaa8ba5166eded12258c66393a77c84d7030320c2 (diff)
downloadupstream-85b2f213c5293f32becc238e7b1b86002e02eda3.tar.gz
upstream-85b2f213c5293f32becc238e7b1b86002e02eda3.tar.bz2
upstream-85b2f213c5293f32becc238e7b1b86002e02eda3.zip
generic: 5.10: replace ramips AR8033 fiber patch with 5.18 patches
A patch was added in kernel 5.4 to support the fiber operation of AR8033 with ramips devices. In kernel 5.18 similar enhancements were added to the kernel. Those patches are required for other fiber based devices but when added, build fails for ramips targets. This commit removes the ramips patch and adds the kernel 5.18 ones. Signed-off-by: Daniel Kestrel <kestrel1974@t-online.de> [ split commit, refresh patch and improve commit title ] Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to 'target/linux/generic/backport-5.10/775-v5.18-01-net-phy-at803x-move-page-selection-fix-to-config_init.patch')
-rw-r--r--target/linux/generic/backport-5.10/775-v5.18-01-net-phy-at803x-move-page-selection-fix-to-config_init.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.10/775-v5.18-01-net-phy-at803x-move-page-selection-fix-to-config_init.patch b/target/linux/generic/backport-5.10/775-v5.18-01-net-phy-at803x-move-page-selection-fix-to-config_init.patch
new file mode 100644
index 0000000000..5d1246893b
--- /dev/null
+++ b/target/linux/generic/backport-5.10/775-v5.18-01-net-phy-at803x-move-page-selection-fix-to-config_init.patch
@@ -0,0 +1,81 @@
+From 4f3a00c7f5b2cfe4e127fd3fe49b55e1b318c01f Mon Sep 17 00:00:00 2001
+From: Robert Hancock <robert.hancock@calian.com>
+Date: Tue, 25 Jan 2022 10:54:08 -0600
+Subject: [PATCH] net: phy: at803x: move page selection fix to config_init
+
+The fix to select the copper page on AR8031 was being done in the probe
+function rather than config_init, so it would not be redone after resume
+from suspend. Move this to config_init so it is always redone when
+needed.
+
+Fixes: c329e5afb42f ("net: phy: at803x: select correct page on config init")
+Signed-off-by: Robert Hancock <robert.hancock@calian.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/phy/at803x.c | 40 ++++++++++++++++------------------------
+ 1 file changed, 16 insertions(+), 24 deletions(-)
+
+--- a/drivers/net/phy/at803x.c
++++ b/drivers/net/phy/at803x.c
+@@ -651,25 +651,7 @@ static int at803x_probe(struct phy_devic
+ return ret;
+ }
+
+- /* Some bootloaders leave the fiber page selected.
+- * Switch to the copper page, as otherwise we read
+- * the PHY capabilities from the fiber side.
+- */
+- if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) {
+- phy_lock_mdio_bus(phydev);
+- ret = at803x_write_page(phydev, AT803X_PAGE_COPPER);
+- phy_unlock_mdio_bus(phydev);
+- if (ret)
+- goto err;
+- }
+-
+ return 0;
+-
+-err:
+- if (priv->vddio)
+- regulator_disable(priv->vddio);
+-
+- return ret;
+ }
+
+ static void at803x_remove(struct phy_device *phydev)
+@@ -745,6 +727,22 @@ static int at803x_config_init(struct phy
+ {
+ int ret;
+
++ if (phydev->drv->phy_id == ATH8031_PHY_ID) {
++ /* Some bootloaders leave the fiber page selected.
++ * Switch to the copper page, as otherwise we read
++ * the PHY capabilities from the fiber side.
++ */
++ phy_lock_mdio_bus(phydev);
++ ret = at803x_write_page(phydev, AT803X_PAGE_COPPER);
++ phy_unlock_mdio_bus(phydev);
++ if (ret)
++ return ret;
++
++ ret = at8031_pll_config(phydev);
++ if (ret < 0)
++ return ret;
++ }
++
+ /* The RX and TX delay default is:
+ * after HW reset: RX delay enabled and TX delay disabled
+ * after SW reset: RX delay enabled, while TX delay retains the
+@@ -770,12 +768,6 @@ static int at803x_config_init(struct phy
+ if (ret < 0)
+ return ret;
+
+- if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) {
+- ret = at8031_pll_config(phydev);
+- if (ret < 0)
+- return ret;
+- }
+-
+ return 0;
+ }
+