netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH (net.git) 0/2] stmmac: MDIO fixes
@ 2016-03-09  9:00 Giuseppe Cavallaro
  2016-03-09  9:00 ` [PATCH (net.git) 1/2] Revert "stmmac: Fix 'eth0: No PHY found' regression" Giuseppe Cavallaro
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2016-03-09  9:00 UTC (permalink / raw)
  To: netdev
  Cc: gabriel.fernandez, afaerber, fschaefer.oss, dinh.linux, davem,
	Giuseppe Cavallaro

These two patches are to fix the recent regressions raised
when test the stmmac on some platforms.
Please I kindly ask you to give me the feedback if it actually
covers all the cases and if the stmmac runs fine on the boxes.
I have tested on my side the H410 B2120 with an embedded switch
(so using the fixed-link).

Giuseppe Cavallaro (2):
  Revert "stmmac: Fix 'eth0: No PHY found' regression"
  stmmac: fix MDIO settings

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   11 ++-------
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  |   11 +++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   22 +++++--------------
 include/linux/stmmac.h                             |    3 +-
 4 files changed, 20 insertions(+), 27 deletions(-)

-- 
1.7.4.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH (net.git) 1/2] Revert "stmmac: Fix 'eth0: No PHY found' regression"
  2016-03-09  9:00 [PATCH (net.git) 0/2] stmmac: MDIO fixes Giuseppe Cavallaro
@ 2016-03-09  9:00 ` Giuseppe Cavallaro
  2016-03-09  9:00 ` [PATCH (net.git) 2/2] stmmac: fix MDIO settings Giuseppe Cavallaro
  2016-03-09 18:20 ` [PATCH (net.git) 0/2] stmmac: MDIO fixes Frank Schäfer
  2 siblings, 0 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2016-03-09  9:00 UTC (permalink / raw)
  To: netdev
  Cc: gabriel.fernandez, afaerber, fschaefer.oss, dinh.linux, davem,
	Giuseppe Cavallaro

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>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  |   11 ++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |    9 +--------
 include/linux/stmmac.h                             |    1 -
 3 files changed, 11 insertions(+), 10 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 =
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 881a79d..eead8ab 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -100,7 +100,6 @@ struct plat_stmmacenet_data {
 	int interface;
 	struct stmmac_mdio_bus_data *mdio_bus_data;
 	struct device_node *phy_node;
-	struct device_node *mdio_node;
 	struct stmmac_dma_cfg *dma_cfg;
 	int clk_csr;
 	int has_gmac;
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH (net.git) 2/2] stmmac: fix MDIO settings
  2016-03-09  9:00 [PATCH (net.git) 0/2] stmmac: MDIO fixes Giuseppe Cavallaro
  2016-03-09  9:00 ` [PATCH (net.git) 1/2] Revert "stmmac: Fix 'eth0: No PHY found' regression" Giuseppe Cavallaro
@ 2016-03-09  9:00 ` Giuseppe Cavallaro
  2016-03-09 10:27   ` Gabriel Fernandez
  2016-03-09 14:39   ` Andrew Lunn
  2016-03-09 18:20 ` [PATCH (net.git) 0/2] stmmac: MDIO fixes Frank Schäfer
  2 siblings, 2 replies; 7+ messages in thread
From: Giuseppe Cavallaro @ 2016-03-09  9:00 UTC (permalink / raw)
  To: netdev
  Cc: gabriel.fernandez, afaerber, fschaefer.oss, dinh.linux, davem,
	Giuseppe Cavallaro

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
inside the main (for example to skip EEE).

So the patch now introduces a new platforms boolean to
manage that 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>
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>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   11 +++--------
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   15 ++++++---------
 include/linux/stmmac.h                             |    2 +-
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c21015b..87e4643 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->plat->is_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_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 6a52fa1..09684dd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -138,7 +138,12 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
 			return ERR_PTR(-ENODEV);
 
 		plat->phy_node = of_node_get(np);
-	}
+		plat->is_fixed_link = true;
+	} else
+		plat->mdio_bus_data =
+			devm_kzalloc(&pdev->dev,
+				     sizeof(struct stmmac_mdio_bus_data),
+				     GFP_KERNEL);
 
 	/* "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.
@@ -146,14 +151,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
 	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);
-
 	of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size);
 
 	of_property_read_u32(np, "rx-fifo-depth", &plat->rx_fifo_size);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index eead8ab..1550558 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -94,10 +94,10 @@ struct stmmac_dma_cfg {
 };
 
 struct plat_stmmacenet_data {
-	char *phy_bus_name;
 	int bus_id;
 	int phy_addr;
 	int interface;
+	bool is_fixed_link;
 	struct stmmac_mdio_bus_data *mdio_bus_data;
 	struct device_node *phy_node;
 	struct stmmac_dma_cfg *dma_cfg;
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH (net.git) 2/2] stmmac: fix MDIO settings
  2016-03-09  9:00 ` [PATCH (net.git) 2/2] stmmac: fix MDIO settings Giuseppe Cavallaro
@ 2016-03-09 10:27   ` Gabriel Fernandez
  2016-03-09 10:39     ` Giuseppe CAVALLARO
  2016-03-09 14:39   ` Andrew Lunn
  1 sibling, 1 reply; 7+ messages in thread
From: Gabriel Fernandez @ 2016-03-09 10:27 UTC (permalink / raw)
  To: Giuseppe Cavallaro
  Cc: netdev, Andreas Färber, fschaefer.oss, Dinh Nguyen,
	David S. Miller

Hi Peppe,

You missed something like that in stmmac_main.c ?

@@ -864,13 +864,12 @@ static int stmmac_init_phy(struct net_device *dev)
  phy_disconnect(phydev);
  return -ENODEV;
  }

  /* If attached to a switch, there is no reason to poll phy handler */
- if (priv->plat->phy_bus_name)
- if (!strcmp(priv->plat->phy_bus_name, "fixed"))
- phydev->irq = PHY_IGNORE_INTERRUPT;
+ if (priv->plat->is_fixed_link)
+ phydev->irq = PHY_IGNORE_INTERRUPT;


Best regards

Gabriel


On 9 March 2016 at 10:00, Giuseppe Cavallaro <peppe.cavallaro@st.com> 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
> inside the main (for example to skip EEE).
>
> So the patch now introduces a new platforms boolean to
> manage that 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>
> 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>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   11 +++--------
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   15 ++++++---------
>  include/linux/stmmac.h                             |    2 +-
>  3 files changed, 10 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index c21015b..87e4643 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->plat->is_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_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index 6a52fa1..09684dd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -138,7 +138,12 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>                         return ERR_PTR(-ENODEV);
>
>                 plat->phy_node = of_node_get(np);
> -       }
> +               plat->is_fixed_link = true;
> +       } else
> +               plat->mdio_bus_data =
> +                       devm_kzalloc(&pdev->dev,
> +                                    sizeof(struct stmmac_mdio_bus_data),
> +                                    GFP_KERNEL);
>
>         /* "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.
> @@ -146,14 +151,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>         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);
> -
>         of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size);
>
>         of_property_read_u32(np, "rx-fifo-depth", &plat->rx_fifo_size);
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index eead8ab..1550558 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -94,10 +94,10 @@ struct stmmac_dma_cfg {
>  };
>
>  struct plat_stmmacenet_data {
> -       char *phy_bus_name;
>         int bus_id;
>         int phy_addr;
>         int interface;
> +       bool is_fixed_link;
>         struct stmmac_mdio_bus_data *mdio_bus_data;
>         struct device_node *phy_node;
>         struct stmmac_dma_cfg *dma_cfg;
> --
> 1.7.4.4
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH (net.git) 2/2] stmmac: fix MDIO settings
  2016-03-09 10:27   ` Gabriel Fernandez
@ 2016-03-09 10:39     ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 7+ messages in thread
From: Giuseppe CAVALLARO @ 2016-03-09 10:39 UTC (permalink / raw)
  To: Gabriel Fernandez
  Cc: netdev, Andreas Färber, fschaefer.oss, Dinh Nguyen,
	David S. Miller

Hi Gabriel

On 3/9/2016 11:27 AM, Gabriel Fernandez wrote:
> Hi Peppe,
>
> You missed something like that in stmmac_main.c ?
>
> @@ -864,13 +864,12 @@ static int stmmac_init_phy(struct net_device *dev)
>    phy_disconnect(phydev);
>    return -ENODEV;
>    }
>
>    /* If attached to a switch, there is no reason to poll phy handler */
> - if (priv->plat->phy_bus_name)
> - if (!strcmp(priv->plat->phy_bus_name, "fixed"))
> - phydev->irq = PHY_IGNORE_INTERRUPT;
> + if (priv->plat->is_fixed_link)
> + phydev->irq = PHY_IGNORE_INTERRUPT;

this is for net.git where this if condition code is not present.
I will propose a patch for net-next later.
I'd like to try to fix the new regression on xmit.

thx to have spot this.

Regards
peppe

