aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2410/s3c2440-clock.c
diff options
context:
space:
mode:
authorBen Dooks <ben@trinity.fluff.org>2006-03-20 16:00:48 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-03-21 17:06:20 -0500
commit36c64af4e013ddf44c44298f50ff138ef1e2e7b7 (patch)
tree9ece82d6a2ed67fb3efa1e422435864f09c22d96 /arch/arm/mach-s3c2410/s3c2440-clock.c
parente44c03960f232e0f9bd2f6bcffccf83770757a8e (diff)
[ARM] 3361/1: S3C24XX - add USB bus clock source
Patch from Ben Dooks Add USB bus clock definition for 48MHz fed to OHCI and gadget cores Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-s3c2410/s3c2440-clock.c')
-rw-r--r--arch/arm/mach-s3c2410/s3c2440-clock.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/arch/arm/mach-s3c2410/s3c2440-clock.c b/arch/arm/mach-s3c2410/s3c2440-clock.c
index 7bca0be8738..57a15974d4b 100644
--- a/arch/arm/mach-s3c2410/s3c2440-clock.c
+++ b/arch/arm/mach-s3c2410/s3c2440-clock.c
@@ -31,6 +31,7 @@
31#include <linux/sysdev.h> 31#include <linux/sysdev.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/mutex.h>
34#include <linux/clk.h> 35#include <linux/clk.h>
35 36
36#include <asm/hardware.h> 37#include <asm/hardware.h>
@@ -111,20 +112,38 @@ static struct clk s3c2440_clk_ac97 = {
111static int s3c2440_clk_add(struct sys_device *sysdev) 112static int s3c2440_clk_add(struct sys_device *sysdev)
112{ 113{
113 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); 114 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
115 unsigned long clkdivn;
114 struct clk *clk_h; 116 struct clk *clk_h;
115 struct clk *clk_p; 117 struct clk *clk_p;
118 struct clk *clk_upll;
116 119
117 printk("S3C2440: Clock Support, DVS %s\n", 120 printk("S3C2440: Clock Support, DVS %s\n",
118 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off"); 121 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");
119 122
120 clk_p = clk_get(NULL, "pclk"); 123 clk_p = clk_get(NULL, "pclk");
121 clk_h = clk_get(NULL, "hclk"); 124 clk_h = clk_get(NULL, "hclk");
125 clk_upll = clk_get(NULL, "upll");
122 126
123 if (IS_ERR(clk_p) || IS_ERR(clk_h)) { 127 if (IS_ERR(clk_p) || IS_ERR(clk_h) || IS_ERR(clk_upll)) {
124 printk(KERN_ERR "S3C2440: Failed to get parent clocks\n"); 128 printk(KERN_ERR "S3C2440: Failed to get parent clocks\n");
125 return -EINVAL; 129 return -EINVAL;
126 } 130 }
127 131
132 /* check rate of UPLL, and if it is near 96MHz, then change
133 * to using half the UPLL rate for the system */
134
135 if (clk_get_rate(clk_upll) > (94 * MHZ)) {
136 clk_usb_bus.rate = clk_get_rate(clk_upll) / 2;
137
138 mutex_lock(&clocks_mutex);
139
140 clkdivn = __raw_readl(S3C2410_CLKDIVN);
141 clkdivn |= S3C2440_CLKDIVN_UCLK;
142 __raw_writel(camdivn, S3C2410_CLKDIVN);
143
144 mutex_unlock(&clocks_mutex);
145 }
146
128 s3c2440_clk_cam.parent = clk_h; 147 s3c2440_clk_cam.parent = clk_h;
129 s3c2440_clk_ac97.parent = clk_p; 148 s3c2440_clk_ac97.parent = clk_p;
130 s3c2440_clk_cam_upll.parent = clk_upll; 149 s3c2440_clk_cam_upll.parent = clk_upll;