netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Grant Likely <grant.likely@secretlab.ca>,
	devicetree-discuss@lists.ozlabs.org,
	Netdev <netdev@vger.kernel.org>
Subject: RFD: OF device tree vs. PHY flags.
Date: Fri, 15 Oct 2010 11:18:00 -0700	[thread overview]
Message-ID: <4CB89AD8.7020200@caviumnetworks.com> (raw)

I am in the process of planning a conversion of Octeon SOC platform code 
to use the OF device tree in the Linux kernel.

One issue that I have encountered, is that for some boards, we need to 
pass a non-zero flags argument to the phy_attach_direct() method.  The 
value of the flags is board dependent, so it would make some sense to 
encode its value in the device tree itself.  The flags I am interested 
in control the configuration of clocking modes and status LED connections.

I would suggest the following:

o Add a new property to "ethernet-phy" dts bindings called 
"linux,flags".  It would contain a comma separated string of flag names. 
  Something like "led-mode1,clock-mode2".  The semantics of the flag 
names would be interpreted by the PHY driver...

o Add a new function pointer to struct phy_driver: u32 
(*of_parse_flags)(struct phy_device *phydev).  This would parse and 
return the flags value for the "linux,flags" property from the 
device_node associated with the particular PHY device in question.

o Modify of_phy_connect() to do something like the following:

.
.
.
	if (phy->driver && phy->driver->of_parse_flags)
		flags |= phy->driver->of_parse_flags(phy);
.
.
.

o Perhaps add some helper functions to of_mdio.c to assist in parsing 
the "linux,flags" properties string.

o Any extra code in the PHY drivers and struct phy_driver would be 
protected by #ifdef CONFIG_OF

How does this sound?

Any suggestions as for improvements, or better names for things?


Thanks,
David Daney

             reply	other threads:[~2010-10-15 18:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-15 18:18 David Daney [this message]
2010-10-16  3:39 ` RFD: OF device tree vs. PHY flags Grant Likely

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=4CB89AD8.7020200@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --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).