devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	devicetree@vger.kernel.org, netdev@vger.kernel.org,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] net/macb: add support for resetting PHY using GPIO
Date: Fri, 11 Dec 2015 10:33:22 +0000	[thread overview]
Message-ID: <20151211103322.GR8644@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20151211102130.GA11966@pengutronix.de>

On Fri, Dec 11, 2015 at 11:21:30AM +0100, Sascha Hauer wrote:
> On Fri, Dec 11, 2015 at 10:40:22AM +0100, Gregory CLEMENT wrote:
> > So I see 2 options:
> > 
> > - leaving the phy-reset-gpios property in the ethernet node. Thanks to
> >   this we can use the gpiod functions, and it is still possible to use
> >   manage the power management.
> > 
> > - using a reset-gpios property inside the phy node. But then the only
> >   solution to get a reference on it, will be to use
> >   of_get_named_gpio. All the gpiod functions need a reference to the
> >   device that we won't have at this point. Also we will only be able to
> >   power up the reset, but we won't have any reference to it latter.
> 
> Have you seen fwnode_get_named_gpiod()? This seems to be the right
> function for the job.

Except:

1. You don't have a dev->fwnode pointer setup.
2. Using &dev->of_node->fwnode is really going underneath the covers.

I've pointed this problem out several times with the fwnode code, which
seems to be a half-baked and incomplete design when it comes to DT.

I'd suggest using of_get_named_gpio_flags() et.al. and converting the
resulting gpio number to a gpio descriptor - or trying to push DT and
fwnode people to initialise dev->fwnode so that a proper transition to
fwnode for DT can be made.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

      reply	other threads:[~2015-12-11 10:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 17:49 [PATCH] net/macb: add support for resetting PHY using GPIO Gregory CLEMENT
2015-12-09 18:18 ` Andrew Lunn
2015-12-09 18:27 ` Moritz Fischer
2015-12-09 19:10 ` kbuild test robot
2015-12-10  7:37 ` Sascha Hauer
2015-12-10 15:08   ` Gregory CLEMENT
2015-12-11  8:46     ` Sascha Hauer
2015-12-11  9:40       ` Gregory CLEMENT
2015-12-11 10:21         ` Sascha Hauer
2015-12-11 10:33           ` Russell King - ARM Linux [this message]

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=20151211103322.GR8644@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=thomas.petazzoni@free-electrons.com \
    /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).