>
>
> Best regards
>
> Gabriel
>
>
> On 9 March 2016 at 10:00, Giuseppe Cavallaro <peppe.cavallaro@st.com> 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
>> inside the main (for example to skip EEE).
>>
>> So the patch now introduces a new platforms boolean to
>> manage that 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>
>> 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>
>> ---
>>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   11 +++--------
>>   .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   15 ++++++---------
>>   include/linux/stmmac.h                             |    2 +-
>>   3 files changed, 10 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index c21015b..87e4643 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->plat->is_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_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> index 6a52fa1..09684dd 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> @@ -138,7 +138,12 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>>                          return ERR_PTR(-ENODEV);
>>
>>                  plat->phy_node = of_node_get(np);
>> -       }
>> +               plat->is_fixed_link = true;
>> +       } else
>> +               plat->mdio_bus_data =
>> +                       devm_kzalloc(&pdev->dev,
>> +                                    sizeof(struct stmmac_mdio_bus_data),
>> +                                    GFP_KERNEL);
>>
>>          /* "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.
>> @@ -146,14 +151,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>>          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);
>> -
>>          of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size);
>>
>>          of_property_read_u32(np, "rx-fifo-depth", &plat->rx_fifo_size);
>> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
>> index eead8ab..1550558 100644
>> --- a/include/linux/stmmac.h
>> +++ b/include/linux/stmmac.h
>> @@ -94,10 +94,10 @@ struct stmmac_dma_cfg {
>>   };
>>
>>   struct plat_stmmacenet_data {
>> -       char *phy_bus_name;
>>          int bus_id;
>>          int phy_addr;
>>          int interface;
>> +       bool is_fixed_link;
>>          struct stmmac_mdio_bus_data *mdio_bus_data;
>>          struct device_node *phy_node;
>>          struct stmmac_dma_cfg *dma_cfg;
>> --
>> 1.7.4.4
>>
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH (net.git) 2/2] stmmac: fix MDIO settings
  2016-03-09  9:00 ` [PATCH (net.git) 2/2] stmmac: fix MDIO settings Giuseppe Cavallaro
  2016-03-09 10:27   ` Gabriel Fernandez
@ 2016-03-09 14:39   ` Andrew Lunn
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2016-03-09 14:39 UTC (permalink / raw)
  To: Giuseppe Cavallaro
  Cc: netdev, gabriel.fernandez, afaerber, fschaefer.oss, dinh.linux,
	davem

On Wed, Mar 09, 2016 at 10:00:07AM +0100, 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
> inside the main (for example to skip EEE).
> 
> So the patch now introduces a new platforms boolean to
> manage that 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>
> 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>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   11 +++--------
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   15 ++++++---------
>  include/linux/stmmac.h                             |    2 +-
>  3 files changed, 10 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index c21015b..87e4643 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->plat->is_fixed_link)
>  		goto out;

Hi Giuseppe

The phydev itself has a bool is_pseudo_fixed_link. You might be able
to use this instead of adding your own.

   Andrew

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH (net.git) 0/2] stmmac: MDIO fixes
  2016-03-09  9:00 [PATCH (net.git) 0/2] stmmac: MDIO fixes Giuseppe Cavallaro
  2016-03-09  9:00 ` [PATCH (net.git) 1/2] Revert "stmmac: Fix 'eth0: No PHY found' regression" Giuseppe Cavallaro
  2016-03-09  9:00 ` [PATCH (net.git) 2/2] stmmac: fix MDIO settings Giuseppe Cavallaro
@ 2016-03-09 18:20 ` Frank Schäfer
  2 siblings, 0 replies; 7+ messages in thread
From: Frank Schäfer @ 2016-03-09 18:20 UTC (permalink / raw)
  To: Giuseppe Cavallaro, netdev; +Cc: gabriel.fernandez, afaerber, dinh.linux, davem


Am 09.03.2016 um 10:00 schrieb Giuseppe Cavallaro:
> These two patches are to fix the recent regressions raised
> when test the stmmac on some platforms.
> Please I kindly ask you to give me the feedback if it actually
> covers all the cases and if the stmmac runs fine on the boxes.
> I have tested on my side the H410 B2120 with an embedded switch
> (so using the fixed-link).
>
> Giuseppe Cavallaro (2):
>   Revert "stmmac: Fix 'eth0: No PHY found' regression"
>   stmmac: fix MDIO settings
>
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   11 ++-------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c  |   11 +++++++++-
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   22 +++++--------------
>  include/linux/stmmac.h                             |    3 +-
>  4 files changed, 20 insertions(+), 27 deletions(-)
Works fine on the Banana Pi M1 board.
(Fixes "libphy: PHY stmmac-0:ffffffff not found")

Regards,
Frank

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-03-09 18:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09  9:00 [PATCH (net.git) 0/2] stmmac: MDIO fixes Giuseppe Cavallaro
2016-03-09  9:00 ` [PATCH (net.git) 1/2] Revert "stmmac: Fix 'eth0: No PHY found' regression" Giuseppe Cavallaro
2016-03-09  9:00 ` [PATCH (net.git) 2/2] stmmac: fix MDIO settings Giuseppe Cavallaro
2016-03-09 10:27   ` Gabriel Fernandez
2016-03-09 10:39     ` Giuseppe CAVALLARO
2016-03-09 14:39   ` Andrew Lunn
2016-03-09 18:20 ` [PATCH (net.git) 0/2] stmmac: MDIO fixes Frank Schäfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).