diff mbox

net: phy: resume phydev when PHY_RESUMING

Message ID 1399972998-21772-1-git-send-email-zhangfei.gao@linaro.org
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Zhangfei Gao May 13, 2014, 9:23 a.m. UTC
Commit be9dad1f9f26604fb suspend phydev when going to HALTED.
However not to resume phydev when going to RESUMING.
BMCR_PDOWN remains set "ifconfig eth0 down" -> "ifconfig eth0 up".
Unless phy_attach_direct is called in open function.

Fix the issue via phy_resume in PHY_RESUMING

Signed-off-by: Jiancheng Xue <xuejiancheng@huawei.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
 drivers/net/phy/phy.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Sergei Shtylyov May 13, 2014, 6:51 p.m. UTC | #1
Hello.

On 05/13/2014 01:23 PM, Zhangfei Gao wrote:

> Commit be9dad1f9f26604fb suspend phydev when going to HALTED.

    Please also specify that commit's summary line in parens.

> However not to resume phydev when going to RESUMING.
> BMCR_PDOWN remains set "ifconfig eth0 down" -> "ifconfig eth0 up".
> Unless phy_attach_direct is called in open function.

> Fix the issue via phy_resume in PHY_RESUMING

> Signed-off-by: Jiancheng Xue <xuejiancheng@huawei.com>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Florian Fainelli May 13, 2014, 7:46 p.m. UTC | #2
2014-05-13 11:51 GMT-07:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
>
> On 05/13/2014 01:23 PM, Zhangfei Gao wrote:
>
>> Commit be9dad1f9f26604fb suspend phydev when going to HALTED.
>
>
>    Please also specify that commit's summary line in parens.

That, and please rephrase your commit message such that we can
understand the problem this fixes. Something along the lines of:

"With commit be9dad1f9f26604fb ("net: phy: suspend phydev when going
to HALTED"), an unused PHY device will be put in a low-power mode
using BMCR_PDOWN. Some Ethernet drivers might be calling phy_connect()
and phy_disconnect() from their ndo_open, respectively ndo_close()
callbacks, in such a case, the PHY will be powered down during the
phy_disconnect() call, but will fail to be powered up in
phy_connect(). This patch fixes the following scenario."

Thanks

>
>
>> However not to resume phydev when going to RESUMING.
>> BMCR_PDOWN remains set "ifconfig eth0 down" -> "ifconfig eth0 up".
>> Unless phy_attach_direct is called in open function.
>
>
>> Fix the issue via phy_resume in PHY_RESUMING
>
>
>> Signed-off-by: Jiancheng Xue <xuejiancheng@huawei.com>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>
>
> WBR, Sergei
>
diff mbox

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1b6d09a..be5d52e 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -715,7 +715,7 @@  void phy_state_machine(struct work_struct *work)
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct phy_device *phydev =
 			container_of(dwork, struct phy_device, state_queue);
-	int needs_aneg = 0, do_suspend = 0;
+	int needs_aneg = 0, do_suspend = 0, do_resume = 0;
 	int err = 0;
 
 	mutex_lock(&phydev->lock);
@@ -865,6 +865,8 @@  void phy_state_machine(struct work_struct *work)
 			}
 			phydev->adjust_link(phydev->attached_dev);
 		}
+
+		do_resume = 1;
 		break;
 	}
 
@@ -876,6 +878,9 @@  void phy_state_machine(struct work_struct *work)
 	if (do_suspend)
 		phy_suspend(phydev);
 
+	if (do_resume)
+		phy_resume(phydev);
+
 	if (err < 0)
 		phy_error(phydev);