Commit ae26c1c6 authored by Giuseppe CAVALLARO's avatar Giuseppe CAVALLARO Committed by David S. Miller

stmmac: fix PHY reset during resume

When stmmac_mdio_reset, was called from stmmac_resume, it was not
resetting the PHY due to which MAC was not getting reset properly and
hence ethernet interface not was resumed properly.
The issue was currently only reproducible on stih301-b2204.
Signed-off-by: default avatarPankaj Dev <pankaj.dev@st.com>
Signed-off-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 22407e13
...@@ -138,7 +138,6 @@ int stmmac_mdio_reset(struct mii_bus *bus) ...@@ -138,7 +138,6 @@ int stmmac_mdio_reset(struct mii_bus *bus)
#ifdef CONFIG_OF #ifdef CONFIG_OF
if (priv->device->of_node) { if (priv->device->of_node) {
int reset_gpio, active_low;
if (data->reset_gpio < 0) { if (data->reset_gpio < 0) {
struct device_node *np = priv->device->of_node; struct device_node *np = priv->device->of_node;
...@@ -154,24 +153,23 @@ int stmmac_mdio_reset(struct mii_bus *bus) ...@@ -154,24 +153,23 @@ int stmmac_mdio_reset(struct mii_bus *bus)
"snps,reset-active-low"); "snps,reset-active-low");
of_property_read_u32_array(np, of_property_read_u32_array(np,
"snps,reset-delays-us", data->delays, 3); "snps,reset-delays-us", data->delays, 3);
}
reset_gpio = data->reset_gpio; if (gpio_request(data->reset_gpio, "mdio-reset"))
active_low = data->active_low; return 0;
}
if (!gpio_request(reset_gpio, "mdio-reset")) { gpio_direction_output(data->reset_gpio,
gpio_direction_output(reset_gpio, active_low ? 1 : 0); data->active_low ? 1 : 0);
if (data->delays[0]) if (data->delays[0])
msleep(DIV_ROUND_UP(data->delays[0], 1000)); msleep(DIV_ROUND_UP(data->delays[0], 1000));
gpio_set_value(reset_gpio, active_low ? 0 : 1); gpio_set_value(data->reset_gpio, data->active_low ? 0 : 1);
if (data->delays[1]) if (data->delays[1])
msleep(DIV_ROUND_UP(data->delays[1], 1000)); msleep(DIV_ROUND_UP(data->delays[1], 1000));
gpio_set_value(reset_gpio, active_low ? 1 : 0); gpio_set_value(data->reset_gpio, data->active_low ? 1 : 0);
if (data->delays[2]) if (data->delays[2])
msleep(DIV_ROUND_UP(data->delays[2], 1000)); msleep(DIV_ROUND_UP(data->delays[2], 1000));
}
} }
#endif #endif
......
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