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
-@@ -779,8 +779,14 @@ static int phylink_bringup_phy(struct ph
- config.interface = interface;
+@@ -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)
phy->phylink = pl;
phy->phy_link_change = phylink_phy_change;
+--
+2.20.1
+
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;
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) {
}
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);
}
static void ag71xx_rings_free(struct ag71xx *ag)
+--
+2.20.1
+
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
+@@ -1313,7 +1313,7 @@ static int ag71xx_open(struct net_device *ndev)
return 0;
err:
return ret;
}
+--
+2.20.1
+
drivers/net/ethernet/atheros/ag71xx.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index 405db37c084f..4aa93f5cffdc 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
@@ -324,7 +324,6 @@ struct ag71xx {
struct reset_control *mdio_reset;
struct mii_bus *mii_bus;
-@@ -565,7 +564,7 @@ static int ag71xx_mdio_probe(struct ag71
+@@ -565,7 +564,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
mii_bus->reset = ag71xx_mdio_reset;
mii_bus->priv = ag;
mii_bus->parent = dev;
if (!IS_ERR(ag->mdio_reset)) {
reset_control_assert(ag->mdio_reset);
-@@ -1679,10 +1678,6 @@ static const struct net_device_ops ag71x
+@@ -1671,10 +1670,6 @@ static const struct net_device_ops ag71xx_netdev_ops = {
.ndo_validate_addr = eth_validate_addr,
};
static int ag71xx_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
-@@ -1690,7 +1685,7 @@ static int ag71xx_probe(struct platform_
+@@ -1682,7 +1677,7 @@ static int ag71xx_probe(struct platform_device *pdev)
struct net_device *ndev;
struct resource *res;
const void *mac_addr;
struct ag71xx *ag;
if (!np)
-@@ -1709,16 +1704,6 @@ static int ag71xx_probe(struct platform_
+@@ -1701,16 +1696,6 @@ static int ag71xx_probe(struct platform_device *pdev)
return -EINVAL;
ag = netdev_priv(ndev);
ag->clk_eth = devm_clk_get(&pdev->dev, "eth");
if (IS_ERR(ag->clk_eth)) {
+--
+2.20.1
+
drivers/net/ethernet/atheros/ag71xx.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index 4aa93f5cffdc..a0cb122f5714 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
-@@ -1683,7 +1683,6 @@ static int ag71xx_probe(struct platform_
+@@ -1675,7 +1675,6 @@ static int ag71xx_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
const struct ag71xx_dcfg *dcfg;
struct net_device *ndev;
const void *mac_addr;
int tx_size, err;
struct ag71xx *ag;
-@@ -1695,16 +1694,16 @@ static int ag71xx_probe(struct platform_
+@@ -1687,16 +1686,16 @@ static int ag71xx_probe(struct platform_device *pdev)
if (!ndev)
return -ENOMEM;
ag->clk_eth = devm_clk_get(&pdev->dev, "eth");
if (IS_ERR(ag->clk_eth)) {
netif_err(ag, probe, ndev, "Failed to get eth clk.\n");
-@@ -1726,12 +1725,6 @@ static int ag71xx_probe(struct platform_
+@@ -1718,12 +1717,6 @@ static int ag71xx_probe(struct platform_device *pdev)
goto err_free;
}
ndev->irq = platform_get_irq(pdev, 0);
err = devm_request_irq(&pdev->dev, ndev->irq, ag71xx_interrupt,
0x0, dev_name(&pdev->dev), ndev);
+--
+2.20.1
+
drivers/net/ethernet/atheros/ag71xx.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index a0cb122f5714..29ff2b38e998 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
-@@ -1721,8 +1721,7 @@ static int ag71xx_probe(struct platform_
+@@ -1713,8 +1713,7 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->mac_reset = devm_reset_control_get(&pdev->dev, "mac");
if (IS_ERR(ag->mac_reset)) {
netif_err(ag, probe, ndev, "missing mac reset\n");
}
ndev->irq = platform_get_irq(pdev, 0);
-@@ -1731,7 +1730,7 @@ static int ag71xx_probe(struct platform_
+@@ -1723,7 +1722,7 @@ static int ag71xx_probe(struct platform_device *pdev)
if (err) {
netif_err(ag, probe, ndev, "unable to request IRQ %d\n",
ndev->irq);
}
ndev->netdev_ops = &ag71xx_netdev_ops;
-@@ -1758,10 +1757,8 @@ static int ag71xx_probe(struct platform_
+@@ -1750,10 +1749,8 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->stop_desc = dmam_alloc_coherent(&pdev->dev,
sizeof(struct ag71xx_desc),
&ag->stop_desc_dma, GFP_KERNEL);
}
netif_napi_add(ndev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT);
-@@ -1787,7 +1783,7 @@ static int ag71xx_probe(struct platform_
+@@ -1778,7 +1775,7 @@ static int ag71xx_probe(struct platform_device *pdev)
err = clk_prepare_enable(ag->clk_eth);
if (err) {
netif_err(ag, probe, ndev, "Failed to enable eth clk.\n");
}
ag71xx_wr(ag, AG71XX_REG_MAC_CFG1, 0);
-@@ -1823,8 +1819,6 @@ err_mdio_remove:
+@@ -1814,8 +1811,6 @@ static int ag71xx_probe(struct platform_device *pdev)
ag71xx_mdio_remove(ag);
err_put_clk:
clk_disable_unprepare(ag->clk_eth);
return err;
}
+--
+2.20.1
+
--- /dev/null
+From 7338811fa63c37cffadb35460a53175285a4bbc3 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, RGMII and SGMII
+
+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.
+
+The QCA9563 often uses SGMII to connect to external switches.
+
+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 | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index 29ff2b38e998..5e0c08553042 100644
+--- a/drivers/net/ethernet/atheros/ag71xx.c
++++ b/drivers/net/ethernet/atheros/ag71xx.c
+@@ -873,8 +873,11 @@ static void ag71xx_mac_validate(struct phylink_config *config,
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
+
+ if (state->interface != PHY_INTERFACE_MODE_NA &&
++ state->interface != PHY_INTERFACE_MODE_MII &&
++ state->interface != PHY_INTERFACE_MODE_RMII &&
+ state->interface != PHY_INTERFACE_MODE_GMII &&
+- state->interface != PHY_INTERFACE_MODE_MII) {
++ state->interface != PHY_INTERFACE_MODE_SGMII &&
++ phy_interface_mode_is_rgmii(state->interface)) {
+ bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+ return;
+ }
+@@ -888,7 +891,9 @@ 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_SGMII ||
++ phy_interface_mode_is_rgmii(state->interface)) {
+ phylink_set(mask, 1000baseT_Full);
+ phylink_set(mask, 1000baseX_Full);
+ }
+--
+2.20.1
+
+++ /dev/null
-From 6aca67c4d0d277a2d1e45cf61eafd5d3360ccca0 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(-)
-
---- a/drivers/net/ethernet/atheros/ag71xx.c
-+++ b/drivers/net/ethernet/atheros/ag71xx.c
-@@ -873,8 +873,10 @@ static void ag71xx_mac_validate(struct p
- __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
-
- if (state->interface != PHY_INTERFACE_MODE_NA &&
-+ state->interface != PHY_INTERFACE_MODE_MII &&
-+ state->interface != PHY_INTERFACE_MODE_RMII &&
- state->interface != PHY_INTERFACE_MODE_GMII &&
-- state->interface != PHY_INTERFACE_MODE_MII) {
-+ phy_interface_mode_is_rgmii(state->interface)) {
- bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
- return;
- }
-@@ -888,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 ||
-+ phy_interface_mode_is_rgmii(state->interface)) {
- phylink_set(mask, 1000baseT_Full);
- phylink_set(mask, 1000baseX_Full);
- }
-From 77858d8ef04e47db1b2edf294a2afc842e67b34e Mon Sep 17 00:00:00 2001
+From 5d0b959d227dc13c53ff9045557f5789f8e26ff8 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 1 Mar 2020 18:02:22 +0100
Subject: ag71xx: Configure Ethernet interface
drivers/net/ethernet/atheros/ag71xx.c | 76 +++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index 5e0c08553042..c67ed47b8ea8 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
@@ -64,6 +64,14 @@
struct ag71xx_desc *stop_desc;
dma_addr_t stop_desc_dma;
-@@ -363,6 +373,18 @@ static u32 ag71xx_rr(struct ag71xx *ag,
+@@ -363,6 +373,18 @@ static u32 ag71xx_rr(struct ag71xx *ag, unsigned int reg)
return ioread32(ag->mac_base + reg);
}
static void ag71xx_sb(struct ag71xx *ag, unsigned int reg, u32 mask)
{
void __iomem *r;
-@@ -847,6 +869,52 @@ static void ag71xx_hw_start(struct ag71x
+@@ -847,6 +869,52 @@ static void ag71xx_hw_start(struct ag71xx *ag)
netif_wake_queue(ag->ndev);
}
static void ag71xx_mac_config(struct phylink_config *config, unsigned int mode,
const struct phylink_link_state *state)
{
-@@ -858,6 +926,9 @@ static void ag71xx_mac_config(struct phy
+@@ -858,6 +926,9 @@ static void ag71xx_mac_config(struct phylink_config *config, unsigned int mode,
if (!ag71xx_is(ag, AR7100) && !ag71xx_is(ag, AR9130))
ag71xx_fast_reset(ag);
if (ag->tx_ring.desc_split) {
ag->fifodata[2] &= 0xffff;
ag->fifodata[2] |= ((2048 - ag->tx_ring.desc_split) / 4) << 16;
-@@ -1707,6 +1778,11 @@ static int ag71xx_probe(struct platform_
+@@ -1701,6 +1772,11 @@ static int ag71xx_probe(struct platform_device *pdev)
if (IS_ERR(ag->mac_base))
return PTR_ERR(ag->mac_base);
ag->clk_eth = devm_clk_get(&pdev->dev, "eth");
if (IS_ERR(ag->clk_eth)) {
netif_err(ag, probe, ndev, "Failed to get eth clk.\n");
+--
+2.20.1
+
-From 844d79bc784c2ca7c13f095d254f8ca6f3f7551b Mon Sep 17 00:00:00 2001
+From 47f20d77ba2ee83f64f81cc625f1017404dbc1e4 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 1 Mar 2020 20:58:36 +0100
Subject: of: Add of_get_available_child_by_name()
include/linux/of.h | 10 ++++++++++
2 files changed, 36 insertions(+)
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index ae03b1218b06..1b4738ed65fe 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
-@@ -860,6 +860,32 @@ struct device_node *of_get_compatible_ch
+@@ -833,6 +833,32 @@ struct device_node *of_get_compatible_child(const struct device_node *parent,
+ }
EXPORT_SYMBOL(of_get_compatible_child);
- /**
++/**
+ * of_get_available_child_by_name - Find the available child node by
+ * name for a given parent
+ * @node: parent node
+}
+EXPORT_SYMBOL(of_get_available_child_by_name);
+
-+/**
+ /**
* of_get_child_by_name - Find the child node by name for a given parent
* @node: parent node
- * @name: child name to look for.
+diff --git a/include/linux/of.h b/include/linux/of.h
+index c669c0a4732f..a6c11db35e11 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
-@@ -294,6 +294,9 @@ extern struct device_node *of_get_compat
+@@ -294,6 +294,9 @@ extern struct device_node *of_get_compatible_child(const struct device_node *par
const char *compatible);
extern struct device_node *of_get_child_by_name(const struct device_node *node,
const char *name);
/* cache lookup */
extern struct device_node *of_find_next_cache_node(const struct device_node *);
-@@ -663,6 +666,13 @@ static inline struct device_node *of_get
- const struct device_node *node,
- const char *name)
- {
-+ return NULL;
-+}
-+
+@@ -668,6 +671,13 @@ static inline struct device_node *of_get_child_by_name(
+ return NULL;
+ }
+
+static inline struct device_node *of_get_available_child_by_name(
+ const struct device_node *node,
+ const char *name)
+{
- return NULL;
- }
-
++ return NULL;
++}
++
+ static inline int of_device_is_compatible(const struct device_node *device,
+ const char *name)
+ {
+--
+2.20.1
+
-From 7c8cf5434a4667f05d0f8b169a5d560710c88afd Mon Sep 17 00:00:00 2001
+From 3d677a30e0c61bab706b90fe4feb02b673c26faf Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 1 Mar 2020 20:59:52 +0100
Subject: ag71xx: Probe MDIO only when available
drivers/net/ethernet/atheros/ag71xx.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
+diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
+index c67ed47b8ea8..44baa9a934dc 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
-@@ -545,12 +545,12 @@ static int ag71xx_mdio_reset(struct mii_
+@@ -545,12 +545,12 @@ static int ag71xx_mdio_reset(struct mii_bus *bus)
return 0;
}
int err;
np = dev->of_node;
-@@ -595,9 +595,7 @@ static int ag71xx_mdio_probe(struct ag71
+@@ -595,9 +595,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
msleep(200);
}
if (err)
goto mdio_err_put_clk;
-@@ -1755,6 +1753,7 @@ static const struct net_device_ops ag71x
+@@ -1749,6 +1747,7 @@ static const struct net_device_ops ag71xx_netdev_ops = {
static int ag71xx_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
const struct ag71xx_dcfg *dcfg;
struct net_device *ndev;
const void *mac_addr;
-@@ -1869,9 +1868,16 @@ static int ag71xx_probe(struct platform_
+@@ -1863,9 +1862,16 @@ static int ag71xx_probe(struct platform_device *pdev)
ag71xx_hw_init(ag);
platform_set_drvdata(pdev, ndev);
-@@ -1895,7 +1901,8 @@ static int ag71xx_probe(struct platform_
+@@ -1889,7 +1895,8 @@ static int ag71xx_probe(struct platform_device *pdev)
return 0;
err_mdio_remove:
err_put_clk:
clk_disable_unprepare(ag->clk_eth);
return err;
+--
+2.20.1
+