devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Miao <eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Haojian Zhuang
	<haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
	khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
Subject: Re: [PATCH 7/7] i2c: pxa: support to parse property
Date: Wed, 20 Jul 2011 09:22:33 +0800	[thread overview]
Message-ID: <CAMPhdO9oHNVX66QLAAnLYhm3cGR4Roms6cYFXAbkZ=LxtO+aTQ@mail.gmail.com> (raw)
In-Reply-To: <20110719194550.GK6848-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>

On Wed, Jul 20, 2011 at 3:45 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Tue, Jul 19, 2011 at 10:24:50AM +0800, Haojian Zhuang wrote:
>> Support to parse some optional properties. These three properties are
>> i2c-polling, i2c-frequency, i2c-class.
>>
>> After supporting these property, i2c-pxa driver can avoid to use platform
>> data except for slave mode.
>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
>> ---
>>  .../devicetree/bindings/i2c/pxa255-i2c.txt         |   36 ++++++++++++++++++++
>>  drivers/i2c/busses/i2c-pxa.c                       |   22 ++++++++----
>>  2 files changed, 51 insertions(+), 7 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
>> new file mode 100644
>> index 0000000..bf34236
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
>> @@ -0,0 +1,36 @@
>> +PXA255 I2C
>> +
>> +The I2C-Controller is first used in PXA255. It's widely used in Intel/Marvell
>> +silicons.
>> +
>> +Optional Property:
>> +     - i2c-polling: Specifies whether I2C-Controller is used in polling
>> +       mode or interrupt mode. The type of property should be <u32>.
>
> mrvl,i2c-polling
>
> Make this an empty property instead of reading a value out of it.  If
> the property is present, then it means polling mode is requested.
> Besides, wouldn't just the absence of an "interrupts" property mean that
> the i2c controller should be run in polled mode?

And change it to 'use-polling' might be clearer here. The absence of an
'interrupt' property gives an illusion of this controller not connected to
any IRQ line, while this is not true, it's just not used in polling mode.

PS: polling mode used in interrupt disabled situations, e.g. late in
suspend or early in resume.

