public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <paul@pwsan.com>
To: linux-arm-kernel@lists.arm.linux.org.uk, linux-kernel@vger.kernel.org
Cc: linux-omap@vger.kernel.org, Paul Walmsley <paul@pwsan.com>,
	Tony Lindgren <tony@atomide.com>
Subject: [PATCH D 07/11] OMAP2/3 clock: add _omap2_clk_{read,write}_reg()
Date: Wed, 28 Jan 2009 12:18:36 -0700	[thread overview]
Message-ID: <20090128191833.16688.37564.stgit@localhost.localdomain> (raw)
In-Reply-To: <20090128191638.16688.33452.stgit@localhost.localdomain>

Create new static functions to read/write registers used in the struct
clk, _omap2_clk_{read,write}_reg().  A subsequent patch will use these
to ensure the correct register read/write instruction is used, which depends
on whether the clock registers are in the CM, PRM, or SCM.

linux-omap source commit is 2d8ea5c30f091efa6258f5c9dac292835cd36412.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/clock.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 185e1b7..1662d85 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -28,6 +28,7 @@
 #include <mach/clockdomain.h>
 #include <mach/cpu.h>
 #include <mach/prcm.h>
+#include <mach/control.h>
 #include <asm/div64.h>
 
 #include "memory.h"
@@ -76,6 +77,42 @@ u8 cpu_mask;
  *-------------------------------------------------------------------------*/
 
 /*
+ * _omap2_clk_read_reg - read a clock register
+ * @clk: struct clk *
+ *
+ * Given a struct clk *, returns the value of the clock's register.
+ */
+static u32 _omap2_clk_read_reg(u16 reg_offset, struct clk *clk)
+{
+	if (clk->prcm_mod & CLK_REG_IN_SCM)
+		return omap_ctrl_readl(reg_offset);
+	else if (clk->prcm_mod & CLK_REG_IN_PRM)
+		return prm_read_mod_reg(clk->prcm_mod & PRCM_MOD_ADDR_MASK,
+					reg_offset);
+	else
+		return cm_read_mod_reg(clk->prcm_mod, reg_offset);
+}
+
+/*
+ * _omap2_clk_write_reg - write a clock's register
+ * @v: value to write to the clock's enable_reg
+ * @clk: struct clk *
+ *
+ * Given a register value @v and struct clk * @clk, writes the value of @v to
+ * the clock's enable register.  No return value.
+ */
+static void _omap2_clk_write_reg(u32 v, u16 reg_offset, struct clk *clk)
+{
+	if (clk->prcm_mod & CLK_REG_IN_SCM)
+		omap_ctrl_writel(v, reg_offset);
+	else if (clk->prcm_mod & CLK_REG_IN_PRM)
+		prm_write_mod_reg(v, clk->prcm_mod & PRCM_MOD_ADDR_MASK,
+				  reg_offset);
+	else
+		cm_write_mod_reg(v, clk->prcm_mod, reg_offset);
+}
+
+/*
  * _dpll_test_fint - test whether an Fint value is valid for the DPLL
  * @clk: DPLL struct clk to test
  * @n: divider value (N) to test



  parent reply	other threads:[~2009-01-28 20:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 19:18 [PATCH D 00/11] OMAP clock, D of F: clock code cleanup Paul Walmsley
2009-01-28 19:18 ` [PATCH D 01/11] OMAP: Add clk_get_parent() for OMAP2/3 Paul Walmsley
2009-01-29 11:00   ` Russell King - ARM Linux
2009-01-30  6:29     ` Paul Walmsley
2009-01-31 14:23       ` Russell King - ARM Linux
2009-01-31 15:07         ` Måns Rullgård
2009-01-31 15:26           ` Russell King - ARM Linux
2009-01-31 15:39             ` Måns Rullgård
2009-01-31 15:56               ` Russell King - ARM Linux
2009-01-31 16:51                 ` Måns Rullgård
2009-01-28 19:18 ` [PATCH D 02/11] OMAP2/3 clock: clean up mach-omap2/clock.c Paul Walmsley
2009-01-28 19:18 ` [PATCH D 03/11] OMAP2 PRCM: clean up CM_IDLEST bits Paul Walmsley
2009-01-28 19:18 ` [PATCH D 04/11] OMAP3 clock: split mcbspX_src_fck from mcbspX_fck Paul Walmsley
2009-01-28 19:18 ` [PATCH D 05/11] OMAP2 clock: add clk.prcm_mod field; annotate OMAP2xxx clocks Paul Walmsley
2009-01-28 19:18 ` [PATCH D 06/11] OMAP3 clock: add "prcm_mod" field to OMAP3xxx clocks Paul Walmsley
2009-01-28 19:18 ` Paul Walmsley [this message]
2009-01-28 19:18 ` [PATCH D 08/11] OMAP2/3 clock: use clk->prcm_mod for all struct clk register addressing Paul Walmsley
2009-01-28 19:18 ` [PATCH D 09/11] OMAP2/3 clock: encode target IDLEST bits Paul Walmsley
2009-01-28 19:18 ` [PATCH D 10/11] OMAP2/3 clock: clean up omap2_clk_wait_ready() Paul Walmsley
2009-01-28 19:18 ` [PATCH D 11/11] Fix omap1 clock issues Paul Walmsley
2009-01-29 14:37   ` Russell King - ARM Linux
2009-01-30  7:58     ` Paul Walmsley
2009-02-06 21:19     ` Paul Walmsley
2009-02-06 21:44       ` Russell King - ARM Linux
2009-02-06 23:04         ` 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=20090128191833.16688.37564.stgit@localhost.localdomain \
    --to=paul@pwsan.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --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