summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/cadence
diff options
context:
space:
mode:
authorGregory CLEMENT <gregory.clement@free-electrons.com>2015-12-11 11:34:53 +0100
committerDavid S. Miller <davem@davemloft.net>2015-12-15 04:04:12 +0100
commit5833e0526820c3216de8ae60661fb307c89c8710 (patch)
tree7e81f56638235fbc4b22c769b57c59353e70b694 /drivers/net/ethernet/cadence
parentnet: Fix typo in skb_fclone_busy (diff)
downloadlinux-5833e0526820c3216de8ae60661fb307c89c8710.tar.xz
linux-5833e0526820c3216de8ae60661fb307c89c8710.zip
net/macb: add support for resetting PHY using GPIO
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. This reset can't be done at the PHY driver level. The PHY must be able to answer the to the mii bus scan to let the kernel creating a PHY device. The patch introduces a new optional property "phy-reset-gpios" inspired from the one use for the FEC. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence')
-rw-r--r--drivers/net/ethernet/cadence/macb.c8
-rw-r--r--drivers/net/ethernet/cadence/macb.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 169059c92f80..01236465c298 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -2904,6 +2904,10 @@ static int macb_probe(struct platform_device *pdev)
else
macb_get_hwaddr(bp);
+ /* Power up the PHY if there is a GPIO reset */
+ bp->reset_gpio = devm_gpiod_get_optional(&bp->pdev->dev, "phy-reset",
+ GPIOD_OUT_HIGH);
+
err = of_get_phy_mode(np);
if (err < 0) {
pdata = dev_get_platdata(&pdev->dev);
@@ -2970,6 +2974,10 @@ static int macb_remove(struct platform_device *pdev)
mdiobus_unregister(bp->mii_bus);
kfree(bp->mii_bus->irq);
mdiobus_free(bp->mii_bus);
+
+ /* Shutdown the PHY if there is a GPIO reset */
+ gpiod_set_value(bp->reset_gpio, 0);
+
unregister_netdev(dev);
clk_disable_unprepare(bp->tx_clk);
clk_disable_unprepare(bp->hclk);
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index d83b0db77821..5c03e811224d 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -829,6 +829,7 @@ struct macb {
unsigned int dma_burst_length;
phy_interface_t phy_interface;
+ struct gpio_desc *reset_gpio;
/* AT91RM9200 transmit */
struct sk_buff *skb; /* holds skb until xmit interrupt completes */