All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: netdev@vger.kernel.org, nicolas.ferre@atmel.com
Subject: [PATCH] macb: fix PHY reset
Date: Tue, 22 Mar 2016 22:27:38 +0300	[thread overview]
Message-ID: <3349780.3Prc3uV314@wasted.cogentembedded.com> (raw)

The driver calls gpiod_set_value() with GPIOD_OUT_* instead of 0 and 1, as
a result the PHY isn't really  put back into reset state in macb_remove().
Moreover, the driver assumes that something else has set the GPIO direction
to output, so if  it has not, the PHY wouldn't be taken out of reset in
macb_probe() either...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
The patch is against David Miller's 'net.git' repo.

 drivers/net/ethernet/cadence/macb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: net/drivers/net/ethernet/cadence/macb.c
===================================================================
--- net.orig/drivers/net/ethernet/cadence/macb.c
+++ net/drivers/net/ethernet/cadence/macb.c
@@ -2959,7 +2959,7 @@ static int macb_probe(struct platform_de
 		int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);
 		if (gpio_is_valid(gpio))
 			bp->reset_gpio = gpio_to_desc(gpio);
-		gpiod_set_value(bp->reset_gpio, GPIOD_OUT_HIGH);
+		gpiod_direction_output(bp->reset_gpio, 1);
 	}
 	of_node_put(phy_node);
 
@@ -3029,7 +3029,7 @@ static int macb_remove(struct platform_d
 		mdiobus_free(bp->mii_bus);
 
 		/* Shutdown the PHY if there is a GPIO reset */
-		gpiod_set_value(bp->reset_gpio, GPIOD_OUT_LOW);
+		gpiod_set_value(bp->reset_gpio, 0);
 
 		unregister_netdev(dev);
 		clk_disable_unprepare(bp->tx_clk);

             reply	other threads:[~2016-03-22 19:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 19:27 Sergei Shtylyov [this message]
2016-03-22 19:34 ` [PATCH] macb: fix PHY reset Sergei Shtylyov
2016-03-22 20:07   ` David Miller
2016-03-22 21:04     ` Sergei Shtylyov
2016-03-22 21:33     ` Sergei Shtylyov
2016-03-23  8:54       ` Nicolas Ferre

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=3349780.3Prc3uV314@wasted.cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@atmel.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 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.