netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Alexandru Marginean <alexandru.marginean@nxp.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	network dev <netdev@vger.kernel.org>,
	Grygorii Strashko <grygorii.strashko@ti.com>
Subject: Re: binding for scanning a MDIO bus
Date: Fri, 22 Nov 2019 16:09:32 +0100	[thread overview]
Message-ID: <20191122150932.GC6602@lunn.ch> (raw)
In-Reply-To: <7b6fc87b-b6d8-21e6-bd8d-74c72b3d63a7@nxp.com>

On Fri, Nov 22, 2019 at 12:31:30PM +0000, Alexandru Marginean wrote:
> Hi everyone,
> 
> I am looking for the proper binding to scan for a PHY on an MDIO bus 
> that's not a child of the Ethernet device but otherwise is associated 
> with it.  Scanning this bus should guarantee finding the correct PHY, if 
> one exists.  As far as I can tell current bindings don't allow such 
> association, although the code seems to support it.
> 
> The hardware that I'm using and could use such a binding is a NXP QDS 
> board with PHY cards.  In particular this is a LS1028A, but the problem 
> is common to the NXP QDS boards.  These cards wire MDIO up to the CPU 
> through a mux.  The mux practically selects one of the slots/cards so 
> the MDIO bus the PHY is on is private to the slot/card.
> Each slot is also associated with an Ethernet interface, this is subject 
> to serdes configuration and specifically for that I'm looking to apply a 
> DT overlay.  Overlays are really impractical with the PHY cards though, 
> there are several types of cards, number of slots can go up to 8 or so 
> on some types of QDS boards and number of PHY card overlays that should 
> be defined would blow up.  The number of overlays users would need to 
> apply at boot would also go up to number of slots + 1.
> 
> The function of_mdiobus_register does scan for PHYs if 'reg' is missing 
> in PHY nodes, is this code considered obsolete, is it OK to use it if 
> needed but otherwise discouraged?  Any thoughts on including support for 
> scanning in the binding document, like making 'reg' property in phy 
> nodes optional?
> 
> For what is worth scanning is a good solution in some cases, better than 
> others anyway.  I'm sure it's not just people being too lazy to set up 
> 'reg' that use this code.

Hi Alexandru

You often see the bus registered using mdiobus_register(). That then
means a scan is performed and all phys on the bus found. The MAC
driver then uses phy_find_first() to find the first PHY on the bus.
The danger here is that the hardware design changes, somebody adds a
second PHY, and it all stops working in interesting and confusing
ways.

Would this work for you?

      Andrew

  reply	other threads:[~2019-11-22 15:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22 12:31 binding for scanning a MDIO bus Alexandru Marginean
2019-11-22 15:09 ` Andrew Lunn [this message]
2019-11-22 16:20   ` Alexandru Marginean
2019-11-22 17:42     ` Andrew Lunn
2019-11-22 20:40       ` Alexandru Marginean
2019-11-22 21:12         ` Vladimir Oltean
2019-11-22 23:01           ` Alexandru Marginean

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=20191122150932.GC6602@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alexandru.marginean@nxp.com \
    --cc=f.fainelli@gmail.com \
    --cc=grygorii.strashko@ti.com \
    --cc=hkallweit1@gmail.com \
    --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).