mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Christian Ruppert <christian.ruppert@abilis.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Patrice CHOTARD <patrice.chotard@st.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Rob Landley <rob@landley.net>,
	Sascha Leuenberger <sascha.leuenberger@abilis.com>,
	Pierrick Hascoet <pierrick.hascoet@abilis.com>,
	"devicetree-discuss@lists.ozlabs.org" 
	<devicetree-discuss@lists.ozlabs.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Alexandre Courbot <acourbot@nvidia.com>
Subject: Re: [PATCH 1/4] Make non-linear GPIO ranges accesible from gpiolib
Date: Wed, 26 Jun 2013 11:33:19 -0600	[thread overview]
Message-ID: <51CB25DF.3050004@wwwdotorg.org> (raw)
In-Reply-To: <20130626114159.GA7095@ab42.lan>

On 06/26/2013 05:42 AM, Christian Ruppert wrote:
> On Wed, Jun 19, 2013 at 12:15:13PM -0600, Stephen Warren wrote:
>> On 06/19/2013 06:03 AM, Linus Walleij wrote:
>>> On Tue, Jun 18, 2013 at 11:29 AM, Christian Ruppert
>>> <christian.ruppert@abilis.com> wrote:
>>>
>>>> This patch adds the infrastructure required to register non-linear gpio
>>>> ranges through gpiolib and the standard GPIO device tree bindings.
>>>>
>>>> Signed-off-by: Christian Ruppert <christian.ruppert@abilis.com>
>>>
>>> I'm basically fine with this, but would like Stephen's ACK if possible.
>>>
>>>> +In addition, named groups of pins can be mapped to pin groups of a given
>>>> +pin controller:
>>>> +
>>>> +       gpio_pio_g: gpio-controller@1480 {
>>>> +               #gpio-cells = <2>;
>>>> +               compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
>>>> +               reg = <0x1480 0x18>;
>>>> +               gpio-controller;
>>>> +               gpio-ranges = <&pinctrl1 0 0 0>, <&pinctrl2 3 0 0>;
>>>> +               gpio-ranges-group-names = "foo", "bar";
>>>> +       };
>>>> +
>>>> +where,
>>>> +   &pinctrl1 and &pinctrl2 is the phandle to the pinctrl DT node.
>>>> +
>>>> +   The following value specifies the base GPIO offset of the pin range with
>>>> +   respect to the GPIO controller's base. The remaining two values must be
>>>> +   0 to indicate that a named pin group should be used for the respective
>>>> +   range. The number of pins in the range is the number of pins in the pin
>>>> +   group.
>>>
>>> So while this works, these zeroes seem a bit awkward, but maybe
>>> it's the only way?
>>>
>>> I'm not good enough on device tree conventions, but isn't this possible:
>>>
>>>               gpio-ranges = <&pinctrl1 0>, <&pinctrl2 3>;
>>>               gpio-ranges-group-names = "foo", "bar";
>>>
>>> Since we don't have any #gpio-ranges-cells or anything like that I
>>> guess we can define this to have a flexible number of cells
>>> depending on use case?
>>
>> If we're willing to have gpio-ranges be either *all* group names, or
>> *all* IDs, we can define the format of gpio-ranges to have two cells
>> (phandle and GPIO number) if the property gpio-ranges-group-names
>> exists, but four cells (phandle, GPIO number, pin number, count)
>> otherwise. However, that's a little restrictive, since then what if one
>> GPIO controller is hooked to two different pinmux controllers, and you
>> want to use different formats for the references to each. A
>> #gpio-ranges-cells in the target of the phandle would allow this, but I
>> don't think this is something the pinctrl node should dictate to those
>> who reference it; it's quite legitimate for a GPIO node to use the pure
>> numeric mapping even if the pin controller happens to expose some pin
>> groups that allow you to do the mapping by name.
> 
> I actually had a version of the patch with #gpio-range-cells specifying
> the format (one argument for named ranges, three for classical ranges)
> before deciding to use a separate property and sending that version. As
> I said in a previous mail, I don't have a preference which of the
> following three possibilities to use and would be grateful for some
> guidance (if it matters at all).
> 
> 1.) separate property:
> 	gpio {
> 		gpio-ranges = <&pinctrl1 0 0 5>;
> 		gpio-range-groups = <&pinctrl2 5>;
> 		gpio-range-group-names = "gpios";
> 	};

