All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-net-drivers@solarflare.com,
	Ramkrishna Vepa <ram.vepa@neterion.com>,
	Santosh Rastapur <santosh.rastapur@neterion.com>,
	Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
Subject: [PATCH 09/16] s2io: Use generic MDIO definitions
Date: Wed, 29 Apr 2009 19:13:29 +0100	[thread overview]
Message-ID: <1241028809.3246.52.camel@achroite> (raw)
In-Reply-To: <1241028086.3246.30.camel@achroite>

Compile-tested only.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/s2io-regs.h |    5 -----
 drivers/net/s2io.c      |   21 +++++++++++----------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h
index f8274f8..416669f 100644
--- a/drivers/net/s2io-regs.h
+++ b/drivers/net/s2io-regs.h
@@ -271,11 +271,6 @@ struct XENA_dev_config {
 	u64 mdio_control;
 #define MDIO_MMD_INDX_ADDR(val)		vBIT(val, 0, 16)
 #define MDIO_MMD_DEV_ADDR(val)		vBIT(val, 19, 5)
-#define MDIO_MMD_PMA_DEV_ADDR		0x1
-#define MDIO_MMD_PMD_DEV_ADDR		0x1
-#define MDIO_MMD_WIS_DEV_ADDR		0x2
-#define MDIO_MMD_PCS_DEV_ADDR		0x3
-#define MDIO_MMD_PHYXS_DEV_ADDR		0x4
 #define MDIO_MMS_PRT_ADDR(val)		vBIT(val, 27, 5)
 #define MDIO_CTRL_START_TRANS(val)	vBIT(val, 56, 4)
 #define MDIO_OP(val)			vBIT(val, 60, 2)
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 1a4979f..80562ea 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -63,6 +63,7 @@
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/mdio.h>
 #include <linux/skbuff.h>
 #include <linux/init.h>
 #include <linux/delay.h>
@@ -3328,9 +3329,9 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
 	struct stat_block *stat_info = sp->mac_control.stats_info;
 
 	/* Check the communication with the MDIO slave */
-	addr = 0x0000;
+	addr = MDIO_CTRL1;
 	val64 = 0x0;
-	val64 = s2io_mdio_read(MDIO_MMD_PMA_DEV_ADDR, addr, dev);
+	val64 = s2io_mdio_read(MDIO_MMD_PMAPMD, addr, dev);
 	if((val64 == 0xFFFF) || (val64 == 0x0000))
 	{
 		DBG_PRINT(ERR_DBG, "ERR: MDIO slave access failed - "
@@ -3338,24 +3339,24 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
 		return;
 	}
 
-	/* Check for the expecte value of 2040 at PMA address 0x0000 */
-	if(val64 != 0x2040)
+	/* Check for the expected value of control reg 1 */
+	if(val64 != MDIO_CTRL1_SPEED10G)
 	{
 		DBG_PRINT(ERR_DBG, "Incorrect value at PMA address 0x0000 - ");
-		DBG_PRINT(ERR_DBG, "Returned: %llx- Expected: 0x2040\n",
-			  (unsigned long long)val64);
+		DBG_PRINT(ERR_DBG, "Returned: %llx- Expected: 0x%x\n",
+			  (unsigned long long)val64, MDIO_CTRL1_SPEED10G);
 		return;
 	}
 
 	/* Loading the DOM register to MDIO register */
 	addr = 0xA100;
-	s2io_mdio_write(MDIO_MMD_PMA_DEV_ADDR, addr, val16, dev);
-	val64 = s2io_mdio_read(MDIO_MMD_PMA_DEV_ADDR, addr, dev);
+	s2io_mdio_write(MDIO_MMD_PMAPMD, addr, val16, dev);
+	val64 = s2io_mdio_read(MDIO_MMD_PMAPMD, addr, dev);
 
 	/* Reading the Alarm flags */
 	addr = 0xA070;
 	val64 = 0x0;
-	val64 = s2io_mdio_read(MDIO_MMD_PMA_DEV_ADDR, addr, dev);
+	val64 = s2io_mdio_read(MDIO_MMD_PMAPMD, addr, dev);
 
 	flag = CHECKBIT(val64, 0x7);
 	type = 1;
@@ -3387,7 +3388,7 @@ static void s2io_updt_xpak_counter(struct net_device *dev)
 	/* Reading the Warning flags */
 	addr = 0xA074;
 	val64 = 0x0;
-	val64 = s2io_mdio_read(MDIO_MMD_PMA_DEV_ADDR, addr, dev);
+	val64 = s2io_mdio_read(MDIO_MMD_PMAPMD, addr, dev);
 
 	if(CHECKBIT(val64, 0x7))
 		stat_info->xpak_stat.warn_transceiver_temp_high++;

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  parent reply	other threads:[~2009-04-29 18:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29 18:01 [PATCH 00/16] MDIO and ethtool enhancements Ben Hutchings
2009-04-29 18:02 ` [PATCH 01/16] ethtool: Add port type PORT_OTHER Ben Hutchings
2009-04-29 18:04 ` [PATCH 02/16] mdio: Add register definitions for MDIO (clause 45) Ben Hutchings
2009-04-29 18:04 ` [PATCH 03/16] mdio: Add generic MDIO (clause 45) support functions Ben Hutchings
2009-04-29 18:05 ` [PATCH 04/16] sfc: Use generic MDIO functions and definitions Ben Hutchings
2009-04-29 18:06 ` [PATCH 05/16] chelsio: Use generic MDIO definitions and mdio_mii_ioctl() Ben Hutchings
2009-04-29 18:07 ` [PATCH 06/16] cxgb3: " Ben Hutchings
2009-04-29 18:08 ` [PATCH 07/16] ixgbe: Use generic MDIO definitions and functions Ben Hutchings
2009-04-29 18:11 ` [PATCH 08/16] ixgb: Use generic MDIO definitions Ben Hutchings
2009-04-29 18:13 ` Ben Hutchings [this message]
2009-04-29 18:15 ` [PATCH 10/16] mii: Simplify mii_resolve_flowctrl_fdx() Ben Hutchings
2009-04-30  8:18   ` Steve.Glendinning
2009-04-29 18:19 ` [PATCH 11/16] mii: Add mii_advertise_flowctrl() Ben Hutchings
2009-04-29 18:19 ` [PATCH 12/16] mdio: Add mdio45_ethtool_spauseparam_an() Ben Hutchings
2009-04-29 18:20 ` [PATCH 13/16] sfc: Use generic MDIO flow control auto-negotiation functions Ben Hutchings
2009-04-29 18:21 ` [PATCH 14/16] ethtool/mdio: Report MDIO mode support and link partner advertising Ben Hutchings
2009-04-29 18:25 ` [PATCH 15/16] ethtool/mdio: Support backplane mode negotiation Ben Hutchings
2009-04-29 18:34 ` [PATCH 16/16] mii: Rewrite mii_ethtool_gset() to report mdio_support and lp_advertising Ben Hutchings
2009-04-30  0:31 ` [PATCH 00/16] MDIO and ethtool enhancements David Miller
2009-04-30  1:28   ` Ben Hutchings

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=1241028809.3246.52.camel@achroite \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=ram.vepa@neterion.com \
    --cc=santosh.rastapur@neterion.com \
    --cc=sreenivasa.honnur@neterion.com \
    /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.