mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt
@ 2013-02-21  9:21 Hubert Feurstein
  2013-02-21  9:21 ` [PATCH 2/2] net: imx_fec: fix RMII support for i.MX6 Hubert Feurstein
  2013-02-21 13:27 ` [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Hubert Feurstein @ 2013-02-21  9:21 UTC (permalink / raw)
  To: barebox

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
 drivers/net/fec_imx.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 2378a19..6dfb093 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -425,15 +425,20 @@ static int fec_open(struct eth_device *edev)
 static void fec_halt(struct eth_device *dev)
 {
 	struct fec_priv *fec = (struct fec_priv *)dev->priv;
-	int counter = 0xffff;
+	uint64_t tmo;
 
 	/* issue graceful stop command to the FEC transmitter if necessary */
 	writel(readl(fec->regs + FEC_X_CNTRL) | FEC_ECNTRL_RESET,
 			fec->regs + FEC_X_CNTRL);
 
 	/* wait for graceful stop to register */
-	while ((counter--) && (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_GRA)))
-		;	/* FIXME ensure time */
+	tmo = get_time_ns();
+	while (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_GRA)) {
+		if (is_timeout(tmo, 1 * SECOND)) {
+			printf("graceful stop timeout\n");
+			break;
+		}
+	}
 
 	/* Disable SmartDMA tasks */
 	fec_tx_task_disable(fec);
-- 
1.8.1.3


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

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

* [PATCH 2/2] net: imx_fec: fix RMII support for i.MX6
  2013-02-21  9:21 [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt Hubert Feurstein
@ 2013-02-21  9:21 ` Hubert Feurstein
  2013-02-21 13:28   ` Sascha Hauer
  2013-02-21 13:27 ` [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Hubert Feurstein @ 2013-02-21  9:21 UTC (permalink / raw)
  To: barebox

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
 drivers/net/fec_imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 6dfb093..80fb2ce 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -309,7 +309,7 @@ static int fec_init(struct eth_device *dev)
 	}
 
 	if (fec->xcv_type == RMII) {
-		if (fec_is_imx28(fec)) {
+		if (fec_is_imx28(fec) || fec_is_imx6(fec)) {
 			rcntl |= FEC_R_CNTRL_RMII_MODE | FEC_R_CNTRL_FCE |
 				FEC_R_CNTRL_NO_LGTH_CHECK;
 		} else {
-- 
1.8.1.3


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

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

* Re: [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt
  2013-02-21  9:21 [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt Hubert Feurstein
  2013-02-21  9:21 ` [PATCH 2/2] net: imx_fec: fix RMII support for i.MX6 Hubert Feurstein
@ 2013-02-21 13:27 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-02-21 13:27 UTC (permalink / raw)
  To: Hubert Feurstein; +Cc: barebox

On Thu, Feb 21, 2013 at 10:21:13AM +0100, Hubert Feurstein wrote:
> Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
> ---
>  drivers/net/fec_imx.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 2378a19..6dfb093 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -425,15 +425,20 @@ static int fec_open(struct eth_device *edev)
>  static void fec_halt(struct eth_device *dev)
>  {
>  	struct fec_priv *fec = (struct fec_priv *)dev->priv;
> -	int counter = 0xffff;
> +	uint64_t tmo;
>  
>  	/* issue graceful stop command to the FEC transmitter if necessary */
>  	writel(readl(fec->regs + FEC_X_CNTRL) | FEC_ECNTRL_RESET,
>  			fec->regs + FEC_X_CNTRL);
>  
>  	/* wait for graceful stop to register */
> -	while ((counter--) && (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_GRA)))
> -		;	/* FIXME ensure time */
> +	tmo = get_time_ns();
> +	while (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_GRA)) {
> +		if (is_timeout(tmo, 1 * SECOND)) {
> +			printf("graceful stop timeout\n");

dev_err please.

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] 4+ messages in thread

* Re: [PATCH 2/2] net: imx_fec: fix RMII support for i.MX6
  2013-02-21  9:21 ` [PATCH 2/2] net: imx_fec: fix RMII support for i.MX6 Hubert Feurstein
@ 2013-02-21 13:28   ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-02-21 13:28 UTC (permalink / raw)
  To: Hubert Feurstein; +Cc: barebox

On Thu, Feb 21, 2013 at 10:21:14AM +0100, Hubert Feurstein wrote:
> Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>

Applied (only this one)

Sascha

> ---
>  drivers/net/fec_imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 6dfb093..80fb2ce 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -309,7 +309,7 @@ static int fec_init(struct eth_device *dev)
>  	}
>  
>  	if (fec->xcv_type == RMII) {
> -		if (fec_is_imx28(fec)) {
> +		if (fec_is_imx28(fec) || fec_is_imx6(fec)) {
>  			rcntl |= FEC_R_CNTRL_RMII_MODE | FEC_R_CNTRL_FCE |
>  				FEC_R_CNTRL_NO_LGTH_CHECK;
>  		} else {
> -- 
> 1.8.1.3
> 
> 
> _______________________________________________
> 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] 4+ messages in thread

end of thread, other threads:[~2013-02-21 13:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-21  9:21 [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt Hubert Feurstein
2013-02-21  9:21 ` [PATCH 2/2] net: imx_fec: fix RMII support for i.MX6 Hubert Feurstein
2013-02-21 13:28   ` Sascha Hauer
2013-02-21 13:27 ` [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt Sascha Hauer

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