From: "Dale Farnsworth" <dale@farnsworth.org>
To: Netdev <netdev@oss.sgi.com>, Jeff Garzik <jgarzik@pobox.com>
Cc: James Chapman <jchapman@katalix.com>
Subject: [PATCH: 2.6.12-rc1] mii: Add test for GigE support
Date: Tue, 22 Mar 2005 16:17:46 -0700 [thread overview]
Message-ID: <20050322231746.GA27770@xyzzy> (raw)
This patch adds the ability to test a PHY for GigE support
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Index: linux-2.5-enet/drivers/net/mii.c
===================================================================
--- linux-2.5-enet.orig/drivers/net/mii.c
+++ linux-2.5-enet/drivers/net/mii.c
@@ -207,6 +207,21 @@
return 0;
}
+int mii_check_gmii_support(struct mii_if_info *mii)
+{
+ int reg;
+
+ reg = mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR);
+ if (reg & BMSR_HAS_EXTSTAT1000) {
+ reg = mii->mdio_read(mii->dev, mii->phy_id, MII_EXTSTAT1000);
+ if (reg & (ESR_1000_BASE_X_FD | ESR_1000_BASE_T_FD |
+ ESR_1000_BASE_X_HD | ESR_1000_BASE_T_HD))
+ return 1;
+ }
+
+ return 0;
+}
+
int mii_link_ok (struct mii_if_info *mii)
{
/* first, a dummy read, needed to latch some MII phys */
Index: linux-2.5-enet/include/linux/mii.h
===================================================================
--- linux-2.5-enet.orig/include/linux/mii.h
+++ linux-2.5-enet/include/linux/mii.h
@@ -22,6 +22,7 @@
#define MII_EXPANSION 0x06 /* Expansion register */
#define MII_CTRL1000 0x09 /* 1000BASE-T control */
#define MII_STAT1000 0x0a /* 1000BASE-T status */
+#define MII_EXTSTAT1000 0x0f /* 1000BASE-XX extended status */
#define MII_DCOUNTER 0x12 /* Disconnect counter */
#define MII_FCSCOUNTER 0x13 /* False carrier counter */
#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */
@@ -54,7 +55,8 @@
#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
#define BMSR_RFAULT 0x0010 /* Remote fault detected */
#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
-#define BMSR_RESV 0x07c0 /* Unused... */
+#define BMSR_HAS_EXTSTAT1000 0x0100 /* Has 1000BASE extended status*/
+#define BMSR_RESV 0x06c0 /* Unused... */
#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
@@ -121,6 +123,12 @@
#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
+/* 1000BASE Ext Status register */
+#define ESR_1000_BASE_X_FD 0x8000
+#define ESR_1000_BASE_X_HD 0x4000
+#define ESR_1000_BASE_T_FD 0x2000
+#define ESR_1000_BASE_T_HD 0x1000
+
struct mii_if_info {
int phy_id;
int advertising;
@@ -143,6 +151,7 @@
extern int mii_nway_restart (struct mii_if_info *mii);
extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
extern int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
+extern int mii_check_gmii_support(struct mii_if_info *mii);
extern void mii_check_link (struct mii_if_info *mii);
extern unsigned int mii_check_media (struct mii_if_info *mii,
unsigned int ok_to_print,
next reply other threads:[~2005-03-22 23:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-22 23:17 Dale Farnsworth [this message]
2005-03-22 23:27 ` [PATCH: 2.6.12-rc1] mii: Add test for GigE support Jeff Garzik
2005-03-23 1:21 ` Andy Fleming
2005-03-23 1:47 ` Jeff Garzik
2005-03-23 6:14 ` Dale Farnsworth
2005-03-25 4:42 ` Jeff Garzik
2005-08-22 23:50 ` [PATCH] [NET] " Dale Farnsworth
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=20050322231746.GA27770@xyzzy \
--to=dale@farnsworth.org \
--cc=jchapman@katalix.com \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.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.