* [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on link change
@ 2016-04-26 17:44 Timur Tabi
2016-04-27 2:46 ` Florian Fainelli
2016-04-28 20:48 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Timur Tabi @ 2016-04-26 17:44 UTC (permalink / raw)
To: netdev, Florian Fainelli, davem, marek.belisko, ujhelyi.m, zonque
Commit 13a56b44 ("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>
---
drivers/net/phy/at803x.c | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index b3ffaee..f279a89 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -359,27 +359,25 @@ static void at803x_link_change_notify(struct phy_device *phydev)
* in the FIFO. In such cases, the FIFO enters an error mode it
* cannot recover from by software.
*/
- if (phydev->drv->phy_id == ATH8030_PHY_ID) {
- if (phydev->state == PHY_NOLINK) {
- if (priv->gpiod_reset && !priv->phy_reset) {
- struct at803x_context context;
-
- at803x_context_save(phydev, &context);
-
- gpiod_set_value(priv->gpiod_reset, 1);
- msleep(1);
- gpiod_set_value(priv->gpiod_reset, 0);
- msleep(1);
-
- at803x_context_restore(phydev, &context);
-
- phydev_dbg(phydev, "%s(): phy was reset\n",
- __func__);
- priv->phy_reset = true;
- }
- } else {
- priv->phy_reset = false;
+ if (phydev->state == PHY_NOLINK) {
+ if (priv->gpiod_reset && !priv->phy_reset) {
+ struct at803x_context context;
+
+ at803x_context_save(phydev, &context);
+
+ gpiod_set_value(priv->gpiod_reset, 1);
+ msleep(1);
+ gpiod_set_value(priv->gpiod_reset, 0);
+ msleep(1);
+
+ at803x_context_restore(phydev, &context);
+
+ phydev_dbg(phydev, "%s(): phy was reset\n",
+ __func__);
+ priv->phy_reset = true;
}
+ } else {
+ priv->phy_reset = false;
}
}
@@ -391,7 +389,6 @@ static struct phy_driver at803x_driver[] = {
.phy_id_mask = 0xffffffef,
.probe = at803x_probe,
.config_init = at803x_config_init,
- .link_change_notify = at803x_link_change_notify,
.set_wol = at803x_set_wol,
.get_wol = at803x_get_wol,
.suspend = at803x_suspend,
@@ -427,7 +424,6 @@ static struct phy_driver at803x_driver[] = {
.phy_id_mask = 0xffffffef,
.probe = at803x_probe,
.config_init = at803x_config_init,
- .link_change_notify = at803x_link_change_notify,
.set_wol = at803x_set_wol,
.get_wol = at803x_get_wol,
.suspend = at803x_suspend,
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on link change
2016-04-26 17:44 [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on link change Timur Tabi
@ 2016-04-27 2:46 ` Florian Fainelli
2016-04-28 20:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2016-04-27 2:46 UTC (permalink / raw)
To: Timur Tabi, netdev, davem, marek.belisko, ujhelyi.m, zonque
Le 26/04/2016 10:44, Timur Tabi a écrit :
> Commit 13a56b44 ("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>
This looks nicer indeed!
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on link change
2016-04-26 17:44 [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on link change Timur Tabi
2016-04-27 2:46 ` Florian Fainelli
@ 2016-04-28 20:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-04-28 20:48 UTC (permalink / raw)
To: timur; +Cc: netdev, f.fainelli, marek.belisko, ujhelyi.m, zonque
From: Timur Tabi <timur@codeaurora.org>
Date: Tue, 26 Apr 2016 12:44:18 -0500
> Commit 13a56b44 ("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>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-28 20:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-26 17:44 [PATCH] net: phy: at803x: only the AT8030 needs a hardware reset on link change Timur Tabi
2016-04-27 2:46 ` Florian Fainelli
2016-04-28 20:48 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.