From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
Cc: Andrey Danin <danindrey-JGs/UdohzUI@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Subject: Re: How to encode being an I2C slave in DT?
Date: Tue, 05 May 2015 14:07:11 -0600 [thread overview]
Message-ID: <554922EF.3050906@wwwdotorg.org> (raw)
In-Reply-To: <20150505105513.GA1841@katana>
On 05/05/2015 04:55 AM, Wolfram Sang wrote:
>
> I'm back in town. Sorry for the delay...
>
>> One thing where we need your help as a I2C maintainer is how to represent an
>> i2c slave device using device-tree. You may remember our discussion in the
>> past from here [1] where you suggested to just make a slave client by its
>> compatible name. Stephen Warren from NVIDIA raised some concerns about this
>> solution because it may not be appropriate in all possible future cases (which
>> is what a proper device-tree representation should take care off). He instead
>> suggested to mark a slave client by adding some flag to the reg property, to
>> be able to handle a situation where both master client and slave client have
>> the same i2c bus address forming a loopback (e.g. for testing purpose) on the
>> same bus. More details here [2].
>
> Well... I can agree that we shouldn't prevent a loopback from a DT point
> of view. (Despite the fact that it is really for development and I
> wonder how many I2C IP cores can do this flawlessly)
>
> However, I am still against putting that information into the reg
> property. I see devices coming which have multiple addresses, so people
> somewhen want to encode this in DT as well. I'd like to have that a
> simple array of addresses. Adding flags, rarely used, will create a mess
> IMO.
The container node has a #address-cells property for this very reason.
It's perfectly well-defined how to split up a property containing a
large number of cells into separate values, by using the value of
#address-cells. Plus, the canonical formatting (albeit not enforced by
the DT compiler) for a property that contains an array of entries, each
2 cells in size, would be:
reg = <0 0x1a>, <0 0x40>, <0 0x48>;
rather than:
reg = <0 0x1a 0 0x40 0 0x48>;
... so it's quite simple to make it very human-readable too.
> So what about adding a new property "i2c-slave-reg"? This does not only
> prevent the confusion above, but also makes it very clear that this node
> is an I2C slave without the need to encode that somehow in the
> compatible property (although it probably should be described there as
> well, still).
That doesn't sound like a good idea. reg is the DT-defined way of
identifying/numbering child nodes. We shouldn't invent other properties
that mean essentially the same thing, but simply encode flags.
It might be reasonable to split an I2C controller node up so that it has
n child nodes:
i2c-controller@1234 {
compatible = "foo";
reg = <0x1234 0x100>;
#address-cells = <1>;
#size-cells = <0>;
master {
eeprom@1a {
compatible = ...;
reg = <0x1a>;
};
...
};
slave {
nvec@NN {
compatible = ...;
reg = <0xNN>;
};
...
};
};
However, that seems a lot more complex and invasive than just adding an
extra address cell to reg, and putting everything into a single node.
>> I hope with this post I can join the different discussions somehow so we are
>> able to find a common sense which is acceptable for all.
>
> Thanks for doing this! I changed the subject to maybe raise interest a
> bit more.
next prev parent reply other threads:[~2015-05-05 20:07 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-30 20:00 [PATCH v2 0/4] arm: tegra: implement NVEC driver using tegra i2c Andrey Danin
2015-03-30 20:00 ` [PATCH v2 1/4] i2c: tegra: implement slave mode Andrey Danin
[not found] ` <1427745615-5428-2-git-send-email-danindrey-JGs/UdohzUI@public.gmane.org>
2015-04-03 19:46 ` Wolfram Sang
2015-07-20 9:50 ` Wolfram Sang
2015-03-30 20:00 ` [PATCH v2 2/4] staging/nvec: reimplement on top of tegra i2c driver Andrey Danin
[not found] ` <1427745615-5428-3-git-send-email-danindrey-JGs/UdohzUI@public.gmane.org>
2015-04-03 19:57 ` Wolfram Sang
2015-03-30 20:00 ` [PATCH v2 3/4] staging/nvec: remove old code Andrey Danin
2015-03-30 20:00 ` [PATCH v2 4/4] dt: paz00: define nvec as child of i2c bus Andrey Danin
2015-04-03 19:46 ` [PATCH v2 0/4] arm: tegra: implement NVEC driver using tegra i2c Wolfram Sang
2015-04-07 11:37 ` [PATCH v2 0/4] arm: tegra: implement NVEC driver using tegrai2c Marc Dietrich
2015-04-10 21:35 ` Wolfram Sang
2015-05-05 10:55 ` How to encode being an I2C slave in DT? Wolfram Sang
2015-05-05 20:07 ` Stephen Warren [this message]
[not found] ` <554922EF.3050906-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-05-06 16:17 ` Wolfram Sang
2015-05-06 17:01 ` Stephen Warren
2015-05-19 0:37 ` Rob Herring
[not found] ` <CAL_Jsq+iyeK-bV3ggcJv8Cw3EU71fkBo1wqYZnhCoh2-b_tO-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-19 6:16 ` Wolfram Sang
2015-07-16 9:03 ` Andrey Danin
[not found] ` <55A7736F.5090802-JGs/UdohzUI@public.gmane.org>
2015-07-16 18:14 ` Wolfram Sang
2015-05-06 6:59 ` Uwe Kleine-König
[not found] ` <20150506065928.GP25193-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-06 7:53 ` Marc Dietrich
2015-05-06 8:09 ` Uwe Kleine-König
[not found] ` <20150506080951.GS25193-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-06 15:57 ` Stephen Warren
[not found] ` <554A39F1.9060507-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-05-06 17:47 ` Uwe Kleine-König
[not found] ` <20150506174757.GZ25193-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-06 18:35 ` 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=554922EF.3050906@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
--cc=danindrey-JGs/UdohzUI@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marvin24-Mmb7MZpHnFY@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@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).