summaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2010-01-30 07:02:58 +0100
committerBen Dooks <ben-linux@fluff.org>2010-01-30 08:25:01 +0100
commit4ec07bba6945290c48dcc5b789cbd7adeabd7695 (patch)
tree3f72de5a5a133ece5b5d36220809b32e08425651 /arch/arm
parentARM: S5P: Change S5P_TIMER_IRQ based to 11 for SAMSUNG S5P series. (diff)
downloadlinux-4ec07bba6945290c48dcc5b789cbd7adeabd7695.tar.xz
linux-4ec07bba6945290c48dcc5b789cbd7adeabd7695.zip
ARM: S3C2443: Use common clock gate code
Add common clock gate code for each of the S3C2443 clock gate code. Whether to move this elsewhere will be decided later. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-s3c2443/clock.c48
1 files changed, 13 insertions, 35 deletions
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index 3eb8b935d64c..5d061ea0c513 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -53,55 +53,33 @@
* set the correct muxing at initialisation
*/
-static int s3c2443_clkcon_enable_h(struct clk *clk, int enable)
+static int s3c2443_gate(void __iomem *reg, struct clk *clk, int enable)
{
- unsigned int clocks = clk->ctrlbit;
- unsigned long clkcon;
-
- clkcon = __raw_readl(S3C2443_HCLKCON);
+ u32 ctrlbit = clk->ctrlbit;
+ u32 con = __raw_readl(reg);
if (enable)
- clkcon |= clocks;
+ con |= ctrlbit;
else
- clkcon &= ~clocks;
-
- __raw_writel(clkcon, S3C2443_HCLKCON);
+ con &= ~ctrlbit;
+ __raw_writel(con, reg);
return 0;
}
-static int s3c2443_clkcon_enable_p(struct clk *clk, int enable)
+static int s3c2443_clkcon_enable_h(struct clk *clk, int enable)
{
- unsigned int clocks = clk->ctrlbit;
- unsigned long clkcon;
-
- clkcon = __raw_readl(S3C2443_PCLKCON);
-
- if (enable)
- clkcon |= clocks;
- else
- clkcon &= ~clocks;
-
- __raw_writel(clkcon, S3C2443_PCLKCON);
+ return s3c2443_gate(S3C2443_HCLKCON, clk, enable);
+}
- return 0;
+static int s3c2443_clkcon_enable_p(struct clk *clk, int enable)
+{
+ return s3c2443_gate(S3C2443_PCLKCON, clk, enable);
}
static int s3c2443_clkcon_enable_s(struct clk *clk, int enable)
{
- unsigned int clocks = clk->ctrlbit;
- unsigned long clkcon;
-
- clkcon = __raw_readl(S3C2443_SCLKCON);
-
- if (enable)
- clkcon |= clocks;
- else
- clkcon &= ~clocks;
-
- __raw_writel(clkcon, S3C2443_SCLKCON);
-
- return 0;
+ return s3c2443_gate(S3C2443_SCLKCON, clk, enable);
}
static unsigned long s3c2443_roundrate_clksrc(struct clk *clk,