linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette@ti.com>
To: linux@arm.linux.org.uk
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	khilman@ti.com, tony@atomide.com, b-cousson@ti.com,
	rnayak@ti.com, jeremy.kerr@canonical.com, paul@pwsan.com,
	broonie@opensource.wolfsonmicro.com, tglx@linutronix.de,
	linus.walleij@stericsson.com, amit.kucheria@linaro.org,
	dsaxena@linaro.org, patches@linaro.org,
	linaro-dev@lists.linaro.org, grant.likely@secretlab.ca,
	sboyd@quicinc.com, shawn.guo@freescale.com, skannan@quicinc.com,
	magnus.damm@gmail.com, arnd.bergmann@linaro.org,
	eric.miao@linaro.org, richard.zhao@linaro.org,
	mturquette@linaro.org, mturquette@ti.com, andrew@lunn.ch
Subject: [PATCH 4/7] omap: hwmod: convert to use common struct clk
Date: Tue, 13 Dec 2011 20:11:55 -0800	[thread overview]
Message-ID: <1323835918-2371-5-git-send-email-mturquette@ti.com> (raw)
In-Reply-To: <1323835918-2371-1-git-send-email-mturquette@ti.com>

hwmod functions implicitly deal with hardware clks and must be updated
to support the new common struct clk and accompanying functions.

Changes in this patch include adding clk_prepare/clk_unprepare to hwmod
as well as using struct clk_hw_omap instead of the old OMAP-specific
struct clk.

Signed-off-by: Mike Turquette <mturquette@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |   54 ++++++++++++++++++++++++++++---------
 1 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 207a2ff..3e533c7 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -465,13 +465,19 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
  */
 static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
 {
+	struct clk_hw_omap *oclk;
+	struct clk_hw_omap *init_oclk;
+
 	if (!oh->_clk)
 		return -EINVAL;
 
-	if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS)
+	oclk = to_clk_hw_omap(oh->_clk);
+	init_oclk = to_clk_hw_omap(init_oh->_clk);
+
+	if (oclk->clkdm && oclk->clkdm->flags & CLKDM_NO_AUTODEPS)
 		return 0;
 
-	return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm);
+	return clkdm_add_sleepdep(oclk->clkdm, init_oclk->clkdm);
 }
 
 /**
@@ -489,13 +495,19 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
  */
 static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
 {
+	struct clk_hw_omap *oclk;
+	struct clk_hw_omap *init_oclk;
+
 	if (!oh->_clk)
 		return -EINVAL;
 
-	if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS)
+	oclk = to_clk_hw_omap(oh->_clk);
+	init_oclk = to_clk_hw_omap(init_oh->_clk);
+
+	if (oclk->clkdm && oclk->clkdm->flags & CLKDM_NO_AUTODEPS)
 		return 0;
 
-	return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm);
+	return clkdm_del_sleepdep(oclk->clkdm, init_oclk->clkdm);
 }
 
 /**
@@ -509,10 +521,12 @@ static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
 static int _init_main_clk(struct omap_hwmod *oh)
 {
 	int ret = 0;
+	struct clk_hw_omap *oclk;
 
 	if (!oh->main_clk)
 		return 0;
 
+	/* FIXME replace with common clk get_clk_by_name() */
 	oh->_clk = omap_clk_get_by_name(oh->main_clk);
 	if (!oh->_clk) {
 		pr_warning("omap_hwmod: %s: cannot clk_get main_clk %s\n",
@@ -520,7 +534,9 @@ static int _init_main_clk(struct omap_hwmod *oh)
 		return -EINVAL;
 	}
 
-	if (!oh->_clk->clkdm)
+	oclk = to_clk_hw_omap(oh->_clk);
+
+	if (!oclk->clkdm)
 		pr_warning("omap_hwmod: %s: missing clockdomain for %s.\n",
 			   oh->main_clk, oh->_clk->name);
 
@@ -601,16 +617,20 @@ static int _enable_clocks(struct omap_hwmod *oh)
 
 	pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name);
 
-	if (oh->_clk)
+	if (oh->_clk) {
+		clk_prepare(oh->_clk);
 		clk_enable(oh->_clk);
+	}
 
 	if (oh->slaves_cnt > 0) {
 		for (i = 0; i < oh->slaves_cnt; i++) {
 			struct omap_hwmod_ocp_if *os = oh->slaves[i];
 			struct clk *c = os->_clk;
 
-			if (c && (os->flags & OCPIF_SWSUP_IDLE))
+			if (c && (os->flags & OCPIF_SWSUP_IDLE)) {
+				clk_prepare(c);
 				clk_enable(c);
+			}
 		}
 	}
 
@@ -631,16 +651,20 @@ static int _disable_clocks(struct omap_hwmod *oh)
 
 	pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name);
 
