25 #include <linux/module.h>
26 #include <linux/kernel.h>
27 #include <linux/list.h>
28 #include <linux/errno.h>
30 #include <linux/device.h>
39 #include <mach/hardware.h>
43 #include <mach/regs-clock.h>
45 #include <plat/clock.h>
56 static unsigned long s3c2442_camif_upll_round(
struct clk *
clk,
62 if (rate > parent_rate)
65 div = parent_rate /
rate;
68 return parent_rate / 3;
79 return parent_rate / (div * 2);
82 static int s3c2442_camif_upll_setrate(
struct clk *clk,
unsigned long rate)
85 unsigned long camdivn =
__raw_readl(S3C2440_CAMDIVN);
87 rate = s3c2442_camif_upll_round(clk, rate);
89 camdivn &= ~S3C2442_CAMDIVN_CAMCLK_DIV3;
91 if (rate == parent_rate) {
92 camdivn &= ~S3C2440_CAMDIVN_CAMCLK_SEL;
93 }
else if ((parent_rate / rate) == 3) {
94 camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
95 camdivn |= S3C2442_CAMDIVN_CAMCLK_DIV3;
97 camdivn &= ~S3C2440_CAMDIVN_CAMCLK_MASK;
98 camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
99 camdivn |= (((parent_rate /
rate) / 2) - 1);
109 static struct clk s3c2442_clk_cam = {
113 .ctrlbit = S3C2440_CLKCON_CAMERA,
116 static struct clk s3c2442_clk_cam_upll = {
117 .name =
"camif-upll",
120 .set_rate = s3c2442_camif_upll_setrate,
121 .round_rate = s3c2442_camif_upll_round,
127 struct clk *clock_upll;
135 if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) {
140 s3c2442_clk_cam.
parent = clock_h;
141 s3c2442_clk_cam_upll.
parent = clock_upll;
152 .name =
"s3c2442_clk",
154 .add_dev = s3c2442_clk_add,
157 static __init int s3c2442_clk_init(
void)
165 static struct device s3c2442_dev = {
171 printk(
"S3C2442: Initialising architecture\n");