netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition
@ 2009-05-15 16:04 Ben Hutchings
  2009-05-15 16:05 ` [PATCH 2/3] mdio: Add XENPAK LASI register definitions Ben Hutchings
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ben Hutchings @ 2009-05-15 16:04 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

These do not have an in-kernel user but may be useful to user-space.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 include/linux/mdio.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 26b4eb3..825f1e2 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -46,6 +46,8 @@
 
 /* Media-dependent registers. */
 #define MDIO_PMA_10GBT_TXPWR	131	/* 10GBASE-T TX power control */
+#define MDIO_PMA_10GBT_SNR	133	/* 10GBASE-T SNR margin, lane A.
+					 * Lanes B-D are numbered 134-136. */
 #define MDIO_PMA_10GBR_FECABLE	170	/* 10GBASE-R FEC ability */
 #define MDIO_PCS_10GBX_STAT1	24	/* 10GBASE-X PCS status 1 */
 #define MDIO_PCS_10GBRT_STAT1	32	/* 10GBASE-R/-T PCS status 1 */
@@ -188,6 +190,11 @@
 /* PMA 10GBASE-T TX power register. */
 #define MDIO_PMA_10GBT_TXPWR_SHORT	0x0001	/* Short-reach mode */
 
+/* PMA 10GBASE-T SNR registers. */
+/* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */
+#define MDIO_PMA_10GBT_SNR_BIAS		0x8000
+#define MDIO_PMA_10GBT_SNR_MAX		127
+
 /* PMA 10GBASE-R FEC ability register. */
 #define MDIO_PMA_10GBR_FECABLE_ABLE	0x0001	/* FEC ability */
 #define MDIO_PMA_10GBR_FECABLE_ERRABLE	0x0002	/* FEC error indic. ability */

-- 
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.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] mdio: Add XENPAK LASI register definitions
  2009-05-15 16:04 [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition Ben Hutchings
@ 2009-05-15 16:05 ` Ben Hutchings
  2009-05-18  4:07   ` David Miller
  2009-05-15 16:06 ` [PATCH 3/3] sfc: Use generic XENPAK " Ben Hutchings
  2009-05-18  4:06 ` [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Ben Hutchings @ 2009-05-15 16:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

These registers were originally defined for XENPAK modules, but are
also implemented by many other 10G PHYs.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 include/linux/mdio.h |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 825f1e2..5685164 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -55,6 +55,14 @@
 #define MDIO_AN_10GBT_CTRL	32	/* 10GBASE-T auto-negotiation control */
 #define MDIO_AN_10GBT_STAT	33	/* 10GBASE-T auto-negotiation status */
 
+/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
+#define MDIO_PMA_LASI_RXCTRL	0x9000	/* RX_ALARM control */
+#define MDIO_PMA_LASI_TXCTRL	0x9001	/* TX_ALARM control */
+#define MDIO_PMA_LASI_CTRL	0x9002	/* LASI control */
+#define MDIO_PMA_LASI_RXSTAT	0x9003	/* RX_ALARM status */
+#define MDIO_PMA_LASI_TXSTAT	0x9004	/* TX_ALARM status */
+#define MDIO_PMA_LASI_STAT	0x9005	/* LASI status */
+
 /* Control register 1. */
 /* Enable extended speed selection */
 #define MDIO_CTRL1_SPEEDSELEXT		(BMCR_SPEED1000 | BMCR_SPEED100)
@@ -218,6 +226,26 @@
 #define MDIO_AN_10GBT_STAT_MS		0x4000	/* Master/slave config */
 #define MDIO_AN_10GBT_STAT_MSFLT	0x8000	/* Master/slave config fault */
 
+/* LASI RX_ALARM control/status registers. */
+#define MDIO_PMA_LASI_RX_PHYXSLFLT	0x0001	/* PHY XS RX local fault */
+#define MDIO_PMA_LASI_RX_PCSLFLT	0x0008	/* PCS RX local fault */
+#define MDIO_PMA_LASI_RX_PMALFLT	0x0010	/* PMA/PMD RX local fault */
+#define MDIO_PMA_LASI_RX_OPTICPOWERFLT	0x0020	/* RX optical power fault */
+#define MDIO_PMA_LASI_RX_WISLFLT	0x0200	/* WIS local fault */
+
+/* LASI TX_ALARM control/status registers. */
+#define MDIO_PMA_LASI_TX_PHYXSLFLT	0x0001	/* PHY XS TX local fault */
+#define MDIO_PMA_LASI_TX_PCSLFLT	0x0008	/* PCS TX local fault */
+#define MDIO_PMA_LASI_TX_PMALFLT	0x0010	/* PMA/PMD TX local fault */
+#define MDIO_PMA_LASI_TX_LASERPOWERFLT	0x0080	/* Laser output power fault */
+#define MDIO_PMA_LASI_TX_LASERTEMPFLT	0x0100	/* Laser temperature fault */
+#define MDIO_PMA_LASI_TX_LASERBICURRFLT	0x0200	/* Laser bias current fault */
+
+/* LASI control/status registers. */
+#define MDIO_PMA_LASI_LSALARM		0x0001	/* LS_ALARM enable/status */
+#define MDIO_PMA_LASI_TXALARM		0x0002	/* TX_ALARM enable/status */
+#define MDIO_PMA_LASI_RXALARM		0x0004	/* RX_ALARM enable/status */
+
 /* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */
 
 #define MDIO_PHY_ID_C45			0x8000

-- 
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.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] sfc: Use generic XENPAK register definitions
  2009-05-15 16:04 [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition Ben Hutchings
  2009-05-15 16:05 ` [PATCH 2/3] mdio: Add XENPAK LASI register definitions Ben Hutchings
