firmware/build_patches/openwrt/0215-generic-backport-5.18-...

155 lines
6.0 KiB
Diff

From e1abb1ddb7177391d9e02be985e5950d3dd233e0 Mon Sep 17 00:00:00 2001
From: Stijn Segers <foss@volatilesystems.org>
Date: Sat, 26 Aug 2023 12:08:34 +0200
Subject: [PATCH 15/18] generic: backport 5.18 AT803x fiber support patch
Commit e1242fc3390 backported some 5.18 AT803x patches, which were
modified to apply to 5.15. With the QCA8081 patches part of the 5.16
merge window, those 5.18 AT803x patches need to be the actual upstream
ones; otherwise RB5009UG just hangs at boot time.
Signed-off-by: Stijn Segers <foss@volatilesystems.org>
---
...-01-net-phy-at803x-add-fiber-support.patch | 37 ++++++++++---------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/target/linux/generic/backport-5.15/778-v5.18-01-net-phy-at803x-add-fiber-support.patch b/target/linux/generic/backport-5.15/778-v5.18-01-net-phy-at803x-add-fiber-support.patch
index 7cb21ed00d..989dc06ca6 100644
--- a/target/linux/generic/backport-5.15/778-v5.18-01-net-phy-at803x-add-fiber-support.patch
+++ b/target/linux/generic/backport-5.15/778-v5.18-01-net-phy-at803x-add-fiber-support.patch
@@ -20,9 +20,11 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/at803x.c | 76 +++++++++++++++++++++++++++++++++++-----
1 file changed, 67 insertions(+), 9 deletions(-)
+diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
+index 052b2eb9f101f..3f3d4c164df40 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
-@@ -48,6 +48,8 @@
+@@ -51,6 +51,8 @@
#define AT803X_INTR_ENABLE_PAGE_RECEIVED BIT(12)
#define AT803X_INTR_ENABLE_LINK_FAIL BIT(11)
#define AT803X_INTR_ENABLE_LINK_SUCCESS BIT(10)
@@ -31,10 +33,11 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#define AT803X_INTR_ENABLE_WIRESPEED_DOWNGRADE BIT(5)
#define AT803X_INTR_ENABLE_POLARITY_CHANGED BIT(1)
#define AT803X_INTR_ENABLE_WOL BIT(0)
-@@ -82,6 +84,17 @@
+@@ -85,7 +87,17 @@
+ #define AT803X_DEBUG_DATA 0x1E
#define AT803X_MODE_CFG_MASK 0x0F
- #define AT803X_MODE_CFG_SGMII 0x01
+-#define AT803X_MODE_CFG_SGMII 0x01
+#define AT803X_MODE_CFG_BASET_RGMII 0x00
+#define AT803X_MODE_CFG_BASET_SGMII 0x01
+#define AT803X_MODE_CFG_BX1000_RGMII_50OHM 0x02
@@ -49,7 +52,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#define AT803X_PSSR 0x11 /*PHY-Specific Status Register*/
#define AT803X_PSSR_MR_AN_COMPLETE 0x0200
-@@ -199,6 +212,8 @@ struct at803x_priv {
+@@ -283,6 +295,8 @@ struct at803x_priv {
u16 clk_25m_mask;
u8 smarteee_lpi_tw_1g;
u8 smarteee_lpi_tw_100m;
@@ -58,7 +61,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
struct regulator_dev *vddio_rdev;
struct regulator_dev *vddh_rdev;
struct regulator *vddio;
-@@ -674,7 +689,33 @@ static int at803x_probe(struct phy_devic
+@@ -784,7 +798,33 @@ static int at803x_probe(struct phy_device *phydev)
return ret;
}
@@ -92,7 +95,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}
static void at803x_remove(struct phy_device *phydev)
-@@ -687,6 +728,7 @@ static void at803x_remove(struct phy_dev
+@@ -797,6 +837,7 @@ static void at803x_remove(struct phy_device *phydev)
static int at803x_get_features(struct phy_device *phydev)
{
@@ -100,7 +103,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
int err;
err = genphy_read_abilities(phydev);
-@@ -704,12 +746,13 @@ static int at803x_get_features(struct ph
+@@ -823,12 +864,13 @@ static int at803x_get_features(struct phy_device *phydev)
* As a result of that, ESTATUS_1000_XFULL is set
* to 1 even when operating in copper TP mode.
*
@@ -119,7 +122,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
return 0;
}
-@@ -773,15 +816,18 @@ static int at8031_pll_config(struct phy_
+@@ -892,15 +934,18 @@ static int at8031_pll_config(struct phy_device *phydev)
static int at803x_config_init(struct phy_device *phydev)
{
@@ -141,7 +144,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
phy_unlock_mdio_bus(phydev);
if (ret)
return ret;
-@@ -840,6 +886,7 @@ static int at803x_ack_interrupt(struct p
+@@ -959,6 +1004,7 @@ static int at803x_ack_interrupt(struct phy_device *phydev)
static int at803x_config_intr(struct phy_device *phydev)
{
@@ -149,7 +152,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
int err;
int value;
-@@ -856,6 +903,10 @@ static int at803x_config_intr(struct phy
+@@ -975,6 +1021,10 @@ static int at803x_config_intr(struct phy_device *phydev)
value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED;
value |= AT803X_INTR_ENABLE_LINK_FAIL;
value |= AT803X_INTR_ENABLE_LINK_SUCCESS;
@@ -160,12 +163,12 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
err = phy_write(phydev, AT803X_INTR_ENABLE, value);
} else {
-@@ -923,8 +974,12 @@ static void at803x_link_change_notify(st
+@@ -1107,8 +1157,12 @@ static int at803x_read_specific_status(struct phy_device *phydev)
static int at803x_read_status(struct phy_device *phydev)
{
+ struct at803x_priv *priv = phydev->priv;
- int ss, err, old_link = phydev->link;
+ int err, old_link = phydev->link;
+ if (priv->is_1000basex)
+ return genphy_c37_read_status(phydev);
@@ -173,7 +176,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/* Update the link, but return if there was an error */
err = genphy_update_link(phydev);
if (err)
-@@ -1023,6 +1078,7 @@ static int at803x_config_mdix(struct phy
+@@ -1162,6 +1216,7 @@ static int at803x_config_mdix(struct phy_device *phydev, u8 ctrl)
static int at803x_config_aneg(struct phy_device *phydev)
{
@@ -181,13 +184,13 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
int ret;
ret = at803x_config_mdix(phydev, phydev->mdix_ctrl);
-@@ -1039,6 +1095,9 @@ static int at803x_config_aneg(struct phy
+@@ -1178,6 +1233,9 @@ static int at803x_config_aneg(struct phy_device *phydev)
return ret;
}
+ if (priv->is_1000basex)
+ return genphy_c37_config_aneg(phydev);
+
- return genphy_config_aneg(phydev);
- }
-
+ /* Do not restart auto-negotiation by setting ret to 0 defautly,
+ * when calling __genphy_config_aneg later.
+ */
--
2.42.1