Commit e806b3ad authored by Michael Welling's avatar Michael Welling
Browse files

Adds a GPIO registration to toggle PHY oscillator for APM sleep.


Signed-off-by: default avatarMichael Welling <mwelling@emacinc.com>
parent db89d60c
......@@ -28,6 +28,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_net.h>
#include <linux/of_gpio.h>
#include <linux/pinctrl/consumer.h>
#include "macb.h"
......@@ -2142,6 +2143,18 @@ static int __init macb_probe(struct platform_device *pdev)
bp->phy_interface = err;
}
bp->phy_osc_gpio = of_get_named_gpio(pdev->dev.of_node, "osc-gpio", 0);
if (gpio_is_valid(bp->phy_osc_gpio))
{
if (gpio_request(bp->phy_osc_gpio, "osc-gpio") == 0) {
gpio_direction_output(bp->phy_osc_gpio, 1);
netdev_info(dev, "Oscillator GPIO = %d.\n", bp->phy_osc_gpio);
}
else
netdev_info(dev, "Oscillator GPIO not available.\n");
}
if (bp->phy_interface == PHY_INTERFACE_MODE_RGMII)
macb_or_gem_writel(bp, USRIO, GEM_BIT(RGMII));
else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII)
......@@ -2239,6 +2252,9 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state)
netif_carrier_off(netdev);
netif_device_detach(netdev);
if (gpio_is_valid(bp->phy_osc_gpio))
gpio_direction_output(bp->phy_osc_gpio, 0);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
......@@ -2269,6 +2285,9 @@ static int macb_resume(struct platform_device *pdev)
clk_prepare_enable(bp->pclk);
clk_prepare_enable(bp->hclk);
if (gpio_is_valid(bp->phy_osc_gpio))
gpio_direction_output(bp->phy_osc_gpio, 1);
netif_device_attach(netdev);
return 0;
......
......@@ -623,6 +623,7 @@ struct macb {
unsigned int dma_burst_length;
phy_interface_t phy_interface;
int phy_osc_gpio;
/* AT91RM9200 transmit */
struct sk_buff *skb; /* holds skb until xmit interrupt completes */
......
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