[openwrt/openwrt] kernel: improve driver support for gen-3 Aquantia Ethernet PHYs

LEDE Commits lede-commits at lists.infradead.org
Tue Jan 4 16:58:12 PST 2022


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/6c312d9717e1fd37552a6e840967cb0061f7bc8f

commit 6c312d9717e1fd37552a6e840967cb0061f7bc8f
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Tue Jan 4 23:01:53 2022 +0000

    kernel: improve driver support for gen-3 Aquantia Ethernet PHYs
    
     * correctly set system side interface, the original patch was
       errornous and there is a follow-up fix for it
     * enable phy statistics for AQR112(+R/C) and ARQ412
       (ethtool --phy-statistics ethX)
    
    Tested, including phy-statistics, on
     - IEI Puzzle M901 (AQR112, AQR112C, AQR112R)
     - IEI Puzzle M902 (AQR113, AQR112R)
     - Ubiquiti UniFi 6 LR (AQR112C)
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 ...et-phy-aquantia-enable-AQR112-and-AQR412.patch} | 16 +++++++---
 ...-phy-aquantia-fix-system-side-protocol-mi.patch | 34 ++++++++++++++++++++++
 ...t-phy-aquantia-Add-AQR113-driver-support.patch} |  8 ++---
 ...aquantia-add-PHY_IDs-for-AQR112-variants.patch} | 14 +++++++--
 4 files changed, 61 insertions(+), 11 deletions(-)

diff --git a/target/linux/generic/hack-5.10/721-net-phy-aquantia-enable-AQR112-and-AQR412.patch b/target/linux/generic/hack-5.10/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch
similarity index 90%
rename from target/linux/generic/hack-5.10/721-net-phy-aquantia-enable-AQR112-and-AQR412.patch
rename to target/linux/generic/hack-5.10/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch
index 882f20c6d1..e3541400d7 100644
--- a/target/linux/generic/hack-5.10/721-net-phy-aquantia-enable-AQR112-and-AQR412.patch
+++ b/target/linux/generic/hack-5.10/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch
@@ -109,30 +109,38 @@ Signed-off-by: Alex Marginean <alexandru.marginean at nxp.com>
  static int aqr_config_intr(struct phy_device *phydev)
  {
  	bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED;
-@@ -738,6 +808,22 @@ static struct phy_driver aqr_driver[] =
+@@ -738,6 +808,30 @@ static struct phy_driver aqr_driver[] =
  	.get_stats	= aqr107_get_stats,
  	.link_change_notify = aqr107_link_change_notify,
  },
 +{
 +	PHY_ID_MATCH_MODEL(PHY_ID_AQR112),
 +	.name		= "Aquantia AQR112",
-+	.config_aneg    = aqr_config_aneg_set_prot,
++	.probe		= aqr107_probe,
++	.config_aneg	= aqr_config_aneg_set_prot,
 +	.config_intr	= aqr_config_intr,
 +	.ack_interrupt	= aqr_ack_interrupt,
 +	.read_status	= aqr107_read_status,
++	.get_sset_count	= aqr107_get_sset_count,
++	.get_strings	= aqr107_get_strings,
++	.get_stats	= aqr107_get_stats,
 +},
 +{
 +	PHY_ID_MATCH_MODEL(PHY_ID_AQR412),
 +	.name		= "Aquantia AQR412",
-+	.config_aneg    = aqr_config_aneg_set_prot,
++	.probe		= aqr107_probe,
++	.config_aneg	= aqr_config_aneg_set_prot,
 +	.config_intr	= aqr_config_intr,
 +	.ack_interrupt	= aqr_ack_interrupt,
 +	.read_status	= aqr107_read_status,
++	.get_sset_count	= aqr107_get_sset_count,
++	.get_strings	= aqr107_get_strings,
++	.get_stats	= aqr107_get_stats,
 +},
  };
  
  module_phy_driver(aqr_driver);