@ 2009-05-15 16:06 ` Ben Hutchings
  2009-05-18  4:07   ` David Miller
  2009-05-18  4:06 ` [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Ben Hutchings @ 2009-05-15 16:06 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/tenxpress.c |   16 +----------
 drivers/net/sfc/xenpack.h   |   57 -------------------------------------------
 drivers/net/sfc/xfp_phy.c   |    4 +-
 3 files changed, 4 insertions(+), 73 deletions(-)
 delete mode 100644 drivers/net/sfc/xenpack.h

diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index 0421190..db723c5 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -44,18 +44,6 @@
  */
 #define MAX_BAD_LP_TRIES	(5)
 
-/* LASI Control */
-#define PMA_PMD_LASI_CTRL	36866
-#define PMA_PMD_LASI_STATUS	36869
-#define PMA_PMD_LS_ALARM_LBN	0
-#define PMA_PMD_LS_ALARM_WIDTH	1
-#define PMA_PMD_TX_ALARM_LBN	1
-#define PMA_PMD_TX_ALARM_WIDTH	1
-#define PMA_PMD_RX_ALARM_LBN	2
-#define PMA_PMD_RX_ALARM_WIDTH	1
-#define PMA_PMD_AN_ALARM_LBN	3
-#define PMA_PMD_AN_ALARM_WIDTH	1
-
 /* Extended control register */
 #define PMA_PMD_XCONTROL_REG	49152
 #define PMA_PMD_EXT_GMII_EN_LBN	1
@@ -579,8 +567,8 @@ static void tenxpress_phy_poll(struct efx_nic *efx)
 			change = true;
 	} else {
 		int status = efx_mdio_read(efx, MDIO_MMD_PMAPMD,
-					   PMA_PMD_LASI_STATUS);
-		if (status & (1 << PMA_PMD_LS_ALARM_LBN))
+					   MDIO_PMA_LASI_STAT);
+		if (status & MDIO_PMA_LASI_LSALARM)
 			change = true;
 	}
 
diff --git a/drivers/net/sfc/xenpack.h b/drivers/net/sfc/xenpack.h
deleted file mode 100644
index 4e52286..0000000
--- a/drivers/net/sfc/xenpack.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
- * Driver for Solarflare Solarstorm network controllers and boards
- * Copyright 2006 Solarflare Communications Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation, incorporated herein by reference.
- */
-
-#ifndef EFX_XENPACK_H
-#define EFX_XENPACK_H
-
-/* Exported functions from Xenpack standard PHY control */
-
-#include "mdio_10g.h"
-
-/****************************************************************************/
-/* XENPACK MDIO register extensions */
-#define MDIO_XP_LASI_RX_CTRL	(0x9000)
-#define MDIO_XP_LASI_TX_CTRL	(0x9001)
-#define MDIO_XP_LASI_CTRL	(0x9002)
-#define MDIO_XP_LASI_RX_STAT	(0x9003)
-#define MDIO_XP_LASI_TX_STAT	(0x9004)
-#define MDIO_XP_LASI_STAT	(0x9005)
-
-/* Control/Status bits */
-#define XP_LASI_LS_ALARM	(1 << 0)
-#define XP_LASI_TX_ALARM	(1 << 1)
-#define XP_LASI_RX_ALARM	(1 << 2)
-/* These two are Quake vendor extensions to the standard XENPACK defines */
-#define XP_LASI_LS_INTB		(1 << 3)
-#define XP_LASI_TEST		(1 << 7)
-
-/* Enable LASI interrupts for PHY */
-static inline void xenpack_enable_lasi_irqs(struct efx_nic *efx)
-{
-	/* Read to clear LASI status register */
-	efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_XP_LASI_STAT);
-
-	efx_mdio_write(efx, MDIO_MMD_PMAPMD, MDIO_XP_LASI_CTRL,
-		       XP_LASI_LS_ALARM);
-}
-
-/* Read the LASI interrupt status to clear the interrupt. */
-static inline int xenpack_clear_lasi_irqs(struct efx_nic *efx)
-{
-	/* Read to clear link status alarm */
-	return efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_XP_LASI_STAT);
-}
-
-/* Turn off LASI interrupts */
-static inline void xenpack_disable_lasi_irqs(struct efx_nic *efx)
-{
-	efx_mdio_write(efx, MDIO_MMD_PMAPMD, MDIO_XP_LASI_CTRL, 0);
-}
-
-#endif /* EFX_XENPACK_H */
diff --git a/drivers/net/sfc/xfp_phy.c b/drivers/net/sfc/xfp_phy.c
index aad2dca..bb2e6af 100644
--- a/drivers/net/sfc/xfp_phy.c
+++ b/drivers/net/sfc/xfp_phy.c
@@ -15,7 +15,6 @@
 #include <linux/delay.h>
 #include "efx.h"
 #include "mdio_10g.h"
-#include "xenpack.h"
 #include "phy.h"
 #include "falcon.h"
 
@@ -169,7 +168,8 @@ static int xfp_phy_init(struct efx_nic *efx)
 
 static void xfp_phy_clear_interrupt(struct efx_nic *efx)
 {
-	xenpack_clear_lasi_irqs(efx);
+	/* Read to clear link status alarm */
+	efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_STAT);
 }
 
 static int xfp_link_ok(struct efx_nic *efx)

-- 
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.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition
  2009-05-15 16:04 [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition Ben Hutchings
  2009-05-15 16:05 ` [PATCH 2/3] mdio: Add XENPAK LASI register definitions Ben Hutchings
  2009-05-15 16:06 ` [PATCH 3/3] sfc: Use generic XENPAK " Ben Hutchings
@ 2009-05-18  4:06 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-05-18  4:06 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Fri, 15 May 2009 17:04:12 +0100

> These do not have an in-kernel user but may be useful to user-space.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>

Applied to net-next-2.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] mdio: Add XENPAK LASI register definitions
  2009-05-15 16:05 ` [PATCH 2/3] mdio: Add XENPAK LASI register definitions Ben Hutchings
@ 2009-05-18  4:07   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-05-18  4:07 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Fri, 15 May 2009 17:05:49 +0100

> These registers were originally defined for XENPAK modules, but are
> also implemented by many other 10G PHYs.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>

Applied to net-next-2.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] sfc: Use generic XENPAK register definitions
  2009-05-15 16:06 ` [PATCH 3/3] sfc: Use generic XENPAK " Ben Hutchings
@ 2009-05-18  4:07   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-05-18  4:07 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Fri, 15 May 2009 17:06:16 +0100

> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>

Applied to net-next-2.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-05-18  4:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 16:04 [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition Ben Hutchings
2009-05-15 16:05 ` [PATCH 2/3] mdio: Add XENPAK LASI register definitions Ben Hutchings
2009-05-18  4:07   ` David Miller
2009-05-15 16:06 ` [PATCH 3/3] sfc: Use generic XENPAK " Ben Hutchings
2009-05-18  4:07   ` David Miller
2009-05-18  4:06 ` [PATCH 1/3] mdio: Add 10GBASE-T SNR register definition David Miller

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).