* [PATCH] phy: SMSC device Energy Detect power-down mode
@ 2009-12-16 7:28 Giuseppe CAVALLARO
2009-12-26 2:38 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Giuseppe CAVALLARO @ 2009-12-16 7:28 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
SMSC Ethernet Transceivers (LAN88710, LAN8710, LAN8720, LAN8187,
LAN8700, LAN83C185) provide a mechanism to conserve power when
the device is not connected to an active link partner
(Energy Detect Mode).
So this patch enables the Energy Detect power-down mode
for these Transceivers.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/phy/smsc.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 5123bb9..209e4cb 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -25,6 +25,7 @@
#define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
#define MII_LAN83C185_IM 30 /* Interrupt Mask */
+#define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
#define MII_LAN83C185_ISF_INT1 (1<<1) /* Auto-Negotiation Page Received */
#define MII_LAN83C185_ISF_INT2 (1<<2) /* Parallel Detection Fault */
@@ -37,8 +38,10 @@
#define MII_LAN83C185_ISF_INT_ALL (0x0e)
#define MII_LAN83C185_ISF_INT_PHYLIB_EVENTS \
- (MII_LAN83C185_ISF_INT6 | MII_LAN83C185_ISF_INT4)
+ (MII_LAN83C185_ISF_INT6 | MII_LAN83C185_ISF_INT4 | \
+ MII_LAN83C185_ISF_INT7)
+#define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */
static int smsc_phy_config_intr(struct phy_device *phydev)
{
@@ -59,9 +62,18 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)
static int smsc_phy_config_init(struct phy_device *phydev)
{
+ int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
+ /* Enable energy detect mode for this SMSC Transceivers */
+ rc |= MII_LAN83C185_EDPWRDOWN;
+ phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc);
+
return smsc_phy_ack_interrupt (phydev);
}
+static int lan911x_config_init(struct phy_device *phydev)
+{
+ return smsc_phy_ack_interrupt(phydev);
+}
static struct phy_driver lan83c185_driver = {
.phy_id = 0x0007c0a0, /* OUI=0x00800f, Model#=0x0a */
@@ -147,7 +159,7 @@ static struct phy_driver lan911x_int_driver = {
/* basic functions */
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
- .config_init = smsc_phy_config_init,
+ .config_init = lan911x_config_init,
/* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt,
--
1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] phy: SMSC device Energy Detect power-down mode
2009-12-16 7:28 [PATCH] phy: SMSC device Energy Detect power-down mode Giuseppe CAVALLARO
@ 2009-12-26 2:38 ` David Miller
2010-01-04 10:01 ` Giuseppe CAVALLARO
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2009-12-26 2:38 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Wed, 16 Dec 2009 08:28:18 +0100
> SMSC Ethernet Transceivers (LAN88710, LAN8710, LAN8720, LAN8187,
> LAN8700, LAN83C185) provide a mechanism to conserve power when
> the device is not connected to an active link partner
> (Energy Detect Mode).
> So this patch enables the Energy Detect power-down mode
> for these Transceivers.
>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Both phy_read() and phy_write() can return errors, you must check
for them. The rest of this driver does this properly.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] phy: SMSC device Energy Detect power-down mode
2009-12-26 2:38 ` David Miller
@ 2010-01-04 10:01 ` Giuseppe CAVALLARO
0 siblings, 0 replies; 3+ messages in thread
From: Giuseppe CAVALLARO @ 2010-01-04 10:01 UTC (permalink / raw)
To: David Miller; +Cc: netdev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi David,
David Miller wrote:
> From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
> Date: Wed, 16 Dec 2009 08:28:18 +0100
>
>> SMSC Ethernet Transceivers (LAN88710, LAN8710, LAN8720, LAN8187,
>> LAN8700, LAN83C185) provide a mechanism to conserve power when
>> the device is not connected to an active link partner
>> (Energy Detect Mode).
>> So this patch enables the Energy Detect power-down mode
>> for these Transceivers.
>>
>> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>
> Both phy_read() and phy_write() can return errors, you must check
> for them. The rest of this driver does this properly.
I'm resending the patch with this fixed.
Thanks,
Peppe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAktBvGUACgkQ2Xo3j31MSSLA/gCfRSXQ7i/GEiZjPAHV4ZUxoxM5
YTUAoIPTXQ82zgsjj3q1gSdn1vY0G/dr
=fJnv
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-04 10:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-16 7:28 [PATCH] phy: SMSC device Energy Detect power-down mode Giuseppe CAVALLARO
2009-12-26 2:38 ` David Miller
2010-01-04 10:01 ` Giuseppe CAVALLARO
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).