mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Christian Hemp <c.hemp@phytec.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 7/7] smm911x: check if the device is ready before using it
Date: Wed, 29 Aug 2012 12:07:37 +0200	[thread overview]
Message-ID: <1346234857.11069.39.camel@lws-hemp> (raw)
In-Reply-To: <1346216778-14100-7-git-send-email-plagnioj@jcrosoft.com>

Hi Jean-Christophe,

there is a issue in your header
“[PATCH 7/7] smm911x: check if the device is ready before using it”
            
I think smc911x is correct.


Christian

Am Mittwoch, den 29.08.2012, 07:06 +0200 schrieb Jean-Christophe
PLAGNIOL-VILLARD:
> poll the READY bit in PMT_CTRL. Any other access to the device is
> forbidden while this bit isn't set. Try for 100ms
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  drivers/net/smc911x.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> index cfcd83f..3695d32 100644
> --- a/drivers/net/smc911x.c
> +++ b/drivers/net/smc911x.c
> @@ -422,6 +422,7 @@ static int smc911x_probe(struct device_d *dev)
>  	uint32_t val;
>  	int is_32bit;
>  	struct smc911x_plat *pdata = dev->platform_data;
> +	unsigned int to = 100;
>  
>  	priv = xzalloc(sizeof(*priv));
>  	is_32bit = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
> @@ -452,6 +453,17 @@ static int smc911x_probe(struct device_d *dev)
>  		}
>  	}
>  
> +	/*
> +	 * poll the READY bit in PMT_CTRL. Any other access to the device is
> +	 * forbidden while this bit isn't set. Try for 100ms
> +	 */
> +	while (!(smc911x_reg_read(priv, PMT_CTRL) & PMT_CTRL_READY) && --to)
> +		udelay(1000);
> +	if (to == 0) {
> +		dev_err(dev, "Device not READY in 100ms aborting\n");
> +		return -ENODEV;
> +	}
> +
>  	val = smc911x_reg_read(priv, BYTE_TEST);
>  	if (val == 0x43218765) {
>  		dev_info(dev, "BYTE_TEST looks swapped, "



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

  parent reply	other threads:[~2012-08-29 10:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-29  4:27 [PATCH 0/7 2] smsc911x: runtime configuration improvement Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  5:06 ` [PATCH 1/7] smc911x: move register define to smc911x.h Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  5:06   ` [PATCH 2/7] smc911x: introduce read/write ops Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  5:06   ` [PATCH 3/7] smc911x: add 16bit bus width support Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  5:06   ` [PATCH 4/7] smc911x: add support to pass the shift via platform data Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  5:06   ` [PATCH 5/7] smc911x: improve detection handle Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  6:52     ` Sascha Hauer
2012-08-29  8:36       ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  9:04         ` Sascha Hauer
2012-08-29  5:06   ` [PATCH 6/7] smc911x: update chip detection Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  5:06   ` [PATCH 7/7] smm911x: check if the device is ready before using it Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  6:53     ` Sascha Hauer
2012-08-29  8:35       ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-29  9:04         ` Sascha Hauer
2012-08-29 10:07     ` Christian Hemp [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-14 17:25 [PATCH 0/7] smsc911x: runtime configuration improvement Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 17:32 ` [PATCH 1/7] smc911x: move register define to smc911x.h Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 17:32   ` [PATCH 7/7] smm911x: check if the device is ready before using it Jean-Christophe PLAGNIOL-VILLARD

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=1346234857.11069.39.camel@lws-hemp \
    --to=c.hemp@phytec.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.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