All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] drivers/net/phy: implement fallback mechanism for negative phy adresses
@ 2019-03-29  6:03 Hannes Schmelzer
  2019-03-29  6:08 ` Hannes Schmelzer
  2019-03-29  8:23 ` Michal Simek
  0 siblings, 2 replies; 3+ messages in thread
From: Hannes Schmelzer @ 2019-03-29  6:03 UTC (permalink / raw)
  To: u-boot

Negative phy-addresses can occour if the caller function was not able to
determine a valid phy address (from device-tree for example). In this
case we catch this here and search for ANY phy device on the given mdio-
bus.

Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>

---

 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0c8b29d..916b525 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 #endif
 {
 	struct phy_device *phydev = NULL;
+	uint mask = (addr > 0) ? (0x1 << addr) : 0xffffffff;
 
 #ifdef CONFIG_PHY_FIXED
 	phydev = phy_connect_fixed(bus, dev, interface);
 #endif
 
 	if (!phydev)
-		phydev = phy_find_by_mask(bus, 1 << addr, interface);
+		phydev = phy_find_by_mask(bus, mask, interface);
 
 	if (phydev)
 		phy_connect_dev(phydev, dev);
-- 
2.7.4

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

* [U-Boot] [PATCH] drivers/net/phy: implement fallback mechanism for negative phy adresses
  2019-03-29  6:03 [U-Boot] [PATCH] drivers/net/phy: implement fallback mechanism for negative phy adresses Hannes Schmelzer
@ 2019-03-29  6:08 ` Hannes Schmelzer
  2019-03-29  8:23 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Schmelzer @ 2019-03-29  6:08 UTC (permalink / raw)
  To: u-boot



On 3/29/19 7:03 AM, Hannes Schmelzer wrote:
> Negative phy-addresses can occour if the caller function was not able to
> determine a valid phy address (from device-tree for example). In this
> case we catch this here and search for ANY phy device on the given mdio-
> bus.
>
> Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
>
> ---
>
>   drivers/net/phy/phy.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 0c8b29d..916b525 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
>   #endif
>   {
>   	struct phy_device *phydev = NULL;
> +	uint mask = (addr > 0) ? (0x1 << addr) : 0xffffffff;
>   
>   #ifdef CONFIG_PHY_FIXED
>   	phydev = phy_connect_fixed(bus, dev, interface);
>   #endif
>   
>   	if (!phydev)
> -		phydev = phy_find_by_mask(bus, 1 << addr, interface);
> +		phydev = phy_find_by_mask(bus, mask, interface);
>   
>   	if (phydev)
>   		phy_connect_dev(phydev, dev);
This fallback is only useful if the board has absolutely no description
of the phy connected to some MAC.
With some drivers, like the MXC_FEC, it is possible to configure
a phy-address within the board header.

In days where DM is more and more used, i would suggest having
a meaningful device-tree which also describes the connected ethernet-phy.

cheers,
Hannes

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

* [U-Boot] [PATCH] drivers/net/phy: implement fallback mechanism for negative phy adresses
  2019-03-29  6:03 [U-Boot] [PATCH] drivers/net/phy: implement fallback mechanism for negative phy adresses Hannes Schmelzer
  2019-03-29  6:08 ` Hannes Schmelzer
@ 2019-03-29  8:23 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2019-03-29  8:23 UTC (permalink / raw)
  To: u-boot

Please fix subject net: phy: should be fine.

On 29. 03. 19 7:03, Hannes Schmelzer wrote:
> Negative phy-addresses can occour if the caller function was not able to
> determine a valid phy address (from device-tree for example). In this
> case we catch this here and search for ANY phy device on the given mdio-
> bus.
> 
> Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
> 

> ---
> 
>  drivers/net/phy/phy.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 0c8b29d..916b525 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
>  #endif
>  {
>  	struct phy_device *phydev = NULL;
> +	uint mask = (addr > 0) ? (0x1 << addr) : 0xffffffff;

s/0x1/1/

>  
>  #ifdef CONFIG_PHY_FIXED
>  	phydev = phy_connect_fixed(bus, dev, interface);
>  #endif
>  
>  	if (!phydev)
> -		phydev = phy_find_by_mask(bus, 1 << addr, interface);
> +		phydev = phy_find_by_mask(bus, mask, interface);
>  
>  	if (phydev)
>  		phy_connect_dev(phydev, dev);
> 

When subject and that stuff above are fixed please add
Tested-by: Michal Simek <michal.simek@xilinx.com>

And then we can remove our code from zynq_gem (phy_dectection()).

Thanks,
Michal

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

end of thread, other threads:[~2019-03-29  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29  6:03 [U-Boot] [PATCH] drivers/net/phy: implement fallback mechanism for negative phy adresses Hannes Schmelzer
2019-03-29  6:08 ` Hannes Schmelzer
2019-03-29  8:23 ` Michal Simek

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.