From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/8] i2c: mux-pinctrl: Rework to honor disabled child nodes
Date: Tue, 17 Feb 2015 14:15:11 -0700 [thread overview]
Message-ID: <54E3AF5F.3020902@wwwdotorg.org> (raw)
In-Reply-To: <54E3ADB9.1040008@gmail.com>
On 02/17/2015 02:08 PM, Sebastian Hesselbarth wrote:
> On 17.02.2015 21:46, Stephen Warren wrote:
>> On 02/17/2015 11:52 AM, Sebastian Hesselbarth wrote:
>>> I2C mux pinctrl driver currently determines the number of sub-busses by
>>> counting available pinctrl-names. Unfortunately, this requires each
>>> incarnation of the devicetree node with different available sub-busses
>>> to be rewritten.
>>
>> Can you be more explicit about the problem here? Why does anything need
>> to be re-written if a child node is disabled; presumably there's no need
>> for the child bus numbers to be contiguous. In other words, with the
>> example in the existing DT binding doc:
>>
>> i2cmux {
>> compatible = "i2c-mux-pinctrl";
>> ...
>> pinctrl-names = "ddc", "pta", "idle";
>> pinctrl-0 = <&state_i2cmux_ddc>;
>> pinctrl-1 = <&state_i2cmux_pta>;
>> pinctrl-2 = <&state_i2cmux_idle>;
>>
>> i2c at 0 {
>> reg = <0>;
>> ...
>> i2c at 1 {
>> reg = <1>;
>> ...
>>
>> That would generate child busses 0 and 1. If I was to disable the i2c at 0
>> node, then there would still be definitions for child busses 0 and 1 in
>> the DT, it's just that child bus 0 wouldn't actually exist at run-time.
>> I don't see what part of DT needs to be re-written to accomodate this?
>
> The way the current driver works, to disable i2c at 0 you'd have to remove
> the pinctrl-0 state, pinctrl-names string at position 0, and the node
> itself.
>
> So, on Dove SoC there is three sub-busses, now consider one board A with
> i2c0 and i2c1 enabled but board B with i2c0 and i2c2 enabled:
>
> board-A.dts:
>
> i2cmux {
> pinctrl-names = "i2c0", "i2c1", "idle";
> pinctrl-0 = <&state_for_i2c0>;
> pinctrl-1 = <&state_for_i2c1>;
> };
>
> but
>
> board-B.dts:
>
> i2cmux {
> pinctrl-names = "i2c0", "i2c2", "idle";
> pinctrl-0 = <&state_for_i2c0>;
> pinctrl-1 = <&state_for_i2c2>;
> /* Note that this ^^^ is state_for_i2c2 */
> };
>
> while the approach with status = "disabled" allows all properties for
> both board remain the same - except you'll enable either i2c1 or i2c2
> sub-node on board level:
>
> i2cmux {
> pinctrl-names = "i2c0", "i2c1", "i2c2", "idle";
> pinctrl-0 = <&state_for_i2c0>;
> pinctrl-1 = <&state_for_i2c1>;
> pinctrl-2 = <&state_for_i2c2>;
> };
>
> board-A.dts:
>
> i2cmux {
> i2c at 0 { status = "okay"; };
> i2c at 1 { status = "okay"; };
> };
>
> and
>
> board-B.dts:
>
> i2cmux {
> i2c at 0 { status = "okay"; };
> i2c at 2 { status = "okay"; };
> };
OK, that all makes sense, but I don't think there's any change at all to
the binding; this can all be fixed in the driver without affecting the
definition of the binding at all. At most all that's needed in the
binding is a note to the effect that if a particular child node is
disabled, then this has no effect at all on the requirements for the
pinctrl properties.
> In general, it is less about the binding but how the driver is written:
> Number of sub-busses is determined by elements in pinctrl-names not
> available (enabled) sub-nodes.
>
>>> This patch reworks i2c-mux-pinctrl driver to count the number of
>>> available sub-nodes instead. The rework should be compatible to the old
>>> way of probing for sub-busses and additionally allows to disable unused
>>> sub-busses with standard DT property status = "disabled".
>>>
>>> This also amends the corresponding devicetree binding documentation to
>>> reflect the new functionality to disable unused sub-nodes. While at it,
>>> also fix two references to binding documentation files that miss an
>>> "i2c-"
>>> prefix.
>>
>>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pinctrl.txt
>>> b/Documentation/devicetree/bindings/i2c/i2c-mux-pinctrl.txt
>>
>>> -For each named state defined in the pinctrl-names property, an I2C
>>> child bus
>>> -will be created. I2C child bus numbers are assigned based on the
>>> index into
>>> -the pinctrl-names property.
>>> +For each child node that is not disabled by a status != "okay", an I2C
>>> +child bus will be created. I2C child bus numbers are assigned based
>>> on the
>>> +order of child nodes.
>>
>> I would have assumed that disabled sub-nodes was a global concept within
>> DT, and so wouldn't be mentioned in the binding. It would just be a bug
>> in the driver if it didn't ignore disabled sub-nodes.
>
> Yep, the concept is very global. It is about the current driver and this
> binding changes are just to make it a little more clear that the driver
> should behave different, i.e. get rid of anything that implies that
> pinctrl-names has any effect on the number of sub-busses registered.
>
>>> -The only exception is that no bus will be created for a state named
>>> "idle". If
>>> -such a state is defined, it must be the last entry in pinctrl-names.
>>> For
>>> -example:
>>> -
>>> - pinctrl-names = "ddc", "pta", "idle" -> ddc = bus 0, pta = bus 1
>>> - pinctrl-names = "ddc", "idle", "pta" -> Invalid ("idle" not last)
>>> - pinctrl-names = "idle", "ddc", "pta" -> Invalid ("idle" not last)
>>> +There must be a corresponding pinctrl-names entry for each enabled
>>> child
>>> +node at the position of the child node's "reg" property.
>>
>> The addition there seems fine, but the existing text re: the idle state
>> seems clearer in the original text.
>
> Ok, I'll have a look at how to preserve this section better.
>
> Do you still have one of the current boards available for testing?
Yes, I have both Seaboard and Ventana still (the two Tegra boards that
use this driver). I haven't used them in a while; I hope they still work:-)
next prev parent reply other threads:[~2015-02-17 21:15 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 18:52 [PATCH 0/8] Add proper support for Compulab CM-A510/SBC-A510 Sebastian Hesselbarth
2015-02-17 18:52 ` [PATCH 1/8] i2c: mux-pinctrl: Rework to honor disabled child nodes Sebastian Hesselbarth
2015-02-17 20:46 ` Stephen Warren
2015-02-17 21:08 ` Sebastian Hesselbarth
2015-02-17 21:15 ` Stephen Warren [this message]
2015-02-17 21:19 ` Sebastian Hesselbarth
2015-02-26 21:46 ` Stephen Warren
2015-02-17 18:52 ` [PATCH 2/8] devicetree: vendor-prefixes: Add CompuLab to known vendors Sebastian Hesselbarth
2015-02-17 19:37 ` Rob Herring
2015-02-17 18:52 ` [PATCH 3/8] ARM: dts: dove: Fix uart[23] reg property Sebastian Hesselbarth
2015-02-23 14:54 ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 4/8] ARM: dts: dove: Always include gpio and interrupt-controller headers Sebastian Hesselbarth
2015-02-23 14:54 ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 5/8] ARM: dts: dove: Add node labels for PCIe ports 0 and 1 Sebastian Hesselbarth
2015-02-23 14:55 ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 6/8] ARM: dts: dove: Add some more common pinctrl settings Sebastian Hesselbarth
2015-02-23 14:56 ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 7/8] ARM: dts: dove: Add internal i2c multiplexer node Sebastian Hesselbarth
2015-02-23 15:07 ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 8/8] ARM: dts: dove: Add proper support for Compulab CM-A510/SBC-A510 Sebastian Hesselbarth
2015-02-26 17:55 ` [PATCH 0/8] " Gregory CLEMENT
2015-02-26 19:39 ` Sebastian Hesselbarth
2015-02-26 20:01 ` Stephen Warren
2015-02-26 20:35 ` Sebastian Hesselbarth
2015-02-27 12:24 ` [PATCH v2 0/4] " Sebastian Hesselbarth
2015-02-27 12:24 ` [PATCH v2 1/4] i2c: mux-pinctrl: Rework to honor disabled child nodes Sebastian Hesselbarth
2015-03-02 20:01 ` Stephen Warren
2015-03-04 9:10 ` Sebastian Hesselbarth
2015-03-09 12:21 ` [PATCH v3 " Sebastian Hesselbarth
2015-03-10 16:28 ` Stephen Warren
2015-03-16 20:15 ` Sebastian Hesselbarth
2015-03-18 12:30 ` Wolfram Sang
2015-03-18 13:23 ` Sebastian Hesselbarth
2015-03-18 14:00 ` Wolfram Sang
2015-03-18 23:10 ` Sebastian Hesselbarth
2015-03-19 10:09 ` Wolfram Sang
2015-03-19 10:48 ` Wolfram Sang
2015-03-19 15:47 ` Stephen Warren
2015-03-19 16:02 ` Wolfram Sang
2015-03-19 16:49 ` Stephen Warren
2015-03-19 20:52 ` Sebastian Hesselbarth
2015-03-20 10:19 ` Wolfram Sang
2015-03-21 21:00 ` Wolfram Sang
2015-03-22 13:03 ` Sebastian Hesselbarth
2015-03-23 18:32 ` Wolfram Sang
2015-03-27 21:08 ` Sebastian Hesselbarth
2015-04-03 18:17 ` Wolfram Sang
2015-02-27 12:24 ` [PATCH v2 2/4] devicetree: vendor-prefixes: Add CompuLab to known vendors Sebastian Hesselbarth
2015-02-27 12:24 ` [PATCH v2 3/4] ARM: dts: dove: Add internal i2c multiplexer node Sebastian Hesselbarth
2015-02-27 12:24 ` [PATCH v2 4/4] ARM: dts: dove: Add proper support for Compulab CM-A510/SBC-A510 Sebastian Hesselbarth
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=54E3AF5F.3020902@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=linux-arm-kernel@lists.infradead.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).