aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 50bb71c663e2..45b8b22b9987 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2049,6 +2049,8 @@ static void fec_reset_phy(struct platform_device *pdev)
2049 int err, phy_reset; 2049 int err, phy_reset;
2050 int msec = 1; 2050 int msec = 1;
2051 struct device_node *np = pdev->dev.of_node; 2051 struct device_node *np = pdev->dev.of_node;
2052 enum of_gpio_flags flags;
2053 bool port;
2052 2054
2053 if (!np) 2055 if (!np)
2054 return; 2056 return;
@@ -2058,18 +2060,22 @@ static void fec_reset_phy(struct platform_device *pdev)
2058 if (msec > 1000) 2060 if (msec > 1000)
2059 msec = 1; 2061 msec = 1;
2060 2062
2061 phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0); 2063 phy_reset = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
2062 if (!gpio_is_valid(phy_reset)) 2064 if (!gpio_is_valid(phy_reset))
2063 return; 2065 return;
2064 2066
2065 err = devm_gpio_request_one(&pdev->dev, phy_reset, 2067 if (flags & OF_GPIO_ACTIVE_LOW)
2066 GPIOF_OUT_INIT_LOW, "phy-reset"); 2068 port = GPIOF_OUT_INIT_LOW;
2069 else
2070 port = GPIOF_OUT_INIT_HIGH;
2071
2072 err = devm_gpio_request_one(&pdev->dev, phy_reset, port, "phy-reset");
2067 if (err) { 2073 if (err) {
2068 dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err); 2074 dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
2069 return; 2075 return;
2070 } 2076 }
2071 msleep(msec); 2077 msleep(msec);
2072 gpio_set_value(phy_reset, 1); 2078 gpio_set_value(phy_reset, !port);
2073} 2079}
2074#else /* CONFIG_OF */ 2080#else /* CONFIG_OF */
2075static void fec_reset_phy(struct platform_device *pdev) 2081static void fec_reset_phy(struct platform_device *pdev)