diff mbox series

[1/2] net: phy: dp83867: avoid error in dp83867_of_init() when PHY has no OF node

Message ID 20220223132056.3364440-2-vladimir.oltean@nxp.com
State Accepted
Commit 107b14e36eaafebdc28666a9d5fecdd4044a59e3
Delegated to: Ramon Fried
Headers show
Series PHY of_init breakage with non-OF | expand

Commit Message

Vladimir Oltean Feb. 23, 2022, 1:20 p.m. UTC
A DM_ETH driver may use phy_connect() towards a PHY address on an MDIO
bus which is not specified in the device tree, as evidenced by:

pfe_eth_probe
-> pfe_phy_configure
   -> phy_connect

When this happens, the PHY will have an invalid OF node.

The dp83867_config() method has extra initialization steps which are
bypassed when the PHY lacks an OF node, which is undesirable because it
will lead to broken networking. Allow the rest of the code to run.

Fixes: 085445ca4104 ("net: phy: ti: Allow the driver to be more configurable")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/phy/dp83867.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ramon Fried March 3, 2022, 7:52 a.m. UTC | #1
On Wed, Feb 23, 2022 at 3:21 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
> A DM_ETH driver may use phy_connect() towards a PHY address on an MDIO
> bus which is not specified in the device tree, as evidenced by:
>
> pfe_eth_probe
> -> pfe_phy_configure
>    -> phy_connect
>
> When this happens, the PHY will have an invalid OF node.
>
> The dp83867_config() method has extra initialization steps which are
> bypassed when the PHY lacks an OF node, which is undesirable because it
> will lead to broken networking. Allow the rest of the code to run.
>
> Fixes: 085445ca4104 ("net: phy: ti: Allow the driver to be more configurable")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/phy/dp83867.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
> index eada4541c9c3..49978d0f25f3 100644
> --- a/drivers/net/phy/dp83867.c
> +++ b/drivers/net/phy/dp83867.c
> @@ -158,7 +158,7 @@ static int dp83867_of_init(struct phy_device *phydev)
>
>         node = phy_get_ofnode(phydev);
>         if (!ofnode_valid(node))
> -               return -EINVAL;
> +               return 0;
>
>         /* Optional configuration */
>         ret = ofnode_read_u32(node, "ti,clk-output-sel",
> --
> 2.25.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Ramon Fried April 1, 2022, 7:12 p.m. UTC | #2
On Thu, Mar 3, 2022 at 9:52 AM Ramon Fried <rfried.dev@gmail.com> wrote:
>
> On Wed, Feb 23, 2022 at 3:21 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> > A DM_ETH driver may use phy_connect() towards a PHY address on an MDIO
> > bus which is not specified in the device tree, as evidenced by:
> >
> > pfe_eth_probe
> > -> pfe_phy_configure
> >    -> phy_connect
> >
> > When this happens, the PHY will have an invalid OF node.
> >
> > The dp83867_config() method has extra initialization steps which are
> > bypassed when the PHY lacks an OF node, which is undesirable because it
> > will lead to broken networking. Allow the rest of the code to run.
> >
> > Fixes: 085445ca4104 ("net: phy: ti: Allow the driver to be more configurable")
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > ---
> >  drivers/net/phy/dp83867.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
> > index eada4541c9c3..49978d0f25f3 100644
> > --- a/drivers/net/phy/dp83867.c
> > +++ b/drivers/net/phy/dp83867.c
> > @@ -158,7 +158,7 @@ static int dp83867_of_init(struct phy_device *phydev)
> >
> >         node = phy_get_ofnode(phydev);
> >         if (!ofnode_valid(node))
> > -               return -EINVAL;
> > +               return 0;
> >
> >         /* Optional configuration */
> >         ret = ofnode_read_u32(node, "ti,clk-output-sel",
> > --
> > 2.25.1
> >
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Applied to u-boot-net/next
Thanks,
Ramon
diff mbox series

Patch

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index eada4541c9c3..49978d0f25f3 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -158,7 +158,7 @@  static int dp83867_of_init(struct phy_device *phydev)
 
 	node = phy_get_ofnode(phydev);
 	if (!ofnode_valid(node))
-		return -EINVAL;
+		return 0;
 
 	/* Optional configuration */
 	ret = ofnode_read_u32(node, "ti,clk-output-sel",