Multiple properties seems a little like over-kill, although I agree it
makes specifying the format of the properties simplest.

> 2.) fixed number of three arguments:
> 	gpio {
> 		gpio-ranges = <&pinctrl1 0 0 5>, <&pinctrl2 5 0 0>;
> 		gpio-range-names = "", "gpios";
> 	};

This one seems fine to me. In many ways it's the simplest.

I guess I'd be OK with either (1) or (2) if someone else had a strong
opinion either way, although I'd tend towards (2) myself I think.

It's a pity properties don't carry type information in them, or we could
just put the string inline with the numbers in gpio-ranges:-(

> 3.) pinctrl-defined format.
> 	pinctrl1: pctl1 {
> 		#gpio-range-cells = <3>;
> 	};
> 	pinctrl2: pctl2 {
> 		#gpio-range-cells = <1>;
> 	};
> 	gpio {
> 		gpio-ranges = <&pinctrl1 0 0 5>, <&pinctrl2 5>;
> 		gpio-range-names = "", "gpios";
> 	};

I don't like that, because the pin controller node shouldn't determine
the format of the gpio-ranges entries here; a DT author would always
have the choice to use purely numerical values in gpio-ranges even if
the pinctrl node's binding did actually define named pin groups that
would allow you to use group names. Hence, the concept of the pinctrl
node having a #gpio-range-cells property seems wrong to me.

  reply	other threads:[~2013-06-26 17:33 UTC|newest]

