mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] fec: restart autoneg at open instead of init
@ 2012-09-06 19:38 Eric Bénard
  2012-09-06 21:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-10  7:43 ` Sascha Hauer
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Bénard @ 2012-09-06 19:38 UTC (permalink / raw)
  To: barebox

this saves some time during boot when ethernet is not needed in barebox

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 drivers/net/fec_imx.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 599a9b4..2bc06a9 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -347,9 +347,6 @@ static int fec_init(struct eth_device *dev)
 	/* size of each buffer */
 	writel(FEC_MAX_PKT_SIZE, fec->regs + FEC_EMRBR);
 
-	if (fec->xcv_type != SEVENWIRE)
-		miidev_restart_aneg(&fec->miidev);
-
 	return 0;
 }
 
@@ -363,6 +360,9 @@ static int fec_open(struct eth_device *edev)
 	int ret;
 	u32 ecr;
 
+	if (fec->xcv_type != SEVENWIRE)
+		miidev_restart_aneg(&fec->miidev);
+
 	/*
 	 * Initialize RxBD/TxBD rings
 	 */
-- 
1.7.7.6


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] fec: restart autoneg at open instead of init
  2012-09-06 19:38 [PATCH 1/3] fec: restart autoneg at open instead of init Eric Bénard
@ 2012-09-06 21:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-09-10  7:43 ` Sascha Hauer
  1 sibling, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-09-06 21:52 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

On 21:38 Thu 06 Sep     , Eric Bénard wrote:
> this saves some time during boot when ethernet is not needed in barebox
> 
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
Wait I'm going to drop this to have the phy init only at the open of the net
on all drivers

Best Regards,
J.
>  drivers/net/fec_imx.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 599a9b4..2bc06a9 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -347,9 +347,6 @@ static int fec_init(struct eth_device *dev)
>  	/* size of each buffer */
>  	writel(FEC_MAX_PKT_SIZE, fec->regs + FEC_EMRBR);
>  
> -	if (fec->xcv_type != SEVENWIRE)
> -		miidev_restart_aneg(&fec->miidev);
> -
>  	return 0;
>  }
>  
> @@ -363,6 +360,9 @@ static int fec_open(struct eth_device *edev)
>  	int ret;
>  	u32 ecr;
>  
> +	if (fec->xcv_type != SEVENWIRE)
> +		miidev_restart_aneg(&fec->miidev);
> +
>  	/*
>  	 * Initialize RxBD/TxBD rings
>  	 */
> -- 
> 1.7.7.6
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] fec: restart autoneg at open instead of init
  2012-09-06 19:38 [PATCH 1/3] fec: restart autoneg at open instead of init Eric Bénard
  2012-09-06 21:52 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-09-10  7:43 ` Sascha Hauer
  2012-09-10  7:51   ` Eric Bénard
  1 sibling, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2012-09-10  7:43 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

Hi Eric,

Regarding the phy issue I have the following plan:

- for -next I think Jean-Christophes phylib will be ready to merge.
  Hopefully it will for for you then again. I think this patch is
  not necessary anymore then.
- for -master I intend to take the "miidev: fix 1G wrong detection"
  patch which should solve your problem for the next release.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] fec: restart autoneg at open instead of init
  2012-09-10  7:43 ` Sascha Hauer
@ 2012-09-10  7:51   ` Eric Bénard
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Bénard @ 2012-09-10  7:51 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

Le Mon, 10 Sep 2012 09:43:36 +0200,
Sascha Hauer <s.hauer@pengutronix.de> a écrit :
> Regarding the phy issue I have the following plan:
> 
> - for -next I think Jean-Christophes phylib will be ready to merge.
>   Hopefully it will for for you then again. I think this patch is
>   not necessary anymore then.
> - for -master I intend to take the "miidev: fix 1G wrong detection"
>   patch which should solve your problem for the next release.
> 
OK, I'll give a try to -next when I find some time.

Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] fec: restart autoneg at open instead of init
  2012-09-07  7:47     ` Sascha Hauer
@ 2012-09-07  7:51       ` Eric Bénard
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Bénard @ 2012-09-07  7:51 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

Le Fri, 7 Sep 2012 09:47:34 +0200,
Sascha Hauer <s.hauer@pengutronix.de> a écrit :

> On Fri, Sep 07, 2012 at 09:30:00AM +0200, Eric Bénard wrote:
> > Hi Sascha,
> > 
> > Le Fri, 7 Sep 2012 08:57:03 +0200,
> > Sascha Hauer <s.hauer@pengutronix.de> a écrit :
> > 
> > > Hi Eric,
> > > 
> > > On Thu, Sep 06, 2012 at 09:39:29PM +0200, Eric Bénard wrote:
> > > > this saves some time during boot when ethernet is not needed in barebox
> > > 
> > > Is this really significant on your hardware? I made a measurement here
> > > and the miidev_restart_aneg() takes 130us on an i.MX27 board.
> > > 
> > > The original intention of doing it at init time was that autonegotation
> > > is already completed when we actually use the network. And this time
> > > really is significant:
> > > 
> > > without the patch:
> > > 
> > > barebox@Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
> > > warning: No MAC address set. Using random address 62:FE:FE:0B:09:A8
> > > phy0: Link is up - 100/Full
> > > host 192.168.23.4 is alive
> > > time: 10ms
> > > 
> > > with the patch:
> > > 
> > > barebox@Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
> > > warning: No MAC address set. Using random address A6:1B:AB:80:FA:E7
> > > phy0: Link is up - 100/Full
> > > host 192.168.23.4 is alive
> > > time: 2040ms
> > > 
> > that strange. I don't see why miidev_restart_aneg() would take less
> > time at boot than at open.
> 
> Well, it does not really take longer. The difference is that if you are
> sitting before your board it usually takes a few seconds to interrupt
> autoboot, think what you want to do, and finally enter some network
> command. In the meantime autonegotiation will be complete. If we start
> autonegotiation at open time, we will always have to wait for the full
> autonegotiation time after starting the first network command.
> 
I didn't check but on my board, the problem may be similar to the 1G
wrong detection : if miidev_restart_aneg is trying to acess the phy
when the MII link is not yet initialized, then it would wait 1s for
the reset to timeout in miidev_restart_aneg which would explain why I
save 1s with this patch.

Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] fec: restart autoneg at open instead of init
  2012-09-07  7:30   ` Eric Bénard
@ 2012-09-07  7:47     ` Sascha Hauer
  2012-09-07  7:51       ` Eric Bénard
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2012-09-07  7:47 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

On Fri, Sep 07, 2012 at 09:30:00AM +0200, Eric Bénard wrote:
> Hi Sascha,
> 
> Le Fri, 7 Sep 2012 08:57:03 +0200,
> Sascha Hauer <s.hauer@pengutronix.de> a écrit :
> 
> > Hi Eric,
> > 
> > On Thu, Sep 06, 2012 at 09:39:29PM +0200, Eric Bénard wrote:
> > > this saves some time during boot when ethernet is not needed in barebox
> > 
> > Is this really significant on your hardware? I made a measurement here
> > and the miidev_restart_aneg() takes 130us on an i.MX27 board.
> > 
> > The original intention of doing it at init time was that autonegotation
> > is already completed when we actually use the network. And this time
> > really is significant:
> > 
> > without the patch:
> > 
> > barebox@Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
> > warning: No MAC address set. Using random address 62:FE:FE:0B:09:A8
> > phy0: Link is up - 100/Full
> > host 192.168.23.4 is alive
> > time: 10ms
> > 
> > with the patch:
> > 
> > barebox@Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
> > warning: No MAC address set. Using random address A6:1B:AB:80:FA:E7
> > phy0: Link is up - 100/Full
> > host 192.168.23.4 is alive
> > time: 2040ms
> > 
> that strange. I don't see why miidev_restart_aneg() would take less
> time at boot than at open.

Well, it does not really take longer. The difference is that if you are
sitting before your board it usually takes a few seconds to interrupt
autoboot, think what you want to do, and finally enter some network
command. In the meantime autonegotiation will be complete. If we start
autonegotiation at open time, we will always have to wait for the full
autonegotiation time after starting the first network command.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] fec: restart autoneg at open instead of init
  2012-09-07  6:57 ` Sascha Hauer
@ 2012-09-07  7:30   ` Eric Bénard
  2012-09-07  7:47     ` Sascha Hauer
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Bénard @ 2012-09-07  7:30 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

Le Fri, 7 Sep 2012 08:57:03 +0200,
Sascha Hauer <s.hauer@pengutronix.de> a écrit :

