From: Omar Ramirez Luna <omar.luna@linaro.org> To: Paul Walmsley <paul@pwsan.com> Cc: Benoit Cousson <b-cousson@ti.com>, Tony Lindgren <tony@atomide.com>, Russell King <linux@arm.linux.org.uk>, Kevin Hilman <khilman@ti.com>, Ohad Ben-Cohen <ohad@wizery.com>, Tomi Valkeinen <tomi.valkeinen@ti.com>, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Omar Ramirez Luna <omar.luna@linaro.org> Subject: [PATCH 1/3] ARM: OMAP: hwmod: partially un-reset hwmods might not be properly enabled Date: Mon, 16 Jul 2012 14:21:23 -0500 [thread overview] Message-ID: <1342466485-1050-2-git-send-email-omar.luna@linaro.org> (raw) In-Reply-To: <1342466485-1050-1-git-send-email-omar.luna@linaro.org> Some IP blocks might not be using/controlling more than one reset line, this check loosens the restriction to fully use hwmod framework for those drivers. E.g.: ipu has reset lines: mmu_cache, cpu0 and cpu1. - cpu1 might not be used and hence (with previous check) won't be fully enabled by hwmod code. While at it, prevent _omap4_module_disable if all the hardreset lines on an IP block are not under reset. Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org> --- arch/arm/mach-omap2/omap_hwmod.c | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 3215dad..091c199 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1558,25 +1558,28 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name) } /** - * _are_any_hardreset_lines_asserted - return true if part of @oh is hard-reset + * _are_all_hardreset_lines_asserted - return true if the @oh is hard-reset * @oh: struct omap_hwmod * * - * If any hardreset line associated with @oh is asserted, then return true. - * Otherwise, if @oh has no hardreset lines associated with it, or if - * no hardreset lines associated with @oh are asserted, then return false. + * If all hardreset lines associated with @oh are asserted, then return true. + * Otherwise, if part of @oh is out hardreset or if no hardreset lines + * associated with @oh are asserted, then return false. * This function is used to avoid executing some parts of the IP block - * enable/disable sequence if a hardreset line is set. + * enable/disable sequence if its hardreset line is set. */ -static bool _are_any_hardreset_lines_asserted(struct omap_hwmod *oh) +static bool _are_all_hardreset_lines_asserted(struct omap_hwmod *oh) { - int i; + int i, rst_cnt = 0; if (oh->rst_lines_cnt == 0) return false; for (i = 0; i < oh->rst_lines_cnt; i++) if (_read_hardreset(oh, oh->rst_lines[i].name) > 0) - return true; + rst_cnt++; + + if (oh->rst_lines_cnt == rst_cnt) + return true; return false; } @@ -1595,6 +1598,13 @@ static int _omap4_disable_module(struct omap_hwmod *oh) if (!oh->clkdm || !oh->prcm.omap4.modulemode) return -EINVAL; + /* + * Since integration code might still be doing something, only + * disable if all lines are under hardreset. + */ + if (!_are_all_hardreset_lines_asserted(oh)) + return 0; + pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__); omap4_cminst_module_disable(oh->clkdm->prcm_partition, @@ -1602,9 +1612,6 @@ static int _omap4_disable_module(struct omap_hwmod *oh) oh->clkdm->clkdm_offs, oh->prcm.omap4.clkctrl_offs); - if (_are_any_hardreset_lines_asserted(oh)) - return 0; - v = _omap4_wait_target_disable(oh); if (v) pr_warn("omap_hwmod: %s: _wait_target_disable failed\n", @@ -1830,7 +1837,7 @@ static int _enable(struct omap_hwmod *oh) } /* - * If an IP block contains HW reset lines and any of them are + * If an IP block contains HW reset lines and all of them are * asserted, we let integration code associated with that * block handle the enable. We've received very little * information on what those driver authors need, and until @@ -1838,7 +1845,7 @@ static int _enable(struct omap_hwmod *oh) * posted to the public lists, this is probably the best we * can do. */ - if (_are_any_hardreset_lines_asserted(oh)) + if (_are_all_hardreset_lines_asserted(oh)) return 0; /* Mux pins for device runtime if populated */ @@ -1918,7 +1925,7 @@ static int _idle(struct omap_hwmod *oh) return -EINVAL; } - if (_are_any_hardreset_lines_asserted(oh)) + if (_are_all_hardreset_lines_asserted(oh)) return 0; if (oh->class->sysc) @@ -2006,7 +2013,7 @@ static int _shutdown(struct omap_hwmod *oh) return -EINVAL; } - if (_are_any_hardreset_lines_asserted(oh)) + if (_are_all_hardreset_lines_asserted(oh)) return 0; pr_debug("omap_hwmod: %s: disabling\n", oh->name); -- 1.7.4.1
WARNING: multiple messages have this Message-ID (diff)
From: omar.luna@linaro.org (Omar Ramirez Luna) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] ARM: OMAP: hwmod: partially un-reset hwmods might not be properly enabled Date: Mon, 16 Jul 2012 14:21:23 -0500 [thread overview] Message-ID: <1342466485-1050-2-git-send-email-omar.luna@linaro.org> (raw) In-Reply-To: <1342466485-1050-1-git-send-email-omar.luna@linaro.org> Some IP blocks might not be using/controlling more than one reset line, this check loosens the restriction to fully use hwmod framework for those drivers. E.g.: ipu has reset lines: mmu_cache, cpu0 and cpu1. - cpu1 might not be used and hence (with previous check) won't be fully enabled by hwmod code. While at it, prevent _omap4_module_disable if all the hardreset lines on an IP block are not under reset. Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org> --- arch/arm/mach-omap2/omap_hwmod.c | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 3215dad..091c199 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1558,25 +1558,28 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name) } /** - * _are_any_hardreset_lines_asserted - return true if part of @oh is hard-reset + * _are_all_hardreset_lines_asserted - return true if the @oh is hard-reset * @oh: struct omap_hwmod * * - * If any hardreset line associated with @oh is asserted, then return true. - * Otherwise, if @oh has no hardreset lines associated with it, or if - * no hardreset lines associated with @oh are asserted, then return false. + * If all hardreset lines associated with @oh are asserted, then return true. + * Otherwise, if part of @oh is out hardreset or if no hardreset lines + * associated with @oh are asserted, then return false. * This function is used to avoid executing some parts of the IP block - * enable/disable sequence if a hardreset line is set. + * enable/disable sequence if its hardreset line is set. */ -static bool _are_any_hardreset_lines_asserted(struct omap_hwmod *oh) +static bool _are_all_hardreset_lines_asserted(struct omap_hwmod *oh) { - int i; + int i, rst_cnt = 0; if (oh->rst_lines_cnt == 0) return false; for (i = 0; i < oh->rst_lines_cnt; i++) if (_read_hardreset(oh, oh->rst_lines[i].name) > 0) - return true; + rst_cnt++; + + if (oh->rst_lines_cnt == rst_cnt) + return true; return false; } @@ -1595,6 +1598,13 @@ static int _omap4_disable_module(struct omap_hwmod *oh) if (!oh->clkdm || !oh->prcm.omap4.modulemode) return -EINVAL; + /* + * Since integration code might still be doing something, only + * disable if all lines are under hardreset. + */ + if (!_are_all_hardreset_lines_asserted(oh)) + return 0; + pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__); omap4_cminst_module_disable(oh->clkdm->prcm_partition, @@ -1602,9 +1612,6 @@ static int _omap4_disable_module(struct omap_hwmod *oh) oh->clkdm->clkdm_offs, oh->prcm.omap4.clkctrl_offs); - if (_are_any_hardreset_lines_asserted(oh)) - return 0; - v = _omap4_wait_target_disable(oh); if (v) pr_warn("omap_hwmod: %s: _wait_target_disable failed\n", @@ -1830,7 +1837,7 @@ static int _enable(struct omap_hwmod *oh) } /* - * If an IP block contains HW reset lines and any of them are + * If an IP block contains HW reset lines and all of them are * asserted, we let integration code associated with that * block handle the enable. We've received very little * information on what those driver authors need, and until @@ -1838,7 +1845,7 @@ static int _enable(struct omap_hwmod *oh) * posted to the public lists, this is probably the best we * can do. */ - if (_are_any_hardreset_lines_asserted(oh)) + if (_are_all_hardreset_lines_asserted(oh)) return 0; /* Mux pins for device runtime if populated */ @@ -1918,7 +1925,7 @@ static int _idle(struct omap_hwmod *oh) return -EINVAL; } - if (_are_any_hardreset_lines_asserted(oh)) + if (_are_all_hardreset_lines_asserted(oh)) return 0; if (oh->class->sysc) @@ -2006,7 +2013,7 @@ static int _shutdown(struct omap_hwmod *oh) return -EINVAL; } - if (_are_any_hardreset_lines_asserted(oh)) + if (_are_all_hardreset_lines_asserted(oh)) return 0; pr_debug("omap_hwmod: %s: disabling\n", oh->name); -- 1.7.4.1
next prev parent reply other threads:[~2012-07-16 19:21 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-07-16 19:21 [PATCH 0/3] OMAP: hwmod: reset API proposal Omar Ramirez Luna 2012-07-16 19:21 ` Omar Ramirez Luna 2012-07-16 19:21 ` Omar Ramirez Luna [this message] 2012-07-16 19:21 ` [PATCH 1/3] ARM: OMAP: hwmod: partially un-reset hwmods might not be properly enabled Omar Ramirez Luna 2012-08-20 14:49 ` Benoit Cousson 2012-08-20 14:49 ` Benoit Cousson 2012-08-20 14:49 ` Benoit Cousson 2012-08-21 1:13 ` Omar Ramirez Luna 2012-08-21 1:13 ` Omar Ramirez Luna 2012-08-21 17:48 ` Omar Ramirez Luna 2012-08-21 17:48 ` Omar Ramirez Luna 2012-07-16 19:21 ` [PATCH 2/3] ARM: OMAP: hwmod: revise deassert sequence Omar Ramirez Luna 2012-07-16 19:21 ` Omar Ramirez Luna 2012-08-02 7:52 ` Paul Walmsley 2012-08-02 7:52 ` Paul Walmsley 2012-08-02 22:20 ` Omar Ramirez Luna 2012-08-02 22:20 ` Omar Ramirez Luna 2012-08-03 5:24 ` Vaibhav Hiremath 2012-08-03 5:24 ` Vaibhav Hiremath 2012-08-03 5:24 ` Vaibhav Hiremath 2012-08-03 15:52 ` Omar Ramirez Luna 2012-08-03 15:52 ` Omar Ramirez Luna 2012-08-20 10:21 ` Benoit Cousson 2012-08-20 10:21 ` Benoit Cousson 2012-08-20 10:21 ` Benoit Cousson 2012-08-21 1:15 ` Omar Ramirez Luna 2012-08-21 1:15 ` Omar Ramirez Luna 2012-07-16 19:21 ` [PATCH 3/3] ARM: OMAP: omap_device: expose hwmod assert/deassert to omap devices Omar Ramirez Luna 2012-07-16 19:21 ` Omar Ramirez Luna 2012-08-02 7:43 ` Paul Walmsley 2012-08-02 7:43 ` Paul Walmsley 2012-08-02 17:56 ` Omar Ramirez Luna 2012-08-02 17:56 ` Omar Ramirez Luna -- strict thread matches above, loose matches on Subject: below -- 2012-06-16 1:54 [PATCH 0/3] OMAP: hwmod: reset API proposal Omar Ramirez Luna 2012-06-16 1:54 ` [PATCH 1/3] ARM: OMAP: hwmod: partially un-reset hwmods might not be properly enabled Omar Ramirez Luna 2012-06-16 1:54 ` Omar Ramirez Luna
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=1342466485-1050-2-git-send-email-omar.luna@linaro.org \ --to=omar.luna@linaro.org \ --cc=b-cousson@ti.com \ --cc=khilman@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=linux@arm.linux.org.uk \ --cc=ohad@wizery.com \ --cc=paul@pwsan.com \ --cc=tomi.valkeinen@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.