Thread overview: 138+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 15:45 [PATCH 1/2] pinmux: Add TB10x pinmux driver Christian Ruppert
2013-04-10 15:45 ` [PATCH 2/2] GPIO: Add TB10x GPIO driver Christian Ruppert
2013-04-17 15:13   ` Linus Walleij
2013-04-17 18:37   ` Stephen Warren
2013-04-17 14:48 ` [PATCH 1/2] pinmux: Add TB10x pinmux driver Linus Walleij
2013-04-17 18:32 ` Stephen Warren
2013-04-18  9:03   ` Christian Ruppert
2013-04-26  7:47     ` Linus Walleij
2013-04-29 16:17       ` Christian Ruppert
2013-05-02 18:49         ` Stephen Warren
2013-05-03 18:03           ` Linus Walleij
2013-05-08 16:41             ` Christian Ruppert
2013-05-08 20:01               ` Stephen Warren
2013-05-10  8:25                 ` Christian Ruppert
2013-05-14 12:29                   ` Linus Walleij
2013-05-15  9:41                     ` Christian Ruppert
2013-05-20  8:03                       ` Linus Walleij
2013-05-22  9:49                         ` Christian Ruppert
2013-06-12 16:44                           ` [RFC] Allow GPIO ranges based on pinctl pin groups Christian Ruppert
2013-06-13  9:00                             ` Linus Walleij
2013-06-13 12:55                               ` [PATCH 1/2] Add pin list based GPIO ranges Christian Ruppert
2013-06-13 18:30                                 ` Linus Walleij
2013-06-14  7:17                                 ` Patrice CHOTARD
2013-06-14  8:24                                   ` [PATCH] Fix comment on pinctrl_gpio_range.pin_base Christian Ruppert
2013-06-16 10:19                                     ` Linus Walleij
2013-06-13 12:55                               ` [PATCH 2/2] Make non-linear GPIO ranges accesible from gpiolib Christian Ruppert
2013-06-13 18:36                                 ` Linus Walleij
2013-06-13 21:38                                 ` Stephen Warren
2013-06-14  9:12                                   ` Christian Ruppert
2013-06-19 18:10                                     ` Stephen Warren
2013-06-19 18:27                                       ` Stephen Warren
2013-06-20 11:57                                         ` Christian Ruppert
2013-06-21 21:17                                           ` Stephen Warren
2013-06-25 11:59                                             ` Christian Ruppert
2013-06-25 15:59                                               ` Stephen Warren
2013-06-25 14:27                                             ` Linus Walleij
2013-06-25 15:19                                               ` Stephen Warren
2013-06-25 14:32                                             ` Linus Walleij
2013-06-25 15:22                                               ` Stephen Warren
2013-06-25 14:56                                             ` Linus Walleij
2013-06-25 15:31                                               ` Stephen Warren
2013-06-25 15:47                                                 ` Linus Walleij
2013-06-25 15:28                                             ` Linus Walleij
2013-06-25 15:39                                               ` Stephen Warren
2013-06-25 15:53                                                 ` Linus Walleij
2013-06-17 16:03                                   ` Christian Ruppert
2013-06-17 16:04                                     ` [PATCH 1/4] " Christian Ruppert
2013-06-18  8:09                                       ` Linus Walleij
2013-06-18  9:25                                         ` Christian Ruppert
2013-06-18  9:29                                           ` Christian Ruppert
2013-06-19 12:03                                             ` Linus Walleij
2013-06-19 18:15                                               ` Stephen Warren
2013-06-26 11:42                                                 ` Christian Ruppert
2013-06-26 17:33                                                   ` Stephen Warren [this message]
2013-06-19 22:27                                             ` Stephen Warren
2013-06-26 11:46                                               ` Christian Ruppert
2013-06-26 17:34                                                 ` Stephen Warren
2013-06-18  9:29                                           ` [PATCH 2/4] pinmux: Add TB10x pinmux driver Christian Ruppert
2013-06-19 22:35                                             ` Stephen Warren
2013-06-26 11:50                                               ` Christian Ruppert
2013-06-26 17:40                                                 ` Stephen Warren
2013-07-05  9:49                                                   ` Christian Ruppert
2013-07-05 18:40                                                     ` Stephen Warren
2013-07-08 13:02                                                       ` Christian Ruppert
2013-07-10 19:27                                                         ` Stephen Warren
2013-07-16  8:47                                                           ` Christian Ruppert
2013-07-16 16:04                                                             ` Stephen Warren
2013-07-18 16:07                                                               ` Christian Ruppert
2013-07-18 19:54                                                                 ` Stephen Warren
2013-07-26  9:42                                                                   ` Christian Ruppert
2013-07-26 16:05                                                                     ` Stephen Warren
2013-07-29 22:35                                             ` Linus Walleij
2013-08-05 11:51                                               ` Christian Ruppert
2013-08-14 16:53                                                 ` Linus Walleij
2013-08-21 15:57                                                   ` Christian Ruppert
2013-08-22 20:10                                                     ` Stephen Warren
2013-08-28 14:47                                                       ` Christian Ruppert
2013-10-08 12:21                                                         ` Christian Ruppert
2013-10-08 12:25                                                           ` [PATCH 01/03] Make non-linear GPIO ranges accesible from gpiolib Christian Ruppert
2013-10-09 11:58                                                             ` Linus Walleij
2013-10-09 13:28                                                               ` Christian Ruppert
2013-10-09 14:01                                                                 ` Linus Walleij
2013-10-10 20:49                                                                   ` Stephen Warren
2013-10-11  7:53                                                                     ` Linus Walleij
2013-10-15 13:36                                                                   ` Christian Ruppert
2013-10-15 13:37                                                                     ` [PATCH V2] " Christian Ruppert
2013-10-16 11:19                                                                       ` Linus Walleij
2013-10-16 12:56                                                                         ` [PATCH] Add a short note on pinctrl_get_group_pins to pinctrl.txt Christian Ruppert
2013-10-16 13:36                                                                           ` Linus Walleij
2013-10-10 20:47                                                               ` [PATCH 01/03] Make non-linear GPIO ranges accesible from gpiolib Stephen Warren
2013-10-08 12:25                                                           ` [PATCH 02/03] pinmux: Add TB10x pinmux driver Christian Ruppert
2013-10-09 12:30                                                             ` Linus Walleij
2013-10-15 13:39                                                               ` [PATCH V2] " Christian Ruppert
2013-10-16 11:25                                                                 ` Linus Walleij
2013-10-08 12:25                                                           ` [PATCH 03/03] GPIO: Add TB10x GPIO driver Christian Ruppert
2013-10-09 12:19                                                             ` Linus Walleij
2013-10-15 13:45                                                               ` Christian Ruppert
2013-10-16 11:29                                                                 ` Linus Walleij
2013-10-16 12:58                                                                   ` Christian Ruppert
2013-10-24 16:23                                                                     ` Christian Ruppert
2013-10-25 21:44                                                                       ` Linus Walleij
2013-10-25  3:27                                                             ` Kumar Gala
2013-08-28 18:49                                                     ` [PATCH 2/4] pinmux: Add TB10x pinmux driver Linus Walleij
2013-08-29  7:35                                                       ` Christian Ruppert
2013-08-29  8:24                                                         ` Linus Walleij
2013-08-30  8:19                                                           ` Christian Ruppert
2013-06-18  9:29                                           ` [PATCH 3/4] GPIO: Add TB10x GPIO driver Christian Ruppert
2013-06-19 22:37                                             ` Stephen Warren
2013-06-18  9:29                                           ` [PATCH 4/4] Add Abilis Systems Sarl to device tree vendor prefixes Christian Ruppert
2013-06-17 16:04                                     ` [PATCH 2/4] pinmux: Add TB10x pinmux driver Christian Ruppert
2013-06-17 16:04                                     ` [PATCH 3/4] GPIO: Add TB10x GPIO driver Christian Ruppert
2013-06-17 16:04                                     ` [PATCH 4/4] Add Abilis Systems Sarl to device tree vendor prefixes Christian Ruppert
2013-05-16  0:12                   ` [PATCH 1/2] pinmux: Add TB10x pinmux driver Stephen Warren
2013-05-20  8:10                     ` Linus Walleij
2013-05-22 14:28                       ` Christian Ruppert
2013-05-23  7:43                         ` Haojian Zhuang
2013-05-24 11:50                           ` Christian Ruppert
2013-05-26 15:49                             ` Haojian Zhuang
2013-06-03 12:30                               ` Christian Ruppert
2013-06-05  1:44                                 ` Haojian Zhuang
2013-06-06 14:11                                   ` Christian Ruppert
2013-06-06 14:32                                     ` Haojian Zhuang
2013-06-06 15:30                                       ` Christian Ruppert
2013-06-07  0:00                                         ` Haojian Zhuang
2013-06-07 11:32                                           ` Christian Ruppert
2013-06-07 14:57                                             ` Haojian Zhuang
2013-06-07 19:18                                         ` Stephen Warren
2013-06-08  8:31                                           ` Haojian Zhuang
2013-06-09  2:47                                             ` Stephen Warren
2013-06-11  7:27                                           ` Christian Ruppert
2013-06-16 11:11                                             ` Linus Walleij
2013-05-29 12:21                             ` Linus Walleij
2013-06-03  9:42                               ` Christian Ruppert
2013-06-07 11:36                                 ` Linus Walleij
2013-06-07 13:34                                   ` Christian Ruppert
2013-05-24  9:20                         ` Linus Walleij
2013-05-24 12:03                           ` Christian Ruppert
2013-05-02 18:52     ` Stephen Warren

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=51CB25DF.3050004@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=acourbot@nvidia.com \
    --cc=christian.ruppert@abilis.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linus.walleij@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrice.chotard@st.com \
    --cc=pierrick.hascoet@abilis.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=sascha.leuenberger@abilis.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

Powered by JetHome