-	if (oh->_clk)
+	if (oh->_clk) {
 		clk_disable(oh->_clk);
+		clk_unprepare(oh->_clk);
+	}
 
 	if (oh->slaves_cnt > 0) {
 		for (i = 0; i < oh->slaves_cnt; i++) {
 			struct omap_hwmod_ocp_if *os = oh->slaves[i];
 			struct clk *c = os->_clk;
 
-			if (c && (os->flags & OCPIF_SWSUP_IDLE))
+			if (c && (os->flags & OCPIF_SWSUP_IDLE)) {
 				clk_disable(c);
+				clk_unprepare(c);
+			}
 		}
 	}
 
@@ -660,6 +684,7 @@ static void _enable_optional_clocks(struct omap_hwmod *oh)
 		if (oc->_clk) {
 			pr_debug("omap_hwmod: enable %s:%s\n", oc->role,
 				 oc->_clk->name);
+			clk_prepare(oc->_clk);
 			clk_enable(oc->_clk);
 		}
 }
@@ -676,6 +701,7 @@ static void _disable_optional_clocks(struct omap_hwmod *oh)
 			pr_debug("omap_hwmod: disable %s:%s\n", oc->role,
 				 oc->_clk->name);
 			clk_disable(oc->_clk);
+			clk_unprepare(oc->_clk);
 		}
 }
 
@@ -1697,6 +1723,7 @@ static int _setup(struct omap_hwmod *oh, void *data)
 				/* XXX omap_iclk_deny_idle(c); */
 			} else {
 				/* XXX omap_iclk_allow_idle(c); */
+				clk_prepare(c);
 				clk_enable(c);
 			}
 		}
@@ -1995,8 +2022,6 @@ int __init omap_hwmod_setup_one(const char *oh_name)
 	struct omap_hwmod *oh;
 	int r;
 
-	pr_debug("omap_hwmod: %s: %s\n", oh_name, __func__);
-
 	if (!mpu_oh) {
 		pr_err("omap_hwmod: %s: cannot setup_one: MPU initiator hwmod %s not yet registered\n",
 		       oh_name, MPU_INITIATOR_NAME);
@@ -2304,6 +2329,7 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
 struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
 {
 	struct clk *c;
+	struct clk_hw_omap *oclk;
 
 	if (!oh)
 		return NULL;
@@ -2316,10 +2342,12 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
 		c = oh->slaves[oh->_mpu_port_index]->_clk;
 	}
 
-	if (!c->clkdm)
+	oclk = to_clk_hw_omap(oh->_clk);
+
+	if (!oclk->clkdm)
 		return NULL;
 
-	return c->clkdm->pwrdm.ptr;
+	return oclk->clkdm->pwrdm.ptr;
 
 }
 
-- 
1.7.5.4


  parent reply	other threads:[~2011-12-14  4:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14  4:11 [PATCH 0/7] RFC: convert OMAP to common struct clk Mike Turquette
2011-12-14  4:11 ` [PATCH 1/7] OMAP: Kconfig: select GENERIC_CLK Mike Turquette
2011-12-14  4:11 ` [PATCH 2/7] HACK: omap4: clk: convert to common struct clk Mike Turquette
     [not found] ` <1323835918-2371-1-git-send-email-mturquette-l0cyMroinI0@public.gmane.org>
2011-12-14  4:11   ` [PATCH 3/7] HACK: omap: convert 44xx data " Mike Turquette
2011-12-14  4:27     ` Paul Walmsley
2011-12-14  4:44       ` Turquette, Mike
2011-12-14  5:29         ` Paul Walmsley
2011-12-14  4:11 ` Mike Turquette [this message]
2011-12-14  4:11 ` [PATCH 5/7] omap: panda: use clk_prepare in ehci init Mike Turquette
2011-12-14  4:11 ` [PATCH 6/7] omap: dss: use clk_prepare in dss reset Mike Turquette
2011-12-14  4:11 ` [PATCH 7/7] HACK: comment WARN_ON in _clkdm_clk_hwmod_disable Mike Turquette

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=1323835918-2371-5-git-send-email-mturquette@ti.com \
    --to=mturquette@ti.com \
    --cc=amit.kucheria@linaro.org \
    --cc=andrew@lunn.ch \
    --cc=arnd.bergmann@linaro.org \
    --cc=b-cousson@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dsaxena@linaro.org \
    --cc=eric.miao@linaro.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jeremy.kerr@canonical.com \
    --cc=khilman@ti.com \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=magnus.damm@gmail.com \
    --cc=mturquette@linaro.org \
    --cc=patches@linaro.org \
    --cc=paul@pwsan.com \
    --cc=richard.zhao@linaro.org \
    --cc=rnayak@ti.com \
    --cc=sboyd@quicinc.com \
    --cc=shawn.guo@freescale.com \
    --cc=skannan@quicinc.com \
    --cc=tglx@linutronix.de \
    --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).