From: Stephen Warren <swarren@nvidia.com>
To: Simon Glass <sjg@chromium.org>
Cc: Devicetree Discuss <devicetree-discuss@lists.ozlabs.org>,
U-Boot Mailing List <u-boot@lists.denx.de>,
Jerry Van Baren <vanbaren@cideas.com>,
Tom Warren <TWarren@nvidia.com>
Subject: Re: [PATCH v2 2/7] fdt: Add function to allow aliases to refer to multiple nodes
Date: Thu, 19 Jan 2012 13:49:01 -0700 [thread overview]
Message-ID: <4F1881BD.2050704@nvidia.com> (raw)
In-Reply-To: <1326394818-32227-3-git-send-email-sjg@chromium.org>
On 01/12/2012 12:00 PM, Simon Glass wrote:
> Some devices can deal with multiple compatible properties. The devices
> need to know which nodes to bind to which features. For example an
> I2C driver which supports two different controller types will want to
> know which type it is dealing with in each case.
>
> The new fdtdec_add_aliases_for_id() function deals with this by allowing
> the driver to search for additional compatible nodes for a different ID.
> It can then detect the new ones and perform appropriate processing.
>
> Another option considered was to return a tuple (node offset, compat id)
> and have the function be passed a list of compatible IDs. This is more
> overhead for the common case though. We may add such a function later if
> more drivers in U-Boot require it.
> +int fdtdec_add_aliases_for_id(const void *blob, const char *name,
> + enum fdt_compat_id id, int *node_list, int maxcount)
...
> @@ -232,11 +238,13 @@ int fdtdec_find_aliases_for_id(const void *blob, const char *name,
> * it as done.
> */
> if (fdtdec_get_is_enabled(blob, node)) {
> + if (node_list[number])
> + continue;
> node_list[number] = node;
> if (number >= num_found)
> num_found = number + 1;
> }
> - nodes[j] = 0;
> + nodes[found] = 0;
> }
>
> /* Add any nodes not mentioned by an alias */
Aren't those two changes really bug-fixes to the underlying patch rather
than part of this enhancement?
I'm not convinced this patch is correct in all cases. It'll probably
work fine for simply device-trees though. Consider the following case:
4 device nodes
A: compat=i2c alias for usb0
B: compat=i2c no alias
C: compat=i2c alias for usb2
D: compat=i2cx alias for usb1
First, we search for all compat=i2c, the list comes back:
0=A
1=B
2=C
Then we search for all compat=i2cx, the list comes back:
-1
-1
-1
D
So D's alias of 1 isn't honored even though if both IDs were searched
for together, it would have been.
Also, what about the scenario where a driver searches for both
nvidia,tegra20-i2c then later nvidia,tegra30-i2c, given that all the DT
nodes are probably compatible with both?
--
nvpublic
next prev parent reply other threads:[~2012-01-19 20:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1326394818-32227-1-git-send-email-sjg@chromium.org>
2012-01-12 19:00 ` [PATCH v2 2/7] fdt: Add function to allow aliases to refer to multiple nodes Simon Glass
2012-01-19 20:49 ` Stephen Warren [this message]
2012-01-19 23:45 ` Simon Glass
2012-01-20 0:17 ` Stephen Warren
2012-01-20 0:31 ` Simon Glass
2012-01-12 19:00 ` [PATCH v2 3/7] tegra: fdt: Add extra I2C bindings for U-Boot Simon Glass
2012-01-13 6:31 ` Heiko Schocher
[not found] ` <4F0FCFBB.3070407-ynQEQJNshbs@public.gmane.org>
2012-01-13 15:02 ` [U-Boot] " Simon Glass
[not found] ` <1326394818-32227-4-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-01-19 20:51 ` Stephen Warren
2012-01-22 17:41 ` Simon Glass
[not found] ` <CAPnjgZ0cOquTwqg4wx3Cz1+OKXUzYoBvUi2PMA7oHN=2riOHmQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-23 18:25 ` Stephen Warren
2012-02-03 23:27 ` Simon Glass
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=4F1881BD.2050704@nvidia.com \
--to=swarren@nvidia.com \
--cc=TWarren@nvidia.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
--cc=vanbaren@cideas.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;
as well as URLs for NNTP newsgroup(s).