--- /dev/null
+From b856150c8098f12996ee81c3ab2a65adbaeeb3ec Mon Sep 17 00:00:00 2001
+From: David Bauer <mail@david-bauer.net>
+Date: Sun, 27 Jun 2021 12:16:07 +0200
+Subject: [PATCH] net: phy: at803x: mask 1000 Base-X link mode
+
+AR8031/AR8033 have different status registers for copper
+and fiber operation. However, the extended status register
+is the same for both operation modes.
+
+As a result of that, ESTATUS_1000_XFULL is set to 1 even when
+operating in copper TP mode.
+
+Remove this mode from the supported link modes, as this driver
+currently only supports copper operation.
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/phy/at803x.c | 30 +++++++++++++++++++++++++++++-
+ 1 file changed, 29 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/phy/at803x.c
++++ b/drivers/net/phy/at803x.c
+@@ -583,6 +583,34 @@ static void at803x_remove(struct phy_dev
+ regulator_disable(priv->vddio);
+ }
+
++static int at803x_get_features(struct phy_device *phydev)
++{
++ int err;
++
++ err = genphy_read_abilities(phydev);
++ if (err)
++ return err;
++
++ if (!at803x_match_phy_id(phydev, ATH8031_PHY_ID))
++ return 0;
++
++ /* AR8031/AR8033 have different status registers
++ * for copper and fiber operation. However, the
++ * extended status register is the same for both
++ * operation modes.
++ *
++ * As a result of that, ESTATUS_1000_XFULL is set
++ * to 1 even when operating in copper TP mode.
++ *
++ * Remove this mode from the supported link modes,
++ * as this driver currently only supports copper
++ * operation.
++ */
++ linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
++ phydev->supported);
++ return 0;
++}
++
+ static int at803x_clk_out_config(struct phy_device *phydev)
+ {
+ struct at803x_priv *priv = phydev->priv;
+@@ -1156,7 +1184,7 @@ static struct phy_driver at803x_driver[]
+ .resume = at803x_resume,
+ .read_page = at803x_read_page,
+ .write_page = at803x_write_page,
+- /* PHY_GBIT_FEATURES */
++ .get_features = at803x_get_features,
+ .read_status = at803x_read_status,
+ .aneg_done = at803x_aneg_done,
+ .ack_interrupt = &at803x_ack_interrupt,
static int at803x_suspend(struct phy_device *phydev)
{
int value;
-@@ -1102,6 +1191,34 @@ static int at803x_cable_test_start(struc
+@@ -1130,6 +1219,34 @@ static int at803x_cable_test_start(struc
return 0;
}
static struct phy_driver at803x_driver[] = {
{
/* Qualcomm Atheros AR8035 */
-@@ -1198,7 +1315,20 @@ static struct phy_driver at803x_driver[]
+@@ -1226,7 +1343,20 @@ static struct phy_driver at803x_driver[]
.read_status = at803x_read_status,
.soft_reset = genphy_soft_reset,
.config_aneg = at803x_config_aneg,
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
-@@ -1328,6 +1328,19 @@ static struct phy_driver at803x_driver[]
+@@ -1356,6 +1356,19 @@ static struct phy_driver at803x_driver[]
.get_sset_count = at803x_get_sset_count,
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
}, };
module_phy_driver(at803x_driver);
-@@ -1338,6 +1351,8 @@ static struct mdio_device_id __maybe_unu
+@@ -1366,6 +1379,8 @@ static struct mdio_device_id __maybe_unu
{ PHY_ID_MATCH_EXACT(ATH8032_PHY_ID) },
{ PHY_ID_MATCH_EXACT(ATH8035_PHY_ID) },
{ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID) },
#define QCA8337_PHY_ID 0x004dd036
#define QCA8K_PHY_ID_MASK 0xffffffff
-@@ -1329,10 +1330,23 @@ static struct phy_driver at803x_driver[]
+@@ -1357,10 +1358,23 @@ static struct phy_driver at803x_driver[]
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
}, {
/* PHY_GBIT_FEATURES */
.probe = at803x_probe,
.flags = PHY_IS_INTERNAL,
-@@ -1352,7 +1366,8 @@ static struct mdio_device_id __maybe_unu
+@@ -1380,7 +1394,8 @@ static struct mdio_device_id __maybe_unu
{ PHY_ID_MATCH_EXACT(ATH8035_PHY_ID) },
{ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID) },
{ PHY_ID_MATCH_EXACT(QCA8337_PHY_ID) },
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
-@@ -1329,6 +1329,8 @@ static struct phy_driver at803x_driver[]
+@@ -1357,6 +1357,8 @@ static struct phy_driver at803x_driver[]
.get_sset_count = at803x_get_sset_count,
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
}, {
/* QCA8327-A from switch QCA8327-AL1A */
.phy_id = QCA8327_A_PHY_ID,
-@@ -1342,6 +1344,8 @@ static struct phy_driver at803x_driver[]
+@@ -1370,6 +1372,8 @@ static struct phy_driver at803x_driver[]
.get_sset_count = at803x_get_sset_count,
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
}, {
/* QCA8327-B from switch QCA8327-BL1A */
.phy_id = QCA8327_B_PHY_ID,
-@@ -1355,6 +1359,8 @@ static struct phy_driver at803x_driver[]
+@@ -1383,6 +1387,8 @@ static struct phy_driver at803x_driver[]
.get_sset_count = at803x_get_sset_count,
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
-@@ -1318,47 +1318,47 @@ static struct phy_driver at803x_driver[]
+@@ -1346,47 +1346,47 @@ static struct phy_driver at803x_driver[]
.config_aneg = at803x_config_aneg,
}, {
/* QCA8337 */
#define AT803X_DEBUG_REG_1F 0x1F
#define AT803X_DEBUG_PLL_ON BIT(2)
-@@ -1220,6 +1225,58 @@ static int qca83xx_config_init(struct ph
+@@ -1248,6 +1253,58 @@ static int qca83xx_config_init(struct ph
return 0;
}
static struct phy_driver at803x_driver[] = {
{
/* Qualcomm Atheros AR8035 */
-@@ -1329,8 +1386,8 @@ static struct phy_driver at803x_driver[]
+@@ -1357,8 +1414,8 @@ static struct phy_driver at803x_driver[]
.get_sset_count = at803x_get_sset_count,
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
}, {
/* QCA8327-A from switch QCA8327-AL1A */
.phy_id = QCA8327_A_PHY_ID,
-@@ -1344,8 +1401,8 @@ static struct phy_driver at803x_driver[]
+@@ -1372,8 +1429,8 @@ static struct phy_driver at803x_driver[]
.get_sset_count = at803x_get_sset_count,
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
}, {
/* QCA8327-B from switch QCA8327-BL1A */
.phy_id = QCA8327_B_PHY_ID,
-@@ -1359,8 +1416,8 @@ static struct phy_driver at803x_driver[]
+@@ -1387,8 +1444,8 @@ static struct phy_driver at803x_driver[]
.get_sset_count = at803x_get_sset_count,
.get_strings = at803x_get_strings,
.get_stats = at803x_get_stats,
#define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15)
#define AT803X_DEBUG_REG_5 0x05
-@@ -1222,9 +1224,37 @@ static int qca83xx_config_init(struct ph
+@@ -1250,9 +1252,37 @@ static int qca83xx_config_init(struct ph
break;
}
static int qca83xx_resume(struct phy_device *phydev)
{
int ret, val;
-@@ -1379,6 +1409,7 @@ static struct phy_driver at803x_driver[]
+@@ -1407,6 +1437,7 @@ static struct phy_driver at803x_driver[]
.phy_id_mask = QCA8K_PHY_ID_MASK,
.name = "Qualcomm Atheros 8337 internal PHY",
/* PHY_GBIT_FEATURES */
.probe = at803x_probe,
.flags = PHY_IS_INTERNAL,
.config_init = qca83xx_config_init,
-@@ -1394,6 +1425,7 @@ static struct phy_driver at803x_driver[]
+@@ -1422,6 +1453,7 @@ static struct phy_driver at803x_driver[]
.phy_id_mask = QCA8K_PHY_ID_MASK,
.name = "Qualcomm Atheros 8327-A internal PHY",
/* PHY_GBIT_FEATURES */
.probe = at803x_probe,
.flags = PHY_IS_INTERNAL,
.config_init = qca83xx_config_init,
-@@ -1409,6 +1441,7 @@ static struct phy_driver at803x_driver[]
+@@ -1437,6 +1469,7 @@ static struct phy_driver at803x_driver[]
.phy_id_mask = QCA8K_PHY_ID_MASK,
.name = "Qualcomm Atheros 8327-B internal PHY",
/* PHY_GBIT_FEATURES */
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
-@@ -1233,6 +1233,9 @@ static int qca83xx_config_init(struct ph
+@@ -1261,6 +1261,9 @@ static int qca83xx_config_init(struct ph
at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
QCA8327_DEBUG_MANU_CTRL_EN, 0);
AT803X_DEBUG_TX_CLK_DLY_EN, 0);
}
-@@ -1208,9 +1208,9 @@ static int qca83xx_config_init(struct ph
+@@ -1236,9 +1236,9 @@ static int qca83xx_config_init(struct ph
switch (switch_revision) {
case 1:
/* For 100M waveform */
break;
case 2:
-@@ -1218,8 +1218,8 @@ static int qca83xx_config_init(struct ph
+@@ -1246,8 +1246,8 @@ static int qca83xx_config_init(struct ph
fallthrough;
case 4:
phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_AZ_DEBUG, 0x803f);
at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3C, 0x6000);
break;
}
-@@ -1230,7 +1230,7 @@ static int qca83xx_config_init(struct ph
+@@ -1258,7 +1258,7 @@ static int qca83xx_config_init(struct ph
*/
if (phydev->drv->phy_id == QCA8327_A_PHY_ID ||
phydev->drv->phy_id == QCA8327_B_PHY_ID)
QCA8327_DEBUG_MANU_CTRL_EN, 0);
/* Following original QCA sourcecode set port to prefer master */
-@@ -1248,12 +1248,12 @@ static void qca83xx_link_change_notify(s
+@@ -1276,12 +1276,12 @@ static void qca83xx_link_change_notify(s
/* Set DAC Amplitude adjustment to +6% for 100m on link running */
if (phydev->state == PHY_RUNNING) {
if (phydev->speed == SPEED_100)
QCA8327_DEBUG_MANU_CTRL_EN, 0);
}
}
-@@ -1300,7 +1300,7 @@ static int qca83xx_suspend(struct phy_de
+@@ -1328,7 +1328,7 @@ static int qca83xx_suspend(struct phy_de
phy_modify(phydev, MII_BMCR, mask, 0);
}
+++ /dev/null
-From 97ca310aa18a93329ef5cd68c20de89761962f45 Mon Sep 17 00:00:00 2001
-From: David Bauer <mail@david-bauer.net>
-Date: Sun, 13 Jun 2021 12:19:36 +0200
-Subject: [PATCH] net: phy: at803x: fix feature detection
-
-AR8031/AR8033 have different status registers for copper
-and fiber operation. However, the extended status register
-is the same for both operation modes.
-
-As a result of that, ESTATUS_1000_XFULL is set to 1 even when
-operating in copper TP mode.
-
-Remove this mode from the supported link modes, as this driver
-currently only supports copper operation.
-
-Signed-off-by: David Bauer <mail@david-bauer.net>
----
- drivers/net/phy/at803x.c | 30 +++++++++++++++++++++++++++++-
- 1 file changed, 29 insertions(+), 1 deletion(-)
-
---- a/drivers/net/phy/at803x.c
-+++ b/drivers/net/phy/at803x.c
-@@ -1032,6 +1032,34 @@ static int at803x_set_tunable(struct phy
- }
- }
-
-+static int at803x_get_features(struct phy_device *phydev)
-+{
-+ int err;
-+
-+ err = genphy_read_abilities(phydev);
-+ if (err)
-+ return err;
-+
-+ if (!at803x_match_phy_id(phydev, ATH8031_PHY_ID))
-+ return 0;
-+
-+ /* AR8031/AR8033 have different status registers
-+ * for copper and fiber operation. However, the
-+ * extended status register is the same for both
-+ * operation modes.
-+ *
-+ * As a result of that, ESTATUS_1000_XFULL is set
-+ * to 1 even when operating in copper TP mode.
-+ *
-+ * Remove this mode from the supported link modes,
-+ * as this driver currently only supports copper
-+ * operation.
-+ */
-+ linkmode_clear_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
-+ phydev->supported);
-+ return 0;
-+}
-+
- static int at803x_cable_test_result_trans(u16 status)
- {
- switch (FIELD_GET(AT803X_CDT_STATUS_STAT_MASK, status)) {
-@@ -1364,7 +1392,7 @@ static struct phy_driver at803x_driver[]
- .resume = at803x_resume,
- .read_page = at803x_read_page,
- .write_page = at803x_write_page,
-- /* PHY_GBIT_FEATURES */
-+ .get_features = at803x_get_features,
- .read_status = at803x_read_status,
- .aneg_done = at803x_aneg_done,
- .ack_interrupt = &at803x_ack_interrupt,