Commit dd0cb7db authored by Linus Walleij's avatar Linus Walleij Committed by David S. Miller

net: smsc911x: request and deassert optional RESET GPIO

On some systems (such as the Qualcomm APQ8060 Dragonboard) the
RESET signal of the SMSC911x is not pulled up by a resistor (or
the internal pull-up that will pull it up if the pin is not
even connected) but instead connected to a GPIO line, so that
the operating system must explicitly deassert RESET before use.

Support this in the SMSC911x driver so this ethernet connector
can be used on such targets.

Notice that we request the line to go logical low (deassert)
whilst the line on the actual component is active low. This
is managed in the respective hardware description when
specifying the GPIO line with e.g. device tree or ACPI. With
device tree it looks like this in one case:

  reset-gpios = <&tlmm 30 GPIO_ACTIVE_LOW>;

Which means that logically requesting the RESET line to be
deasserted will result in the line being driven high, taking
the device out of reset.

Cc: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarJeremy Linton <jeremy.linton@arm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 216559d9
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/gpio/consumer.h>
#include "smsc911x.h" #include "smsc911x.h"
...@@ -147,6 +148,9 @@ struct smsc911x_data { ...@@ -147,6 +148,9 @@ struct smsc911x_data {
/* regulators */ /* regulators */
struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES]; struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES];
/* Reset GPIO */
struct gpio_desc *reset_gpiod;
/* clock */ /* clock */
struct clk *clk; struct clk *clk;
}; };
...@@ -438,6 +442,11 @@ static int smsc911x_request_resources(struct platform_device *pdev) ...@@ -438,6 +442,11 @@ static int smsc911x_request_resources(struct platform_device *pdev)
netdev_err(ndev, "couldn't get regulators %d\n", netdev_err(ndev, "couldn't get regulators %d\n",
ret); ret);
/* Request optional RESET GPIO */
pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev,
"reset",
GPIOD_OUT_LOW);
/* Request clock */ /* Request clock */
pdata->clk = clk_get(&pdev->dev, NULL); pdata->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(pdata->clk)) if (IS_ERR(pdata->clk))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment