netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net: phy: at803x: don't pass function pointers with &
@ 2013-09-21 14:53 Daniel Mack
  2013-09-21 14:53 ` [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks Daniel Mack
  2013-09-22  5:59 ` [PATCH 1/2] net: phy: at803x: don't pass function pointers with & Mugunthan V N
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Mack @ 2013-09-21 14:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, mugunthanvnm, ujhelyi.m, sergei.shtylyov, Daniel Mack

Just a cosmetic cleanup.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 drivers/net/phy/at803x.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index ac22283..4179228 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -163,8 +163,8 @@ static struct phy_driver at803x_driver[] = {
 	.get_wol	= at803x_get_wol,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
-	.config_aneg	= &genphy_config_aneg,
-	.read_status	= &genphy_read_status,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
 	.driver		= {
 		.owner = THIS_MODULE,
 	},
@@ -178,8 +178,8 @@ static struct phy_driver at803x_driver[] = {
 	.get_wol	= at803x_get_wol,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
-	.config_aneg	= &genphy_config_aneg,
-	.read_status	= &genphy_read_status,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
 	.driver		= {
 		.owner = THIS_MODULE,
 	},
@@ -193,8 +193,8 @@ static struct phy_driver at803x_driver[] = {
 	.get_wol	= at803x_get_wol,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
-	.config_aneg	= &genphy_config_aneg,
-	.read_status	= &genphy_read_status,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
 	.driver		= {
 		.owner = THIS_MODULE,
 	},
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks
  2013-09-21 14:53 [PATCH 1/2] net: phy: at803x: don't pass function pointers with & Daniel Mack
@ 2013-09-21 14:53 ` Daniel Mack
  2013-09-22  6:00   ` Mugunthan V N
  2013-09-22  5:59 ` [PATCH 1/2] net: phy: at803x: don't pass function pointers with & Mugunthan V N
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Mack @ 2013-09-21 14:53 UTC (permalink / raw)
  To: netdev; +Cc: davem, mugunthanvnm, ujhelyi.m, sergei.shtylyov, Daniel Mack

When WOL is enabled, the chip can't be put into power-down (BMCR_PDOWN)
mode, as that will also switch off the MAC, which consequently leads to
a link loss.

Use BMCR_ISOLATE in that case, which will at least save us some
milliamperes in comparison to normal operation mode.

Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 drivers/net/phy/at803x.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 4179228..bc71947 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -100,6 +100,45 @@ static void at803x_get_wol(struct phy_device *phydev,
 		wol->wolopts |= WAKE_MAGIC;
 }
 
+static int at803x_suspend(struct phy_device *phydev)
+{
+	int value;
+	int wol_enabled;
+
+	mutex_lock(&phydev->lock);
+
+	value = phy_read(phydev, AT803X_INTR_ENABLE);
+	wol_enabled = value & AT803X_WOL_ENABLE;
+
+	value = phy_read(phydev, MII_BMCR);
+
+	if (wol_enabled)
+		value |= BMCR_ISOLATE;
+	else
+		value |= BMCR_PDOWN;
+
+	phy_write(phydev, MII_BMCR, value);
+
+	mutex_unlock(&phydev->lock);
+
+	return 0;
+}
+
+static int at803x_resume(struct phy_device *phydev)
+{
+	int value;
+
+	mutex_lock(&phydev->lock);
+
+	value = phy_read(phydev, MII_BMCR);
+	value &= ~(BMCR_PDOWN | BMCR_ISOLATE);
+	phy_write(phydev, MII_BMCR, value);
+
+	mutex_unlock(&phydev->lock);
+
+	return 0;
+}
+
 static int at803x_config_init(struct phy_device *phydev)
 {
 	int val;
@@ -161,6 +200,8 @@ static struct phy_driver at803x_driver[] = {
 	.config_init	= at803x_config_init,
 	.set_wol	= at803x_set_wol,
 	.get_wol	= at803x_get_wol,
+	.suspend	= at803x_suspend,
+	.resume		= at803x_resume,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_aneg	= genphy_config_aneg,
@@ -176,6 +217,8 @@ static struct phy_driver at803x_driver[] = {
 	.config_init	= at803x_config_init,
 	.set_wol	= at803x_set_wol,
 	.get_wol	= at803x_get_wol,
+	.suspend	= at803x_suspend,
+	.resume		= at803x_resume,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_aneg	= genphy_config_aneg,
@@ -191,6 +234,8 @@ static struct phy_driver at803x_driver[] = {
 	.config_init	= at803x_config_init,
 	.set_wol	= at803x_set_wol,
 	.get_wol	= at803x_get_wol,
+	.suspend	= at803x_suspend,
+	.resume		= at803x_resume,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_aneg	= genphy_config_aneg,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] net: phy: at803x: don't pass function pointers with &
  2013-09-21 14:53 [PATCH 1/2] net: phy: at803x: don't pass function pointers with & Daniel Mack
  2013-09-21 14:53 ` [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks Daniel Mack
@ 2013-09-22  5:59 ` Mugunthan V N
  1 sibling, 0 replies; 6+ messages in thread
From: Mugunthan V N @ 2013-09-22  5:59 UTC (permalink / raw)
  To: Daniel Mack; +Cc: netdev, davem, ujhelyi.m, sergei.shtylyov

On Saturday 21 September 2013 08:23 PM, Daniel Mack wrote:
> Just a cosmetic cleanup.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>
Looks good to me

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks
  2013-09-21 14:53 ` [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks Daniel Mack
@ 2013-09-22  6:00   ` Mugunthan V N
  2013-09-27 18:49     ` Daniel Mack
  0 siblings, 1 reply; 6+ messages in thread
From: Mugunthan V N @ 2013-09-22  6:00 UTC (permalink / raw)
  To: Daniel Mack, netdev; +Cc: davem, ujhelyi.m, sergei.shtylyov

On Saturday 21 September 2013 08:23 PM, Daniel Mack wrote:
> When WOL is enabled, the chip can't be put into power-down (BMCR_PDOWN)
> mode, as that will also switch off the MAC, which consequently leads to
> a link loss.
>
> Use BMCR_ISOLATE in that case, which will at least save us some
> milliamperes in comparison to normal operation mode.
>
> Signed-off-by: Daniel Mack <zonque@gmail.com>
Looks good to me

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks
  2013-09-22  6:00   ` Mugunthan V N
@ 2013-09-27 18:49     ` Daniel Mack
  2013-09-27 21:28       ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Mack @ 2013-09-27 18:49 UTC (permalink / raw)
  To: Mugunthan V N; +Cc: netdev, davem, ujhelyi.m, sergei.shtylyov

On 22.09.2013 08:00, Mugunthan V N wrote:
> On Saturday 21 September 2013 08:23 PM, Daniel Mack wrote:
>> When WOL is enabled, the chip can't be put into power-down (BMCR_PDOWN)
>> mode, as that will also switch off the MAC, which consequently leads to
>> a link loss.
>>
>> Use BMCR_ISOLATE in that case, which will at least save us some
>> milliamperes in comparison to normal operation mode.
>>
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
> Looks good to me
> 
> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Thanks :)

David, can you take these two patches with Mugunthan's Acked-by: or do
you want me to resend them?


Best regards,
Daniel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks
  2013-09-27 18:49     ` Daniel Mack
@ 2013-09-27 21:28       ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2013-09-27 21:28 UTC (permalink / raw)
  To: zonque; +Cc: mugunthanvnm, netdev, ujhelyi.m, sergei.shtylyov

From: Daniel Mack <zonque@gmail.com>
Date: Fri, 27 Sep 2013 20:49:00 +0200

> On 22.09.2013 08:00, Mugunthan V N wrote:
>> On Saturday 21 September 2013 08:23 PM, Daniel Mack wrote:
>>> When WOL is enabled, the chip can't be put into power-down (BMCR_PDOWN)
>>> mode, as that will also switch off the MAC, which consequently leads to
>>> a link loss.
>>>
>>> Use BMCR_ISOLATE in that case, which will at least save us some
>>> milliamperes in comparison to normal operation mode.
>>>
>>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>> Looks good to me
>> 
>> Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
> 
> Thanks :)
> 
> David, can you take these two patches with Mugunthan's Acked-by: or do
> you want me to resend them?

Both applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-27 21:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-21 14:53 [PATCH 1/2] net: phy: at803x: don't pass function pointers with & Daniel Mack
2013-09-21 14:53 ` [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks Daniel Mack
2013-09-22  6:00   ` Mugunthan V N
2013-09-27 18:49     ` Daniel Mack
2013-09-27 21:28       ` David Miller
2013-09-22  5:59 ` [PATCH 1/2] net: phy: at803x: don't pass function pointers with & Mugunthan V N

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).