* [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: linux-arm-kernel These patches port some recent fixes for linux-4.5.y stable branch. They fix the MDIO settings trying to cover the all possible scenario when the stmmac is connected to a real transceiver or a switch. These patches are needed for Kernel 4.5 where Lime2, BananaPi and Cubieboard2 show problems when use the stmmac: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823493 Additional Note: o The 4.4.y branch has a previous version of the stmmac; that is not including the development that introduced the regressions for MDIO bus. o The 4.5.y kernel has "March_2013" stmmac version plus the patch that introduce some MDIO configuration problems so the regressions. o The 4.6.y has all the fixes on top of the "Oct_2015" stmmac version. Giuseppe CAVALLARO (1): Revert "stmmac: Fix 'eth0: No PHY found' regression" Giuseppe Cavallaro (1): stmmac: fix MDIO settings drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 10 +-- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 91 ++++++++++++++++------ 3 files changed, 70 insertions(+), 42 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: stable Cc: linux-arm-kernel, netdev, robin.murphy, marc.zyngier, afaerber, peppe.cavallaro, bert, linux-sunxi, maxime.ripard These patches port some recent fixes for linux-4.5.y stable branch. They fix the MDIO settings trying to cover the all possible scenario when the stmmac is connected to a real transceiver or a switch. These patches are needed for Kernel 4.5 where Lime2, BananaPi and Cubieboard2 show problems when use the stmmac: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823493 Additional Note: o The 4.4.y branch has a previous version of the stmmac; that is not including the development that introduced the regressions for MDIO bus. o The 4.5.y kernel has "March_2013" stmmac version plus the patch that introduce some MDIO configuration problems so the regressions. o The 4.6.y has all the fixes on top of the "Oct_2015" stmmac version. Giuseppe CAVALLARO (1): Revert "stmmac: Fix 'eth0: No PHY found' regression" Giuseppe Cavallaro (1): stmmac: fix MDIO settings drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 10 +-- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 91 ++++++++++++++++------ 3 files changed, 70 insertions(+), 42 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: stable-u79uwXL29TY76Z2rM5mHXA Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, netdev-u79uwXL29TY76Z2rM5mHXA, robin.murphy-5wv7dgnIgG8, marc.zyngier-5wv7dgnIgG8, afaerber-l3A5Bk7waGM, peppe.cavallaro-qxv4g6HH51o, bert-phGP8mJ4Mqk, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8 These patches port some recent fixes for linux-4.5.y stable branch. They fix the MDIO settings trying to cover the all possible scenario when the stmmac is connected to a real transceiver or a switch. These patches are needed for Kernel 4.5 where Lime2, BananaPi and Cubieboard2 show problems when use the stmmac: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823493 Additional Note: o The 4.4.y branch has a previous version of the stmmac; that is not including the development that introduced the regressions for MDIO bus. o The 4.5.y kernel has "March_2013" stmmac version plus the patch that introduce some MDIO configuration problems so the regressions. o The 4.6.y has all the fixes on top of the "Oct_2015" stmmac version. Giuseppe CAVALLARO (1): Revert "stmmac: Fix 'eth0: No PHY found' regression" Giuseppe Cavallaro (1): stmmac: fix MDIO settings drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 10 +-- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 91 ++++++++++++++++------ 3 files changed, 70 insertions(+), 42 deletions(-) -- 2.7.4 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/2 (linux-stable-4.5.y)] Revert "stmmac: Fix 'eth0: No PHY found' regression" @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: linux-arm-kernel From: Giuseppe CAVALLARO <peppe.cavallaro@st.com> This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493. due to problems on GeekBox and Banana Pi M1 board when connected to a real transceiver instead of a switch via fixed-link. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> Cc: Andreas F?rber <afaerber@suse.de> Cc: Frank Sch?fer <fschaefer.oss@googlemail.com> Cc: Dinh Nguyen <dinh.linux@gmail.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 ++++++++++- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 +-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index efb54f3..0faf163 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -199,12 +199,21 @@ int stmmac_mdio_register(struct net_device *ndev) struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; int addr, found; - struct device_node *mdio_node = priv->plat->mdio_node; + struct device_node *mdio_node = NULL; + struct device_node *child_node = NULL; if (!mdio_bus_data) return 0; if (IS_ENABLED(CONFIG_OF)) { + for_each_child_of_node(priv->device->of_node, child_node) { + if (of_device_is_compatible(child_node, + "snps,dwmac-mdio")) { + mdio_node = child_node; + break; + } + } + if (mdio_node) { netdev_dbg(ndev, "FOUND MDIO subnode\n"); } else { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 4514ba7..6a52fa1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -110,7 +110,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) struct device_node *np = pdev->dev.of_node; struct plat_stmmacenet_data *plat; struct stmmac_dma_cfg *dma_cfg; - struct device_node *child_node = NULL; plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); if (!plat) @@ -141,19 +140,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->phy_node = of_node_get(np); } - for_each_child_of_node(np, child_node) - if (of_device_is_compatible(child_node, "snps,dwmac-mdio")) { - plat->mdio_node = child_node; - break; - } - /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); - if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node) + if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name) plat->mdio_bus_data = NULL; else plat->mdio_bus_data = -- 2.7.4 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 1/2 (linux-stable-4.5.y)] Revert "stmmac: Fix 'eth0: No PHY found' regression" @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: stable Cc: linux-arm-kernel, netdev, robin.murphy, marc.zyngier, afaerber, peppe.cavallaro, bert, linux-sunxi, maxime.ripard, Gabriel Fernandez, Frank Schäfer, Dinh Nguyen, David S . Miller From: Giuseppe CAVALLARO <peppe.cavallaro@st.com> This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493. due to problems on GeekBox and Banana Pi M1 board when connected to a real transceiver instead of a switch via fixed-link. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> Cc: Andreas Färber <afaerber@suse.de> Cc: Frank Schäfer <fschaefer.oss@googlemail.com> Cc: Dinh Nguyen <dinh.linux@gmail.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net> --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 ++++++++++- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 +-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index efb54f3..0faf163 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -199,12 +199,21 @@ int stmmac_mdio_register(struct net_device *ndev) struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; int addr, found; - struct device_node *mdio_node = priv->plat->mdio_node; + struct device_node *mdio_node = NULL; + struct device_node *child_node = NULL; if (!mdio_bus_data) return 0; if (IS_ENABLED(CONFIG_OF)) { + for_each_child_of_node(priv->device->of_node, child_node) { + if (of_device_is_compatible(child_node, + "snps,dwmac-mdio")) { + mdio_node = child_node; + break; + } + } + if (mdio_node) { netdev_dbg(ndev, "FOUND MDIO subnode\n"); } else { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 4514ba7..6a52fa1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -110,7 +110,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) struct device_node *np = pdev->dev.of_node; struct plat_stmmacenet_data *plat; struct stmmac_dma_cfg *dma_cfg; - struct device_node *child_node = NULL; plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); if (!plat) @@ -141,19 +140,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->phy_node = of_node_get(np); } - for_each_child_of_node(np, child_node) - if (of_device_is_compatible(child_node, "snps,dwmac-mdio")) { - plat->mdio_node = child_node; - break; - } - /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); - if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node) + if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name) plat->mdio_bus_data = NULL; else plat->mdio_bus_data = -- 2.7.4 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 1/2 (linux-stable-4.5.y)] Revert "stmmac: Fix 'eth0: No PHY found' regression" @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: stable-u79uwXL29TY76Z2rM5mHXA Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, netdev-u79uwXL29TY76Z2rM5mHXA, robin.murphy-5wv7dgnIgG8, marc.zyngier-5wv7dgnIgG8, afaerber-l3A5Bk7waGM, peppe.cavallaro-qxv4g6HH51o, bert-phGP8mJ4Mqk, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, Gabriel Fernandez, Frank Schäfer, Dinh Nguyen, David S . Miller From: Giuseppe CAVALLARO <peppe.cavallaro-qxv4g6HH51o@public.gmane.org> This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493. due to problems on GeekBox and Banana Pi M1 board when connected to a real transceiver instead of a switch via fixed-link. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro-qxv4g6HH51o@public.gmane.org> Cc: Gabriel Fernandez <gabriel.fernandez-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Cc: Andreas Färber <afaerber-l3A5Bk7waGM@public.gmane.org> Cc: Frank Schäfer <fschaefer.oss-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Cc: Dinh Nguyen <dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> Signed-off-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 ++++++++++- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 +-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index efb54f3..0faf163 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -199,12 +199,21 @@ int stmmac_mdio_register(struct net_device *ndev) struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; int addr, found; - struct device_node *mdio_node = priv->plat->mdio_node; + struct device_node *mdio_node = NULL; + struct device_node *child_node = NULL; if (!mdio_bus_data) return 0; if (IS_ENABLED(CONFIG_OF)) { + for_each_child_of_node(priv->device->of_node, child_node) { + if (of_device_is_compatible(child_node, + "snps,dwmac-mdio")) { + mdio_node = child_node; + break; + } + } + if (mdio_node) { netdev_dbg(ndev, "FOUND MDIO subnode\n"); } else { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 4514ba7..6a52fa1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -110,7 +110,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) struct device_node *np = pdev->dev.of_node; struct plat_stmmacenet_data *plat; struct stmmac_dma_cfg *dma_cfg; - struct device_node *child_node = NULL; plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); if (!plat) @@ -141,19 +140,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->phy_node = of_node_get(np); } - for_each_child_of_node(np, child_node) - if (of_device_is_compatible(child_node, "snps,dwmac-mdio")) { - plat->mdio_node = child_node; - break; - } - /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); - if ((plat->phy_node && !of_phy_is_fixed_link(np)) || !plat->mdio_node) + if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name) plat->mdio_bus_data = NULL; else plat->mdio_bus_data = -- 2.7.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 1/2 (linux-stable-4.5.y)] Revert "stmmac: Fix 'eth0: No PHY found' regression" @ 2016-08-14 15:44 ` Greg KH 0 siblings, 0 replies; 20+ messages in thread From: Greg KH @ 2016-08-14 15:44 UTC (permalink / raw) To: linux-arm-kernel On Mon, May 23, 2016 at 03:17:42PM +0200, Giuseppe Cavallaro wrote: > From: Giuseppe CAVALLARO <peppe.cavallaro@st.com> > > This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493. > due to problems on GeekBox and Banana Pi M1 board when > connected to a real transceiver instead of a switch via > fixed-link. > > Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> > Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> > Cc: Andreas F?rber <afaerber@suse.de> > Cc: Frank Sch?fer <fschaefer.oss@googlemail.com> > Cc: Dinh Nguyen <dinh.linux@gmail.com> > Cc: David S. Miller <davem@davemloft.net> > Signed-off-by: David S. Miller <davem@davemloft.net> > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 ++++++++++- > drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 +-------- > 2 files changed, 11 insertions(+), 9 deletions(-) <formletter> This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly. </formletter> ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2 (linux-stable-4.5.y)] Revert "stmmac: Fix 'eth0: No PHY found' regression" @ 2016-08-14 15:44 ` Greg KH 0 siblings, 0 replies; 20+ messages in thread From: Greg KH @ 2016-08-14 15:44 UTC (permalink / raw) To: Giuseppe Cavallaro Cc: stable, linux-arm-kernel, netdev, robin.murphy, marc.zyngier, afaerber, bert, linux-sunxi, maxime.ripard, Gabriel Fernandez, Frank Schäfer, Dinh Nguyen, David S . Miller On Mon, May 23, 2016 at 03:17:42PM +0200, Giuseppe Cavallaro wrote: > From: Giuseppe CAVALLARO <peppe.cavallaro@st.com> > > This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493. > due to problems on GeekBox and Banana Pi M1 board when > connected to a real transceiver instead of a switch via > fixed-link. > > Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> > Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> > Cc: Andreas F�rber <afaerber@suse.de> > Cc: Frank Sch�fer <fschaefer.oss@googlemail.com> > Cc: Dinh Nguyen <dinh.linux@gmail.com> > Cc: David S. Miller <davem@davemloft.net> > Signed-off-by: David S. Miller <davem@davemloft.net> > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 ++++++++++- > drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 +-------- > 2 files changed, 11 insertions(+), 9 deletions(-) <formletter> This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly. </formletter> ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2 (linux-stable-4.5.y)] Revert "stmmac: Fix 'eth0: No PHY found' regression" @ 2016-08-14 15:44 ` Greg KH 0 siblings, 0 replies; 20+ messages in thread From: Greg KH @ 2016-08-14 15:44 UTC (permalink / raw) To: Giuseppe Cavallaro Cc: stable-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, netdev-u79uwXL29TY76Z2rM5mHXA, robin.murphy-5wv7dgnIgG8, marc.zyngier-5wv7dgnIgG8, afaerber-l3A5Bk7waGM, bert-phGP8mJ4Mqk, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, Gabriel Fernandez, Frank Schäfer, Dinh Nguyen, David S . Miller On Mon, May 23, 2016 at 03:17:42PM +0200, Giuseppe Cavallaro wrote: > From: Giuseppe CAVALLARO <peppe.cavallaro-qxv4g6HH51o@public.gmane.org> > > This reverts commit 88f8b1bb41c6208f81b6a480244533ded7b59493. > due to problems on GeekBox and Banana Pi M1 board when > connected to a real transceiver instead of a switch via > fixed-link. > > Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro-qxv4g6HH51o@public.gmane.org> > Cc: Gabriel Fernandez <gabriel.fernandez-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > Cc: Andreas Färber <afaerber-l3A5Bk7waGM@public.gmane.org> > Cc: Frank Schäfer <fschaefer.oss-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > Cc: Dinh Nguyen <dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> > Signed-off-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 ++++++++++- > drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 +-------- > 2 files changed, 11 insertions(+), 9 deletions(-) <formletter> This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly. </formletter> -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/2 (linux-stable-4.5.y)] stmmac: fix MDIO settings @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: linux-arm-kernel Initially the phy_bus_name was added to manipulate the driver name but it was recently just used to manage the fixed-link and then to take some decision at run-time. So the patch uses the is_pseudo_fixed_link and removes the phy_bus_name variable not necessary anymore. The driver can manage the mdio registration by using phy-handle, dwmac-mdio and own parameter e.g. snps,phy-addr. This patch takes care about all these possible configurations and fixes the mdio registration in case of there is a real transceiver or a switch (that needs to be managed by using fixed-link). Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Andreas F?rber <afaerber@suse.de> Tested-by: Frank Sch?fer <fschaefer.oss@googlemail.com> Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> Cc: Dinh Nguyen <dinh.linux@gmail.com> Cc: David S. Miller <davem@davemloft.net> Cc: Phil Reid <preid@electromag.com.au> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 19 +---- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 84 +++++++++++++++++----- 3 files changed, 70 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c21015b..389d7d0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -271,7 +271,6 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) */ bool stmmac_eee_init(struct stmmac_priv *priv) { - char *phy_bus_name = priv->plat->phy_bus_name; unsigned long flags; bool ret = false; @@ -283,7 +282,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv) goto out; /* Never init EEE in case of a switch is attached */ - if (phy_bus_name && (!strcmp(phy_bus_name, "fixed"))) + if (priv->phydev->is_pseudo_fixed_link) goto out; /* MAC core supports the EEE feature. */ @@ -820,12 +819,8 @@ static int stmmac_init_phy(struct net_device *dev) phydev = of_phy_connect(dev, priv->plat->phy_node, &stmmac_adjust_link, 0, interface); } else { - if (priv->plat->phy_bus_name) - snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x", - priv->plat->phy_bus_name, priv->plat->bus_id); - else - snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", - priv->plat->bus_id); + snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", + priv->plat->bus_id); snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id, priv->plat->phy_addr); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 0faf163..3f5512f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -198,29 +198,12 @@ int stmmac_mdio_register(struct net_device *ndev) struct mii_bus *new_bus; struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; + struct device_node *mdio_node = priv->plat->mdio_node; int addr, found; - struct device_node *mdio_node = NULL; - struct device_node *child_node = NULL; if (!mdio_bus_data) return 0; - if (IS_ENABLED(CONFIG_OF)) { - for_each_child_of_node(priv->device->of_node, child_node) { - if (of_device_is_compatible(child_node, - "snps,dwmac-mdio")) { - mdio_node = child_node; - break; - } - } - - if (mdio_node) { - netdev_dbg(ndev, "FOUND MDIO subnode\n"); - } else { - netdev_warn(ndev, "No MDIO subnode found\n"); - } - } - new_bus = mdiobus_alloc(); if (new_bus == NULL) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 6a52fa1..190fb6d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -96,6 +96,69 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries) } /** + * stmmac_dt_phy - parse device-tree driver parameters to allocate PHY resources + * @plat: driver data platform structure + * @np: device tree node + * @dev: device pointer + * Description: + * The mdio bus will be allocated in case of a phy transceiver is on board; + * it will be NULL if the fixed-link is configured. + * If there is the "snps,dwmac-mdio" sub-node the mdio will be allocated + * in any case (for DSA, mdio must be registered even if fixed-link). + * The table below sums the supported configurations: + * ------------------------------- + * snps,phy-addr | Y + * ------------------------------- + * phy-handle | Y + * ------------------------------- + * fixed-link | N + * ------------------------------- + * snps,dwmac-mdio | + * even if | Y + * fixed-link | + * ------------------------------- + * + * It returns 0 in case of success otherwise -ENODEV. + */ +static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, + struct device_node *np, struct device *dev) +{ + bool mdio = true; + + /* If phy-handle property is passed from DT, use it as the PHY */ + plat->phy_node = of_parse_phandle(np, "phy-handle", 0); + if (plat->phy_node) + dev_dbg(dev, "Found phy-handle subnode\n"); + + /* If phy-handle is not specified, check if we have a fixed-phy */ + if (!plat->phy_node && of_phy_is_fixed_link(np)) { + if ((of_phy_register_fixed_link(np) < 0)) + return -ENODEV; + + dev_dbg(dev, "Found fixed-link subnode\n"); + plat->phy_node = of_node_get(np); + mdio = false; + } + + /* If snps,dwmac-mdio is passed from DT, always register the MDIO */ + for_each_child_of_node(np, plat->mdio_node) { + if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio")) + break; + } + + if (plat->mdio_node) { + dev_dbg(dev, "Found MDIO subnode\n"); + mdio = true; + } + + if (mdio) + plat->mdio_bus_data = + devm_kzalloc(dev, sizeof(struct stmmac_mdio_bus_data), + GFP_KERNEL); + return 0; +} + +/** * stmmac_probe_config_dt - parse device-tree driver parameters * @pdev: platform_device structure * @plat: driver data platform structure @@ -129,30 +192,15 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* Default to phy auto-detection */ plat->phy_addr = -1; - /* If we find a phy-handle property, use it as the PHY */ - plat->phy_node = of_parse_phandle(np, "phy-handle", 0); - - /* If phy-handle is not specified, check if we have a fixed-phy */ - if (!plat->phy_node && of_phy_is_fixed_link(np)) { - if ((of_phy_register_fixed_link(np) < 0)) - return ERR_PTR(-ENODEV); - - plat->phy_node = of_node_get(np); - } - /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); - if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name) - plat->mdio_bus_data = NULL; - else - plat->mdio_bus_data = - devm_kzalloc(&pdev->dev, - sizeof(struct stmmac_mdio_bus_data), - GFP_KERNEL); + /* To Configure PHY by using all device-tree supported properties */ + if (stmmac_dt_phy(plat, np, &pdev->dev)) + return ERR_PTR(-ENODEV); of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); -- 2.7.4 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2 (linux-stable-4.5.y)] stmmac: fix MDIO settings @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: stable Cc: linux-arm-kernel, netdev, robin.murphy, marc.zyngier, afaerber, peppe.cavallaro, bert, linux-sunxi, maxime.ripard, Gabriel Fernandez, Dinh Nguyen, David S . Miller, Phil Reid Initially the phy_bus_name was added to manipulate the driver name but it was recently just used to manage the fixed-link and then to take some decision at run-time. So the patch uses the is_pseudo_fixed_link and removes the phy_bus_name variable not necessary anymore. The driver can manage the mdio registration by using phy-handle, dwmac-mdio and own parameter e.g. snps,phy-addr. This patch takes care about all these possible configurations and fixes the mdio registration in case of there is a real transceiver or a switch (that needs to be managed by using fixed-link). Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Tested-by: Frank Schäfer <fschaefer.oss@googlemail.com> Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> Cc: Dinh Nguyen <dinh.linux@gmail.com> Cc: David S. Miller <davem@davemloft.net> Cc: Phil Reid <preid@electromag.com.au> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 19 +---- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 84 +++++++++++++++++----- 3 files changed, 70 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c21015b..389d7d0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -271,7 +271,6 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) */ bool stmmac_eee_init(struct stmmac_priv *priv) { - char *phy_bus_name = priv->plat->phy_bus_name; unsigned long flags; bool ret = false; @@ -283,7 +282,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv) goto out; /* Never init EEE in case of a switch is attached */ - if (phy_bus_name && (!strcmp(phy_bus_name, "fixed"))) + if (priv->phydev->is_pseudo_fixed_link) goto out; /* MAC core supports the EEE feature. */ @@ -820,12 +819,8 @@ static int stmmac_init_phy(struct net_device *dev) phydev = of_phy_connect(dev, priv->plat->phy_node, &stmmac_adjust_link, 0, interface); } else { - if (priv->plat->phy_bus_name) - snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x", - priv->plat->phy_bus_name, priv->plat->bus_id); - else - snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", - priv->plat->bus_id); + snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", + priv->plat->bus_id); snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id, priv->plat->phy_addr); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 0faf163..3f5512f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -198,29 +198,12 @@ int stmmac_mdio_register(struct net_device *ndev) struct mii_bus *new_bus; struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; + struct device_node *mdio_node = priv->plat->mdio_node; int addr, found; - struct device_node *mdio_node = NULL; - struct device_node *child_node = NULL; if (!mdio_bus_data) return 0; - if (IS_ENABLED(CONFIG_OF)) { - for_each_child_of_node(priv->device->of_node, child_node) { - if (of_device_is_compatible(child_node, - "snps,dwmac-mdio")) { - mdio_node = child_node; - break; - } - } - - if (mdio_node) { - netdev_dbg(ndev, "FOUND MDIO subnode\n"); - } else { - netdev_warn(ndev, "No MDIO subnode found\n"); - } - } - new_bus = mdiobus_alloc(); if (new_bus == NULL) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 6a52fa1..190fb6d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -96,6 +96,69 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries) } /** + * stmmac_dt_phy - parse device-tree driver parameters to allocate PHY resources + * @plat: driver data platform structure + * @np: device tree node + * @dev: device pointer + * Description: + * The mdio bus will be allocated in case of a phy transceiver is on board; + * it will be NULL if the fixed-link is configured. + * If there is the "snps,dwmac-mdio" sub-node the mdio will be allocated + * in any case (for DSA, mdio must be registered even if fixed-link). + * The table below sums the supported configurations: + * ------------------------------- + * snps,phy-addr | Y + * ------------------------------- + * phy-handle | Y + * ------------------------------- + * fixed-link | N + * ------------------------------- + * snps,dwmac-mdio | + * even if | Y + * fixed-link | + * ------------------------------- + * + * It returns 0 in case of success otherwise -ENODEV. + */ +static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, + struct device_node *np, struct device *dev) +{ + bool mdio = true; + + /* If phy-handle property is passed from DT, use it as the PHY */ + plat->phy_node = of_parse_phandle(np, "phy-handle", 0); + if (plat->phy_node) + dev_dbg(dev, "Found phy-handle subnode\n"); + + /* If phy-handle is not specified, check if we have a fixed-phy */ + if (!plat->phy_node && of_phy_is_fixed_link(np)) { + if ((of_phy_register_fixed_link(np) < 0)) + return -ENODEV; + + dev_dbg(dev, "Found fixed-link subnode\n"); + plat->phy_node = of_node_get(np); + mdio = false; + } + + /* If snps,dwmac-mdio is passed from DT, always register the MDIO */ + for_each_child_of_node(np, plat->mdio_node) { + if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio")) + break; + } + + if (plat->mdio_node) { + dev_dbg(dev, "Found MDIO subnode\n"); + mdio = true; + } + + if (mdio) + plat->mdio_bus_data = + devm_kzalloc(dev, sizeof(struct stmmac_mdio_bus_data), + GFP_KERNEL); + return 0; +} + +/** * stmmac_probe_config_dt - parse device-tree driver parameters * @pdev: platform_device structure * @plat: driver data platform structure @@ -129,30 +192,15 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* Default to phy auto-detection */ plat->phy_addr = -1; - /* If we find a phy-handle property, use it as the PHY */ - plat->phy_node = of_parse_phandle(np, "phy-handle", 0); - - /* If phy-handle is not specified, check if we have a fixed-phy */ - if (!plat->phy_node && of_phy_is_fixed_link(np)) { - if ((of_phy_register_fixed_link(np) < 0)) - return ERR_PTR(-ENODEV); - - plat->phy_node = of_node_get(np); - } - /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); - if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name) - plat->mdio_bus_data = NULL; - else - plat->mdio_bus_data = - devm_kzalloc(&pdev->dev, - sizeof(struct stmmac_mdio_bus_data), - GFP_KERNEL); + /* To Configure PHY by using all device-tree supported properties */ + if (stmmac_dt_phy(plat, np, &pdev->dev)) + return ERR_PTR(-ENODEV); of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); -- 2.7.4 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2 (linux-stable-4.5.y)] stmmac: fix MDIO settings @ 2016-05-23 13:17 ` Giuseppe Cavallaro 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe Cavallaro @ 2016-05-23 13:17 UTC (permalink / raw) To: stable-u79uwXL29TY76Z2rM5mHXA Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, netdev-u79uwXL29TY76Z2rM5mHXA, robin.murphy-5wv7dgnIgG8, marc.zyngier-5wv7dgnIgG8, afaerber-l3A5Bk7waGM, peppe.cavallaro-qxv4g6HH51o, bert-phGP8mJ4Mqk, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, Gabriel Fernandez, Dinh Nguyen, David S . Miller, Phil Reid Initially the phy_bus_name was added to manipulate the driver name but it was recently just used to manage the fixed-link and then to take some decision at run-time. So the patch uses the is_pseudo_fixed_link and removes the phy_bus_name variable not necessary anymore. The driver can manage the mdio registration by using phy-handle, dwmac-mdio and own parameter e.g. snps,phy-addr. This patch takes care about all these possible configurations and fixes the mdio registration in case of there is a real transceiver or a switch (that needs to be managed by using fixed-link). Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro-qxv4g6HH51o@public.gmane.org> Reviewed-by: Andreas Färber <afaerber-l3A5Bk7waGM@public.gmane.org> Tested-by: Frank Schäfer <fschaefer.oss-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Cc: Gabriel Fernandez <gabriel.fernandez-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Cc: Dinh Nguyen <dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> Cc: Phil Reid <preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org> --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 19 +---- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 84 +++++++++++++++++----- 3 files changed, 70 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c21015b..389d7d0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -271,7 +271,6 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) */ bool stmmac_eee_init(struct stmmac_priv *priv) { - char *phy_bus_name = priv->plat->phy_bus_name; unsigned long flags; bool ret = false; @@ -283,7 +282,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv) goto out; /* Never init EEE in case of a switch is attached */ - if (phy_bus_name && (!strcmp(phy_bus_name, "fixed"))) + if (priv->phydev->is_pseudo_fixed_link) goto out; /* MAC core supports the EEE feature. */ @@ -820,12 +819,8 @@ static int stmmac_init_phy(struct net_device *dev) phydev = of_phy_connect(dev, priv->plat->phy_node, &stmmac_adjust_link, 0, interface); } else { - if (priv->plat->phy_bus_name) - snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x", - priv->plat->phy_bus_name, priv->plat->bus_id); - else - snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", - priv->plat->bus_id); + snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x", + priv->plat->bus_id); snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id, priv->plat->phy_addr); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 0faf163..3f5512f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -198,29 +198,12 @@ int stmmac_mdio_register(struct net_device *ndev) struct mii_bus *new_bus; struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data; + struct device_node *mdio_node = priv->plat->mdio_node; int addr, found; - struct device_node *mdio_node = NULL; - struct device_node *child_node = NULL; if (!mdio_bus_data) return 0; - if (IS_ENABLED(CONFIG_OF)) { - for_each_child_of_node(priv->device->of_node, child_node) { - if (of_device_is_compatible(child_node, - "snps,dwmac-mdio")) { - mdio_node = child_node; - break; - } - } - - if (mdio_node) { - netdev_dbg(ndev, "FOUND MDIO subnode\n"); - } else { - netdev_warn(ndev, "No MDIO subnode found\n"); - } - } - new_bus = mdiobus_alloc(); if (new_bus == NULL) return -ENOMEM; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 6a52fa1..190fb6d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -96,6 +96,69 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries) } /** + * stmmac_dt_phy - parse device-tree driver parameters to allocate PHY resources + * @plat: driver data platform structure + * @np: device tree node + * @dev: device pointer + * Description: + * The mdio bus will be allocated in case of a phy transceiver is on board; + * it will be NULL if the fixed-link is configured. + * If there is the "snps,dwmac-mdio" sub-node the mdio will be allocated + * in any case (for DSA, mdio must be registered even if fixed-link). + * The table below sums the supported configurations: + * ------------------------------- + * snps,phy-addr | Y + * ------------------------------- + * phy-handle | Y + * ------------------------------- + * fixed-link | N + * ------------------------------- + * snps,dwmac-mdio | + * even if | Y + * fixed-link | + * ------------------------------- + * + * It returns 0 in case of success otherwise -ENODEV. + */ +static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, + struct device_node *np, struct device *dev) +{ + bool mdio = true; + + /* If phy-handle property is passed from DT, use it as the PHY */ + plat->phy_node = of_parse_phandle(np, "phy-handle", 0); + if (plat->phy_node) + dev_dbg(dev, "Found phy-handle subnode\n"); + + /* If phy-handle is not specified, check if we have a fixed-phy */ + if (!plat->phy_node && of_phy_is_fixed_link(np)) { + if ((of_phy_register_fixed_link(np) < 0)) + return -ENODEV; + + dev_dbg(dev, "Found fixed-link subnode\n"); + plat->phy_node = of_node_get(np); + mdio = false; + } + + /* If snps,dwmac-mdio is passed from DT, always register the MDIO */ + for_each_child_of_node(np, plat->mdio_node) { + if (of_device_is_compatible(plat->mdio_node, "snps,dwmac-mdio")) + break; + } + + if (plat->mdio_node) { + dev_dbg(dev, "Found MDIO subnode\n"); + mdio = true; + } + + if (mdio) + plat->mdio_bus_data = + devm_kzalloc(dev, sizeof(struct stmmac_mdio_bus_data), + GFP_KERNEL); + return 0; +} + +/** * stmmac_probe_config_dt - parse device-tree driver parameters * @pdev: platform_device structure * @plat: driver data platform structure @@ -129,30 +192,15 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* Default to phy auto-detection */ plat->phy_addr = -1; - /* If we find a phy-handle property, use it as the PHY */ - plat->phy_node = of_parse_phandle(np, "phy-handle", 0); - - /* If phy-handle is not specified, check if we have a fixed-phy */ - if (!plat->phy_node && of_phy_is_fixed_link(np)) { - if ((of_phy_register_fixed_link(np) < 0)) - return ERR_PTR(-ENODEV); - - plat->phy_node = of_node_get(np); - } - /* "snps,phy-addr" is not a standard property. Mark it as deprecated * and warn of its use. Remove this when phy node support is added. */ if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) dev_warn(&pdev->dev, "snps,phy-addr property is deprecated\n"); - if ((plat->phy_node && !of_phy_is_fixed_link(np)) || plat->phy_bus_name) - plat->mdio_bus_data = NULL; - else - plat->mdio_bus_data = - devm_kzalloc(&pdev->dev, - sizeof(struct stmmac_mdio_bus_data), - GFP_KERNEL); + /* To Configure PHY by using all device-tree supported properties */ + if (stmmac_dt_phy(plat, np, &pdev->dev)) + return ERR_PTR(-ENODEV); of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); -- 2.7.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/2 (linux-stable-4.5.y)] stmmac: fix MDIO settings 2016-05-23 13:17 ` Giuseppe Cavallaro (?) @ 2016-08-14 15:44 ` Greg KH -1 siblings, 0 replies; 20+ messages in thread From: Greg KH @ 2016-08-14 15:44 UTC (permalink / raw) To: linux-arm-kernel On Mon, May 23, 2016 at 03:17:43PM +0200, Giuseppe Cavallaro wrote: > Initially the phy_bus_name was added to manipulate the > driver name but it was recently just used to manage the > fixed-link and then to take some decision at run-time. > So the patch uses the is_pseudo_fixed_link and removes > the phy_bus_name variable not necessary anymore. > > The driver can manage the mdio registration by using phy-handle, > dwmac-mdio and own parameter e.g. snps,phy-addr. > This patch takes care about all these possible configurations > and fixes the mdio registration in case of there is a real > transceiver or a switch (that needs to be managed by using > fixed-link). > > Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> > Reviewed-by: Andreas F?rber <afaerber@suse.de> > Tested-by: Frank Sch?fer <fschaefer.oss@googlemail.com> > Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> > Cc: Dinh Nguyen <dinh.linux@gmail.com> > Cc: David S. Miller <davem@davemloft.net> > Cc: Phil Reid <preid@electromag.com.au> > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 19 +---- > .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 84 +++++++++++++++++----- > 3 files changed, 70 insertions(+), 44 deletions(-) <formletter> This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly. </formletter> ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2 (linux-stable-4.5.y)] stmmac: fix MDIO settings @ 2016-08-14 15:44 ` Greg KH 0 siblings, 0 replies; 20+ messages in thread From: Greg KH @ 2016-08-14 15:44 UTC (permalink / raw) To: Giuseppe Cavallaro Cc: stable, linux-arm-kernel, netdev, robin.murphy, marc.zyngier, afaerber, bert, linux-sunxi, maxime.ripard, Gabriel Fernandez, Dinh Nguyen, David S . Miller, Phil Reid On Mon, May 23, 2016 at 03:17:43PM +0200, Giuseppe Cavallaro wrote: > Initially the phy_bus_name was added to manipulate the > driver name but it was recently just used to manage the > fixed-link and then to take some decision at run-time. > So the patch uses the is_pseudo_fixed_link and removes > the phy_bus_name variable not necessary anymore. > > The driver can manage the mdio registration by using phy-handle, > dwmac-mdio and own parameter e.g. snps,phy-addr. > This patch takes care about all these possible configurations > and fixes the mdio registration in case of there is a real > transceiver or a switch (that needs to be managed by using > fixed-link). > > Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> > Reviewed-by: Andreas F�rber <afaerber@suse.de> > Tested-by: Frank Sch�fer <fschaefer.oss@googlemail.com> > Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> > Cc: Dinh Nguyen <dinh.linux@gmail.com> > Cc: David S. Miller <davem@davemloft.net> > Cc: Phil Reid <preid@electromag.com.au> > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 19 +---- > .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 84 +++++++++++++++++----- > 3 files changed, 70 insertions(+), 44 deletions(-) <formletter> This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly. </formletter> ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2 (linux-stable-4.5.y)] stmmac: fix MDIO settings @ 2016-08-14 15:44 ` Greg KH 0 siblings, 0 replies; 20+ messages in thread From: Greg KH @ 2016-08-14 15:44 UTC (permalink / raw) To: Giuseppe Cavallaro Cc: stable, linux-arm-kernel, netdev, robin.murphy, marc.zyngier, afaerber, bert, linux-sunxi, maxime.ripard, Gabriel Fernandez, Dinh Nguyen, David S . Miller, Phil Reid On Mon, May 23, 2016 at 03:17:43PM +0200, Giuseppe Cavallaro wrote: > Initially the phy_bus_name was added to manipulate the > driver name but it was recently just used to manage the > fixed-link and then to take some decision at run-time. > So the patch uses the is_pseudo_fixed_link and removes > the phy_bus_name variable not necessary anymore. > > The driver can manage the mdio registration by using phy-handle, > dwmac-mdio and own parameter e.g. snps,phy-addr. > This patch takes care about all these possible configurations > and fixes the mdio registration in case of there is a real > transceiver or a switch (that needs to be managed by using > fixed-link). > > Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> > Reviewed-by: Andreas Färber <afaerber@suse.de> > Tested-by: Frank Schäfer <fschaefer.oss@googlemail.com> > Cc: Gabriel Fernandez <gabriel.fernandez@linaro.org> > Cc: Dinh Nguyen <dinh.linux@gmail.com> > Cc: David S. Miller <davem@davemloft.net> > Cc: Phil Reid <preid@electromag.com.au> > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +-- > drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 19 +---- > .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 84 +++++++++++++++++----- > 3 files changed, 70 insertions(+), 44 deletions(-) <formletter> This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly. </formletter> ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes 2016-05-23 13:17 ` Giuseppe Cavallaro @ 2016-05-23 15:36 ` Greg KH -1 siblings, 0 replies; 20+ messages in thread From: Greg KH @ 2016-05-23 15:36 UTC (permalink / raw) To: linux-arm-kernel On Mon, May 23, 2016 at 03:17:41PM +0200, Giuseppe Cavallaro wrote: > These patches port some recent fixes for linux-4.5.y stable branch. > They fix the MDIO settings trying to cover the all possible scenario > when the stmmac is connected to a real transceiver or a switch. > > These patches are needed for Kernel 4.5 where Lime2, BananaPi and Cubieboard2 > show problems when use the stmmac: > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823493 What are the git commit id for these patches in Linus's tree? thanks, greg k-h ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes @ 2016-05-23 15:36 ` Greg KH 0 siblings, 0 replies; 20+ messages in thread From: Greg KH @ 2016-05-23 15:36 UTC (permalink / raw) To: Giuseppe Cavallaro Cc: stable, linux-arm-kernel, netdev, robin.murphy, marc.zyngier, afaerber, bert, linux-sunxi, maxime.ripard On Mon, May 23, 2016 at 03:17:41PM +0200, Giuseppe Cavallaro wrote: > These patches port some recent fixes for linux-4.5.y stable branch. > They fix the MDIO settings trying to cover the all possible scenario > when the stmmac is connected to a real transceiver or a switch. > > These patches are needed for Kernel 4.5 where Lime2, BananaPi and Cubieboard2 > show problems when use the stmmac: > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823493 What are the git commit id for these patches in Linus's tree? thanks, greg k-h ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes @ 2016-05-24 7:08 ` Giuseppe CAVALLARO 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe CAVALLARO @ 2016-05-24 7:08 UTC (permalink / raw) To: linux-arm-kernel On 5/23/2016 5:36 PM, Greg KH wrote: > On Mon, May 23, 2016 at 03:17:41PM +0200, Giuseppe Cavallaro wrote: >> These patches port some recent fixes for linux-4.5.y stable branch. >> They fix the MDIO settings trying to cover the all possible scenario >> when the stmmac is connected to a real transceiver or a switch. >> >> These patches are needed for Kernel 4.5 where Lime2, BananaPi and Cubieboard2 >> show problems when use the stmmac: >> >> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823493 > > What are the git commit id for these patches in Linus's tree? Commits are: stmmac: fix MDIO settings a7657f128c279ae5796ab2ca7d04a7819f4259f0 and Revert "stmmac: Fix 'eth0: No PHY found' regression" d7e944c8ddc0983640a9a32868fb217485d12ca2 Regards Peppe > > thanks, > > greg k-h > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes @ 2016-05-24 7:08 ` Giuseppe CAVALLARO 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe CAVALLARO @ 2016-05-24 7:08 UTC (permalink / raw) To: Greg KH Cc: stable, linux-arm-kernel, netdev, robin.murphy, marc.zyngier, afaerber, bert, linux-sunxi, maxime.ripard On 5/23/2016 5:36 PM, Greg KH wrote: > On Mon, May 23, 2016 at 03:17:41PM +0200, Giuseppe Cavallaro wrote: >> These patches port some recent fixes for linux-4.5.y stable branch. >> They fix the MDIO settings trying to cover the all possible scenario >> when the stmmac is connected to a real transceiver or a switch. >> >> These patches are needed for Kernel 4.5 where Lime2, BananaPi and Cubieboard2 >> show problems when use the stmmac: >> >> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823493 > > What are the git commit id for these patches in Linus's tree? Commits are: stmmac: fix MDIO settings a7657f128c279ae5796ab2ca7d04a7819f4259f0 and Revert "stmmac: Fix 'eth0: No PHY found' regression" d7e944c8ddc0983640a9a32868fb217485d12ca2 Regards Peppe > > thanks, > > greg k-h > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes @ 2016-05-24 7:08 ` Giuseppe CAVALLARO 0 siblings, 0 replies; 20+ messages in thread From: Giuseppe CAVALLARO @ 2016-05-24 7:08 UTC (permalink / raw) To: Greg KH Cc: stable-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, netdev-u79uwXL29TY76Z2rM5mHXA, robin.murphy-5wv7dgnIgG8, marc.zyngier-5wv7dgnIgG8, afaerber-l3A5Bk7waGM, bert-phGP8mJ4Mqk, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8 On 5/23/2016 5:36 PM, Greg KH wrote: > On Mon, May 23, 2016 at 03:17:41PM +0200, Giuseppe Cavallaro wrote: >> These patches port some recent fixes for linux-4.5.y stable branch. >> They fix the MDIO settings trying to cover the all possible scenario >> when the stmmac is connected to a real transceiver or a switch. >> >> These patches are needed for Kernel 4.5 where Lime2, BananaPi and Cubieboard2 >> show problems when use the stmmac: >> >> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823493 > > What are the git commit id for these patches in Linus's tree? Commits are: stmmac: fix MDIO settings a7657f128c279ae5796ab2ca7d04a7819f4259f0 and Revert "stmmac: Fix 'eth0: No PHY found' regression" d7e944c8ddc0983640a9a32868fb217485d12ca2 Regards Peppe > > thanks, > > greg k-h > > ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2016-08-14 15:44 UTC | newest] Thread overview: 20+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-05-23 13:17 [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes Giuseppe Cavallaro 2016-05-23 13:17 ` Giuseppe Cavallaro 2016-05-23 13:17 ` Giuseppe Cavallaro 2016-05-23 13:17 ` [PATCH 1/2 (linux-stable-4.5.y)] Revert "stmmac: Fix 'eth0: No PHY found' regression" Giuseppe Cavallaro 2016-05-23 13:17 ` Giuseppe Cavallaro 2016-05-23 13:17 ` Giuseppe Cavallaro 2016-08-14 15:44 ` Greg KH 2016-08-14 15:44 ` Greg KH 2016-08-14 15:44 ` Greg KH 2016-05-23 13:17 ` [PATCH 2/2 (linux-stable-4.5.y)] stmmac: fix MDIO settings Giuseppe Cavallaro 2016-05-23 13:17 ` Giuseppe Cavallaro 2016-05-23 13:17 ` Giuseppe Cavallaro 2016-08-14 15:44 ` Greg KH 2016-08-14 15:44 ` Greg KH 2016-08-14 15:44 ` Greg KH 2016-05-23 15:36 ` [PATCH 0/2 (linux-stable-4.5.y)] net: stmmac: MDIO fixes Greg KH 2016-05-23 15:36 ` Greg KH 2016-05-24 7:08 ` Giuseppe CAVALLARO 2016-05-24 7:08 ` Giuseppe CAVALLARO 2016-05-24 7:08 ` Giuseppe CAVALLARO
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.