hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/cpufreq/s3c2440-cpufreq.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2006-2009 Simtec Electronics
34 * http://armlinux.simtec.co.uk/
....@@ -5,10 +6,6 @@
56 * Vincent Sanders <vince@simtec.co.uk>
67 *
78 * S3C2440/S3C2442 CPU Frequency scaling
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
129 */
1310
1411 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -23,14 +20,27 @@
2320 #include <linux/clk.h>
2421 #include <linux/err.h>
2522 #include <linux/io.h>
23
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
24
+#include <linux/soc/samsung/s3c-pm.h>
2625
2726 #include <asm/mach/arch.h>
2827 #include <asm/mach/map.h>
2928
30
-#include <mach/regs-clock.h>
29
+#define S3C2440_CLKDIVN_PDIVN (1<<0)
30
+#define S3C2440_CLKDIVN_HDIVN_MASK (3<<1)
31
+#define S3C2440_CLKDIVN_HDIVN_1 (0<<1)
32
+#define S3C2440_CLKDIVN_HDIVN_2 (1<<1)
33
+#define S3C2440_CLKDIVN_HDIVN_4_8 (2<<1)
34
+#define S3C2440_CLKDIVN_HDIVN_3_6 (3<<1)
35
+#define S3C2440_CLKDIVN_UCLK (1<<3)
3136
32
-#include <plat/cpu.h>
33
-#include <plat/cpu-freq-core.h>
37
+#define S3C2440_CAMDIVN_CAMCLK_MASK (0xf<<0)
38
+#define S3C2440_CAMDIVN_CAMCLK_SEL (1<<4)
39
+#define S3C2440_CAMDIVN_HCLK3_HALF (1<<8)
40
+#define S3C2440_CAMDIVN_HCLK4_HALF (1<<9)
41
+#define S3C2440_CAMDIVN_DVSEN (1<<12)
42
+
43
+#define S3C2442_CAMDIVN_CAMCLK_DIV3 (1<<5)
3444
3545 static struct clk *xtal;
3646 static struct clk *fclk;
....@@ -146,8 +156,8 @@
146156 s3c_freq_dbg("%s: divisors: h=%d, p=%d\n", __func__,
147157 cfg->divs.h_divisor, cfg->divs.p_divisor);
148158
149
- clkdiv = __raw_readl(S3C2410_CLKDIVN);
150
- camdiv = __raw_readl(S3C2440_CAMDIVN);
159
+ clkdiv = s3c24xx_read_clkdivn();
160
+ camdiv = s3c2440_read_camdivn();
151161
152162 clkdiv &= ~(S3C2440_CLKDIVN_HDIVN_MASK | S3C2440_CLKDIVN_PDIVN);
153163 camdiv &= ~CAMDIVN_HCLK_HALF;
....@@ -187,11 +197,11 @@
187197 * then make a short delay and remove the hclk halving if necessary.
188198 */
189199
190
- __raw_writel(camdiv | CAMDIVN_HCLK_HALF, S3C2440_CAMDIVN);
191
- __raw_writel(clkdiv, S3C2410_CLKDIVN);
200
+ s3c2440_write_camdivn(camdiv | CAMDIVN_HCLK_HALF);
201
+ s3c24xx_write_clkdivn(clkdiv);
192202
193203 ndelay(20);
194
- __raw_writel(camdiv, S3C2440_CAMDIVN);
204
+ s3c2440_write_camdivn(camdiv);
195205
196206 clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
197207 }