All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: fec_mxc: fix phy-reset-gpios logic
@ 2018-10-18 14:14 Anatolij Gustschin
  2018-10-22 21:02 ` Joe Hershberger
  0 siblings, 1 reply; 3+ messages in thread
From: Anatolij Gustschin @ 2018-10-18 14:14 UTC (permalink / raw)
  To: u-boot

'phy-reset-gpios' property is optional, don't return error when
it is missing. Read 'phy-reset-duration' property only if
'phy-reset-gpios' exists. The binding defines the duration value
in milliseconds, so use mdelay() for waiting.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/fec_mxc.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index d0fdbcb771..5a1a8bc897 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1254,7 +1254,7 @@ static void fec_gpio_reset(struct fec_priv *priv)
 	debug("fec_gpio_reset: fec_gpio_reset(dev)\n");
 	if (dm_gpio_is_valid(&priv->phy_reset_gpio)) {
 		dm_gpio_set_value(&priv->phy_reset_gpio, 1);
-		udelay(priv->reset_delay);
+		mdelay(priv->reset_delay);
 		dm_gpio_set_value(&priv->phy_reset_gpio, 0);
 	}
 }
@@ -1352,22 +1352,18 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
 
 #ifdef CONFIG_DM_GPIO
 	ret = gpio_request_by_name(dev, "phy-reset-gpios", 0,
-			     &priv->phy_reset_gpio, GPIOD_IS_OUT);
-	if (ret == 0) {
-		ret = dev_read_u32_array(dev, "phy-reset-duration",
-					 &priv->reset_delay, 1);
-	} else if (ret == -ENOENT) {
-		priv->reset_delay = 1000;
-		ret = 0;
-	}
+				   &priv->phy_reset_gpio, GPIOD_IS_OUT);
+	if (ret < 0)
+		return 0; /* property is optional, don't return error! */
 
+	priv->reset_delay = dev_read_u32_default(dev, "phy-reset-duration", 1);
 	if (priv->reset_delay > 1000) {
-		printf("FEX MXC: gpio reset timeout should be less the 1000\n");
-		priv->reset_delay = 1000;
+		/* property value wrong, use default value */
+		priv->reset_delay = 1;
 	}
 #endif
 
-	return ret;
+	return 0;
 }
 
 static const struct udevice_id fecmxc_ids[] = {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] net: fec_mxc: fix phy-reset-gpios logic
  2018-10-18 14:14 [U-Boot] [PATCH] net: fec_mxc: fix phy-reset-gpios logic Anatolij Gustschin
@ 2018-10-22 21:02 ` Joe Hershberger
  2018-10-22 21:11   ` Anatolij Gustschin
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Hershberger @ 2018-10-22 21:02 UTC (permalink / raw)
  To: u-boot

Hi Anatolij,

On Thu, Oct 18, 2018 at 9:15 AM Anatolij Gustschin <agust@denx.de> wrote:
>
> 'phy-reset-gpios' property is optional, don't return error when
> it is missing. Read 'phy-reset-duration' property only if
> 'phy-reset-gpios' exists. The binding defines the duration value
> in milliseconds, so use mdelay() for waiting.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Cc: Joe Hershberger <joe.hershberger@ni.com>

This is already covered in https://patchwork.ozlabs.org/patch/979099/
and https://patchwork.ozlabs.org/patch/979101/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] net: fec_mxc: fix phy-reset-gpios logic
  2018-10-22 21:02 ` Joe Hershberger
@ 2018-10-22 21:11   ` Anatolij Gustschin
  0 siblings, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2018-10-22 21:11 UTC (permalink / raw)
  To: u-boot

Hi Joe,

On Mon, 22 Oct 2018 21:02:22 +0000
Joe Hershberger joe.hershberger at ni.com wrote:
...
> This is already covered in https://patchwork.ozlabs.org/patch/979099/
> and https://patchwork.ozlabs.org/patch/979101/

Okay, thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-22 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 14:14 [U-Boot] [PATCH] net: fec_mxc: fix phy-reset-gpios logic Anatolij Gustschin
2018-10-22 21:02 ` Joe Hershberger
2018-10-22 21:11   ` Anatolij Gustschin

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.