> Hi Eric,
> 
> On Thu, Sep 06, 2012 at 09:39:29PM +0200, Eric Bénard wrote:
> > this saves some time during boot when ethernet is not needed in barebox
> 
> Is this really significant on your hardware? I made a measurement here
> and the miidev_restart_aneg() takes 130us on an i.MX27 board.
> 
> The original intention of doing it at init time was that autonegotation
> is already completed when we actually use the network. And this time
> really is significant:
> 
> without the patch:
> 
> barebox@Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
> warning: No MAC address set. Using random address 62:FE:FE:0B:09:A8
> phy0: Link is up - 100/Full
> host 192.168.23.4 is alive
> time: 10ms
> 
> with the patch:
> 
> barebox@Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
> warning: No MAC address set. Using random address A6:1B:AB:80:FA:E7
> phy0: Link is up - 100/Full
> host 192.168.23.4 is alive
> time: 2040ms
> 
that strange. I don't see why miidev_restart_aneg() would take less
time at boot than at open.

Eric

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/3] fec: restart autoneg at open instead of init
  2012-09-06 19:39 Eric Bénard
@ 2012-09-07  6:57 ` Sascha Hauer
  2012-09-07  7:30   ` Eric Bénard
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2012-09-07  6:57 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

Hi Eric,

On Thu, Sep 06, 2012 at 09:39:29PM +0200, Eric Bénard wrote:
> this saves some time during boot when ethernet is not needed in barebox

Is this really significant on your hardware? I made a measurement here
and the miidev_restart_aneg() takes 130us on an i.MX27 board.

The original intention of doing it at init time was that autonegotation
is already completed when we actually use the network. And this time
really is significant:

without the patch:

barebox@Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
warning: No MAC address set. Using random address 62:FE:FE:0B:09:A8
phy0: Link is up - 100/Full
host 192.168.23.4 is alive
time: 10ms

with the patch:

barebox@Phytec phyCORE-i.MX27:/ time ping 192.168.23.4
warning: No MAC address set. Using random address A6:1B:AB:80:FA:E7
phy0: Link is up - 100/Full
host 192.168.23.4 is alive
time: 2040ms


Sascha

> 
> Signed-off-by: Eric Bénard <eric@eukrea.com>
> ---
>  drivers/net/fec_imx.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 599a9b4..2bc06a9 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -347,9 +347,6 @@ static int fec_init(struct eth_device *dev)
>  	/* size of each buffer */
>  	writel(FEC_MAX_PKT_SIZE, fec->regs + FEC_EMRBR);
>  
> -	if (fec->xcv_type != SEVENWIRE)
> -		miidev_restart_aneg(&fec->miidev);
> -
>  	return 0;
>  }
>  
> @@ -363,6 +360,9 @@ static int fec_open(struct eth_device *edev)
>  	int ret;
>  	u32 ecr;
>  
> +	if (fec->xcv_type != SEVENWIRE)
> +		miidev_restart_aneg(&fec->miidev);
> +
>  	/*
>  	 * Initialize RxBD/TxBD rings
>  	 */
> -- 
> 1.7.7.6
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/3] fec: restart autoneg at open instead of init
@ 2012-09-06 19:39 Eric Bénard
  2012-09-07  6:57 ` Sascha Hauer
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Bénard @ 2012-09-06 19:39 UTC (permalink / raw)
  To: barebox

this saves some time during boot when ethernet is not needed in barebox

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 drivers/net/fec_imx.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 599a9b4..2bc06a9 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -347,9 +347,6 @@ static int fec_init(struct eth_device *dev)
 	/* size of each buffer */
 	writel(FEC_MAX_PKT_SIZE, fec->regs + FEC_EMRBR);
 
-	if (fec->xcv_type != SEVENWIRE)
-		miidev_restart_aneg(&fec->miidev);
-
 	return 0;
 }
 
@@ -363,6 +360,9 @@ static int fec_open(struct eth_device *edev)
 	int ret;
 	u32 ecr;
 
+	if (fec->xcv_type != SEVENWIRE)
+		miidev_restart_aneg(&fec->miidev);
+
 	/*
 	 * Initialize RxBD/TxBD rings
 	 */
-- 
1.7.7.6


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-09-10  7:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-06 19:38 [PATCH 1/3] fec: restart autoneg at open instead of init Eric Bénard
2012-09-06 21:52 ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-10  7:43 ` Sascha Hauer
2012-09-10  7:51   ` Eric Bénard
2012-09-06 19:39 Eric Bénard
2012-09-07  6:57 ` Sascha Hauer
2012-09-07  7:30   ` Eric Bénard
2012-09-07  7:47     ` Sascha Hauer
2012-09-07  7:51       ` Eric Bénard

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