mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Hubert Feurstein <h.feurstein@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] net: fec_imx: ensure constant timeout in fec_halt
Date: Thu, 21 Feb 2013 14:27:03 +0100	[thread overview]
Message-ID: <20130221132703.GO1906@pengutronix.de> (raw)
In-Reply-To: <1361438474-28008-1-git-send-email-h.feurstein@gmail.com>

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

      parent reply	other threads:[~2013-02-21 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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:28   ` Sascha Hauer
2013-02-21 13:27 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130221132703.GO1906@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=h.feurstein@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox