public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3] net: phy: implement fallback mechanism for negative phy adresses
@ 2019-03-29  8:54 Hannes Schmelzer
  2019-03-29  8:56 ` Michal Simek
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hannes Schmelzer @ 2019-03-29  8:54 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>

---

Changes in v3:
- fix commit message

Changes in v2:
- cosmetic changes

 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..4e8d294 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) ? (1 << 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] 5+ messages in thread

* [U-Boot] [PATCH v3] net: phy: implement fallback mechanism for negative phy adresses
  2019-03-29  8:54 [U-Boot] [PATCH v3] net: phy: implement fallback mechanism for negative phy adresses Hannes Schmelzer
@ 2019-03-29  8:56 ` Michal Simek
  2019-04-03  8:05 ` Lukasz Majewski
  2019-04-08 11:52 ` [U-Boot] [U-Boot, " Tom Rini
  2 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2019-03-29  8:56 UTC (permalink / raw)
  To: u-boot

On 29. 03. 19 9:54, 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>
> 
> ---
> 
> Changes in v3:
> - fix commit message
> 
> Changes in v2:
> - cosmetic changes
> 
>  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..4e8d294 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) ? (1 << 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);
> 

Tested-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

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

* [U-Boot] [PATCH v3] net: phy: implement fallback mechanism for negative phy adresses
  2019-03-29  8:54 [U-Boot] [PATCH v3] net: phy: implement fallback mechanism for negative phy adresses Hannes Schmelzer
  2019-03-29  8:56 ` Michal Simek
@ 2019-04-03  8:05 ` Lukasz Majewski
  2019-04-07 20:17   ` Lukasz Majewski
  2019-04-08 11:52 ` [U-Boot] [U-Boot, " Tom Rini
  2 siblings, 1 reply; 5+ messages in thread
From: Lukasz Majewski @ 2019-04-03  8:05 UTC (permalink / raw)
  To: u-boot

Hi Hannes,

> 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>
> 
> ---
> 
> Changes in v3:
> - fix commit message
> 
> Changes in v2:
> - cosmetic changes
> 
>  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..4e8d294 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) ? (1 << 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);

Tested-by: Lukasz Majewski <lukma@denx.de>

Test HW: imx53 (HSC device).

Could this patch be applied to v2019.04, please ?

(So there is NO need to revert:
"drivers/net/fec: phy_init: remove redundant logic").


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190403/23325b8c/attachment.sig>

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

* [U-Boot] [PATCH v3] net: phy: implement fallback mechanism for negative phy adresses
  2019-04-03  8:05 ` Lukasz Majewski
@ 2019-04-07 20:17   ` Lukasz Majewski
  0 siblings, 0 replies; 5+ messages in thread
From: Lukasz Majewski @ 2019-04-07 20:17 UTC (permalink / raw)
  To: u-boot

Hi Tom,

> Hi Hannes,
> 
> > 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>
> > 
> > ---
> > 
> > Changes in v3:
> > - fix commit message
> > 
> > Changes in v2:
> > - cosmetic changes
> > 
> >  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..4e8d294 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) ? (1 << 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);  
> 
> Tested-by: Lukasz Majewski <lukma@denx.de>
> 
> Test HW: imx53 (HSC device).
> 
> Could this patch be applied to v2019.04, please ?
> 
> (So there is NO need to revert:
> "drivers/net/fec: phy_init: remove redundant logic").
> 

Tom, do you plan to add thins commit to v2019.04 ?

> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma at denx.de




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190407/5f0f1117/attachment.sig>

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

* [U-Boot] [U-Boot, v3] net: phy: implement fallback mechanism for negative phy adresses
  2019-03-29  8:54 [U-Boot] [PATCH v3] net: phy: implement fallback mechanism for negative phy adresses Hannes Schmelzer
  2019-03-29  8:56 ` Michal Simek
  2019-04-03  8:05 ` Lukasz Majewski
@ 2019-04-08 11:52 ` Tom Rini
  2 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2019-04-08 11:52 UTC (permalink / raw)
  To: u-boot

On Fri, Mar 29, 2019 at 09:54:05AM +0100, 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>
> Tested-by: Michal Simek <michal.simek@xilinx.com>
> Tested-by: Lukasz Majewski <lukma@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190408/3bb023ba/attachment.sig>

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

end of thread, other threads:[~2019-04-08 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-29  8:54 [U-Boot] [PATCH v3] net: phy: implement fallback mechanism for negative phy adresses Hannes Schmelzer
2019-03-29  8:56 ` Michal Simek
2019-04-03  8:05 ` Lukasz Majewski
2019-04-07 20:17   ` Lukasz Majewski
2019-04-08 11:52 ` [U-Boot] [U-Boot, " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox