From: lokeshvutla@ti.com (Lokesh Vutla)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/PATCH 4/7] arm: omap: device: add support for generating sysconfig data from DT
Date: Wed, 10 Dec 2014 16:19:06 +0530 [thread overview]
Message-ID: <54882522.20002@ti.com> (raw)
In-Reply-To: <1418164072-19087-5-git-send-email-balbi@ti.com>
Hi Felipe,
On Wednesday 10 December 2014 03:57 AM, Felipe Balbi wrote:
> After moving sysconfig data to DT, we need to make
> sure we can generate the same data we have today in C
> files out of the DT provided properties.
>
> This patch adds support for all optional properties
> documented by a previous commit.
>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
> arch/arm/mach-omap2/omap_device.c | 115 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 115 insertions(+)
>
> diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
> index abd622b..ea729aa 100644
> --- a/arch/arm/mach-omap2/omap_device.c
> +++ b/arch/arm/mach-omap2/omap_device.c
> @@ -25,6 +25,7 @@
> */
> #undef DEBUG
[...snip..]
> +
> +static int omap_hwmod_init_sysc(struct device *dev,
> + struct omap_hwmod *oh, int index)
> +{
> + struct device_node *node = dev->of_node;
> + struct omap_hwmod_class *class = oh->class;
> + struct omap_hwmod_class_sysconfig *sysc;
> + int ret;
> + int i;
> + char name[128];
> + const char *tmp = oh->name;
> + u32 prop;
> +
> + /* if data isn't provided by DT, skip */
> + if ((class && class->sysc) || !omap_hwmod_has_sysc_bindings(dev))
> + return 0;
> +
> + class = kzalloc(sizeof(*class), GFP_KERNEL);
> + if (!class)
> + return -ENOMEM;
> +
> + i = 0;
> + while (*tmp) {
> + if (isalpha(*tmp))
> + name[i++] = *tmp;
> + tmp++;
> + }
> + name[i] = '\0';
> +
> + class->name = kzalloc(sizeof(name), GFP_KERNEL);
> + if (!class->name)
> + return -ENOMEM;
> + strncpy(class->name, name, sizeof(name) - 1);
> +
> + sysc = kzalloc(sizeof(*sysc), GFP_KERNEL);
> + if (!sysc)
> + return -ENOMEM;
> +
> + ret = of_property_read_u32_index(node, "ti,rev_offs", index, &prop);
> + if (!ret)
> + sysc->rev_offs = prop;
> +
> + ret = of_property_read_u32_index(node, "ti,sysc_offs", index, &prop);
> + if (!ret)
> + sysc->sysc_offs = prop;
> +
> + ret = of_property_read_u32_index(node, "ti,syss_offs", index, &prop);
> + if (!ret)
> + sysc->syss_offs = prop;
> +
> + ret = of_property_read_u32_index(node, "ti,sysc_flags", index, &prop);
> + if (!ret)
> + sysc->sysc_flags = prop & 0xffff;
> +
> + ret = of_property_read_u32_index(node, "ti,srst_udelay", index, &prop);
> + if (!ret)
> + sysc->srst_udelay = prop & 0xff;
> +
> + ret = of_property_read_u32_index(node, "ti,idlemodes", index, &prop);
> + if (!ret)
> + sysc->idlemodes = prop & 0xff;
> +
> + ret = of_property_read_u32_index(node, "ti,clockact", index, &prop);
> + if (!ret)
> + sysc->clockact = prop & 0xff;
> +
> + ret = of_property_read_u32_index(node, "ti,sysc_type", index, &prop);
> + if (ret)
> + prop = 1;
> +
> + switch (prop) {
> + case 2:
> + sysc->sysc_fields = &omap_hwmod_sysc_type2;
> + break;
> + case 3:
> + sysc->sysc_fields = &omap_hwmod_sysc_type3;
> + break;
> + case 1:
> + default:
> + sysc->sysc_fields = &omap_hwmod_sysc_type1;
> + }
Missed hooking the class to oh?
class->sysc = sysc;
oh->class = class;
Thanks and regards,
Lokesh
> +
> + return 0;
> +}
>
> /**
> * omap_device_build_from_dt - build an omap_device with multiple hwmods
> @@ -154,6 +264,11 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
> goto odbfd_exit1;
> }
> hwmods[i] = oh;
> +
> + ret = omap_hwmod_init_sysc(&pdev->dev, oh, i);
> + if (ret)
> + goto odbfd_exit1;
> +
> if (oh->flags & HWMOD_INIT_NO_IDLE)
> device_active = true;
>
>
WARNING: multiple messages have this Message-ID (diff)
From: Lokesh Vutla <lokeshvutla-l0cyMroinI0@public.gmane.org>
To: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: "Kristo, Tero" <t-kristo-l0cyMroinI0@public.gmane.org>,
Linux ARM Kernel Mailing List
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>,
Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC/PATCH 4/7] arm: omap: device: add support for generating sysconfig data from DT
Date: Wed, 10 Dec 2014 16:19:06 +0530 [thread overview]
Message-ID: <54882522.20002@ti.com> (raw)
In-Reply-To: <1418164072-19087-5-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
Hi Felipe,
On Wednesday 10 December 2014 03:57 AM, Felipe Balbi wrote:
> After moving sysconfig data to DT, we need to make
> sure we can generate the same data we have today in C
> files out of the DT provided properties.
>
> This patch adds support for all optional properties
> documented by a previous commit.
>
> Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
> ---
> arch/arm/mach-omap2/omap_device.c | 115 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 115 insertions(+)
>
> diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
> index abd622b..ea729aa 100644
> --- a/arch/arm/mach-omap2/omap_device.c
> +++ b/arch/arm/mach-omap2/omap_device.c
> @@ -25,6 +25,7 @@
> */
> #undef DEBUG
[...snip..]
> +
> +static int omap_hwmod_init_sysc(struct device *dev,
> + struct omap_hwmod *oh, int index)
> +{
> + struct device_node *node = dev->of_node;
> + struct omap_hwmod_class *class = oh->class;
> + struct omap_hwmod_class_sysconfig *sysc;
> + int ret;
> + int i;
> + char name[128];
> + const char *tmp = oh->name;
> + u32 prop;
> +
> + /* if data isn't provided by DT, skip */
> + if ((class && class->sysc) || !omap_hwmod_has_sysc_bindings(dev))
> + return 0;
> +
> + class = kzalloc(sizeof(*class), GFP_KERNEL);
> + if (!class)
> + return -ENOMEM;
> +
> + i = 0;
> + while (*tmp) {
> + if (isalpha(*tmp))
> + name[i++] = *tmp;
> + tmp++;
> + }
> + name[i] = '\0';
> +
> + class->name = kzalloc(sizeof(name), GFP_KERNEL);
> + if (!class->name)
> + return -ENOMEM;
> + strncpy(class->name, name, sizeof(name) - 1);
> +
> + sysc = kzalloc(sizeof(*sysc), GFP_KERNEL);
> + if (!sysc)
> + return -ENOMEM;
> +
> + ret = of_property_read_u32_index(node, "ti,rev_offs", index, &prop);
> + if (!ret)
> + sysc->rev_offs = prop;
> +
> + ret = of_property_read_u32_index(node, "ti,sysc_offs", index, &prop);
> + if (!ret)
> + sysc->sysc_offs = prop;
> +
> + ret = of_property_read_u32_index(node, "ti,syss_offs", index, &prop);
> + if (!ret)
> + sysc->syss_offs = prop;
> +
> + ret = of_property_read_u32_index(node, "ti,sysc_flags", index, &prop);
> + if (!ret)
> + sysc->sysc_flags = prop & 0xffff;
> +
> + ret = of_property_read_u32_index(node, "ti,srst_udelay", index, &prop);
> + if (!ret)
> + sysc->srst_udelay = prop & 0xff;
> +
> + ret = of_property_read_u32_index(node, "ti,idlemodes", index, &prop);
> + if (!ret)
> + sysc->idlemodes = prop & 0xff;
> +
> + ret = of_property_read_u32_index(node, "ti,clockact", index, &prop);
> + if (!ret)
> + sysc->clockact = prop & 0xff;
> +
> + ret = of_property_read_u32_index(node, "ti,sysc_type", index, &prop);
> + if (ret)
> + prop = 1;
> +
> + switch (prop) {
> + case 2:
> + sysc->sysc_fields = &omap_hwmod_sysc_type2;
> + break;
> + case 3:
> + sysc->sysc_fields = &omap_hwmod_sysc_type3;
> + break;
> + case 1:
> + default:
> + sysc->sysc_fields = &omap_hwmod_sysc_type1;
> + }
Missed hooking the class to oh?
class->sysc = sysc;
oh->class = class;
Thanks and regards,
Lokesh
> +
> + return 0;
> +}
>
> /**
> * omap_device_build_from_dt - build an omap_device with multiple hwmods
> @@ -154,6 +264,11 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
> goto odbfd_exit1;
> }
> hwmods[i] = oh;
> +
> + ret = omap_hwmod_init_sysc(&pdev->dev, oh, i);
> + if (ret)
> + goto odbfd_exit1;
> +
> if (oh->flags & HWMOD_INIT_NO_IDLE)
> device_active = true;
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-12-10 10:49 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 22:27 [RFC/PATCH 0/7] arm: omap: move more HWMOD data to DT Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi
2014-12-09 22:27 ` [RFC/PATCH 1/7] arm: omap: hwmod: add debugfs interface Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi
2014-12-09 22:27 ` [RFC/PATCH 2/7] arm: omap: devicetree: add new properties for OMAP devices Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi
2014-12-10 11:07 ` Lokesh Vutla
2014-12-10 11:07 ` Lokesh Vutla
2014-12-10 15:00 ` Felipe Balbi
2014-12-10 15:00 ` Felipe Balbi
2014-12-11 0:46 ` Sebastian Reichel
2014-12-11 0:46 ` Sebastian Reichel
2014-12-11 14:21 ` Felipe Balbi
2014-12-11 14:21 ` Felipe Balbi
2014-12-11 17:11 ` Tony Lindgren
2014-12-11 17:11 ` Tony Lindgren
2014-12-09 22:27 ` [RFC/PATCH 3/7] arm: omap: hwmod: drop 'const' qualifier from omap_hwmod_class name Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi
2014-12-09 22:27 ` [RFC/PATCH 4/7] arm: omap: device: add support for generating sysconfig data from DT Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi
2014-12-10 10:49 ` Lokesh Vutla [this message]
2014-12-10 10:49 ` Lokesh Vutla
2014-12-10 14:48 ` Felipe Balbi
2014-12-10 14:48 ` Felipe Balbi
2014-12-09 22:27 ` [RFC/PATCH 5/7] arm: omap: hwmod: allow for registration of class-less hwmods Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi
2014-12-10 10:50 ` Lokesh Vutla
2014-12-10 10:50 ` Lokesh Vutla
2014-12-10 14:54 ` Felipe Balbi
2014-12-10 14:54 ` Felipe Balbi
2014-12-11 0:52 ` Sebastian Reichel
2014-12-11 0:52 ` Sebastian Reichel
2014-12-11 14:23 ` Felipe Balbi
2014-12-11 14:23 ` Felipe Balbi
2014-12-11 17:44 ` Sebastian Reichel
2014-12-11 17:44 ` Sebastian Reichel
2014-12-11 17:56 ` Tony Lindgren
2014-12-11 17:56 ` Tony Lindgren
2014-12-11 17:32 ` Tony Lindgren
2014-12-11 17:32 ` Tony Lindgren
2014-12-09 22:27 ` [RFC/PATCH 6/7] arm: boot: dts: am4372: add sysconfig data to all HWMODs Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi
2014-12-09 22:27 ` [RFC/PATCH 7/7] arm: omap: hwmod: 43xx: remove sysc and class data Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi
2014-12-09 22:30 ` [RFC/PATCH 0/7] arm: omap: move more HWMOD data to DT Felipe Balbi
2014-12-09 22:30 ` Felipe Balbi
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=54882522.20002@ti.com \
--to=lokeshvutla@ti.com \
--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 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.