public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <paul@pwsan.com>
To: linux-omap@vger.kernel.org
Cc: Paul Walmsley <paul@pwsan.com>
Subject: [PATCH v2 06/11] OMAP2/3 clock: use symbolic constants in omap2_clk_wait_ready()
Date: Thu, 18 Sep 2008 11:47:09 -0600	[thread overview]
Message-ID: <20080918174706.7146.13322.stgit@localhost.localdomain> (raw)
In-Reply-To: <20080918174432.7146.21366.stgit@localhost.localdomain>

Convert the bare constants in the register arithmetic in
omap2_clk_wait_ready() to use meaningful symbolic names.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/clock.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 2bdd587..ebf2d7e 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -65,6 +65,13 @@
 #define ST_CORE_CLK_REF			0x1
 #define ST_CORE_CLK_32K			0x3
 
+/* Bitmask to isolate the register type of clk.enable_reg */
+#define PRCM_REGTYPE_MASK		0xf0
+/* various CM register type options */
+#define CM_FCLKEN_REGTYPE		0x00
+#define CM_ICLKEN_REGTYPE		0x10
+#define CM_IDLEST_REGTYPE		0x20
+
 u8 cpu_mask;
 
 /*-------------------------------------------------------------------------
@@ -301,12 +308,13 @@ static void omap2_clk_wait_ready(struct clk *clk)
 	prcm_mod = reg & ~0xff;
 	prcm_regid = reg & 0xff;
 
+	other_reg = reg & ~PRCM_REGTYPE_MASK;
+
+	/* If we are enabling an fclk, also test the iclk; and vice versa */
 	if (prcm_regid >= CM_FCLKEN1 && prcm_regid <= OMAP24XX_CM_FCLKEN2)
-		other_reg = ((reg & ~0xf0) | 0x10); /* CM_ICLKEN* */
-	else if (prcm_regid >= CM_ICLKEN1 && prcm_regid <= OMAP24XX_CM_ICLKEN4)
-		other_reg = ((reg & ~0xf0) | 0x00); /* CM_FCLKEN* */
+		other_reg |= CM_ICLKEN_REGTYPE;
 	else
-		return;
+		other_reg |= CM_FCLKEN_REGTYPE;
 
 	/* Covers most of the cases - a few exceptions are below */
 	other_bit = 1 << clk->enable_bit;
@@ -377,7 +385,8 @@ static void omap2_clk_wait_ready(struct clk *clk)
 	if (!(__raw_readl((void __iomem *)other_reg) & other_bit))
 		return;
 
-	idlest_reg = ((other_reg & ~0xf0) | 0x20); /* CM_IDLEST* */
+	idlest_reg = other_reg & ~PRCM_REGTYPE_MASK;
+	idlest_reg |= CM_IDLEST_REGTYPE;
 
 	omap2_wait_clock_ready((void __iomem *)idlest_reg, idlest_bit,
 			       clk->name);



  parent reply	other threads:[~2008-09-18 17:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 17:46 [PATCH v2 00/11] OMAP2/3 clock: encode prcm_mod for each struct clk Paul Walmsley
2008-09-18 17:46 ` [PATCH v2 01/11] OMAP3 clock: split mcbspX_src_fck from mcbspX_fck Paul Walmsley
2008-09-18 17:46 ` [PATCH v2 02/11] OMAP2/3 clock: shorten some variable names in clock.c for legibility Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 03/11] OMAP2 clock: add clk.prcm_mod field; annotate OMAP2xxx clocks Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 04/11] OMAP3 clock: add "prcm_mod" field to OMAP3xxx clocks Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 05/11] OMAP2/3 clock: add _omap2_clk_{read,write}_reg() Paul Walmsley
2008-09-18 17:47 ` Paul Walmsley [this message]
2008-09-18 17:47 ` [PATCH v2 07/11] OMAP2/3 clock: use prcm_mod field in omap2_clk_wait_ready() Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 08/11] OMAP2/3 clock: convert omap2_wait_clock_ready() to use clk.prcm_mod Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 09/11] OMAP2/3 clock: remove omap2_get_clksel() Paul Walmsley
2008-09-18 17:47 ` [PATCH v2 10/11] OMAP2/3 clock: simplify omap2_clksel_get_src_field() 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=20080918174706.7146.13322.stgit@localhost.localdomain \
    --to=paul@pwsan.com \
    --cc=linux-omap@vger.kernel.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