linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: paul@pwsan.com (Paul Walmsley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/8] OMAP2 clock: APLL code shouldn't rely on static clocks in its local namespace
Date: Thu, 03 Dec 2009 03:07:03 -0700	[thread overview]
Message-ID: <20091203100702.1203.96130.stgit@localhost.localdomain> (raw)
In-Reply-To: <20091203095830.1203.76290.stgit@localhost.localdomain>

Similar to the previous patch, the APLL code relied on the presence of the
static struct clks in its own namespace.  The APLL code didn't use them for
validation, however - it adjusted its own internal state depending on
the struct clk * that called it.  Now that static struct clks are
leaving the clock24xx.c namespace, use a more durable method: split the
omap2_clk_fixed_enable() function into omap2_clk_apll96_enable() and
omap2_clk_apll54_enable().  They still share a disable function.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/clock24xx.c |   35 +++++++++++++++++++++++------------
 arch/arm/mach-omap2/clock24xx.h |    4 ++--
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index 8ecd175..e60d1c0 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -42,7 +42,8 @@
 #include "cm-regbits-24xx.h"
 
 static const struct clkops clkops_oscck;
-static const struct clkops clkops_fixed;
+static const struct clkops clkops_apll96;
+static const struct clkops clkops_apll54;
 
 static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
 					   void __iomem **idlest_reg,
@@ -338,7 +339,7 @@ static void omap2_sys_clk_recalc(struct clk * clk)
 #endif	/* OLD_CK */
 
 /* Enable an APLL if off */
-static int omap2_clk_fixed_enable(struct clk *clk)
+static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask)
 {
 	u32 cval, apll_mask;
 
@@ -353,12 +354,7 @@ static int omap2_clk_fixed_enable(struct clk *clk)
 	cval |= apll_mask;
 	cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
 
-	if (clk == &apll96_ck)
-		cval = OMAP24XX_ST_96M_APLL;
-	else if (clk == &apll54_ck)
-		cval = OMAP24XX_ST_54M_APLL;
-
-	omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), cval,
+	omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), status_mask,
 			     clk->name);
 
 	/*
@@ -368,8 +364,18 @@ static int omap2_clk_fixed_enable(struct clk *clk)
 	return 0;
 }
 
+static int omap2_clk_apll96_enable(struct clk *clk)
+{
+	return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL);
+}
+
+static int omap2_clk_apll54_enable(struct clk *clk)
+{
+	return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL);
+}
+
 /* Stop APLL */
-static void omap2_clk_fixed_disable(struct clk *clk)
+static void omap2_clk_apll_disable(struct clk *clk)
 {
 	u32 cval;
 
@@ -378,9 +384,14 @@ static void omap2_clk_fixed_disable(struct clk *clk)
 	cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
 }
 
-static const struct clkops clkops_fixed = {
-	.enable		= &omap2_clk_fixed_enable,
-	.disable	= &omap2_clk_fixed_disable,
+static const struct clkops clkops_apll96 = {
+	.enable		= &omap2_clk_apll96_enable,
+	.disable	= &omap2_clk_apll_disable,
+};
+
+static const struct clkops clkops_apll54 = {
+	.enable		= &omap2_clk_apll54_enable,
+	.disable	= &omap2_clk_apll_disable,
 };
 
 /*
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index d19cf7a..21238d1 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -708,7 +708,7 @@ static struct clk dpll_ck = {
 
 static struct clk apll96_ck = {
 	.name		= "apll96_ck",
-	.ops		= &clkops_fixed,
+	.ops		= &clkops_apll96,
 	.parent		= &sys_ck,
 	.rate		= 96000000,
 	.flags		= RATE_FIXED | ENABLE_ON_INIT,
@@ -719,7 +719,7 @@ static struct clk apll96_ck = {
 
 static struct clk apll54_ck = {
 	.name		= "apll54_ck",
-	.ops		= &clkops_fixed,
+	.ops		= &clkops_apll54,
 	.parent		= &sys_ck,
 	.rate		= 54000000,
 	.flags		= RATE_FIXED | ENABLE_ON_INIT,

  parent reply	other threads:[~2009-12-03 10:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 10:06 [PATCH 0/8] OMAP clock: convert static definitions in header files to C files Paul Walmsley
2009-12-03 10:07 ` [PATCH 1/8] OMAP1/2/3 clock: remove paranoid checks in preparation for clock{, 2xxx, 3xxx}_data.c Paul Walmsley
2009-12-03 10:07 ` Paul Walmsley [this message]
2009-12-03 10:07 ` [PATCH 3/8] OMAP2/3: move SDRC macros to mach-omap2/sdrc.h Paul Walmsley
2009-12-03 10:07 ` [PATCH 5/8] OMAP3 clock: convert clock34xx.h to clock34xx_data.c Paul Walmsley
2009-12-03 10:07 ` [PATCH 4/8] OMAP2xxx clock: remove implicit dependency between rate CPU flag and clkdev_omap CPU flag Paul Walmsley
2009-12-03 10:07 ` [PATCH 6/8] OMAP2 clock: convert clock24xx.h to clock2xxx_data.c, opp2xxx* Paul Walmsley
2009-12-03 10:07 ` [PATCH 7/8] OMAP1 clock: convert test in disable_unused() to use ENABLE_ON_INIT Paul Walmsley
2009-12-03 10:07 ` [PATCH 8/8] OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c Paul Walmsley
2009-12-03 10:27   ` Russell King
2009-12-03 10:36     ` Paul Walmsley
2009-12-03 10:43       ` Russell King - ARM Linux
2009-12-03 10:57         ` Paul Walmsley
2009-12-03 11:22           ` [PATCH v2 5/8] OMAP3 clock: convert clock34xx.h to clock34xx_data.c Paul Walmsley
2009-12-03 11:23           ` [PATCH v2 6/8] OMAP2 clock: convert clock24xx.h to clock2xxx_data.c, opp2xxx* Paul Walmsley
2009-12-03 11:24           ` [PATCH v2 8/8] OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c Paul Walmsley
2009-12-03 12:11             ` Russell King - ARM Linux
2009-12-03 12:33               ` Paul Walmsley
2009-12-03 15:03                 ` Russell King - ARM Linux
2009-12-03 15:26                   ` Paul Walmsley
2009-12-03 16:18                     ` [PATCH v3 5/8] OMAP3 clock: convert clock34xx.h to clock34xx_data.c Paul Walmsley
2009-12-03 16:19                     ` [PATCH v3 6/8] OMAP2 clock: convert clock24xx.h to clock2xxx_data.c, opp2xxx* Paul Walmsley
2009-12-03 16:20                     ` [PATCH v3 8/8] OMAP1 clock: convert mach-omap1/clock.h to mach-omap1/clock_data.c Paul Walmsley
2009-12-03 10:29   ` [PATCH " Russell King
2009-12-03 10:37     ` Paul Walmsley
2009-12-03 10:41       ` Russell King - ARM Linux
2009-12-04 10:05 ` [PATCH 0/8] OMAP clock: convert static definitions in header files to C files Nayak, Rajendra
2009-12-04 10:13   ` Russell King - ARM Linux
2009-12-07 12:58   ` Paul Walmsley

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=20091203100702.1203.96130.stgit@localhost.localdomain \
    --to=paul@pwsan.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 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).