netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net-next v2 8/8] net: phy: bcm7xxx: utilize PHY revision in config_init
Date: Fri, 19 Sep 2014 13:07:56 -0700	[thread overview]
Message-ID: <1411157276-18260-9-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1411157276-18260-1-git-send-email-f.fainelli@gmail.com>

Now that the GENET and SF2 drivers have been updated to communicate us
what is the revision of the BCM7xxx integrated PHY, utilize that
information in the config_init() callback to call into the appropriate
workaround function based on our revision.

While at it, we also print the revision and patch level to help debug
new chips.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/bcm7xxx.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c
index be3a591aabba..daae69950925 100644
--- a/drivers/net/phy/bcm7xxx.c
+++ b/drivers/net/phy/bcm7xxx.c
@@ -196,13 +196,22 @@ static int bcm7xxx_eee_enable(struct phy_device *phydev)
 
 static int bcm7xxx_28nm_config_init(struct phy_device *phydev)
 {
-	int ret;
-
-	ret = bcm7445_config_init(phydev);
-	if (ret)
-		return ret;
+	u8 rev = PHY_BRCM_7XXX_REV(phydev->dev_flags);
+	u8 patch = PHY_BRCM_7XXX_PATCH(phydev->dev_flags);
+	int ret = 0;
+
+	dev_info(&phydev->dev, "PHY revision: 0x%02x, patch: %d\n", rev, patch);
+
+	switch (rev) {
+	case 0xa0:
+	case 0xb0:
+		ret = bcm7445_config_init(phydev);
+		break;
+	default:
+		ret = bcm7xxx_28nm_afe_config_init(phydev);
+		break;
+	}
 
-	ret = bcm7xxx_28nm_afe_config_init(phydev);
 	if (ret)
 		return ret;
 
-- 
1.9.1

  parent reply	other threads:[~2014-09-19 20:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-19 20:07 [PATCH net-next v2 0/8] net: phy: Broadcom BCM7xxx PHY workaround update Florian Fainelli
2014-09-19 20:07 ` [PATCH net-next v2 1/8] of: mdio: honor flags passed to of_phy_connect Florian Fainelli
2014-09-19 20:07 ` [PATCH net-next v2 2/8] net: phy: broadcom: add helper for PHY revision and patch level Florian Fainelli
2014-09-19 20:07 ` [PATCH net-next v2 3/8] net: phy: bcm7xxx: do not use PHY_BRCM_100MBPS_WAR Florian Fainelli
2014-09-19 20:07 ` [PATCH net-next v2 4/8] net: bcmgenet: remove PHY_BRCM_100MBPS_WAR Florian Fainelli
2014-09-19 20:07 ` [PATCH net-next v2 5/8] net: bcmgenet: communicate integrated PHY revision to PHY driver Florian Fainelli
2014-09-19 20:07 ` [PATCH net-next v2 6/8] net: dsa: allow switch drivers to specify phy_device::dev_flags Florian Fainelli
2014-09-19 20:07 ` [PATCH net-next v2 7/8] net: dsa: bcm_sf2: communicate integrated PHY revision to PHY driver Florian Fainelli
2014-09-19 20:07 ` Florian Fainelli [this message]
2014-09-19 20:27 ` [PATCH net-next v2 0/8] net: phy: Broadcom BCM7xxx PHY workaround update David Miller

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=1411157276-18260-9-git-send-email-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=davem@davemloft.net \
    --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 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).