aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/micrel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/micrel.c')
-rw-r--r--drivers/net/phy/micrel.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 6a5fd18f062c..b9252b8d81ff 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -268,23 +268,12 @@ out:
268 return ret; 268 return ret;
269} 269}
270 270
271static int kszphy_config_init(struct phy_device *phydev) 271/* Some config bits need to be set again on resume, handle them here. */
272static int kszphy_config_reset(struct phy_device *phydev)
272{ 273{
273 struct kszphy_priv *priv = phydev->priv; 274 struct kszphy_priv *priv = phydev->priv;
274 const struct kszphy_type *type;
275 int ret; 275 int ret;
276 276
277 if (!priv)
278 return 0;
279
280 type = priv->type;
281
282 if (type->has_broadcast_disable)
283 kszphy_broadcast_disable(phydev);
284
285 if (type->has_nand_tree_disable)
286 kszphy_nand_tree_disable(phydev);
287
288 if (priv->rmii_ref_clk_sel) { 277 if (priv->rmii_ref_clk_sel) {
289 ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val); 278 ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val);
290 if (ret) { 279 if (ret) {
@@ -295,11 +284,30 @@ static int kszphy_config_init(struct phy_device *phydev)
295 } 284 }
296 285
297 if (priv->led_mode >= 0) 286 if (priv->led_mode >= 0)
298 kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode); 287 kszphy_setup_led(phydev, priv->type->led_mode_reg, priv->led_mode);
299 288
300 return 0; 289 return 0;
301} 290}
302 291
292static int kszphy_config_init(struct phy_device *phydev)
293{
294 struct kszphy_priv *priv = phydev->priv;
295 const struct kszphy_type *type;
296
297 if (!priv)
298 return 0;
299
300 type = priv->type;
301
302 if (type->has_broadcast_disable)
303 kszphy_broadcast_disable(phydev);
304
305 if (type->has_nand_tree_disable)
306 kszphy_nand_tree_disable(phydev);
307
308 return kszphy_config_reset(phydev);
309}
310
303static int ksz8041_config_init(struct phy_device *phydev) 311static int ksz8041_config_init(struct phy_device *phydev)
304{ 312{
305 struct device_node *of_node = phydev->mdio.dev.of_node; 313 struct device_node *of_node = phydev->mdio.dev.of_node;
@@ -700,8 +708,14 @@ static int kszphy_suspend(struct phy_device *phydev)
700 708
701static int kszphy_resume(struct phy_device *phydev) 709static int kszphy_resume(struct phy_device *phydev)
702{ 710{
711 int ret;
712
703 genphy_resume(phydev); 713 genphy_resume(phydev);
704 714
715 ret = kszphy_config_reset(phydev);
716 if (ret)
717 return ret;
718
705 /* Enable PHY Interrupts */ 719 /* Enable PHY Interrupts */
706 if (phy_interrupt_is_valid(phydev)) { 720 if (phy_interrupt_is_valid(phydev)) {
707 phydev->interrupts = PHY_INTERRUPT_ENABLED; 721 phydev->interrupts = PHY_INTERRUPT_ENABLED;