linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Roese <sr-ynQEQJNshbs@public.gmane.org>
To: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org,
	Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org>
Subject: Re: [PATCH v2] i2c: designware: Add support for 16bit register access
Date: Wed, 18 Apr 2012 14:58:11 +0200	[thread overview]
Message-ID: <201204181458.11326.sr@denx.de> (raw)
In-Reply-To: <20120418112426.GD21955-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On Wednesday 18 April 2012 13:24:26 Wolfram Sang wrote:

<snip>

> > @@ -254,7 +265,13 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
> > 
> >  	/* Configure register endianess access */
> >  	reg = dw_readl(dev, DW_IC_COMP_TYPE);
> >  	if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) {
> > 
> > -		dev->swab = 1;
> > +		dev->accessor_flags |= ACCESS_SWAP;
> > +		reg = DW_IC_COMP_TYPE_VALUE;
> 
> May I ask you to use proper if/elseif/else blocks instead of overwriting
> reg? I know you didn't come up with the mechanism, yet it looks too
> fragile to be extended IMO.

Okay, will do.
 
> > +	}
> > +
> > +	/* Configure register access mode 16bit */
> > +	if (reg == (DW_IC_COMP_TYPE_VALUE & 0x0000ffff)) {
> 
> Does it make sense to check reg + 2 for the upper part of the signature?

Not from my point of view. Its very unlikely that this driver will be used on 
another controller. Its configured (via its address in platform-data or DT) 
for exactly this controller. And matching 16bit of this 32bit register seems 
enough for me. I would even have no problem to remove this check completely.

Thanks,
Stefan

      parent reply	other threads:[~2012-04-18 12:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18  7:33 [PATCH v2] i2c: designware: Add support for 16bit register access Stefan Roese
     [not found] ` <1334734399-1003-1-git-send-email-sr-ynQEQJNshbs@public.gmane.org>
2012-04-18 11:24   ` Wolfram Sang
     [not found]     ` <20120418112426.GD21955-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-04-18 12:58       ` Stefan Roese [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=201204181458.11326.sr@denx.de \
    --to=sr-ynqeqjnshbs@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org \
    --cc=viresh.kumar-qxv4g6HH51o@public.gmane.org \
    --cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).