hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/cpufreq/s3c2412-cpufreq.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright 2008 Simtec Electronics
34 * http://armlinux.simtec.co.uk/
45 * Ben Dooks <ben@simtec.co.uk>
56 *
67 * S3C2412 CPU Frequency scalling
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -22,15 +19,24 @@
2219 #include <linux/clk.h>
2320 #include <linux/err.h>
2421 #include <linux/io.h>
22
+#include <linux/soc/samsung/s3c-cpufreq-core.h>
23
+#include <linux/soc/samsung/s3c-pm.h>
2524
2625 #include <asm/mach/arch.h>
2726 #include <asm/mach/map.h>
2827
29
-#include <mach/regs-clock.h>
30
-#include <mach/s3c2412.h>
31
-
32
-#include <plat/cpu.h>
33
-#include <plat/cpu-freq-core.h>
28
+#define S3C2412_CLKDIVN_PDIVN (1<<2)
29
+#define S3C2412_CLKDIVN_HDIVN_MASK (3<<0)
30
+#define S3C2412_CLKDIVN_ARMDIVN (1<<3)
31
+#define S3C2412_CLKDIVN_DVSEN (1<<4)
32
+#define S3C2412_CLKDIVN_HALFHCLK (1<<5)
33
+#define S3C2412_CLKDIVN_USB48DIV (1<<6)
34
+#define S3C2412_CLKDIVN_UARTDIV_MASK (15<<8)
35
+#define S3C2412_CLKDIVN_UARTDIV_SHIFT (8)
36
+#define S3C2412_CLKDIVN_I2SDIV_MASK (15<<12)
37
+#define S3C2412_CLKDIVN_I2SDIV_SHIFT (12)
38
+#define S3C2412_CLKDIVN_CAMDIV_MASK (15<<16)
39
+#define S3C2412_CLKDIVN_CAMDIV_SHIFT (16)
3440
3541 /* our clock resources. */
3642 static struct clk *xtal;
....@@ -120,7 +126,7 @@
120126 unsigned long clkdiv;
121127 unsigned long olddiv;
122128
123
- olddiv = clkdiv = __raw_readl(S3C2410_CLKDIVN);
129
+ olddiv = clkdiv = s3c24xx_read_clkdivn();
124130
125131 /* clear off current clock info */
126132
....@@ -137,30 +143,9 @@
137143 clkdiv |= S3C2412_CLKDIVN_PDIVN;
138144
139145 s3c_freq_dbg("%s: div %08lx => %08lx\n", __func__, olddiv, clkdiv);
140
- __raw_writel(clkdiv, S3C2410_CLKDIVN);
146
+ s3c24xx_write_clkdivn(clkdiv);
141147
142148 clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
143
-}
144
-
145
-static void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
146
-{
147
- struct s3c_cpufreq_board *board = cfg->board;
148
- unsigned long refresh;
149
-
150
- s3c_freq_dbg("%s: refresh %u ns, hclk %lu\n", __func__,
151
- board->refresh, cfg->freq.hclk);
152
-
153
- /* Reduce both the refresh time (in ns) and the frequency (in MHz)
154
- * by 10 each to ensure that we do not overflow 32 bit numbers. This
155
- * should work for HCLK up to 133MHz and refresh period up to 30usec.
156
- */
157
-
158
- refresh = (board->refresh / 10);
159
- refresh *= (cfg->freq.hclk / 100);
160
- refresh /= (1 * 1000 * 1000); /* 10^6 */
161
-
162
- s3c_freq_dbg("%s: setting refresh 0x%08lx\n", __func__, refresh);
163
- __raw_writel(refresh, S3C2412_REFRESH);
164149 }
165150
166151 /* set the default cpu frequency information, based on an 200MHz part