[PATCH 07/16] fec_imx: Impelemnt reset timeout

Antony Pavlov antonynpavlov at gmail.com
Tue Mar 15 22:46:19 PDT 2016


On Tue, 15 Mar 2016 20:33:42 -0700
Andrey Smirnov <andrew.smirnov at gmail.com> wrote:

> [PATCH 07/16] fec_imx: Impelemnt reset timeout
                         ^^^^^^^^^ Implement?

> Don't wait for more than one second for IP block to finish resetting. If
> the block is dead it makes more sence to continue execution in hopes
> that the rest of the processor is fine, rather than spin indefinetly
> inside of the fec_probe function
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
> ---
>  drivers/net/fec_imx.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 601edba..fc2c8e1 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -656,6 +656,7 @@ static int fec_probe(struct device_d *dev)
>  	enum fec_type type;
>  	int phy_reset;
>  	u32 msec = 1;
> +	u64 start;
>  
>  	ret = dev_get_drvdata(dev, (const void **)&type);
>  	if (ret)
> @@ -708,9 +709,13 @@ static int fec_probe(struct device_d *dev)
>  	}
>  
>  	/* Reset chip. */
> +	start = get_time_ns();
>  	writel(FEC_ECNTRL_RESET, fec->regs + FEC_ECNTRL);
>  	while(readl(fec->regs + FEC_ECNTRL) & FEC_ECNTRL_RESET) {
> -		udelay(10);
> +		if (is_timeout(start, SECOND)) {
> +			ret = -ETIMEDOUT;
> +			goto free_gpio;
> +		}
>  	}
>  
>  	/*
> -- 
> 2.5.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


-- 
-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list