From: Santosh Shilimkar <santosh.shilimkar@ti.com> To: b-cousson@ti.com Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tony@atomide.com, Santosh Shilimkar <santosh.shilimkar@ti.com>, Rajendra Nayak <rnayak@ti.com> Subject: [PATCH v2 10/11] ARM: OMAP2+: hwmod: extract module address space from DT blob Date: Tue, 19 Mar 2013 19:00:56 +0530 [thread overview] Message-ID: <1363699857-5505-11-git-send-email-santosh.shilimkar@ti.com> (raw) In-Reply-To: <1363699857-5505-1-git-send-email-santosh.shilimkar@ti.com> Patch adds the code for extracting the module ocp address space from device tree blob in case the hwmod address space look up fails. The idea is to remove the address space data from hwmod and extract it from DT blob. Cc: Benoit Cousson <b-cousson@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> --- arch/arm/mach-omap2/omap_hwmod.c | 45 +++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index c2c798c..4501038 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -138,6 +138,8 @@ #include <linux/spinlock.h> #include <linux/slab.h> #include <linux/bootmem.h> +#include <linux/of.h> +#include <linux/of_address.h> #include <asm/system_misc.h> @@ -2350,6 +2352,34 @@ static int _shutdown(struct omap_hwmod *oh) } /** + * of_dev_hwmod_lookup - look up needed hwmod from dt blob + * @np: struct device_node * + * @oh: struct omap_hwmod * + * + * Parse the dt blob and find out needed hwmod. Recursive function is + * implemented to take care hierarchical dt blob parsing. + * Return: The device node on success or NULL on failure. + */ +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); + if (!strcmp(p, oh->name)) + return np0; + np1 = of_dev_hwmod_lookup(np0, oh); + if (np1) + return np1; + } + } + return NULL; +} + +/** * _init_mpu_rt_base - populate the virtual address for a hwmod * @oh: struct omap_hwmod * to locate the virtual address * @@ -2361,7 +2391,8 @@ static int _shutdown(struct omap_hwmod *oh) static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) { struct omap_hwmod_addr_space *mem; - void __iomem *va_start; + void __iomem *va_start = NULL; + struct device_node *np; if (!oh) return; @@ -2375,10 +2406,18 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) if (!mem) { pr_debug("omap_hwmod: %s: no MPU register target found\n", oh->name); - return; + + /* Extract the IO space from device tree blob */ + if (!of_have_populated_dt()) + return; + + np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); + if (np) + va_start = of_iomap(np, 0); + } else { + va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); } - va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); if (!va_start) { pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); return; -- 1.7.9.5
WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@ti.com (Santosh Shilimkar) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 10/11] ARM: OMAP2+: hwmod: extract module address space from DT blob Date: Tue, 19 Mar 2013 19:00:56 +0530 [thread overview] Message-ID: <1363699857-5505-11-git-send-email-santosh.shilimkar@ti.com> (raw) In-Reply-To: <1363699857-5505-1-git-send-email-santosh.shilimkar@ti.com> Patch adds the code for extracting the module ocp address space from device tree blob in case the hwmod address space look up fails. The idea is to remove the address space data from hwmod and extract it from DT blob. Cc: Benoit Cousson <b-cousson@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> --- arch/arm/mach-omap2/omap_hwmod.c | 45 +++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index c2c798c..4501038 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -138,6 +138,8 @@ #include <linux/spinlock.h> #include <linux/slab.h> #include <linux/bootmem.h> +#include <linux/of.h> +#include <linux/of_address.h> #include <asm/system_misc.h> @@ -2350,6 +2352,34 @@ static int _shutdown(struct omap_hwmod *oh) } /** + * of_dev_hwmod_lookup - look up needed hwmod from dt blob + * @np: struct device_node * + * @oh: struct omap_hwmod * + * + * Parse the dt blob and find out needed hwmod. Recursive function is + * implemented to take care hierarchical dt blob parsing. + * Return: The device node on success or NULL on failure. + */ +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); + if (!strcmp(p, oh->name)) + return np0; + np1 = of_dev_hwmod_lookup(np0, oh); + if (np1) + return np1; + } + } + return NULL; +} + +/** * _init_mpu_rt_base - populate the virtual address for a hwmod * @oh: struct omap_hwmod * to locate the virtual address * @@ -2361,7 +2391,8 @@ static int _shutdown(struct omap_hwmod *oh) static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) { struct omap_hwmod_addr_space *mem; - void __iomem *va_start; + void __iomem *va_start = NULL; + struct device_node *np; if (!oh) return; @@ -2375,10 +2406,18 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) if (!mem) { pr_debug("omap_hwmod: %s: no MPU register target found\n", oh->name); - return; + + /* Extract the IO space from device tree blob */ + if (!of_have_populated_dt()) + return; + + np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); + if (np) + va_start = of_iomap(np, 0); + } else { + va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); } - va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); if (!va_start) { pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); return; -- 1.7.9.5
next prev parent reply other threads:[~2013-03-19 13:29 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-03-19 13:30 [PATCH v2 00/11] ARM: dts: OMAP5: ocp address space and few updates for 3.10 Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 01/11] ARM: dts: omap5-evm: Update available memory to 2032 MB Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 02/11] ARM: dts: OMAP5: Align the local timer dt node as per the current binding code Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 03/11] ARM: dts: OMAP5: Specify nonsecure PPI IRQ for arch timer Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 04/11] ARM: dts: OMAP5: Move the gic node out of ocp space Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 05/11] ARM: dts: OMAP5: Update the timer and gic nodes for HYP kernel support Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 06/11] ARM: dts: OMAP5: Update keypad reg property Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 07/11] Documentation: dt: OMAP: l3-noc: Add *reg* in required properties Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 08/11] ARM: dts: OMAP4/5: Update l3-noc dt nodes Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 09/11] ARM: dts: OMAP5: Add watchdog timer node Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar [this message] 2013-03-19 13:30 ` [PATCH v2 10/11] ARM: OMAP2+: hwmod: extract module address space from DT blob Santosh Shilimkar 2013-03-19 13:30 ` [PATCH v2 11/11] ARM: OMAP2+: omap_hwmod: Don't call _init_mpu_rt_base if no sysc Santosh Shilimkar 2013-03-19 13:30 ` Santosh Shilimkar 2013-04-11 1:46 ` Jon Hunter 2013-04-11 1:46 ` Jon Hunter 2013-04-12 6:18 ` Hiremath, Vaibhav 2013-04-12 6:18 ` Hiremath, Vaibhav 2013-03-26 14:31 ` [PATCH v2 00/11] ARM: dts: OMAP5: ocp address space and few updates for 3.10 Benoit Cousson 2013-03-26 14:31 ` Benoit Cousson 2013-03-26 14:47 ` Santosh Shilimkar 2013-03-26 14:47 ` Santosh Shilimkar
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=1363699857-5505-11-git-send-email-santosh.shilimkar@ti.com \ --to=santosh.shilimkar@ti.com \ --cc=b-cousson@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=rnayak@ti.com \ --cc=tony@atomide.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: linkBe 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.