devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, hkallweit1@gmail.com,
	linux@armlinux.org.uk, davem@davemloft.net
Subject: Re: [PATCH] net: mdio: of: Do not treat fixed-link as PHY
Date: Mon, 30 Mar 2020 10:22:28 -0700	[thread overview]
Message-ID: <9bbbe2ed-985b-49e7-cc16-8b6bae3e8e8e@gmail.com> (raw)
In-Reply-To: <20200330163028.GE23477@lunn.ch>



On 3/30/2020 9:30 AM, Andrew Lunn wrote:
> On Mon, Mar 30, 2020 at 07:01:36PM +0300, Codrin Ciubotariu wrote:
>> Some ethernet controllers, such as cadence's macb, have an embedded MDIO.
>> For this reason, the ethernet PHY nodes are not under an MDIO bus, but
>> directly under the ethernet node. Since these drivers might use
>> of_mdiobus_child_is_phy(), we should fix this function by returning false
>> if a fixed-link is found.
> 
> So i assume the problem occurs here:
> 
> static int macb_mdiobus_register(struct macb *bp)
> {
>         struct device_node *child, *np = bp->pdev->dev.of_node;
> 
>         /* Only create the PHY from the device tree if at least one PHY is
>          * described. Otherwise scan the entire MDIO bus. We do this to support
>          * old device tree that did not follow the best practices and did not
>          * describe their network PHYs.
>          */
>         for_each_available_child_of_node(np, child)
>                 if (of_mdiobus_child_is_phy(child)) {
>                         /* The loop increments the child refcount,
>                          * decrement it before returning.
>                          */
>                         of_node_put(child);
> 
>                         return of_mdiobus_register(bp->mii_bus, np);
>                 }
> 
>         return mdiobus_register(bp->mii_bus);
> }
> 
> I think a better solution is
> 
>         for_each_available_child_of_node(np, child)
> +		if (of_phy_is_fixed_link(child)
> +		   continue;
>                 if (of_mdiobus_child_is_phy(child)) {
>                         /* The loop increments the child refcount,
>                          * decrement it before returning.
>                          */
>                         of_node_put(child);
> 
>                         return of_mdiobus_register(bp->mii_bus, np);
>                 }
> 
>         return mdiobus_register(bp->mii_bus);
> }
> 
> This problem is only an issue for macb, so keep the fix local to macb.

Agree, there is no reason for of_mdiobus_child_is_phy() to be checking
for a fixed-link. If you submit this formally:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

  reply	other threads:[~2020-03-30 17:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 16:01 [PATCH] net: mdio: of: Do not treat fixed-link as PHY Codrin Ciubotariu
2020-03-30 16:17 ` Andrew Lunn
2020-03-30 16:21   ` Russell King - ARM Linux admin
2020-03-30 16:24     ` Andrew Lunn
2020-03-30 16:30 ` Andrew Lunn
2020-03-30 17:22   ` Florian Fainelli [this message]
2020-03-31  8:54     ` Codrin.Ciubotariu
2020-03-31 12:59       ` Andrew Lunn
2020-04-01  7:50         ` Codrin.Ciubotariu
2020-04-01 13:06           ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bbbe2ed-985b-49e7-cc16-8b6bae3e8e8e@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=codrin.ciubotariu@microchip.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).