Netdev List
 help / color / mirror / Atom feed
* [PATCH] gianfar: Don't reset TBI<->SerDes link if it's already up
@ 2008-09-24 20:23 Trent Piepho
  2008-09-25 23:06 ` Trent Piepho
  0 siblings, 1 reply; 2+ messages in thread
From: Trent Piepho @ 2008-09-24 20:23 UTC (permalink / raw)
  To: netdev; +Cc: afleming, Trent Piepho

The link may be up already via the chip's reset strapping, or though action
of U-Boot, or from the last time the interface was brought up.  Resetting
the link causes it to go down for several seconds.  This can significantly
increase the time from power-on to DHCP completion and a device being
accessible to the network.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Acked-by: Andy Fleming <afleming@freescale.com>
---
 drivers/net/gianfar.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 1a4a85b..dd7d8e5 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -578,6 +578,14 @@ static void gfar_configure_serdes(struct net_device *dev)
 	if (bus)
 		mutex_lock(&bus->mdio_lock);
 
+	/* If the link is already up, we must already be ok, and don't need to
+	 * configure and reset the TBI<->SerDes link.  Maybe U-Boot configured
+	 * everything for us?  Resetting it takes the link down and requires
+	 * several seconds for it to come back.
+	 */
+	if (gfar_local_mdio_read(regs, tbipa, MII_BMSR) & BMSR_LSTATUS)
+		goto done;
+
 	/* Single clk mode, mii mode off(for serdes communication) */
 	gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT);
 
@@ -588,6 +596,7 @@ static void gfar_configure_serdes(struct net_device *dev)
 	gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE |
 			BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000);
 
+	done:
 	if (bus)
 		mutex_unlock(&bus->mdio_lock);
 }
-- 
1.5.4.1


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

* Re: [PATCH] gianfar: Don't reset TBI<->SerDes link if it's already up
  2008-09-24 20:23 [PATCH] gianfar: Don't reset TBI<->SerDes link if it's already up Trent Piepho
@ 2008-09-25 23:06 ` Trent Piepho
  0 siblings, 0 replies; 2+ messages in thread
From: Trent Piepho @ 2008-09-25 23:06 UTC (permalink / raw)
  Cc: netdev, Fleming Andy

I just realized that this patch won't apply cleanly without another patch that
I haven't sent yet.

Please ignore, I'll repost both patches as a series when I get an ack for the
one not posted yet.

On Wed, 24 Sep 2008, Trent Piepho wrote:
> The link may be up already via the chip's reset strapping, or though action
> of U-Boot, or from the last time the interface was brought up.  Resetting
> the link causes it to go down for several seconds.  This can significantly
> increase the time from power-on to DHCP completion and a device being
> accessible to the network.
>
> Signed-off-by: Trent Piepho <tpiepho@freescale.com>
> Acked-by: Andy Fleming <afleming@freescale.com>
> ---
> drivers/net/gianfar.c |    9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
> index 1a4a85b..dd7d8e5 100644
> --- a/drivers/net/gianfar.c
> +++ b/drivers/net/gianfar.c
> @@ -578,6 +578,14 @@ static void gfar_configure_serdes(struct net_device *dev)
> 	if (bus)
> 		mutex_lock(&bus->mdio_lock);
>
> +	/* If the link is already up, we must already be ok, and don't need to
> +	 * configure and reset the TBI<->SerDes link.  Maybe U-Boot configured
> +	 * everything for us?  Resetting it takes the link down and requires
> +	 * several seconds for it to come back.
> +	 */
> +	if (gfar_local_mdio_read(regs, tbipa, MII_BMSR) & BMSR_LSTATUS)
> +		goto done;
> +
> 	/* Single clk mode, mii mode off(for serdes communication) */
> 	gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT);
>
> @@ -588,6 +596,7 @@ static void gfar_configure_serdes(struct net_device *dev)
> 	gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE |
> 			BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000);
>
> +	done:
> 	if (bus)
> 		mutex_unlock(&bus->mdio_lock);
> }
>

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

end of thread, other threads:[~2008-09-25 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-24 20:23 [PATCH] gianfar: Don't reset TBI<->SerDes link if it's already up Trent Piepho
2008-09-25 23:06 ` Trent Piepho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox