Skip to content

Commit a05d7df

Browse files
Timur Tabidavem330
authored andcommitted
net: phy: at803x: only the AT8030 needs a hardware reset on link change
Commit 13a56b4 ("at803x: Add support for hardware reset") added a work-around for a hardware bug on the AT8030. However, the work-around was being called for all 803x PHYs, even those that don't need it. Function at803x_link_change_notify() checks to make sure that it only resets the PHY on the 8030, but it makes more sense to not call that function at all if it isn't needed. Signed-off-by: Timur Tabi <timur@codeaurora.org> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 956a7ff commit a05d7df

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

drivers/net/phy/at803x.c

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -359,27 +359,25 @@ static void at803x_link_change_notify(struct phy_device *phydev)
359359
* in the FIFO. In such cases, the FIFO enters an error mode it
360360
* cannot recover from by software.
361361
*/
362-
if (phydev->drv->phy_id == ATH8030_PHY_ID) {
363-
if (phydev->state == PHY_NOLINK) {
364-
if (priv->gpiod_reset && !priv->phy_reset) {
365-
struct at803x_context context;
366-
367-
at803x_context_save(phydev, &context);
368-
369-
gpiod_set_value(priv->gpiod_reset, 1);
370-
msleep(1);
371-
gpiod_set_value(priv->gpiod_reset, 0);
372-
msleep(1);
373-
374-
at803x_context_restore(phydev, &context);
375-
376-
phydev_dbg(phydev, "%s(): phy was reset\n",
377-
__func__);
378-
priv->phy_reset = true;
379-
}
380-
} else {
381-
priv->phy_reset = false;
362+
if (phydev->state == PHY_NOLINK) {
363+
if (priv->gpiod_reset && !priv->phy_reset) {
364+
struct at803x_context context;
365+
366+
at803x_context_save(phydev, &context);
367+
368+
gpiod_set_value(priv->gpiod_reset, 1);
369+
msleep(1);
370+
gpiod_set_value(priv->gpiod_reset, 0);
371+
msleep(1);
372+
373+
at803x_context_restore(phydev, &context);
374+
375+
phydev_dbg(phydev, "%s(): phy was reset\n",
376+
__func__);
377+
priv->phy_reset = true;
382378
}
379+
} else {
380+
priv->phy_reset = false;
383381
}
384382
}
385383

@@ -391,7 +389,6 @@ static struct phy_driver at803x_driver[] = {
391389
.phy_id_mask = 0xffffffef,
392390
.probe = at803x_probe,
393391
.config_init = at803x_config_init,
394-
.link_change_notify = at803x_link_change_notify,
395392
.set_wol = at803x_set_wol,
396393
.get_wol = at803x_get_wol,
397394
.suspend = at803x_suspend,
@@ -427,7 +424,6 @@ static struct phy_driver at803x_driver[] = {
427424
.phy_id_mask = 0xffffffef,
428425
.probe = at803x_probe,
429426
.config_init = at803x_config_init,
430-
.link_change_notify = at803x_link_change_notify,
431427
.set_wol = at803x_set_wol,
432428
.get_wol = at803x_get_wol,
433429
.suspend = at803x_suspend,

0 commit comments

Comments
 (0)