linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY"
@ 2020-01-07  5:08 ` Florian Fainelli
  2020-01-07  5:46   ` Sriram Dash
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2020-01-07  5:08 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, tomeu.vizoso, khilman, David S. Miller, mgalka,
	guillaume.tucker, broonie, Jayati Sahu, Sriram Dash,
	Padmanabhan Rajanbabu, enric.balletbo, Jose Abreu,
	Alexandre Torgue, linux-kernel, Maxime Coquelin,
	Giuseppe Cavallaro, linux-stm32, linux-arm-kernel, heiko

This reverts commit d3e014ec7d5ebe9644b5486bc530b91e62bbf624 ("net:
stmmac: platform: Fix MDIO init for platforms without PHY") because it
breaks existing systems with stmmac which do not have a MDIO bus
sub-node nor a 'phy-handle' property declared in their Device Tree. On
those systems, the stmmac MDIO bus is expected to be created and then
scanned by of_mdiobus_register() to create PHY devices.

While these systems should arguably make use of a more accurate Device
Tree reprensentation with the use of the MDIO bus sub-node an
appropriate 'phy-handle', we cannot break them, therefore restore the
behavior prior to the said commit.

Fixes: d3e014ec7d5e ("net: stmmac: platform: Fix MDIO init for platforms without PHY")
Reported-by: Heiko Stuebner <heiko@sntech.de>
Reported-by: kernelci.org bot <bot@kernelci.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Heiko,

I did not add the Tested-by because the patch is a little bit different
from what you tested, even if you most likely were not hitting the other
part that I was changing. Thanks!

 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index cc8d7e7bf9ac..bedaff0c13bd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -320,7 +320,7 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
 static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
 			 struct device_node *np, struct device *dev)
 {
-	bool mdio = false;
+	bool mdio = true;
 	static const struct of_device_id need_mdio_ids[] = {
 		{ .compatible = "snps,dwc-qos-ethernet-4.10" },
 		{},
-- 
2.19.1


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

* RE: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY"
  2020-01-07  5:08 ` [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY" Florian Fainelli
@ 2020-01-07  5:46   ` Sriram Dash
  2020-01-07 10:46     ` Neil Armstrong
  2020-01-07 10:56     ` Robin Murphy
  0 siblings, 2 replies; 7+ messages in thread
From: Sriram Dash @ 2020-01-07  5:46 UTC (permalink / raw)
  To: 'Florian Fainelli', netdev
  Cc: tomeu.vizoso, khilman, 'David S. Miller',
	mgalka, guillaume.tucker, broonie, 'Jayati Sahu',
	'Padmanabhan Rajanbabu',
	enric.balletbo, 'Jose Abreu', 'Alexandre Torgue',
	linux-kernel, 'Maxime Coquelin',
	'Giuseppe Cavallaro',
	linux-stm32, linux-arm-kernel, heiko, pankaj.dubey, rcsekar

> From: Florian Fainelli <f.fainelli@gmail.com>
> Subject: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for
platforms
> without PHY"
> 
> This reverts commit d3e014ec7d5ebe9644b5486bc530b91e62bbf624 ("net:
> stmmac: platform: Fix MDIO init for platforms without PHY") because it
breaks
> existing systems with stmmac which do not have a MDIO bus sub-node nor a
> 'phy-handle' property declared in their Device Tree. On those systems, the
> stmmac MDIO bus is expected to be created and then scanned by
> of_mdiobus_register() to create PHY devices.
> 
> While these systems should arguably make use of a more accurate Device
Tree
> reprensentation with the use of the MDIO bus sub-node an appropriate 'phy-
> handle', we cannot break them, therefore restore the behavior prior to the
said
> commit.
> 
> Fixes: d3e014ec7d5e ("net: stmmac: platform: Fix MDIO init for platforms
> without PHY")
> Reported-by: Heiko Stuebner <heiko@sntech.de>
> Reported-by: kernelci.org bot <bot@kernelci.org>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Nacked-by: Sriram Dash <Sriram.dash@samsung.com>

> ---
> Heiko,
> 
> I did not add the Tested-by because the patch is a little bit different
from what
> you tested, even if you most likely were not hitting the other part that I
was
> changing. Thanks!
> 
>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index cc8d7e7bf9ac..bedaff0c13bd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -320,7 +320,7 @@ static int stmmac_mtl_setup(struct platform_device
> *pdev,  static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>  			 struct device_node *np, struct device *dev)  {
> -	bool mdio = false;
> +	bool mdio = true;


This is breaking for the platforms with fixed-link.
stih418-b2199.dts and 169445.dts to name a few.

For the newer platforms, they should provide the mdio/ snps,dwmac-mdio
property in the device tree as we are checking the mdio/ snps,dwmac-mdio
property in the stmmac_platform driver for the mdio bus memory allocation.
For existing platforms, I agree we should not break them, but we should make
the code correct. And make the existing platforms adapt to the proper code.
There is a proposed solution. 
https://lkml.org/lkml/2020/1/7/14

What do you think?

>  	static const struct of_device_id need_mdio_ids[] = {
>  		{ .compatible = "snps,dwc-qos-ethernet-4.10" },
>  		{},
> --
> 2.19.1



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

* Re: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY"
  2020-01-07  5:46   ` Sriram Dash
@ 2020-01-07 10:46     ` Neil Armstrong
  2020-01-07 10:56     ` Robin Murphy
  1 sibling, 0 replies; 7+ messages in thread
From: Neil Armstrong @ 2020-01-07 10:46 UTC (permalink / raw)
  To: Sriram Dash, 'Florian Fainelli', netdev
  Cc: 'Jose Abreu', 'Jayati Sahu',
	'Alexandre Torgue',
	tomeu.vizoso, rcsekar, khilman, mgalka, linux-kernel,
	'Padmanabhan Rajanbabu',
	linux-stm32, broonie, pankaj.dubey, 'Maxime Coquelin',
	guillaume.tucker, enric.balletbo, 'Giuseppe Cavallaro',
	'David S. Miller',
	linux-arm-kernel, heiko

On 07/01/2020 06:46, Sriram Dash wrote:
>> From: Florian Fainelli <f.fainelli@gmail.com>
>> Subject: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for
> platforms
>> without PHY"
>>
>> This reverts commit d3e014ec7d5ebe9644b5486bc530b91e62bbf624 ("net:
>> stmmac: platform: Fix MDIO init for platforms without PHY") because it
> breaks
>> existing systems with stmmac which do not have a MDIO bus sub-node nor a
>> 'phy-handle' property declared in their Device Tree. On those systems, the
>> stmmac MDIO bus is expected to be created and then scanned by
>> of_mdiobus_register() to create PHY devices.
>>
>> While these systems should arguably make use of a more accurate Device
> Tree
>> reprensentation with the use of the MDIO bus sub-node an appropriate 'phy-
>> handle', we cannot break them, therefore restore the behavior prior to the
> said
>> commit.
>>
>> Fixes: d3e014ec7d5e ("net: stmmac: platform: Fix MDIO init for platforms
>> without PHY")
>> Reported-by: Heiko Stuebner <heiko@sntech.de>
>> Reported-by: kernelci.org bot <bot@kernelci.org>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> Nacked-by: Sriram Dash <Sriram.dash@samsung.com>
> 
>> ---
>> Heiko,
>>
>> I did not add the Tested-by because the patch is a little bit different
> from what
>> you tested, even if you most likely were not hitting the other part that I
> was
>> changing. Thanks!
>>
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> index cc8d7e7bf9ac..bedaff0c13bd 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> @@ -320,7 +320,7 @@ static int stmmac_mtl_setup(struct platform_device
>> *pdev,  static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>>  			 struct device_node *np, struct device *dev)  {
>> -	bool mdio = false;
>> +	bool mdio = true;
> 
> 
> This is breaking for the platforms with fixed-link.
> stih418-b2199.dts and 169445.dts to name a few.
> 
> For the newer platforms, they should provide the mdio/ snps,dwmac-mdio
> property in the device tree as we are checking the mdio/ snps,dwmac-mdio
> property in the stmmac_platform driver for the mdio bus memory allocation.
> For existing platforms, I agree we should not break them, but we should make
> the code correct. And make the existing platforms adapt to the proper code.
> There is a proposed solution. 
> https://lkml.org/lkml/2020/1/7/14

Can you post it as a patch then and add me in CC since it also breaks Oxnas as reported as Kci ?

Neil

> 
> What do you think?
> 
>>  	static const struct of_device_id need_mdio_ids[] = {
>>  		{ .compatible = "snps,dwc-qos-ethernet-4.10" },
>>  		{},
>> --
>> 2.19.1
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


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

* Re: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY"
  2020-01-07  5:46   ` Sriram Dash
  2020-01-07 10:46     ` Neil Armstrong
@ 2020-01-07 10:56     ` Robin Murphy
  2020-01-07 12:14       ` Sriram Dash
  1 sibling, 1 reply; 7+ messages in thread
From: Robin Murphy @ 2020-01-07 10:56 UTC (permalink / raw)
  To: Sriram Dash, 'Florian Fainelli', netdev
  Cc: 'Jose Abreu', 'Jayati Sahu',
	'Alexandre Torgue',
	tomeu.vizoso, rcsekar, khilman, mgalka, linux-kernel,
	'Padmanabhan Rajanbabu',
	linux-stm32, broonie, pankaj.dubey, 'Maxime Coquelin',
	guillaume.tucker, enric.balletbo, 'Giuseppe Cavallaro',
	'David S. Miller',
	linux-arm-kernel, heiko

On 07/01/2020 5:46 am, Sriram Dash wrote:
>> From: Florian Fainelli <f.fainelli@gmail.com>
>> Subject: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for
> platforms
>> without PHY"
>>
>> This reverts commit d3e014ec7d5ebe9644b5486bc530b91e62bbf624 ("net:
>> stmmac: platform: Fix MDIO init for platforms without PHY") because it
> breaks
>> existing systems with stmmac which do not have a MDIO bus sub-node nor a
>> 'phy-handle' property declared in their Device Tree. On those systems, the
>> stmmac MDIO bus is expected to be created and then scanned by
>> of_mdiobus_register() to create PHY devices.
>>
>> While these systems should arguably make use of a more accurate Device
> Tree
>> reprensentation with the use of the MDIO bus sub-node an appropriate 'phy-
>> handle', we cannot break them, therefore restore the behavior prior to the
> said
>> commit.
>>
>> Fixes: d3e014ec7d5e ("net: stmmac: platform: Fix MDIO init for platforms
>> without PHY")
>> Reported-by: Heiko Stuebner <heiko@sntech.de>
>> Reported-by: kernelci.org bot <bot@kernelci.org>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> Nacked-by: Sriram Dash <Sriram.dash@samsung.com>
> 
>> ---
>> Heiko,
>>
>> I did not add the Tested-by because the patch is a little bit different
> from what
>> you tested, even if you most likely were not hitting the other part that I
> was
>> changing. Thanks!
>>
>>   drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> index cc8d7e7bf9ac..bedaff0c13bd 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> @@ -320,7 +320,7 @@ static int stmmac_mtl_setup(struct platform_device
>> *pdev,  static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>>   			 struct device_node *np, struct device *dev)  {
>> -	bool mdio = false;
>> +	bool mdio = true;
> 
> 
> This is breaking for the platforms with fixed-link.
> stih418-b2199.dts and 169445.dts to name a few.
> 
> For the newer platforms, they should provide the mdio/ snps,dwmac-mdio
> property in the device tree as we are checking the mdio/ snps,dwmac-mdio
> property in the stmmac_platform driver for the mdio bus memory allocation.
> For existing platforms, I agree we should not break them, but we should make
> the code correct. And make the existing platforms adapt to the proper code.
> There is a proposed solution.
> https://lkml.org/lkml/2020/1/7/14
> 
> What do you think?

The binding says that the phy handle and mdio child node are optional, 
so "update all of the DTBs!" is not a viable solution. I'm far from an 
expert here, but AFAICS the fault of the current code is that it assumes 
the lack of a phy handle implies a fixed link, so the obvious answer is 
to actually check whether the "fixed-link" property is present.

Robin.

> 
>>   	static const struct of_device_id need_mdio_ids[] = {
>>   		{ .compatible = "snps,dwc-qos-ethernet-4.10" },
>>   		{},
>> --
>> 2.19.1
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

* RE: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY"
  2020-01-07 10:56     ` Robin Murphy
@ 2020-01-07 12:14       ` Sriram Dash
  2020-01-07 12:36         ` Robin Murphy
  2020-01-07 12:36         ` Jose Abreu
  0 siblings, 2 replies; 7+ messages in thread
From: Sriram Dash @ 2020-01-07 12:14 UTC (permalink / raw)
  To: 'Robin Murphy', 'Florian Fainelli',
	netdev, narmstrong, 'Heiko Stuebner'
  Cc: 'Jose Abreu', 'Jayati Sahu',
	'Alexandre Torgue',
	tomeu.vizoso, rcsekar, khilman, mgalka, linux-kernel,
	'Padmanabhan Rajanbabu',
	linux-stm32, broonie, pankaj.dubey, 'Maxime Coquelin',
	guillaume.tucker, enric.balletbo, 'Giuseppe Cavallaro',
	'David S. Miller',
	linux-arm-kernel, heiko

> From: Robin Murphy <robin.murphy@arm.com>
> Subject: Re: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for
> platforms without PHY"
> 
> On 07/01/2020 5:46 am, Sriram Dash wrote:
> >> From: Florian Fainelli <f.fainelli@gmail.com>
> >> Subject: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for
> > platforms
> >> without PHY"
> >>
> >> This reverts commit d3e014ec7d5ebe9644b5486bc530b91e62bbf624 ("net:
> >> stmmac: platform: Fix MDIO init for platforms without PHY") because
> >> it
> > breaks
> >> existing systems with stmmac which do not have a MDIO bus sub-node
> >> nor a 'phy-handle' property declared in their Device Tree. On those
> >> systems, the stmmac MDIO bus is expected to be created and then
> >> scanned by
> >> of_mdiobus_register() to create PHY devices.
> >>
> >> While these systems should arguably make use of a more accurate
> >> Device
> > Tree
> >> reprensentation with the use of the MDIO bus sub-node an appropriate
> >> 'phy- handle', we cannot break them, therefore restore the behavior
> >> prior to the
> > said
> >> commit.
> >>
> >> Fixes: d3e014ec7d5e ("net: stmmac: platform: Fix MDIO init for
> >> platforms without PHY")
> >> Reported-by: Heiko Stuebner <heiko@sntech.de>
> >> Reported-by: kernelci.org bot <bot@kernelci.org>
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> > Nacked-by: Sriram Dash <Sriram.dash@samsung.com>
> >
> >> ---
> >> Heiko,
> >>
> >> I did not add the Tested-by because the patch is a little bit
> >> different
> > from what
> >> you tested, even if you most likely were not hitting the other part
> >> that I
> > was
> >> changing. Thanks!
> >>
> >>   drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> >> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> >> index cc8d7e7bf9ac..bedaff0c13bd 100644
> >> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> >> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> >> @@ -320,7 +320,7 @@ static int stmmac_mtl_setup(struct
> >> platform_device *pdev,  static int stmmac_dt_phy(struct
> plat_stmmacenet_data *plat,
> >>   			 struct device_node *np, struct device *dev)  {
> >> -	bool mdio = false;
> >> +	bool mdio = true;
> >
> >
> > This is breaking for the platforms with fixed-link.
> > stih418-b2199.dts and 169445.dts to name a few.
> >
> > For the newer platforms, they should provide the mdio/ snps,dwmac-mdio
> > property in the device tree as we are checking the mdio/
> > snps,dwmac-mdio property in the stmmac_platform driver for the mdio bus
> memory allocation.
> > For existing platforms, I agree we should not break them, but we
> > should make the code correct. And make the existing platforms adapt to the
> proper code.
> > There is a proposed solution.
> > https://protect2.fireeye.com/url?k=d075c0fc-8da69942-d0744bb3-0cc47a31
> > ba82-60be9f5a0fb38a27&u=https://lkml.org/lkml/2020/1/7/14
> >
> > What do you think?
> 
> The binding says that the phy handle and mdio child node are optional, so
> "update all of the DTBs!" is not a viable solution. I'm far from an expert here, but

I get your point Robin. Because the mdio child or snps,dwmac-mdio is not mandatory,
there has been this problem.

> AFAICS the fault of the current code is that it assumes the lack of a phy handle
> implies a fixed link, so the obvious answer is to actually check whether the

Kind of. 

> "fixed-link" property is present.


I agree to have a fixed link check. Possibly this can be done:

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -320,7 +320,9 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
 static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
                         struct device_node *np, struct device *dev)
 {
-       bool mdio = false;
+       bool mdio = true;
+       struct device_node *fixed_link;
+
        static const struct of_device_id need_mdio_ids[] = {
                { .compatible = "snps,dwc-qos-ethernet-4.10" },
                {},
@@ -340,9 +342,8 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
                }
        }

-       if (plat->mdio_node) {
-               dev_dbg(dev, "Found MDIO subnode\n");
-               mdio = true;
+       if (of_get_child_by_name(np, "fixed-link")) {
+               mdio = false;
        }

        if (mdio) {

Neil and Heiko,

Can you guys please test this on your platforms?
We can post a more cleaner version of the patch if all agree to it.

> 
> Robin.
> 
> >
> >>   	static const struct of_device_id need_mdio_ids[] = {
> >>   		{ .compatible = "snps,dwc-qos-ethernet-4.10" },
> >>   		{},
> >> --
> >> 2.19.1
> >
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > https://protect2.fireeye.com/url?k=2cb95551-716a0cef-2cb8de1e-0cc47a31
> > ba82-d01ceb62a8a93fa2&u=http://lists.infradead.org/mailman/listinfo/li
> > nux-arm-kernel
> >


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

* Re: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY"
  2020-01-07 12:14       ` Sriram Dash
@ 2020-01-07 12:36         ` Robin Murphy
  2020-01-07 12:36         ` Jose Abreu
  1 sibling, 0 replies; 7+ messages in thread
From: Robin Murphy @ 2020-01-07 12:36 UTC (permalink / raw)
  To: Sriram Dash, 'Florian Fainelli',
	netdev, narmstrong, 'Heiko Stuebner'
  Cc: 'Jose Abreu', 'Jayati Sahu',
	'Alexandre Torgue',
	tomeu.vizoso, rcsekar, khilman, mgalka, linux-kernel,
	'Padmanabhan Rajanbabu',
	linux-stm32, broonie, pankaj.dubey, 'Maxime Coquelin',
	guillaume.tucker, enric.balletbo, 'Giuseppe Cavallaro',
	'David S. Miller',
	linux-arm-kernel

On 07/01/2020 12:14 pm, Sriram Dash wrote:
>> From: Robin Murphy <robin.murphy@arm.com>
>> Subject: Re: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for
>> platforms without PHY"
>>
>> On 07/01/2020 5:46 am, Sriram Dash wrote:
>>>> From: Florian Fainelli <f.fainelli@gmail.com>
>>>> Subject: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for
>>> platforms
>>>> without PHY"
>>>>
>>>> This reverts commit d3e014ec7d5ebe9644b5486bc530b91e62bbf624 ("net:
>>>> stmmac: platform: Fix MDIO init for platforms without PHY") because
>>>> it
>>> breaks
>>>> existing systems with stmmac which do not have a MDIO bus sub-node
>>>> nor a 'phy-handle' property declared in their Device Tree. On those
>>>> systems, the stmmac MDIO bus is expected to be created and then
>>>> scanned by
>>>> of_mdiobus_register() to create PHY devices.
>>>>
>>>> While these systems should arguably make use of a more accurate
>>>> Device
>>> Tree
>>>> reprensentation with the use of the MDIO bus sub-node an appropriate
>>>> 'phy- handle', we cannot break them, therefore restore the behavior
>>>> prior to the
>>> said
>>>> commit.
>>>>
>>>> Fixes: d3e014ec7d5e ("net: stmmac: platform: Fix MDIO init for
>>>> platforms without PHY")
>>>> Reported-by: Heiko Stuebner <heiko@sntech.de>
>>>> Reported-by: kernelci.org bot <bot@kernelci.org>
>>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>> Nacked-by: Sriram Dash <Sriram.dash@samsung.com>
>>>
>>>> ---
>>>> Heiko,
>>>>
>>>> I did not add the Tested-by because the patch is a little bit
>>>> different
>>> from what
>>>> you tested, even if you most likely were not hitting the other part
>>>> that I
>>> was
>>>> changing. Thanks!
>>>>
>>>>    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>>> index cc8d7e7bf9ac..bedaff0c13bd 100644
>>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>>> @@ -320,7 +320,7 @@ static int stmmac_mtl_setup(struct
>>>> platform_device *pdev,  static int stmmac_dt_phy(struct
>> plat_stmmacenet_data *plat,
>>>>    			 struct device_node *np, struct device *dev)  {
>>>> -	bool mdio = false;
>>>> +	bool mdio = true;
>>>
>>>
>>> This is breaking for the platforms with fixed-link.
>>> stih418-b2199.dts and 169445.dts to name a few.
>>>
>>> For the newer platforms, they should provide the mdio/ snps,dwmac-mdio
>>> property in the device tree as we are checking the mdio/
>>> snps,dwmac-mdio property in the stmmac_platform driver for the mdio bus
>> memory allocation.
>>> For existing platforms, I agree we should not break them, but we
>>> should make the code correct. And make the existing platforms adapt to the
>> proper code.
>>> There is a proposed solution.
>>> https://protect2.fireeye.com/url?k=d075c0fc-8da69942-d0744bb3-0cc47a31
>>> ba82-60be9f5a0fb38a27&u=https://lkml.org/lkml/2020/1/7/14
>>>
>>> What do you think?
>>
>> The binding says that the phy handle and mdio child node are optional, so
>> "update all of the DTBs!" is not a viable solution. I'm far from an expert here, but
> 
> I get your point Robin. Because the mdio child or snps,dwmac-mdio is not mandatory,
> there has been this problem.
> 
>> AFAICS the fault of the current code is that it assumes the lack of a phy handle
>> implies a fixed link, so the obvious answer is to actually check whether the
> 
> Kind of.
> 
>> "fixed-link" property is present.
> 
> 
> I agree to have a fixed link check. Possibly this can be done:

FWIW, given the 4th case in the kerneldoc table I think this check might 
need to come first. On the upside, there appears to be a handy helper 
already, so it may just be as simple as:

	bool mdio = !of_phy_is_fixed_link(np);

Robin.

> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -320,7 +320,9 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
>   static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>                           struct device_node *np, struct device *dev)
>   {
> -       bool mdio = false;
> +       bool mdio = true;
> +       struct device_node *fixed_link;
> +
>          static const struct of_device_id need_mdio_ids[] = {
>                  { .compatible = "snps,dwc-qos-ethernet-4.10" },
>                  {},
> @@ -340,9 +342,8 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>                  }
>          }
> 
> -       if (plat->mdio_node) {
> -               dev_dbg(dev, "Found MDIO subnode\n");
> -               mdio = true;
> +       if (of_get_child_by_name(np, "fixed-link")) {
> +               mdio = false;
>          }
> 
>          if (mdio) {
> 
> Neil and Heiko,
> 
> Can you guys please test this on your platforms?
> We can post a more cleaner version of the patch if all agree to it.
> 
>>
>> Robin.
>>
>>>
>>>>    	static const struct of_device_id need_mdio_ids[] = {
>>>>    		{ .compatible = "snps,dwc-qos-ethernet-4.10" },
>>>>    		{},
>>>> --
>>>> 2.19.1
>>>
>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel@lists.infradead.org
>>> https://protect2.fireeye.com/url?k=2cb95551-716a0cef-2cb8de1e-0cc47a31
>>> ba82-d01ceb62a8a93fa2&u=http://lists.infradead.org/mailman/listinfo/li
>>> nux-arm-kernel
>>>
> 

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

* RE: [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY"
  2020-01-07 12:14       ` Sriram Dash
  2020-01-07 12:36         ` Robin Murphy
@ 2020-01-07 12:36         ` Jose Abreu
  1 sibling, 0 replies; 7+ messages in thread
From: Jose Abreu @ 2020-01-07 12:36 UTC (permalink / raw)
  To: Sriram Dash, 'Robin Murphy', 'Florian Fainelli',
	netdev, narmstrong, 'Heiko Stuebner'
  Cc: 'Jayati Sahu', 'Alexandre Torgue',
	tomeu.vizoso, rcsekar, khilman, mgalka, linux-kernel,
	'Padmanabhan Rajanbabu',
	linux-stm32, broonie, pankaj.dubey, 'Maxime Coquelin',
	guillaume.tucker, enric.balletbo, 'Giuseppe Cavallaro',
	'David S. Miller',
	linux-arm-kernel, heiko

From: Sriram Dash <sriram.dash@samsung.com>
Date: Jan/07/2020, 12:14:19 (UTC+00:00)

> Can you guys please test this on your platforms?
> We can post a more cleaner version of the patch if all agree to it.

Can you also test this one [1] ?

[1] https://patchwork.ozlabs.org/patch/1218762/

---
Thanks,
Jose Miguel 
Abreu

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

end of thread, other threads:[~2020-01-07 12:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200107050854epcas1p3c1a66e67f14802322063f6c9747f1986@epcas1p3.samsung.com>
2020-01-07  5:08 ` [PATCH net] Revert "net: stmmac: platform: Fix MDIO init for platforms without PHY" Florian Fainelli
2020-01-07  5:46   ` Sriram Dash
2020-01-07 10:46     ` Neil Armstrong
2020-01-07 10:56     ` Robin Murphy
2020-01-07 12:14       ` Sriram Dash
2020-01-07 12:36         ` Robin Murphy
2020-01-07 12:36         ` Jose Abreu

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).