Commit 79e498a9 authored by Leonard Crestez's avatar Leonard Crestez Committed by David S. Miller

net: phy: micrel: Restore led_mode and clk_sel on resume

These bits seem to be lost after a suspend/resume cycle so just set them
again. Do this by splitting the handling of these bits into a function
that is also called on resume.

This patch fixes ethernet suspend/resume on imx6ul-14x14-evk boards.
Signed-off-by: default avatarLeonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e6f4292a
...@@ -268,23 +268,12 @@ static int kszphy_nand_tree_disable(struct phy_device *phydev) ...@@ -268,23 +268,12 @@ static int kszphy_nand_tree_disable(struct phy_device *phydev)
return ret; return ret;
} }
static int kszphy_config_init(struct phy_device *phydev) /* Some config bits need to be set again on resume, handle them here. */
static int kszphy_config_reset(struct phy_device *phydev)
{ {
struct kszphy_priv *priv = phydev->priv; struct kszphy_priv *priv = phydev->priv;
const struct kszphy_type *type;
int ret; int ret;
if (!priv)
return 0;
type = priv->type;
if (type->has_broadcast_disable)
kszphy_broadcast_disable(phydev);
if (type->has_nand_tree_disable)
kszphy_nand_tree_disable(phydev);
if (priv->rmii_ref_clk_sel) { if (priv->rmii_ref_clk_sel) {
ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val); ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val);
if (ret) { if (ret) {
...@@ -295,9 +284,28 @@ static int kszphy_config_init(struct phy_device *phydev) ...@@ -295,9 +284,28 @@ static int kszphy_config_init(struct phy_device *phydev)
} }
if (priv->led_mode >= 0) if (priv->led_mode >= 0)
kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode); kszphy_setup_led(phydev, priv->type->led_mode_reg, priv->led_mode);
return 0;
}
static int kszphy_config_init(struct phy_device *phydev)
{
struct kszphy_priv *priv = phydev->priv;
const struct kszphy_type *type;
if (!priv)
return 0; return 0;
type = priv->type;
if (type->has_broadcast_disable)
kszphy_broadcast_disable(phydev);
if (type->has_nand_tree_disable)
kszphy_nand_tree_disable(phydev);
return kszphy_config_reset(phydev);
} }
static int ksz8041_config_init(struct phy_device *phydev) static int ksz8041_config_init(struct phy_device *phydev)
...@@ -700,8 +708,14 @@ static int kszphy_suspend(struct phy_device *phydev) ...@@ -700,8 +708,14 @@ static int kszphy_suspend(struct phy_device *phydev)
static int kszphy_resume(struct phy_device *phydev) static int kszphy_resume(struct phy_device *phydev)
{ {
int ret;
genphy_resume(phydev); genphy_resume(phydev);
ret = kszphy_config_reset(phydev);
if (ret)
return ret;
/* Enable PHY Interrupts */ /* Enable PHY Interrupts */
if (phy_interrupt_is_valid(phydev)) { if (phy_interrupt_is_valid(phydev)) {
phydev->interrupts = PHY_INTERRUPT_ENABLED; phydev->interrupts = PHY_INTERRUPT_ENABLED;
......
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