From: Peter Chen <peter.chen@freescale.com>
To: Stefan Agner <stefan@agner.ch>
Cc: Sanchayan Maity <maitysanchayan@gmail.com>,
<gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] usb: chipidea: Add chipidea revision information
Date: Thu, 25 Dec 2014 10:30:46 +0800 [thread overview]
Message-ID: <20141225023044.GC5077@shlinux2> (raw)
In-Reply-To: <e7c92089fe1938c9f7f97bde12c6d8bc@agner.ch>
On Wed, Dec 24, 2014 at 05:22:44PM +0100, Stefan Agner wrote:
> On 2014-12-19 10:55, Sanchayan Maity wrote:
> > Define ci_get_revision API to know the controller revision
> > information according to chipidea 1.1a, 2.0a, 2.4 and 2.5a
> > spec. Besides, add one entry in struct ci_hdrc to indicate
> > revision information. This can be used for adding different
> > code for revisions, implementing erratas.
> >
> > Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
> > ---
> > drivers/usb/chipidea/bits.h | 10 ++++++++++
> > drivers/usb/chipidea/core.c | 23 +++++++++++++++++++++--
> > 2 files changed, 31 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
> > index ca57e3d..e935ccc 100644
> > --- a/drivers/usb/chipidea/bits.h
> > +++ b/drivers/usb/chipidea/bits.h
> > @@ -15,6 +15,16 @@
> >
> > #include <linux/usb/ehci_def.h>
> >
> > +/*
> > + * ID
> > + * For 1.x revision, bit24 - bit31 are reserved
> > + * For 2.x revision, bit25 - bit28 are 0x2
> > + */
> > +#define TAG (0x1F << 16)
> > +#define REVISION (0xF << 21)
> > +#define VERSION (0xF << 25)
> > +#define CIVERSION (0x7 << 29)
> > +
>
> Hm, the other defines use spaces in this file, I like tabs more too, but
> I guess uniformity wins here.. Peter?
I will change to use spaces.
>
> > /* HCCPARAMS */
> > #define HCCPARAMS_LEN BIT(17)
> >
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index 9bdc6bd..33a8c4a 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -136,6 +136,22 @@ static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm)
> > return 0;
> > }
> >
> > +static enum CI_REVISION ci_get_revision(struct ci_hdrc *ci)
> > +{
> > + int ver = hw_read_id_reg(ci, ID_ID, VERSION) >> __ffs(VERSION);
> > + enum CI_REVISION rev = CI_REVISION_UNKNOWN;
> > +
> > + if (ver == 0x2) {
> > + int rev_reg = hw_read_id_reg
> > + (ci, ID_ID, REVISION) >> __ffs(REVISION);
>
> This line break is somewhat awkward, doesn't help for good readability.
>
But it exceeds 80 characters, maybe I change like below:
rev += hw_read_id_reg(ci, ID_ID, REVISION)
>> __ffs(REVISION);
> Is the local integer variable necessary at all? Enums are arithmetic
> types, so afaik this should be fine too:
> rev = CI_REVISION_20;
> rev += hw_read_id_reg(ci, ID_ID, REVISION) >> __ffs(REVISION);
Will change, thanks.
--
Best Regards,
Peter Chen
next prev parent reply other threads:[~2014-12-25 3:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-19 9:55 [PATCH 0/3] usb: chipidea: add one errata for revision 2.40a Sanchayan Maity
2014-12-19 9:55 ` [PATCH 1/3] usb: chipidea: Add identification registers access APIs Sanchayan Maity
2014-12-24 16:00 ` Stefan Agner
2014-12-24 16:15 ` Sanchayan Maity
2014-12-24 16:41 ` Stefan Agner
2014-12-25 2:13 ` Peter Chen
2014-12-25 3:33 ` Sanchayan Maity
2014-12-25 2:03 ` Peter Chen
2014-12-19 9:55 ` [PATCH 2/3] usb: chipidea: Add chipidea revision information Sanchayan Maity
2014-12-24 16:22 ` Stefan Agner
2014-12-25 2:30 ` Peter Chen [this message]
2014-12-19 9:55 ` [PATCH 3/3] usb: chipidea: Add errata for revision 2.40a Sanchayan Maity
2014-12-22 1:18 ` [PATCH 0/3] usb: chipidea: add one " Peter Chen
2014-12-22 13:09 ` Sanchayan Maity
2014-12-23 0:09 ` Peter Chen
2014-12-23 4:11 ` Sanchayan Maity
2014-12-24 7:50 ` Sanchayan Maity
2014-12-24 9:00 ` Peter Chen
2014-12-24 9:20 ` Sanchayan Maity
2014-12-24 15:42 ` Stefan Agner
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=20141225023044.GC5077@shlinux2 \
--to=peter.chen@freescale.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=maitysanchayan@gmail.com \
--cc=stefan@agner.ch \
/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