netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] emac: add support for platform-specific unsupported PHY features
@ 2005-08-05 23:32 Wade Farnsworth
  2005-08-06  0:05 ` Eugene Surovegin
  2005-08-11  4:03 ` Jeff Garzik
  0 siblings, 2 replies; 5+ messages in thread
From: Wade Farnsworth @ 2005-08-05 23:32 UTC (permalink / raw)
  To: jgarzik, netdev, Matt Porter; +Cc: Eugene Surovegin

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

Hello,

This patch adds support to the ibm_emac driver for platform-specific
unsupported PHY features.

The patch attempts to determine the highest speed and duplex when
autonegotiation is unsupported.

-Wade Farnsworth

Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>

[-- Attachment #2: ibm-emac-phy-feat-unsupp-core.patch --]
[-- Type: text/x-patch, Size: 1887 bytes --]

diff -upr linux-2.6/drivers/net/ibm_emac/ibm_emac_core.c linux-2.6-dev/drivers/net/ibm_emac/ibm_emac_core.c
--- linux-2.6/drivers/net/ibm_emac/ibm_emac_core.c	2005-08-03 13:33:42.000000000 -0700
+++ linux-2.6-dev/drivers/net/ibm_emac/ibm_emac_core.c	2005-08-02 10:42:59.000000000 -0700
@@ -1876,6 +1876,9 @@ static int emac_init_device(struct ocp_d
 		rc = -ENODEV;
 		goto bail;
 	}
+	
+	/* Disable any PHY features not supported by the platform */
+	ep->phy_mii.def->features &= ~emacdata->feat_unsupp;
 
 	/* Setup initial PHY config & startup aneg */
 	if (ep->phy_mii.def->ops->init)
@@ -1883,6 +1886,38 @@ static int emac_init_device(struct ocp_d
 	netif_carrier_off(ndev);
 	if (ep->phy_mii.def->features & SUPPORTED_Autoneg)
 		ep->want_autoneg = 1;
+	else {
+		ep->want_autoneg = 0;
+		
+		/* Select highest supported speed/duplex */
+		if (ep->phy_mii.def->features & SUPPORTED_10000baseT_Full) {
+			ep->phy_mii.speed = SPEED_10000;
+			ep->phy_mii.duplex = DUPLEX_FULL;
+		} else if (ep->phy_mii.def->features & 
+			   SUPPORTED_1000baseT_Full) {
+			ep->phy_mii.speed = SPEED_1000;
+			ep->phy_mii.duplex = DUPLEX_FULL;
+		} else if (ep->phy_mii.def->features & 
+			   SUPPORTED_1000baseT_Half) {
+			ep->phy_mii.speed = SPEED_1000;
+			ep->phy_mii.duplex = DUPLEX_HALF;
+		} else if (ep->phy_mii.def->features & 
+			   SUPPORTED_100baseT_Full) {
+			ep->phy_mii.speed = SPEED_100;
+			ep->phy_mii.duplex = DUPLEX_FULL;
+		} else if (ep->phy_mii.def->features & 
+			   SUPPORTED_100baseT_Half) {
+			ep->phy_mii.speed = SPEED_100;
+			ep->phy_mii.duplex = DUPLEX_HALF;
+		} else if (ep->phy_mii.def->features & 
+			   SUPPORTED_10baseT_Full) {
+			ep->phy_mii.speed = SPEED_10;
+			ep->phy_mii.duplex = DUPLEX_FULL;
+		} else {
+			ep->phy_mii.speed = SPEED_10;
+			ep->phy_mii.duplex = DUPLEX_HALF;
+		}
+	}
 	emac_start_link(ep, NULL);
 
 	/* read the MAC Address */

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

end of thread, other threads:[~2005-08-11 20:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-05 23:32 [PATCH] emac: add support for platform-specific unsupported PHY features Wade Farnsworth
2005-08-06  0:05 ` Eugene Surovegin
2005-08-11  4:03 ` Jeff Garzik
2005-08-11 20:39   ` Wade Farnsworth
2005-08-11 20:55     ` Matt Porter

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