-@@ -748,9 +834,11 @@ static struct mdio_device_id __maybe_unu
+@@ -748,9 +842,11 @@ static struct mdio_device_id __maybe_unu
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR105) },
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR106) },
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR107) },
diff --git a/target/linux/generic/hack-5.10/723-net-phy-aquantia-fix-system-side-protocol-mi.patch b/target/linux/generic/hack-5.10/723-net-phy-aquantia-fix-system-side-protocol-mi.patch
new file mode 100644
index 0000000000..9c5df905bb
--- /dev/null
+++ b/target/linux/generic/hack-5.10/723-net-phy-aquantia-fix-system-side-protocol-mi.patch
@@ -0,0 +1,34 @@
+From 5f008cb22f60da4e10375f22266c1a4e20b1252e Mon Sep 17 00:00:00 2001
+From: Alex Marginean <alexandru.marginean at nxp.com>
+Date: Fri, 20 Sep 2019 18:22:52 +0300
+Subject: [PATCH] drivers: net: phy: aquantia: fix system side protocol
+ misconfiguration
+
+Do not set up protocols for speeds that are not supported by FW.  Enabling
+these protocols leads to link issues on system side.
+
+Signed-off-by: Alex Marginean <alexandru.marginean at nxp.com>
+---
+ drivers/net/phy/aquantia_main.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/phy/aquantia_main.c
++++ b/drivers/net/phy/aquantia_main.c
+@@ -301,10 +301,16 @@ static int aqr_config_aneg_set_prot(stru
+ 	phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GSTART_RATE,
+ 		      aquantia_syscfg[if_type].start_rate);
+ 
+-	for (i = 0; i <= aquantia_syscfg[if_type].cnt; i++)
++	for (i = 0; i <= aquantia_syscfg[if_type].cnt; i++) {
++		u16 reg = phy_read_mmd(phydev, MDIO_MMD_VEND1,
++				       AQUANTIA_VND1_GSYSCFG_BASE + i);
++		if (!reg)
++			continue;
++
+ 		phy_write_mmd(phydev, MDIO_MMD_VEND1,
+ 			      AQUANTIA_VND1_GSYSCFG_BASE + i,
+ 			      aquantia_syscfg[if_type].syscfg);
++	}
+ 
+ 	/* wake PHY back up */
+ 	phy_write_mmd(phydev, MDIO_MMD_VEND1, AQUANTIA_VND1_GLOBAL_SC, 0);
diff --git a/target/linux/generic/hack-5.10/722-net-phy-aquantia-Add-AQR113-driver-support.patch b/target/linux/generic/hack-5.10/724-net-phy-aquantia-Add-AQR113-driver-support.patch
similarity index 86%
rename from target/linux/generic/hack-5.10/722-net-phy-aquantia-Add-AQR113-driver-support.patch
rename to target/linux/generic/hack-5.10/724-net-phy-aquantia-Add-AQR113-driver-support.patch
index 2b7a38d1c7..7a661309f9 100644
--- a/target/linux/generic/hack-5.10/722-net-phy-aquantia-Add-AQR113-driver-support.patch
+++ b/target/linux/generic/hack-5.10/724-net-phy-aquantia-Add-AQR113-driver-support.patch
@@ -18,8 +18,8 @@ Add a new entry for AQR113 PHY_ID
  #define PHY_ID_AQR113C	0x31c31c12
  #define PHY_ID_AQCS109	0x03a1b5c2
  #define PHY_ID_AQR405	0x03a1b4b0
-@@ -817,6 +818,14 @@ static struct phy_driver aqr_driver[] =
- 	.read_status	= aqr107_read_status,
+@@ -827,6 +828,14 @@ static struct phy_driver aqr_driver[] =
+ 	.get_stats	= aqr107_get_stats,
  },
  {
 +	PHY_ID_MATCH_MODEL(PHY_ID_AQR113),
@@ -32,8 +32,8 @@ Add a new entry for AQR113 PHY_ID
 +{
  	PHY_ID_MATCH_MODEL(PHY_ID_AQR412),
  	.name		= "Aquantia AQR412",
- 	.config_aneg    = aqr_config_aneg_set_prot,
-@@ -835,6 +844,7 @@ static struct mdio_device_id __maybe_unu
+ 	.probe		= aqr107_probe,
+@@ -849,6 +858,7 @@ static struct mdio_device_id __maybe_unu
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR106) },
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR107) },
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR112) },
diff --git a/target/linux/generic/hack-5.10/723-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch b/target/linux/generic/hack-5.10/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch
similarity index 79%
rename from target/linux/generic/hack-5.10/723-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch
rename to target/linux/generic/hack-5.10/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch
index b60d009241..40ad0ff583 100644
--- a/target/linux/generic/hack-5.10/723-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch
+++ b/target/linux/generic/hack-5.10/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch
@@ -21,30 +21,38 @@ Signed-off-by: Daniel Golle <daniel at makrotopia.org>
  #define PHY_ID_AQR113	0x31c31c40
  #define PHY_ID_AQR113C	0x31c31c12
  #define PHY_ID_AQCS109	0x03a1b5c2
-@@ -818,6 +820,22 @@ static struct phy_driver aqr_driver[] =
- 	.read_status	= aqr107_read_status,
+@@ -828,6 +830,30 @@ static struct phy_driver aqr_driver[] =
+ 	.get_stats	= aqr107_get_stats,
  },
  {
 +	PHY_ID_MATCH_MODEL(PHY_ID_AQR112C),
 +	.name		= "Aquantia AQR112C",
++	.probe		= aqr107_probe,
 +	.config_aneg	= aqr_config_aneg_set_prot,
 +	.config_intr	= aqr_config_intr,
 +	.ack_interrupt	= aqr_ack_interrupt,
 +	.read_status	= aqr107_read_status,
++	.get_sset_count	= aqr107_get_sset_count,
++	.get_strings	= aqr107_get_strings,
++	.get_stats	= aqr107_get_stats,
 +},
 +{
 +	PHY_ID_MATCH_MODEL(PHY_ID_AQR112R),
 +	.name		= "Aquantia AQR112R",
++	.probe		= aqr107_probe,
 +	.config_aneg	= aqr_config_aneg_set_prot,
 +	.config_intr	= aqr_config_intr,
 +	.ack_interrupt	= aqr_ack_interrupt,
 +	.read_status	= aqr107_read_status,
++	.get_sset_count	= aqr107_get_sset_count,
++	.get_strings	= aqr107_get_strings,
++	.get_stats	= aqr107_get_stats,
 +},
 +{
  	PHY_ID_MATCH_MODEL(PHY_ID_AQR113),
  	.name		= "Aquantia AQR113",
  	.config_aneg	= aqr_config_aneg,
-@@ -844,6 +862,8 @@ static struct mdio_device_id __maybe_unu
+@@ -858,6 +884,8 @@ static struct mdio_device_id __maybe_unu
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR106) },
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR107) },
  	{ PHY_ID_MATCH_MODEL(PHY_ID_AQR112) },



More information about the lede-commits mailing list