Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22844
b: refs/heads/master
c: 36c64af
h: refs/heads/master
v: v3
  • Loading branch information
Ben Dooks authored and Russell King committed Mar 21, 2006
1 parent 68c710a commit a9847b9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e44c03960f232e0f9bd2f6bcffccf83770757a8e
refs/heads/master: 36c64af4e013ddf44c44298f50ff138ef1e2e7b7
14 changes: 13 additions & 1 deletion trunk/arch/arm/mach-s3c2410/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
/* clock information */

static LIST_HEAD(clocks);
static DEFINE_MUTEX(clocks_mutex);

DEFINE_MUTEX(clocks_mutex);

/* old functions */

Expand Down Expand Up @@ -296,6 +297,13 @@ static struct clk clk_p = {
.ctrlbit = 0,
};

struct clk clk_usb_bus = {
.name = "usb-bus",
.id = -1,
.rate = 0,
.parent = &clk_upll,
};

/* clocks that could be registered by external code */

static int s3c24xx_dclk_enable(struct clk *clk, int enable)
Expand Down Expand Up @@ -606,6 +614,10 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
if (s3c24xx_register_clock(&clk_p) < 0)
printk(KERN_ERR "failed to register cpu pclk\n");


if (s3c24xx_register_clock(&clk_usb_bus) < 0)
printk(KERN_ERR "failed to register usb bus clock\n");

/* register clocks from clock array */

for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/arm/mach-s3c2410/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ extern struct clk s3c24xx_clkout0;
extern struct clk s3c24xx_clkout1;
extern struct clk s3c24xx_uclk;

extern struct clk clk_usb_bus;

/* exports for arch/arm/mach-s3c2410
*
* Please DO NOT use these outside of arch/arm/mach-s3c2410
*/

extern struct mutex clocks_mutex;

extern int s3c24xx_clkcon_enable(struct clk *clk, int enable);
extern int s3c24xx_register_clock(struct clk *clk);

Expand Down
21 changes: 20 additions & 1 deletion trunk/arch/arm/mach-s3c2410/s3c2440-clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/sysdev.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/mutex.h>
#include <linux/clk.h>

#include <asm/hardware.h>
Expand Down Expand Up @@ -111,20 +112,38 @@ static struct clk s3c2440_clk_ac97 = {
static int s3c2440_clk_add(struct sys_device *sysdev)
{
unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
unsigned long clkdivn;
struct clk *clk_h;
struct clk *clk_p;
struct clk *clk_upll;

printk("S3C2440: Clock Support, DVS %s\n",
(camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");

clk_p = clk_get(NULL, "pclk");
clk_h = clk_get(NULL, "hclk");
clk_upll = clk_get(NULL, "upll");

if (IS_ERR(clk_p) || IS_ERR(clk_h)) {
if (IS_ERR(clk_p) || IS_ERR(clk_h) || IS_ERR(clk_upll)) {
printk(KERN_ERR "S3C2440: Failed to get parent clocks\n");
return -EINVAL;
}

/* check rate of UPLL, and if it is near 96MHz, then change
* to using half the UPLL rate for the system */

if (clk_get_rate(clk_upll) > (94 * MHZ)) {
clk_usb_bus.rate = clk_get_rate(clk_upll) / 2;

mutex_lock(&clocks_mutex);

clkdivn = __raw_readl(S3C2410_CLKDIVN);
clkdivn |= S3C2440_CLKDIVN_UCLK;
__raw_writel(camdivn, S3C2410_CLKDIVN);

mutex_unlock(&clocks_mutex);
}

s3c2440_clk_cam.parent = clk_h;
s3c2440_clk_ac97.parent = clk_p;
s3c2440_clk_cam_upll.parent = clk_upll;
Expand Down

0 comments on commit a9847b9

Please sign in to comment.