Skip to contentSkip to conversation

bnx2x: MDC/MDIO CL45 IOCTLs

PATCH In review Eilon Greenstein 2 participants 2 messages Aug 12, 2009 – Aug 13, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 11/36 bnx2x: MDC/MDIO CL45 IOCTLs

As suggested by Ben Hutchings <[email protected]>, using the MDC/MDIO IOCTL

---
 drivers/net/Kconfig      |    1 +
 drivers/net/bnx2x.h      |    3 +
 drivers/net/bnx2x_main.c |  121 ++++++++++++++++++++++++++++++++--------------
 3 files changed, 88 insertions(+), 37 deletions(-)
drivers/net/Kconfig +1 -0
index 9948fa2..29935a9 100644
@@ -2722,6 +2722,7 @@ config BNX2X
 	select FW_LOADER
 	select ZLIB_INFLATE
 	select LIBCRC32C
+	select MDIO
 	help
 	  This driver supports Broadcom NetXtremeII 10 gigabit Ethernet cards.
 	  To compile this driver as a module, choose M here: the module
drivers/net/bnx2x.h +3 -0
index 5864ae2..903c89d 100644
@@ -30,6 +30,8 @@
 #define BNX2X_NEW_NAPI
 
 
+
+#include <linux/mdio.h>
 #include "bnx2x_reg.h"
 #include "bnx2x_fw_defs.h"
 #include "bnx2x_hsi.h"
@@ -895,6 +897,7 @@ struct bnx2x {
 
 	struct link_params	link_params;
 	struct link_vars	link_vars;
+	struct mdio_if_info	mdio;
 
 	struct bnx2x_common	common;
 	struct bnx2x_port	port;
drivers/net/bnx2x_main.c +84 -37

163 lines not on this page · raw message

Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 5 lines · Eilon Greenstein

As suggested by Ben Hutchings <[email protected]>, using the MDC/MDIO IOCTL

---

[...]

drivers/net/bnx2x_main.c static int __devinit bnx2x_init_dev(struct pci_dev *pdev, · line 11463

Quoted 7 lines
drivers/net/bnx2x_main.c +3 -0
@@ -11419,6 +11458,14 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
 	dev->vlan_features |= NETIF_F_TSO6;
 #endif
 
+	/* get_port_hwinfo() will set prtad and mmds properly */
+	bp->mdio.prtad = MDIO_PRTAD_NONE;
+	bp->mdio.mmds = 0;

I didn't see any code to change mmds.

drivers/net/bnx2x_main.c static int __devinit bnx2x_init_dev(struct pci_dev *pdev, · line 11464

Quoted 1 line
drivers/net/bnx2x_main.c +1 -0
+	bp->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;

MDIO_EMULATE_C22 means the mdio module will map a few clause 22 registers to clause 45 (and reject access to all other clause 22 registers), and you will never be passed devad = MDIO_DEVAD_NONE.

If you want to support clause 22 register access yourself then use MDIO_SUPPORTS_C22.

Ben.

Signature · 3 lines
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.