From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933776AbdEVN5L (ORCPT ); Mon, 22 May 2017 09:57:11 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:39206 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933660AbdEVN5K (ORCPT ); Mon, 22 May 2017 09:57:10 -0400 Date: Mon, 22 May 2017 15:57:05 +0200 From: Andrew Lunn To: Quentin Schulz Cc: fugang.duan@nxp.com, robh+dt@kernel.org, mark.rutland@arm.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@free-electrons.com Subject: Re: [PATCH] net: fec: add post PHY reset delay DT property Message-ID: <20170522135705.GB29447@lunn.ch> References: <20170522091517.6857-1-quentin.schulz@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170522091517.6857-1-quentin.schulz@free-electrons.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 22, 2017 at 11:15:17AM +0200, Quentin Schulz wrote: > Some PHY require to wait for a bit after the reset GPIO has been > toggled. This adds support for the DT property `phy-reset-post-delay` > which gives the delay in milliseconds to wait after reset. > > If the DT property is not given, no delay is observed. Post reset delay > greater than 1000ms are invalid and are default to 1ms. Hi Quentin If it is invalid, please return -EINVAL. > Signed-off-by: Quentin Schulz > --- > Documentation/devicetree/bindings/net/fsl-fec.txt | 5 +++++ > drivers/net/ethernet/freescale/fec_main.c | 17 +++++++++++++++-- > 2 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt > index a1e3693cca16..8795e8ca5793 100644 > --- a/Documentation/devicetree/bindings/net/fsl-fec.txt > +++ b/Documentation/devicetree/bindings/net/fsl-fec.txt > @@ -15,6 +15,11 @@ Optional properties: > - phy-reset-active-high : If present then the reset sequence using the GPIO > specified in the "phy-reset-gpios" property is reversed (H=reset state, > L=operation state). > +- phy-reset-post-delay : Post reset delay in milliseconds. If present then > + a delay of phy-reset-post-delay milliseconds will be observed after the > + phy-reset-gpios has been toggled. Can be omitted thus no delay is > + observed. Delay is in range of 1ms to 1000ms. If given delay is higher > + than 1000ms, 1ms delay is done instead. > - phy-supply : regulator that powers the Ethernet PHY. > - phy-handle : phandle to the PHY device connected to this device. > - fixed-link : Assume a fixed link. See fixed-link.txt in the same directory. > diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c > index 56a563f90b0b..00a7fd0bcd59 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -3192,7 +3192,7 @@ static int fec_reset_phy(struct platform_device *pdev) > { > int err, phy_reset; > bool active_high = false; > - int msec = 1; > + int msec = 1, phy_post_delay = 0; > struct device_node *np = pdev->dev.of_node; > > if (!np) > @@ -3210,7 +3210,6 @@ static int fec_reset_phy(struct platform_device *pdev) > return 0; > > active_high = of_property_read_bool(np, "phy-reset-active-high"); > - > err = devm_gpio_request_one(&pdev->dev, phy_reset, > active_high ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, > "phy-reset"); No white space changes please. Andrew