>
>> +
>> +     - i2c-frequency: Specifies the frequency that the I2C-Controller
>> +       is working. The type of property should be <string>.
>> +
>> +     - i2c-class: Specifies the class of I2C-Controller. The type of
>> +       property should be <u32>.
>
> ???  What is this for?  The description in insufficient.
>
>> +
>> +Example:
>> +     i2c0: i2c@d4011000 {
>> +             compatible = "pxa2xx-i2c";
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +             reg = <0xd4011000 0x60>;
>> +             /* I2C-Controller works in interrupt mode. */
>> +             i2c-polling = <0>;
>> +             /* I2C-Controller's frequency is FAST. */
>> +             i2c-frequency = "fast";
>> +             /* interrupt of I2C-Controller */
>> +             interrupts = <7>;
>> +             interrupt-parent = <&mmp_intc>;
>> +
>> +             pm860x: pmic@34 {
>> +                     interrupt-controller;
>> +                     /* interrupt of pm860x */
>> +                     interrupts = <4>;
>> +                     interrupt-parent = <&mmp_intc>;
>> +             };
>> +     };
>> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
>> index adac74a..4b9fa71 100644
>> --- a/drivers/i2c/busses/i2c-pxa.c
>> +++ b/drivers/i2c/busses/i2c-pxa.c
>> @@ -1060,7 +1060,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
>>       const struct platform_device_id *id = platform_get_device_id(dev);
>>       enum pxa_i2c_types i2c_type;
>>       struct resource *res;
>> -     int irq, ret;
>> +     int irq, ret, poll;
>> +     char *p = NULL;
>>       static int idx = 0;
>>
>>       if (np) {
>> @@ -1093,11 +1094,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
>>
>>
>>       if (np) {
>> +             of_property_read_u32(np, "i2c-polling", &poll);
>> +             i2c->use_pio = (poll) ? 1 : 0;
>> +             of_property_read_string(np, "i2c-frequency", &p);
>> +             if (p && !strncmp(p, "fast", 4))
>> +                     i2c->fast_mode = 1;
>> +             of_property_read_u32(np, "i2c-class", &i2c->adap.class);
>> +
>>               i2c->adap.nr = idx++;
>>               snprintf(i2c->adap.name, sizeof(i2c->adap.name),
>>                       "pxa2xx-i2c.%u", i2c->adap.nr);
>>               i2c->clk = clk_get_sys(i2c->adap.name, NULL);
>>       } else {
>> +             if (plat) {
>> +                     i2c->adap.class = plat->class;
>> +                     i2c->use_pio = plat->use_pio;
>> +                     i2c->fast_mode = plat->fast_mode;
>> +             }
>> +
>>               /*
>>                * If "dev->id" is negative we consider it as zero.
>>                * The reason to do so is to avoid sysfs names that only make
>> @@ -1142,12 +1156,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
>>
>>       clk_enable(i2c->clk);
>>
>> -     if (plat) {
>> -             i2c->adap.class = plat->class;
>> -             i2c->use_pio = plat->use_pio;
>> -             i2c->fast_mode = plat->fast_mode;
>> -     }
>> -
>>       if (i2c->use_pio) {
>>               i2c->adap.algo = &i2c_pxa_pio_algorithm;
>>       } else {
>> --
>> 1.5.6.5
>>
>
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

  parent reply	other threads:[~2011-07-20  1:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2011071901>
2011-07-19  2:24 ` [PATCH 0/7] support DT on ARCH-MMP Haojian Zhuang
     [not found]   ` <1311042290-20253-1-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19  2:24     ` [PATCH 1/7] ARM: mmp: parse irq from DT Haojian Zhuang
     [not found]       ` <1311042290-20253-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19  2:24         ` [PATCH 2/7] ARM: mmp: append MMP_USE_OF config Haojian Zhuang
     [not found]           ` <1311042290-20253-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19  2:24             ` [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone Haojian Zhuang
     [not found]               ` <1311042290-20253-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19  2:24                 ` [PATCH 4/7] tty: serial: support device tree in pxa Haojian Zhuang
     [not found]                   ` <1311042290-20253-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19  2:24                     ` [PATCH 5/7] tty: serial: check ops before registering console Haojian Zhuang
     [not found]                       ` <1311042290-20253-6-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19  2:24                         ` [PATCH 6/7] i2c: pxa: support i2c controller from DT Haojian Zhuang
     [not found]                           ` <1311042290-20253-7-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19  2:24                             ` [PATCH 7/7] i2c: pxa: support to parse property Haojian Zhuang
     [not found]                               ` <1311042290-20253-8-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 10:17                                 ` Eric Miao
     [not found]                                   ` <CAMPhdO-qjR0LSjvMm7hbdqZyrFxa5S8JVa1FO8sDsxOdyUV9Ng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-19 19:47                                     ` Grant Likely
2011-07-19 19:45                                 ` Grant Likely
     [not found]                                   ` <20110719194550.GK6848-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-20  1:22                                     ` Eric Miao [this message]
2011-07-19 19:43                             ` [PATCH 6/7] i2c: pxa: support i2c controller from DT Grant Likely
2011-07-19 19:40                     ` [PATCH 4/7] tty: serial: support device tree in pxa Grant Likely
2011-07-19 19:48                       ` Arnd Bergmann
2011-07-19 19:53                         ` Grant Likely
     [not found]                           ` <CACxGe6u1Pq990opdt7irttuY1OvpZVNXSM11cLdqo5zN8YpYeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-19 20:05                             ` Russell King - ARM Linux
2011-07-19 20:17                               ` Arnd Bergmann
     [not found]                               ` <20110719200515.GB308-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-07-20  1:26                                 ` Eric Miao
2011-07-19 13:42                 ` [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone Mitch Bradley
     [not found]                   ` <4E2589C8.8010604-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2011-07-19 19:49                     ` Grant Likely
2011-07-19 19:36                 ` Grant Likely
2011-07-19 19:24             ` [PATCH 2/7] ARM: mmp: append MMP_USE_OF config Grant Likely
2011-07-19 17:39         ` [PATCH 1/7] ARM: mmp: parse irq from DT Grant Likely
2011-07-19  7:12   ` [PATCH 0/7] support DT on ARCH-MMP Jean Delvare

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='CAMPhdO9oHNVX66QLAAnLYhm3cGR4Roms6cYFXAbkZ=LxtO+aTQ@mail.gmail.com' \
    --to=eric.y.miao-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@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).