diff options
Diffstat (limited to 'arch/arm/mach-s3c2410/s3c2440-clock.c')
| -rw-r--r-- | arch/arm/mach-s3c2410/s3c2440-clock.c | 21 |
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 7bca0be87384..57a15974d4b5 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 = { | |||
| 111 | static int s3c2440_clk_add(struct sys_device *sysdev) | 112 | static 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; |
