From: Felipe Balbi <balbi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
Linux ARM Kernel Mailing List
<linux-arm-kernel@lists.infradead.org>,
Paul Walmsley <paul@pwsan.com>, Nishanth Menon <nm@ti.com>,
devicetree@vger.kernel.org, Felipe Balbi <balbi@ti.com>
Subject: [RFC/PATCH 5/7] arm: omap: hwmod: allow for registration of class-less hwmods
Date: Tue, 9 Dec 2014 16:27:50 -0600 [thread overview]
Message-ID: <1418164072-19087-6-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1418164072-19087-1-git-send-email-balbi@ti.com>
Before this patch, HWMOD requires the existence
of a struct omap_hwmod_class very early. It just
so happens that we're moving that data to DeviceTree
in a follow-up commit so we need to allow the
registration of HWMODs with a valid omap_hwmod_class
pointer.
When the device is built from DT, we will allocate and
populate struct omap_hwmod_class based on DT data.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index cbb908d..2355764 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -504,6 +504,9 @@ static int _set_dmadisable(struct omap_hwmod *oh)
u32 v;
u32 dmadisable_mask;
+ if (!oh->class)
+ return -EINVAL;
+
if (!oh->class->sysc ||
!(oh->class->sysc->sysc_flags & SYSC_HAS_DMADISABLE))
return -EINVAL;
@@ -1843,7 +1846,7 @@ static int _ocp_softreset(struct omap_hwmod *oh)
int c = 0;
int ret = 0;
- if (!oh->class->sysc ||
+ if (!oh->class || !oh->class->sysc ||
!(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET))
return -ENOENT;
@@ -1937,12 +1940,13 @@ static int _reset(struct omap_hwmod *oh)
pr_debug("omap_hwmod: %s: resetting\n", oh->name);
- if (oh->class->reset) {
+ if (oh->class && oh->class->reset) {
r = oh->class->reset(oh);
} else {
if (oh->rst_lines_cnt > 0) {
- for (i = 0; i < oh->rst_lines_cnt; i++)
+ for (i = 0; i < oh->rst_lines_cnt; i++) {
_assert_hardreset(oh, oh->rst_lines[i].name);
+ }
return 0;
} else {
r = _ocp_softreset(oh);
@@ -1958,7 +1962,7 @@ static int _reset(struct omap_hwmod *oh)
* softreset. The _enable() function should be split to avoid
* the rewrite of the OCP_SYSCONFIG register.
*/
- if (oh->class->sysc) {
+ if (oh->class && oh->class->sysc) {
_update_sysc_cache(oh);
_enable_sysc(oh);
}
@@ -2036,7 +2040,7 @@ static int _omap4_get_context_lost(struct omap_hwmod *oh)
*/
static int _enable_preprogram(struct omap_hwmod *oh)
{
- if (!oh->class->enable_preprogram)
+ if (!oh->class || !oh->class->enable_preprogram)
return 0;
return oh->class->enable_preprogram(oh);
@@ -2145,7 +2149,7 @@ static int _enable(struct omap_hwmod *oh)
oh->_state = _HWMOD_STATE_ENABLED;
/* Access the sysconfig only if the target is ready */
- if (oh->class->sysc) {
+ if (oh->class && oh->class->sysc) {
if (!(oh->_int_flags & _HWMOD_SYSCONFIG_LOADED))
_update_sysc_cache(oh);
_enable_sysc(oh);
@@ -2186,7 +2190,7 @@ static int _idle(struct omap_hwmod *oh)
if (_are_all_hardreset_lines_asserted(oh))
return 0;
- if (oh->class->sysc)
+ if (oh->class && oh->class->sysc)
_idle_sysc(oh);
_del_initiator_dep(oh, mpu_oh);
@@ -2244,7 +2248,7 @@ static int _shutdown(struct omap_hwmod *oh)
pr_debug("omap_hwmod: %s: disabling\n", oh->name);
- if (oh->class->pre_shutdown) {
+ if (oh->class && oh->class->pre_shutdown) {
prev_state = oh->_state;
if (oh->_state == _HWMOD_STATE_IDLE)
_enable(oh);
@@ -2256,7 +2260,7 @@ static int _shutdown(struct omap_hwmod *oh)
}
}
- if (oh->class->sysc) {
+ if (oh->class && oh->class->sysc) {
if (oh->_state == _HWMOD_STATE_IDLE)
_enable(oh);
_shutdown_sysc(oh);
@@ -2451,7 +2455,7 @@ static int __init _init(struct omap_hwmod *oh, void *data)
oh->name, np->name);
}
- if (oh->class->sysc) {
+ if (oh->class && oh->class->sysc) {
r = _init_mpu_rt_base(oh, NULL, index, np);
if (r < 0) {
WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
@@ -2684,8 +2688,7 @@ static int __init _setup(struct omap_hwmod *oh, void *data)
*/
static int __init _register(struct omap_hwmod *oh)
{
- if (!oh || !oh->name || !oh->class || !oh->class->name ||
- (oh->_state != _HWMOD_STATE_UNKNOWN))
+ if (!oh || !oh->name || (oh->_state != _HWMOD_STATE_UNKNOWN))
return -EINVAL;
pr_debug("omap_hwmod: %s: registering\n", oh->name);
@@ -3942,6 +3945,9 @@ int omap_hwmod_for_each_by_class(const char *classname,
__func__, classname);
list_for_each_entry(temp_oh, &omap_hwmod_list, node) {
+ if (!temp_oh->class)
+ continue;
+
if (!strcmp(temp_oh->class->name, classname)) {
pr_debug("omap_hwmod: %s: %s: calling callback fn\n",
__func__, temp_oh->name);
--
2.2.0
next prev parent reply other threads:[~2014-12-09 22:27 UTC|newest]
Thread overview: 23+ 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 ` [RFC/PATCH 1/7] arm: omap: hwmod: add debugfs interface Felipe Balbi
2014-12-09 22:27 ` [RFC/PATCH 2/7] arm: omap: devicetree: add new properties for OMAP devices Felipe Balbi
2014-12-10 11:07 ` Lokesh Vutla
2014-12-10 15:00 ` Felipe Balbi
2014-12-11 0:46 ` Sebastian Reichel
2014-12-11 14:21 ` Felipe Balbi
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 ` [RFC/PATCH 4/7] arm: omap: device: add support for generating sysconfig data from DT Felipe Balbi
[not found] ` <1418164072-19087-5-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2014-12-10 10:49 ` Lokesh Vutla
2014-12-10 14:48 ` Felipe Balbi
2014-12-09 22:27 ` Felipe Balbi [this message]
[not found] ` <1418164072-19087-6-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2014-12-10 10:50 ` [RFC/PATCH 5/7] arm: omap: hwmod: allow for registration of class-less hwmods Lokesh Vutla
2014-12-10 14:54 ` Felipe Balbi
2014-12-11 0:52 ` Sebastian Reichel
2014-12-11 14:23 ` Felipe Balbi
2014-12-11 17:44 ` Sebastian Reichel
2014-12-11 17:56 ` 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 ` [RFC/PATCH 7/7] arm: omap: hwmod: 43xx: remove sysc and class data Felipe Balbi
2014-12-09 22:30 ` [RFC/PATCH 0/7] arm: omap: move more HWMOD data to DT 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=1418164072-19087-6-git-send-email-balbi@ti.com \
--to=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=paul@pwsan.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: 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).