Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1431845

[PATCH] net: marvell: Add separate config ANEG function for Marvell 88E1111

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Harini Katakam <harini.katakam@xilinx.com>
Newsgroups linux.kernel
Subject [PATCH] net: marvell: Add separate config ANEG function for Marvell 88E1111
Date Mon, 27 Jun 2016 11:20:02 +0200
Message-ID <rOARY-6GU-3@gated-at.bofh.it> (permalink)
X-Original-To <f.fainelli@gmail.com>, <harinikatakamlinux@gmail.com>
X-Greylist delayed 5575 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 Jun 2016 05:13:07 EDT
Authentication-Results spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com;
Received-Spf Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02;
X-Mailer git-send-email 2.1.1
X-Rcis-Action ALLOW
X-Tm-As-Product-Ver IMSS-7.1.0.1224-8.0.0.1202-22416.006
X-Tm-As-User-Approved-Sender Yes;Yes
X-Ms-Office365-Filtering-Ht Tenant
X-Forefront-Antispam-Report CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(575784001)(8936002)(50226002)(586003)(107886002)(2906002)(36756003)(50986999)(189998001)(92566002)(86362001)(47776003)(5003940100001)(77096005)(11100500001)(9786002)(106466001)(81166006)(50466002)(63266004)(87936001)(19580395003)(19580405001)(6806005)(4326007)(8676002)(81156014)(356003)(7846002)(36386004)(5001770100001)(5003600100003)(4001430100002)(7696003)(305945005)(48376002)(33646002)(229853001)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2NAM02HT148;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;A:1;MX:1;CAT:NONE;LANG:en;CAT:NONE;
MIME-Version 1.0
Content-Type text/plain
X-Ms-Office365-Filtering-Correlation-ID f5caaa07-aed2-4265-da52-08d39e5e43fa
X-Microsoft-Antispam UriScan:;BCL:0;PCL:0;RULEID:(8251501002);SRVR:BL2NAM02HT148;
X-Microsoft-Antispam-Prvs <f6086b698b464ffbb3719b61a0cff557@BL2NAM02HT148.eop-nam02.prod.protection.outlook.com>
X-Exchange-Antispam-Report-Test UriScan:(192813158149592);
X-Exchange-Antispam-Report-Cfa-Test BCL:0;PCL:0;RULEID:(601004)(2401047)(13023025)(13024025)(13018025)(13015025)(13017025)(8121501046)(5005006)(3002001)(10201501046)(6055026);SRVR:BL2NAM02HT148;BCL:0;PCL:0;RULEID:;SRVR:BL2NAM02HT148;
X-Forefront-Prvs 09860C2161
X-Originatororg xilinx.com
X-Ms-Exchange-Crosstenant-Originalarrivaltime 27 Jun 2016 07:40:09.2280 (UTC)
X-Ms-Exchange-Crosstenant-ID 657af505-d5df-48d0-8300-c31994686c5c
X-Ms-Exchange-Crosstenant-Originalattributedtenantconnectingip TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.100];Helo=[xsj-pvapsmtpgw02]
X-Ms-Exchange-Crosstenant-Fromentityheader HybridOnPrem
X-Ms-Exchange-Transport-Crosstenantheadersstamped BL2NAM02HT148
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 75
Organization linux.* mail to news gateway
X-Original-Cc <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <harinik@xilinx.com>, <punnaia@xilinx.com>, <michals@xilinx.com>
X-Original-Date Mon, 27 Jun 2016 13:09:59 +0530
X-Original-Message-ID <1467013199-26925-1-git-send-email-harinik@xilinx.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1431845

Show key headers only | View raw


Marvell 88E1111 currently uses the generic marvell config ANEG function.
This function has a sequence accessing Page 5 and Register 31,
both of which are not defined or reserved for this PHY.
Hence this patch adds a new config ANEG function for Marvell 88E1111
without these erroneous accesses.

Signed-off-by: Harini Katakam <harinik@xilinx.com>
---
 drivers/net/phy/marvell.c |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 280e879..783d0ca 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -285,6 +285,48 @@ static int marvell_config_aneg(struct phy_device *phydev)
 	return 0;
 }
 
+static int m88e1111_config_aneg(struct phy_device *phydev)
+{
+	int err;
+
+	/* The Marvell PHY has an errata which requires
+	 * that certain registers get written in order
+	 * to restart autonegotiation
+	 */
+	err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+
+	err = marvell_set_polarity(phydev, phydev->mdix);
+	if (err < 0)
+		return err;
+
+	err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL,
+			MII_M1111_PHY_LED_DIRECT);
+	if (err < 0)
+		return err;
+
+	err = genphy_config_aneg(phydev);
+	if (err < 0)
+		return err;
+
+	if (phydev->autoneg != AUTONEG_ENABLE) {
+		int bmcr;
+
+		/* A write to speed/duplex bits (that is performed by
+		 * genphy_config_aneg() call above) must be followed by
+		 * a software reset. Otherwise, the write has no effect.
+		 */
+		bmcr = phy_read(phydev, MII_BMCR);
+		if (bmcr < 0)
+			return bmcr;
+
+		err = phy_write(phydev, MII_BMCR, bmcr | BMCR_RESET);
+		if (err < 0)
+			return err;
+	}
+
+	return 0;
+}
+
 #ifdef CONFIG_OF_MDIO
 /*
  * Set and/or override some configuration registers based on the
@@ -1161,7 +1203,7 @@ static struct phy_driver marvell_drivers[] = {
 		.flags = PHY_HAS_INTERRUPT,
 		.probe = marvell_probe,
 		.config_init = &m88e1111_config_init,
-		.config_aneg = &marvell_config_aneg,
+		.config_aneg = &m88e1111_config_aneg,
 		.read_status = &marvell_read_status,
 		.ack_interrupt = &marvell_ack_interrupt,
 		.config_intr = &marvell_config_intr,
-- 
1.7.9.5

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] net: marvell: Add separate config ANEG function for Marvell 88E1111 Harini Katakam <harini.katakam@xilinx.com> - 2016-06-27 11:20 +0200
  Re: [PATCH] net: marvell: Add separate config ANEG function for  Marvell 88E1111 David Miller <davem@davemloft.net> - 2016-06-29 10:10 +0200

csiph-web