From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org,
"Benoît Cousson" <bcousson@baylibre.com>,
"Paul Walmsley" <paul@pwsan.com>
Subject: [PATCH] ARM: OMAP2+: Fix populating the hwmod data from device tree
Date: Tue, 19 Nov 2013 18:56:20 -0800 [thread overview]
Message-ID: <20131120025620.GF10317@atomide.com> (raw)
We have some device tree properties where the ti,hwmod has multiple
values:
am33xx.dtsi: ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
am4372.dtsi: ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
dra7.dtsi: ti,hwmods = "l3_main_1", "l3_main_2";
omap3.dtsi: ti,hwmods = "mcbsp2", "mcbsp2_sidetone";
omap3.dtsi: ti,hwmods = "mcbsp3", "mcbsp3_sidetone";
omap4.dtsi: ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
omap5.dtsi: ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
So we need to handle the whole string array instead of just the
first string to find the related hwmod entry.
Cc: "Benoît Cousson" <bcousson@baylibre.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2228,11 +2228,23 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np,
struct omap_hwmod *oh)
{
struct device_node *np0 = NULL, *np1 = NULL;
- const char *p;
for_each_child_of_node(np, np0) {
- if (of_find_property(np0, "ti,hwmods", NULL)) {
- p = of_get_property(np0, "ti,hwmods", NULL);
+ int count, i;
+
+ count = of_property_count_strings(np0, "ti,hwmods");
+ if (count < 1)
+ continue;
+
+ for (i = 0; i < count; i++) {
+ const char *p;
+ int res;
+
+ res = of_property_read_string_index(np0, "ti,hwmods",
+ i, &p);
+ if (res)
+ continue;
+
if (!strcmp(p, oh->name))
return np0;
np1 = of_dev_hwmod_lookup(np0, oh);
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: OMAP2+: Fix populating the hwmod data from device tree
Date: Tue, 19 Nov 2013 18:56:20 -0800 [thread overview]
Message-ID: <20131120025620.GF10317@atomide.com> (raw)
We have some device tree properties where the ti,hwmod has multiple
values:
am33xx.dtsi: ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
am4372.dtsi: ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
dra7.dtsi: ti,hwmods = "l3_main_1", "l3_main_2";
omap3.dtsi: ti,hwmods = "mcbsp2", "mcbsp2_sidetone";
omap3.dtsi: ti,hwmods = "mcbsp3", "mcbsp3_sidetone";
omap4.dtsi: ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
omap5.dtsi: ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
So we need to handle the whole string array instead of just the
first string to find the related hwmod entry.
Cc: "Beno?t Cousson" <bcousson@baylibre.com>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2228,11 +2228,23 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np,
struct omap_hwmod *oh)
{
struct device_node *np0 = NULL, *np1 = NULL;
- const char *p;
for_each_child_of_node(np, np0) {
- if (of_find_property(np0, "ti,hwmods", NULL)) {
- p = of_get_property(np0, "ti,hwmods", NULL);
+ int count, i;
+
+ count = of_property_count_strings(np0, "ti,hwmods");
+ if (count < 1)
+ continue;
+
+ for (i = 0; i < count; i++) {
+ const char *p;
+ int res;
+
+ res = of_property_read_string_index(np0, "ti,hwmods",
+ i, &p);
+ if (res)
+ continue;
+
if (!strcmp(p, oh->name))
return np0;
np1 = of_dev_hwmod_lookup(np0, oh);
next reply other threads:[~2013-11-20 2:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 2:56 Tony Lindgren [this message]
2013-11-20 2:56 ` [PATCH] ARM: OMAP2+: Fix populating the hwmod data from device tree Tony Lindgren
2013-11-20 18:12 ` Tony Lindgren
2013-11-20 18:12 ` Tony Lindgren
2013-11-20 19:22 ` Tony Lindgren
2013-11-20 19:22 ` Tony Lindgren
2013-11-20 21:58 ` Paul Walmsley
2013-11-20 21:58 ` Paul Walmsley
2013-11-21 0:05 ` Tony Lindgren
2013-11-21 0:05 ` Tony Lindgren
2013-11-21 1:45 ` Tony Lindgren
2013-11-21 1:45 ` Tony Lindgren
2013-11-21 20:48 ` Tony Lindgren
2013-11-21 20:48 ` Tony Lindgren
2013-12-05 17:29 ` Tony Lindgren
2013-12-05 17:29 ` Tony Lindgren
2013-12-06 0:07 ` Paul Walmsley
2013-12-06 0:07 ` Paul Walmsley
2013-12-06 0:25 ` Tony Lindgren
2013-12-06 0:25 ` Tony Lindgren
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=20131120025620.GF10317@atomide.com \
--to=tony@atomide.com \
--cc=bcousson@baylibre.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.