All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] net/macb: add support for resetting PHY using GPIO
Date: Thu, 10 Dec 2015 16:08:08 +0100	[thread overview]
Message-ID: <871tau8hpj.fsf@free-electrons.com> (raw)
In-Reply-To: <20151210073756.GA11966@pengutronix.de> (Sascha Hauer's message of "Thu, 10 Dec 2015 08:37:56 +0100")

Hi Sascha,
 
 On jeu., d?c. 10 2015, Sascha Hauer <s.hauer@pengutronix.de> wrote:

> Hi Gregory,
>
> On Wed, Dec 09, 2015 at 06:49:43PM +0100, Gregory CLEMENT wrote:
>> With device tree it is no more possible to reset the PHY at board
>> level. Furthermore, doing in the driver allow to power down the PHY when
>> the network interface is no more used.
>> 
>> The patch introduces a new optional property "phy-reset-gpio" inspired
>> from the one use for the FEC.
>
> I don't think it's a good idea to further extend the usage of this
> binding. The driver should use the phy-handle property and
> of_phy_connect() which gives you a proper device node for the phy. Then
> the phy device node should get the reset gpio. I know it's more work,

So you suggest to pass from this binding:
macb1: ethernet at fc028000 {
	phy-mode = "rmii";
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";
	phy-reset-gpio = <&pioE 6 GPIO_ACTIVE_HIGH>;

	ethernet-phy at 1 {
		reg = <0x1>;
		interrupt-parent = <&pioB>;
		interrupts = <31 IRQ_TYPE_EDGE_FALLING>;

	};
};

to this binding
macb1: ethernet at fc028000 {
	phy-mode = "rmii";
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	ethernet-phy at 1 {
		reg = <0x1>;
		interrupt-parent = <&pioB>;
		interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
                phy-reset-gpio = <&pioE 6 GPIO_ACTIVE_HIGH>;
	};
};

> but doing it like this gives you additional goodies like proper handling
> of the max-speed property, a fixed-link if necessary and picking the

Currently there is phy_connect_direct so we can already handle the
preperty of the phy.

> correct phy if there are muliple phys on the bus.

but I agree with this one.

Gregory

>
> Sascha
>
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Subject: Re: [PATCH] net/macb: add support for resetting PHY using GPIO
Date: Thu, 10 Dec 2015 16:08:08 +0100	[thread overview]
Message-ID: <871tau8hpj.fsf@free-electrons.com> (raw)
In-Reply-To: <20151210073756.GA11966@pengutronix.de> (Sascha Hauer's message of "Thu, 10 Dec 2015 08:37:56 +0100")

Hi Sascha,
 
 On jeu., déc. 10 2015, Sascha Hauer <s.hauer@pengutronix.de> wrote:

> Hi Gregory,
>
> On Wed, Dec 09, 2015 at 06:49:43PM +0100, Gregory CLEMENT wrote:
>> With device tree it is no more possible to reset the PHY at board
>> level. Furthermore, doing in the driver allow to power down the PHY when
>> the network interface is no more used.
>> 
>> The patch introduces a new optional property "phy-reset-gpio" inspired
>> from the one use for the FEC.
>
> I don't think it's a good idea to further extend the usage of this
> binding. The driver should use the phy-handle property and
> of_phy_connect() which gives you a proper device node for the phy. Then
> the phy device node should get the reset gpio. I know it's more work,

So you suggest to pass from this binding:
macb1: ethernet@fc028000 {
	phy-mode = "rmii";
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";
	phy-reset-gpio = <&pioE 6 GPIO_ACTIVE_HIGH>;

	ethernet-phy@1 {
		reg = <0x1>;
		interrupt-parent = <&pioB>;
		interrupts = <31 IRQ_TYPE_EDGE_FALLING>;

	};
};

to this binding
macb1: ethernet@fc028000 {
	phy-mode = "rmii";
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	ethernet-phy@1 {
		reg = <0x1>;
		interrupt-parent = <&pioB>;
		interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
                phy-reset-gpio = <&pioE 6 GPIO_ACTIVE_HIGH>;
	};
};

> but doing it like this gives you additional goodies like proper handling
> of the max-speed property, a fixed-link if necessary and picking the

Currently there is phy_connect_direct so we can already handle the
preperty of the phy.

> correct phy if there are muliple phys on the bus.

but I agree with this one.

Gregory

>
> Sascha
>
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2015-12-10 15:08 UTC|newest]

Thread overview: 21+ 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 17:49 ` Gregory CLEMENT
2015-12-09 18:18 ` Andrew Lunn
2015-12-09 18:18   ` Andrew Lunn
2015-12-09 18:27 ` Moritz Fischer
2015-12-09 18:27   ` Moritz Fischer
2015-12-09 19:10 ` kbuild test robot
2015-12-09 19:10   ` kbuild test robot
2015-12-09 19:10   ` kbuild test robot
2015-12-10  7:37 ` Sascha Hauer
2015-12-10  7:37   ` Sascha Hauer
2015-12-10 15:08   ` Gregory CLEMENT [this message]
2015-12-10 15:08     ` Gregory CLEMENT
2015-12-11  8:46     ` Sascha Hauer
2015-12-11  8:46       ` Sascha Hauer
2015-12-11  9:40       ` Gregory CLEMENT
2015-12-11  9:40         ` Gregory CLEMENT
2015-12-11 10:21         ` Sascha Hauer
2015-12-11 10:21           ` Sascha Hauer
2015-12-11 10:33           ` Russell King - ARM Linux
2015-12-11 10:33             ` Russell King - ARM Linux

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=871tau8hpj.fsf@free-electrons.com \
    --to=gregory.clement@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.