mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 5/7] smc911x: improve detection handle
Date: Wed, 29 Aug 2012 10:36:07 +0200	[thread overview]
Message-ID: <20120829083607.GE18708@game.jcrosoft.org> (raw)
In-Reply-To: <20120829065245.GM26594@pengutronix.de>

On 08:52 Wed 29 Aug     , Sascha Hauer wrote:
> On Wed, Aug 29, 2012 at 07:06:16AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > detect if the bus is swapped and report a 32bit drivers is used on a 16bit bus
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  drivers/net/smc911x.c |   20 +++++++++++++++++++-
> >  drivers/net/smc911x.h |    2 ++
> >  2 files changed, 21 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
> > index 75a332e..17f365d 100644
> > --- a/drivers/net/smc911x.c
> > +++ b/drivers/net/smc911x.c
> > @@ -470,9 +470,27 @@ static int smc911x_probe(struct device_d *dev)
> >  	}
> >  
> >  	val = smc911x_reg_read(priv, BYTE_TEST);
> > -	if(val != 0x87654321) {
> > +	if (val == 0x43218765) {
> > +		dev_info(dev, "BYTE_TEST looks swapped, "
> > +			   "applying WORD_SWAP");
> 
> dev_dbg please. Users shouldn't be interested in this.
> 
> > +		smc911x_reg_write(priv, WORD_SWAP, 0xffffffff);
> > +
> > +		/* 1 dummy read of BYTE_TEST is needed after a write to
> > +		 * WORD_SWAP before its contents are valid */
> > +		val = smc911x_reg_read(priv, BYTE_TEST);
> > +
> > +		val = smc911x_reg_read(priv, BYTE_TEST);
> > +	}
> > +
> > +	if (val != 0x87654321) {
> >  		dev_err(dev, "no smc911x found on 0x%p (byte_test=0x%08x)\n",
> >  			priv->base, val);
> > +		if (((val >> 16) & 0xFFFF) == (val & 0xFFFF)) {
> > +			dev_err(dev, "top 16 bits equal to bottom 16 bits\n");
> > +			dev_err(dev,
> > +				   "This may mean the chip is set "
> > +				   "for 32 bit while the bus is reading 16 bit\n");
> 
> Please replace the second dev_err with a comment in the source code.
> This is developer information only; developers will grep for the source
> of the message anyway.
code from the kernel prefer to keep it as is

Best Regards,
J.

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

  reply	other threads:[~2012-08-29  8:35 UTC|newest]

Thread overview: 17+ 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 [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2012-09-01  8:47 [PATCH 0/7 v3] smsc911x: runtime configuration improvement Jean-Christophe PLAGNIOL-VILLARD
2012-09-01  8:52 ` [PATCH 1/7] smc911x: move register define to smc911x.h Jean-Christophe PLAGNIOL-VILLARD
2012-09-01  8:52   ` [PATCH 5/7] smc911x: improve detection handle Jean-Christophe PLAGNIOL-VILLARD
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 5/7] smc911x: improve detection handle 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=20120829083607.GE18708@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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