LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Saravana Kannan <saravanak@google.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	kernel-team@android.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v1 2/2] of: property: fw_devlink: Add support for "phy-handle" property
Date: Mon, 16 Aug 2021 13:43:19 -0700	[thread overview]
Message-ID: <CAGETcx-ETuH_axMF41PzfmKmT-M7URiua332WvzzzXQHg=Hj0w@mail.gmail.com> (raw)
In-Reply-To: <YRffzVgP2eBw7HRz@lunn.ch>

On Sat, Aug 14, 2021 at 8:22 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
> Hi Saravana
>
> > Hi Andrew,
> >
>
> > Also there
> > are so many phy related properties that my head is spinning. Is there a
> > "phy" property (which is different from "phys") that treated exactly as
> > "phy-handle"?
>
> Sorry, i don't understand your question.

Sorry. I was just saying I understand the "phy-handle" DT property
(seems specific to ethernet PHY) and "phys" DT property (seems to be
for generic PHYs -- used mostly by display and USB?). But I noticed
there's yet another "phy" DT property which I'm not sure I understand.
It seems to be used by display and ethernet and seems to be a
deprecated property. If you can explain that DT property in the
context of networking and how to interpret it as a human, that'd be
nice.

>
> > +     /*
> > +      * Device tree nodes pointed to by phy-handle never have struct devices
> > +      * created for them even if they have a "compatible" property. So
> > +      * return the parent node pointer.
> > +      */
>
> We have a classic bus with devices on it. The bus master is registers
> with linux using one of the mdiobus_register() calls. That then
> enumerates the bus, looking at the 32 possible address on the bus,
> using mdiobus_scan. It then gets a little complex, due to
> history.
>
> Originally, the only thing you could have on an MDIO bus was a
> PHY. But devices on MDIO busses are more generic, and Linux gained
> support for Ethernet switches on an MDIO bus, and there are a few
> other sort device. So to keep the PHY API untouched, but to add these
> extra devices, we added the generic struct mdio_device which
> represents any sort of device on an MDIO bus. This has a struct device
> embedded in it.
>
> When we scan the bus and find a PHY, a struct phy_device is created,
> which has an embedded struct mdio_device. The struct device in that is
> then registered with the driver core.
>
> So a phy-handle does point to a device, but you need to do an object
> orientated style look at the base class to find it.

Thanks for the detailed explanation. I didn't notice a phy_device had
an mdio_device inside it. Makes sense. I think my comment is not
worded accurately and it really should be:

Device tree nodes pointed to by phy-handle (even if they have a
"compatible" property) will never have struct devices probed and bound
to a driver through the driver framework. It's the parent node/device
that gets bound to a driver and initializes the PHY. So return the
parent node pointer instead.

Does this sound right? As opposed to PHYs the other generic mdio
devices seem to actually have drivers that'll bind to them through the
driver framework.

-Saravana

  reply	other threads:[~2021-08-16 20:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-14  2:31 [PATCH v1 0/2] of: property: Support for few more properties Saravana Kannan
2021-08-14  2:31 ` [PATCH v1 1/2] of: property: fw_devlink: Add support for "leds" and "backlight" Saravana Kannan
2021-08-17 22:02   ` Rob Herring
2021-08-14  2:31 ` [PATCH v1 2/2] of: property: fw_devlink: Add support for "phy-handle" property Saravana Kannan
2021-08-14 15:22   ` Andrew Lunn
2021-08-16 20:43     ` Saravana Kannan [this message]
2021-08-16 21:11       ` Rob Herring
2021-08-17 18:18         ` Saravana Kannan
2021-08-16 21:15       ` Andrew Lunn
2021-08-18  2:13         ` Saravana Kannan

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='CAGETcx-ETuH_axMF41PzfmKmT-M7URiua332WvzzzXQHg=Hj0w@mail.gmail.com' \
    --to=saravanak@google.com \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH v1 2/2] of: property: fw_devlink: Add support for "phy-handle" property' \
    /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

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).