update patches
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 1 Mar 2020 13:24:29 +0000 (14:24 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 12 Mar 2020 22:47:13 +0000 (23:47 +0100)
target/linux/ath79/patches-5.4/200-ag71xx-Handle-allocation-errors-in-ag71xx_rings_init.patch
target/linux/ath79/patches-5.4/201-ag71xx-Call-phylink_disconnect_phy-in-case-ag71xx_hw.patch [new file with mode: 0644]
target/linux/ath79/patches-5.4/202-ag71xx-Add-support-for-RMII-and-RGMII.patch [new file with mode: 0644]
target/linux/ath79/patches-5.4/203-phylink-Improve-error-message-when-validate-failed.patch [new file with mode: 0644]
target/linux/ath79/patches-5.4/999-add-rmgii.patch [deleted file]

index 3b0e2ad4d5a095dc1b4a578e8b4d1f76a4ff67ea..f8e0f880cc96849a9be92d143958bb58957d647f 100644 (file)
@@ -1,7 +1,7 @@
-From 2cee757eaf5cc6175bc0ac7b0b808794124ec40a Mon Sep 17 00:00:00 2001
+From d69de6e350bf1dc5a264ba642360d8422e43bcfa Mon Sep 17 00:00:00 2001
 From: Hauke Mehrtens <hauke@hauke-m.de>
 Date: Mon, 17 Feb 2020 23:40:14 +0100
-Subject: [PATCH 1/3] ag71xx: Handle allocation errors in ag71xx_rings_init()
+Subject: ag71xx: Handle allocation errors in ag71xx_rings_init()
 
 Free the allocated resources in ag71xx_rings_init() in case
 ag71xx_ring_rx_init() returns an error.
@@ -14,9 +14,11 @@ Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
  drivers/net/ethernet/atheros/ag71xx.c | 22 ++++++++++++++++++----
  1 file changed, 18 insertions(+), 4 deletions(-)
 
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index 02b7705393ca..38683224b70b 100644
 --- a/drivers/net/ethernet/atheros/ag71xx.c
 +++ b/drivers/net/ethernet/atheros/ag71xx.c
-@@ -1169,6 +1169,7 @@ static int ag71xx_rings_init(struct ag71
+@@ -1169,6 +1169,7 @@ static int ag71xx_rings_init(struct ag71xx *ag)
        struct ag71xx_ring *tx = &ag->tx_ring;
        struct ag71xx_ring *rx = &ag->rx_ring;
        int ring_size, tx_size;
@@ -24,7 +26,7 @@ Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
  
        ring_size = BIT(tx->order) + BIT(rx->order);
        tx_size = BIT(tx->order);
-@@ -1181,9 +1182,8 @@ static int ag71xx_rings_init(struct ag71
+@@ -1181,9 +1182,8 @@ static int ag71xx_rings_init(struct ag71xx *ag)
                                           ring_size * AG71XX_DESC_SIZE,
                                           &tx->descs_dma, GFP_KERNEL);
        if (!tx->descs_cpu) {
@@ -36,7 +38,7 @@ Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
        }
  
        rx->buf = &tx->buf[tx_size];
-@@ -1191,7 +1191,21 @@ static int ag71xx_rings_init(struct ag71
+@@ -1191,7 +1191,21 @@ static int ag71xx_rings_init(struct ag71xx *ag)
        rx->descs_dma = tx->descs_dma + tx_size * AG71XX_DESC_SIZE;
  
        ag71xx_ring_tx_init(ag);
@@ -59,3 +61,6 @@ Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
  }
  
  static void ag71xx_rings_free(struct ag71xx *ag)
+-- 
+2.20.1
+
diff --git a/target/linux/ath79/patches-5.4/201-ag71xx-Call-phylink_disconnect_phy-in-case-ag71xx_hw.patch b/target/linux/ath79/patches-5.4/201-ag71xx-Call-phylink_disconnect_phy-in-case-ag71xx_hw.patch
new file mode 100644 (file)
index 0000000..98030cc
--- /dev/null
@@ -0,0 +1,33 @@
+From 03afc69f3f96c7a704e3b8aab56f041bc0be3326 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Mon, 17 Feb 2020 23:50:23 +0100
+Subject: ag71xx: Call phylink_disconnect_phy() in case ag71xx_hw_enable()
+ fails
+
+The ag71xx_rings_cleanup() should already be handled in the
+ag71xx_hw_enable() in case it fails internally. In this function we
+should call phylink_disconnect_phy() in case the ag71xx_hw_enable()
+failed to get back into the old state.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
+---
+ drivers/net/ethernet/atheros/ag71xx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index 38683224b70b..405db37c084f 100644
+--- a/drivers/net/ethernet/atheros/ag71xx.c
++++ b/drivers/net/ethernet/atheros/ag71xx.c
+@@ -1313,7 +1313,7 @@ static int ag71xx_open(struct net_device *ndev)
+       return 0;
+ err:
+-      ag71xx_rings_cleanup(ag);
++      phylink_disconnect_phy(ag->phylink);
+       return ret;
+ }
+-- 
+2.20.1
+
diff --git a/target/linux/ath79/patches-5.4/202-ag71xx-Add-support-for-RMII-and-RGMII.patch b/target/linux/ath79/patches-5.4/202-ag71xx-Add-support-for-RMII-and-RGMII.patch
new file mode 100644 (file)
index 0000000..c22ce08
--- /dev/null
@@ -0,0 +1,47 @@
+From c6c6ad7561270d2ea13739b983db3ccc74f78bb9 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 1 Mar 2020 13:59:26 +0100
+Subject: ag71xx: Add support for RMII and RGMII
+
+The GMAC0 on the AR9344 also supports RMII and RGMII. This is an
+external interface which gets connected to an external PHY or an
+external switch. Without this patch the driver does not load on PHYs
+configured to RMII or RGMII.
+
+This still misses the external interface configuration, but that was
+also not done before the switch to phylink.
+
+Fixes: 892e09153fa3 ("net: ag71xx: port to phylink")
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ drivers/net/ethernet/atheros/ag71xx.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index 405db37c084f..f12fe297f8ce 100644
+--- a/drivers/net/ethernet/atheros/ag71xx.c
++++ b/drivers/net/ethernet/atheros/ag71xx.c
+@@ -875,7 +875,9 @@ static void ag71xx_mac_validate(struct phylink_config *config,
+       if (state->interface != PHY_INTERFACE_MODE_NA &&
+           state->interface != PHY_INTERFACE_MODE_GMII &&
+-          state->interface != PHY_INTERFACE_MODE_MII) {
++          state->interface != PHY_INTERFACE_MODE_RGMII &&
++          state->interface != PHY_INTERFACE_MODE_MII &&
++          state->interface != PHY_INTERFACE_MODE_RMII) {
+               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               return;
+       }
+@@ -889,7 +891,8 @@ static void ag71xx_mac_validate(struct phylink_config *config,
+       phylink_set(mask, 100baseT_Full);
+       if (state->interface == PHY_INTERFACE_MODE_NA ||
+-          state->interface == PHY_INTERFACE_MODE_GMII) {
++          state->interface == PHY_INTERFACE_MODE_GMII ||
++          state->interface == PHY_INTERFACE_MODE_RGMII) {
+               phylink_set(mask, 1000baseT_Full);
+               phylink_set(mask, 1000baseX_Full);
+       }
+-- 
+2.20.1
+
diff --git a/target/linux/ath79/patches-5.4/203-phylink-Improve-error-message-when-validate-failed.patch b/target/linux/ath79/patches-5.4/203-phylink-Improve-error-message-when-validate-failed.patch
new file mode 100644 (file)
index 0000000..2cb2cfc
--- /dev/null
@@ -0,0 +1,39 @@
+From d6be63073613930ede10b1cfa92c45f49bea3e70 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 1 Mar 2020 14:19:41 +0100
+Subject: phylink: Improve error message when validate failed
+
+This should improve the error message when the PHY validate in the MAC
+driver failed. I ran into this problem multiple times that I put wrong
+interface values into the device tree and was searching why it is
+failing with -22 (-EINVAL). This should make it easier to spot the
+problem.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ drivers/net/phy/phylink.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
+index b4367fab7899..5347275215be 100644
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -797,8 +797,14 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
+               config.interface = interface;
+       ret = phylink_validate(pl, supported, &config);
+-      if (ret)
++      if (ret) {
++              phylink_warn(pl, "validation of %s with support %*pb and advertisement %*pb failed: %d\n",
++                           phy_modes(config.interface),
++                           __ETHTOOL_LINK_MODE_MASK_NBITS, phy->supported,
++                           __ETHTOOL_LINK_MODE_MASK_NBITS, config.advertising,
++                           ret);
+               return ret;
++      }
+       phy->phylink = pl;
+       phy->phy_link_change = phylink_phy_change;
+-- 
+2.20.1
+
diff --git a/target/linux/ath79/patches-5.4/999-add-rmgii.patch b/target/linux/ath79/patches-5.4/999-add-rmgii.patch
deleted file mode 100644 (file)
index 828d7d0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/net/ethernet/atheros/ag71xx.c
-+++ b/drivers/net/ethernet/atheros/ag71xx.c
-@@ -875,6 +875,7 @@ static void ag71xx_mac_validate(struct p
-       if (state->interface != PHY_INTERFACE_MODE_NA &&
-           state->interface != PHY_INTERFACE_MODE_GMII &&
-+          state->interface != PHY_INTERFACE_MODE_RGMII &&
-           state->interface != PHY_INTERFACE_MODE_MII) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
-               return;
-@@ -889,7 +890,8 @@ static void ag71xx_mac_validate(struct p
-       phylink_set(mask, 100baseT_Full);
-       if (state->interface == PHY_INTERFACE_MODE_NA ||
--          state->interface == PHY_INTERFACE_MODE_GMII) {
-+          state->interface == PHY_INTERFACE_MODE_GMII ||
-+          state->interface == PHY_INTERFACE_MODE_RGMII) {
-               phylink_set(mask, 1000baseT_Full);
-               phylink_set(mask, 1000baseX_Full);
-       }