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

* Re: [PATCH] emac: add support for platform-specific unsupported PHY features
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Eugene Surovegin @ 2005-08-06  0:05 UTC (permalink / raw)
  To: Wade Farnsworth; +Cc: jgarzik, netdev, Matt Porter

On Fri, Aug 05, 2005 at 04:32:05PM -0700, Wade Farnsworth wrote:
> 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.

Looks good.

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

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

I think you are being too optimistic here :). EMAC doesn't support 10G 
Ethernet and will never will (at least sanely) given it's 
brain-damaged design. So I think it's safe to drop 
SUPPORTED_10000baseT_Full test.

I'll update my NAPI tree with similar code.

-- 
Eugene

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

* Re: [PATCH] emac: add support for platform-specific unsupported PHY features
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2005-08-11  4:03 UTC (permalink / raw)
  To: Wade Farnsworth; +Cc: netdev, Matt Porter, Eugene Surovegin

Wade Farnsworth wrote:
> 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>

Can you update this patch RE Eugene's comments?

	Jeff

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

* Re: [PATCH] emac: add support for platform-specific unsupported PHY features
  2005-08-11  4:03 ` Jeff Garzik
@ 2005-08-11 20:39   ` Wade Farnsworth
  2005-08-11 20:55     ` Matt Porter
  0 siblings, 1 reply; 5+ messages in thread
From: Wade Farnsworth @ 2005-08-11 20:39 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, Matt Porter, Eugene Surovegin

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

On Wed, 2005-08-10 at 21:03, Jeff Garzik wrote:
> Wade Farnsworth wrote:
> > 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>
> 
> Can you update this patch RE Eugene's comments?
> 
> 	Jeff
> 

Sorry for the delay.  Here is the updated patch.

-Wade Farnsworth

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



[-- Attachment #2: ibm-emac-phy-feat-exc-core.patch --]
[-- Type: text/x-patch, Size: 1734 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-11 13:29:43.000000000 -0700
+++ linux-2.6-dev/drivers/net/ibm_emac/ibm_emac_core.c	2005-08-11 13:13:40.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->phy_feat_exc;
 
 	/* Setup initial PHY config & startup aneg */
 	if (ep->phy_mii.def->ops->init)
@@ -1883,6 +1886,34 @@ 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_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

* Re: [PATCH] emac: add support for platform-specific unsupported PHY features
  2005-08-11 20:39   ` Wade Farnsworth
@ 2005-08-11 20:55     ` Matt Porter
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Porter @ 2005-08-11 20:55 UTC (permalink / raw)
  To: Wade Farnsworth; +Cc: Jeff Garzik, netdev, Eugene Surovegin

On Thu, Aug 11, 2005 at 01:39:05PM -0700, Wade Farnsworth wrote:
> On Wed, 2005-08-10 at 21:03, Jeff Garzik wrote:
> > Wade Farnsworth wrote:
> > > 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>
> > 
> > Can you update this patch RE Eugene's comments?
> > 
> > 	Jeff
> > 
> 
> Sorry for the delay.  Here is the updated patch.

FWIW, akpm has the ppc32 relevant bits that go with this patch
pending now.

-Matt

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