]> www.infradead.org Git - users/dwmw2/openwrt.git/commitdiff
kernel: improve driver support for gen-3 Aquantia Ethernet PHYs
authorDaniel Golle <daniel@makrotopia.org>
Tue, 4 Jan 2022 23:01:53 +0000 (23:01 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 5 Jan 2022 00:57:25 +0000 (00:57 +0000)
 * 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@makrotopia.org>
target/linux/generic/hack-5.10/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch [moved from target/linux/generic/hack-5.10/721-net-phy-aquantia-enable-AQR112-and-AQR412.patch with 90% similarity]
target/linux/generic/hack-5.10/723-net-phy-aquantia-fix-system-side-protocol-mi.patch [new file with mode: 0644]
target/linux/generic/hack-5.10/724-net-phy-aquantia-Add-AQR113-driver-support.patch [moved from target/linux/generic/hack-5.10/722-net-phy-aquantia-Add-AQR113-driver-support.patch with 86% similarity]
target/linux/generic/hack-5.10/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch [moved from target/linux/generic/hack-5.10/723-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch with 79% similarity]

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 882f20c6d1f78f9195cfb6db0eaac520494ededb..e3541400d7e56bd8b4b3a43af04229b2dfdf0e2e 100644 (file)
@@ -109,30 +109,38 @@ Signed-off-by: Alex Marginean <alexandru.marginean@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 (file)
index 0000000..9c5df90
--- /dev/null
@@ -0,0 +1,34 @@
+From 5f008cb22f60da4e10375f22266c1a4e20b1252e Mon Sep 17 00:00:00 2001
+From: Alex Marginean <alexandru.marginean@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@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);
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 2b7a38d1c785f5b0536eef3da00b303751caf78f..7a661309f946572878e3663708dc0e8e21a2d692 100644 (file)
@@ -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) },
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 b60d0092411190955b9adf6b5f4e95d4fc6b2149..40ad0ff58310b9be94d7e2d642aeb3283714f5bc 100644 (file)
@@ -21,30 +21,38 @@ Signed-off-by: Daniel Golle <daniel@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) },