linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list@gmail.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Stephen Boyd <stephen.boyd@linaro.org>,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 1/3] of: Support parsing phandle argument lists through a nexus node
Date: Thu, 9 Feb 2017 10:52:15 -0800	[thread overview]
Message-ID: <589CBA5F.9000101@gmail.com> (raw)
In-Reply-To: <CAL_JsqKbkynNmCrXbi=VJ5wqYtRrYbC+00qSm_uyZFBLFOUz0w@mail.gmail.com>

On 02/09/17 07:17, Rob Herring wrote:
> On Tue, Jan 24, 2017 at 12:05 PM, Rob Herring <robh+dt@kernel.org> wrote:
>> On Tue, Jan 24, 2017 at 12:36 AM, Frank Rowand <frowand.list@gmail.com> wrote:
>>> Hi Stephen,
>>>
>>> Sorry I did not get to v1 and v2 in a timely manner.
>>>
>>>
>>> On 01/23/17 12:48, Stephen Boyd wrote:
>>>> Platforms like 96boards have a standardized connector/expansion
>>>> slot that exposes signals like GPIOs to expansion boards in an
>>>> SoC agnostic way. We'd like the DT overlays for the expansion
>>>> boards to be written once without knowledge of the SoC on the
>>>> other side of the connector. This avoids the unscalable
>>>> combinatorial explosion of a different DT overlay for each
>>>> expansion board and SoC pair.
>>>>
>>>> We need a way to describe the GPIOs routed through the connector
>>>> in an SoC agnostic way. Let's introduce nexus property parsing
>>>> into the OF core to do this. This is largely based on the
>>>> interrupt nexus support we already have. This allows us to remap
>>>> a phandle list in a consumer node (e.g. reset-gpios) through a
>>>> connector in a generic way (e.g. via gpio-map). Do this in a
>>>> generic routine so that we can remap any sort of variable length
>>>> phandle list.
>>>>
>>>> Taking GPIOs as an example, the connector would be a GPIO nexus,
>>>> supporting the remapping of a GPIO specifier space to multiple
>>>> GPIO providers on the SoC. DT would look as shown below, where
>>>> 'soc_gpio1' and 'soc_gpio2' are inside the SoC, 'connector' is an
>>>> expansion port where boards can be plugged in, and
>>>> 'expansion_device' is a device on the expansion board.
>>>>
>>>>       soc {
>>>>               soc_gpio1: gpio-controller1 {
>>>>                       #gpio-cells = <2>;
>>>>               };
>>>>
>>>>               soc_gpio2: gpio-controller2 {
>>>>                       #gpio-cells = <2>;
>>>>               };
>>>>       };
>>>>
>>>>       connector: connector {
>>>>               #gpio-cells = <2>;
>>>>               gpio-map = <0 0 &soc_gpio1 1 0>,
>>>>                          <1 0 &soc_gpio2 4 0>,
>>>>                          <2 0 &soc_gpio1 3 0>,
>>>>                          <3 0 &soc_gpio2 2 0>;
>>>>               gpio-map-mask = <0xf 0x0>;
>>>>               gpio-map-pass-thru = <0x0 0x1>
>>>>       };
>>>>
>>>>       expansion_device {
>>>>               reset-gpios = <&connector 2 GPIO_ACTIVE_LOW>;
>>>>       };
>>>
>>> The how to architect connectors and plugs threads fell asleep before
>>> coming to a resolution.  We need to revive that discussion.
>>>
>>> One of the concepts of the plug and connector architecture is that
>>> a main board may contain multiple connectors of the same type (or
>>> different types, but the same type is sufficient for this discussion).
>>>
>>> The node describing the card that plugs into one of the connectors
>>> does not know the phandle of the connector it is going to be
>>> connected to.  Some other mechanism is provided to allow a card
>>> to be plugged into any of the available connectors.  If there are
>>> two identical cards plugged into two connectors, then both cards
>>> have the same exact device tree node.  But some mechanism will
>>> exist to resolve (or "link") the two card nodes to the different
>>> connector nodes.
>>>
>>> As a result of this, in the above example the reset-gpios property
>>> in the node 'expansion_device' can not contain '&connector'.  The
>>> concept of &connector belongs to the entire expansion_device node,
>>> not to individual properties within the node.
>>
>> I think this is easily solved with a connector having 2 halves and
>> that we need to search parents for *-map properties. Inheriting from
>> parents is a common pattern in DT though perhaps not walking the
>> parents of a phandle. So we'd have something like this:
>>
>> base-connector-1 {
>>   gpio-map = ...
>>   connector {
>>     child {
>>       some-gpios = <&connector 1>;
>>     };
>>   };
>> };
>>
>> base-connector-2 {
>>   gpio-map = ...
>>   connector {
>>     child {
>>       some-gpios = <&connector 1>;
>>     };
>>   };
>> };
>>
>> Now, how we resolve that /connector from an overlay targets
>> /base-connector-1 and /base-connector-2 is an orthogonal issue and one
>> that's going to be connector specific (at least for probe-able
>> connectors).
> 
> Frank, any more comments on this? If not, I plan to apply this series.
> 
> Rob

Yes, how we resolve which connector a plug goes into is orthogonal.

My objection is that the original example has a property in the
plug node (that is, on the expansion board), directly referencing
the connector node, instead of referencing a resource inside the
connector node.

In the original example, it would make more sense for the first
item in the reset-gpios property to be &gpio-map or "gpio-map"
instead of &connector.

-Frank

  parent reply	other threads:[~2017-02-09 18:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 20:48 [PATCH v3 0/3] OF phandle nexus support + GPIO nexus Stephen Boyd
2017-01-23 20:48 ` [PATCH v3 1/3] of: Support parsing phandle argument lists through a nexus node Stephen Boyd
2017-01-24  6:36   ` Frank Rowand
2017-01-24 18:05     ` Rob Herring
2017-02-09 15:17       ` Rob Herring
2017-02-09 15:35         ` Russell King - ARM Linux
2017-02-09 16:00           ` Rob Herring
     [not found]             ` <CAL_JsqKmkkPobGGzOOcbt2Nbx1=y=+C_167dVKHqrP0UgHBe_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-09 19:55               ` Stephen Boyd
2017-02-09 18:52         ` Frank Rowand [this message]
2017-02-09 22:54           ` Frank Rowand
2017-02-09 15:31   ` Russell King - ARM Linux
2017-01-23 20:48 ` [PATCH v3 2/3] of: unittest: Add phandle remapping test Stephen Boyd
     [not found] ` <20170123204851.12808-1-stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-01-23 20:48   ` [PATCH v3 3/3] gpio: Support gpio nexus dt bindings Stephen Boyd

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=589CBA5F.9000101@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=robh+dt@kernel.org \
    --cc=stephen.boyd@linaro.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).