All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolae Rosia <nicolae.rosia@certsign.ro>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>
Subject: [PATCH] net: phy: fix phy device autoneg wrong value
Date: Thu, 22 Jan 2015 17:56:44 +0000	[thread overview]
Message-ID: <1421948980.717.6.camel@uti.ro> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1435 bytes --]

In phy_device_create, autoneg is set to AUTONEG_ENABLE.
When using the generic phy driver (phy_device.c),
genphy_config_init reads BMSR and finds out if autonegotiation
is possible and sets the phy device features accordingly.
phy_sanitize_settings is supposed to set the right value of
autoneg, but it is never called if autonegotiation is enabled,
which is always the case.

Signed-off-by: Nicolae Rosia <nicolae.rosia@certsign.ro>
---
 drivers/net/phy/phy.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 767cd11..9c35136 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -249,9 +249,6 @@ static void phy_sanitize_settings(struct phy_device
*phydev)
 	unsigned int idx;
 
 	/* Sanitize settings based on PHY capabilities */
-	if ((features & SUPPORTED_Autoneg) == 0)
-		phydev->autoneg = AUTONEG_DISABLE;
-
 	idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex),
 			features);
 
@@ -436,6 +433,9 @@ int phy_start_aneg(struct phy_device *phydev)
 
 	mutex_lock(&phydev->lock);
 
+	if ((phydev->supported & SUPPORTED_Autoneg) == 0)
+		phydev->autoneg = AUTONEG_DISABLE;
+
 	if (AUTONEG_DISABLE == phydev->autoneg)
 		phy_sanitize_settings(phydev);
 
-- 
2.1.0


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

WARNING: multiple messages have this Message-ID (diff)
From: Nicolae Rosia <nicolae.rosia@certsign.ro>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>
Subject: [PATCH] net: phy: fix phy device autoneg wrong value
Date: Thu, 22 Jan 2015 17:56:44 +0000	[thread overview]
Message-ID: <1421948980.717.6.camel@uti.ro> (raw)

In phy_device_create, autoneg is set to AUTONEG_ENABLE.
When using the generic phy driver (phy_device.c),
genphy_config_init reads BMSR and finds out if autonegotiation
is possible and sets the phy device features accordingly.
phy_sanitize_settings is supposed to set the right value of
autoneg, but it is never called if autonegotiation is enabled,
which is always the case.

Signed-off-by: Nicolae Rosia <nicolae.rosia@certsign.ro>
---
 drivers/net/phy/phy.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 767cd11..9c35136 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -249,9 +249,6 @@ static void phy_sanitize_settings(struct phy_device
*phydev)
 	unsigned int idx;
 
 	/* Sanitize settings based on PHY capabilities */
-	if ((features & SUPPORTED_Autoneg) == 0)
-		phydev->autoneg = AUTONEG_DISABLE;
-
 	idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex),
 			features);
 
@@ -436,6 +433,9 @@ int phy_start_aneg(struct phy_device *phydev)
 
 	mutex_lock(&phydev->lock);
 
+	if ((phydev->supported & SUPPORTED_Autoneg) == 0)
+		phydev->autoneg = AUTONEG_DISABLE;
+
 	if (AUTONEG_DISABLE == phydev->autoneg)
 		phy_sanitize_settings(phydev);
 
-- 
2.1.0



             reply	other threads:[~2015-01-22 18:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 17:56 Nicolae Rosia [this message]
2015-01-22 17:56 ` [PATCH] net: phy: fix phy device autoneg wrong value Nicolae Rosia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421948980.717.6.camel@uti.ro \
    --to=nicolae.rosia@certsign.ro \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.