ARM: S3C24XX: Move mach-s3c2410/ cpufreq into mach-s3c24xx/
authorKukjin Kim <kgene.kim@samsung.com>
Mon, 21 Jan 2013 22:51:08 +0000 (14:51 -0800)
committerKukjin Kim <kgene.kim@samsung.com>
Mon, 21 Jan 2013 23:40:23 +0000 (15:40 -0800)
Basically, the cpufreq driver for s3c2410 should be implemented into
drivers/cpufreq, but we don't need to keep the mach-s3c2410 directory.
So this patch moves current cpufreq driver into mach-s3c24xx/.

Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/mach-s3c2410/Kconfig
arch/arm/mach-s3c2410/Makefile
arch/arm/mach-s3c2410/cpu-freq.c [deleted file]
arch/arm/mach-s3c24xx/Kconfig
arch/arm/mach-s3c24xx/Makefile
arch/arm/mach-s3c24xx/cpufreq-s3c2410.c [new file with mode: 0644]

index 68d89cb96af0281009d5b84fc26aaf85a61ddfad..910b8d29f0f40eb8f7e3b8db641b38c3d1d04974 100644 (file)
@@ -4,13 +4,6 @@
 
 # cpu frequency scaling support
 
-config S3C2410_CPUFREQ
-       bool
-       depends on CPU_FREQ_S3C24XX && CPU_S3C2410
-       select S3C2410_CPUFREQ_UTILS
-       help
-         CPU Frequency scaling support for S3C2410
-
 config S3C2410_PLLTABLE
        bool
        depends on S3C2410_CPUFREQ && CPU_FREQ_S3C24XX_PLL
index 6b9a316e0041b9004c47ff4fb07a8972d9c790e2..2a160a5a6113096877201295e83dc3bc6158d65c 100644 (file)
@@ -9,6 +9,5 @@ obj-m                           :=
 obj-n                          :=
 obj-                           :=
 
-obj-$(CONFIG_S3C2410_CPUFREQ)  += cpu-freq.o
 obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o
 
diff --git a/arch/arm/mach-s3c2410/cpu-freq.c b/arch/arm/mach-s3c2410/cpu-freq.c
deleted file mode 100644 (file)
index 5404535..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/* linux/arch/arm/mach-s3c2410/cpu-freq.c
- *
- * Copyright (c) 2006-2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 CPU Frequency scaling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/cpufreq.h>
-#include <linux/device.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/io.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <mach/regs-clock.h>
-
-#include <plat/cpu.h>
-#include <plat/clock.h>
-#include <plat/cpu-freq-core.h>
-
-/* Note, 2410A has an extra mode for 1:4:4 ratio, bit 2 of CLKDIV */
-
-static void s3c2410_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
-{
-       u32 clkdiv = 0;
-
-       if (cfg->divs.h_divisor == 2)
-               clkdiv |= S3C2410_CLKDIVN_HDIVN;
-
-       if (cfg->divs.p_divisor != cfg->divs.h_divisor)
-               clkdiv |= S3C2410_CLKDIVN_PDIVN;
-
-       __raw_writel(clkdiv, S3C2410_CLKDIVN);
-}
-
-static int s3c2410_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
-{
-       unsigned long hclk, fclk, pclk;
-       unsigned int hdiv, pdiv;
-       unsigned long hclk_max;
-
-       fclk = cfg->freq.fclk;
-       hclk_max = cfg->max.hclk;
-
-       cfg->freq.armclk = fclk;
-
-       s3c_freq_dbg("%s: fclk is %lu, max hclk %lu\n",
-                     __func__, fclk, hclk_max);
-
-       hdiv = (fclk > cfg->max.hclk) ? 2 : 1;
-       hclk = fclk / hdiv;
-
-       if (hclk > cfg->max.hclk) {
-               s3c_freq_dbg("%s: hclk too big\n", __func__);
-               return -EINVAL;
-       }
-
-       pdiv = (hclk > cfg->max.pclk) ? 2 : 1;
-       pclk = hclk / pdiv;
-
-       if (pclk > cfg->max.pclk) {
-               s3c_freq_dbg("%s: pclk too big\n", __func__);
-               return -EINVAL;
-       }
-
-       pdiv *= hdiv;
-
-       /* record the result */
-       cfg->divs.p_divisor = pdiv;
-       cfg->divs.h_divisor = hdiv;
-
-       return 0      ;
-}
-
-static struct s3c_cpufreq_info s3c2410_cpufreq_info = {
-       .max            = {
-               .fclk   = 200000000,
-               .hclk   = 100000000,
-               .pclk   =  50000000,
-       },
-
-       /* transition latency is about 5ms worst-case, so
-        * set 10ms to be sure */
-       .latency        = 10000000,
-
-       .locktime_m     = 150,
-       .locktime_u     = 150,
-       .locktime_bits  = 12,
-
-       .need_pll       = 1,
-
-       .name           = "s3c2410",
-       .calc_iotiming  = s3c2410_iotiming_calc,
-       .set_iotiming   = s3c2410_iotiming_set,
-       .get_iotiming   = s3c2410_iotiming_get,
-       .resume_clocks  = s3c2410_setup_clocks,
-
-       .set_fvco       = s3c2410_set_fvco,
-       .set_refresh    = s3c2410_cpufreq_setrefresh,
-       .set_divs       = s3c2410_cpufreq_setdivs,
-       .calc_divs      = s3c2410_cpufreq_calcdivs,
-
-       .debug_io_show  = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs),
-};
-
-static int s3c2410_cpufreq_add(struct device *dev,
-                              struct subsys_interface *sif)
-{
-       return s3c_cpufreq_register(&s3c2410_cpufreq_info);
-}
-
-static struct subsys_interface s3c2410_cpufreq_interface = {
-       .name           = "s3c2410_cpufreq",
-       .subsys         = &s3c2410_subsys,
-       .add_dev        = s3c2410_cpufreq_add,
-};
-
-static int __init s3c2410_cpufreq_init(void)
-{
-       return subsys_interface_register(&s3c2410_cpufreq_interface);
-}
-
-arch_initcall(s3c2410_cpufreq_init);
-
-static int s3c2410a_cpufreq_add(struct device *dev,
-                               struct subsys_interface *sif)
-{
-       /* alter the maximum freq settings for S3C2410A. If a board knows
-        * it only has a maximum of 200, then it should register its own
-        * limits. */
-
-       s3c2410_cpufreq_info.max.fclk = 266000000;
-       s3c2410_cpufreq_info.max.hclk = 133000000;
-       s3c2410_cpufreq_info.max.pclk =  66500000;
-       s3c2410_cpufreq_info.name = "s3c2410a";
-
-       return s3c2410_cpufreq_add(dev, sif);
-}
-
-static struct subsys_interface s3c2410a_cpufreq_interface = {
-       .name           = "s3c2410a_cpufreq",
-       .subsys         = &s3c2410a_subsys,
-       .add_dev        = s3c2410a_cpufreq_add,
-};
-
-static int __init s3c2410a_cpufreq_init(void)
-{
-       return subsys_interface_register(&s3c2410a_cpufreq_interface);
-}
-
-arch_initcall(s3c2410a_cpufreq_init);
index 25df14a9e268b94aa30d39480d5fac0258b21925..04921b91da0d700bd90574f482760c278ea481c4 100644 (file)
@@ -127,6 +127,13 @@ config S3C2410_PM
 
 if CPU_S3C2410
 
+config S3C2410_CPUFREQ
+       bool
+       depends on CPU_FREQ_S3C24XX && CPU_S3C2410
+       select S3C2410_CPUFREQ_UTILS
+       help
+         CPU Frequency scaling support for S3C2410
+
 config S3C24XX_SIMTEC_NOR
        bool
        help
index 0ab6ab15da4ca11fdb79c5144051333e4d10f00a..3c9fd511e3e9bb64e6e11b3ea583f9927697d412 100644 (file)
@@ -17,6 +17,7 @@ obj-                          :=
 obj-y                          += common.o
 
 obj-$(CONFIG_CPU_S3C2410)      += s3c2410.o
+obj-$(CONFIG_S3C2410_CPUFREQ)  += cpufreq-s3c2410.o
 obj-$(CONFIG_S3C2410_DMA)      += dma-s3c2410.o
 obj-$(CONFIG_S3C2410_PM)       += pm-s3c2410.o sleep-s3c2410.o
 
diff --git a/arch/arm/mach-s3c24xx/cpufreq-s3c2410.c b/arch/arm/mach-s3c24xx/cpufreq-s3c2410.c
new file mode 100644 (file)
index 0000000..cfa0dd8
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2006-2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 CPU Frequency scaling
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/cpufreq.h>
+#include <linux/device.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include <mach/regs-clock.h>
+
+#include <plat/cpu.h>
+#include <plat/clock.h>
+#include <plat/cpu-freq-core.h>
+
+/* Note, 2410A has an extra mode for 1:4:4 ratio, bit 2 of CLKDIV */
+
+static void s3c2410_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
+{
+       u32 clkdiv = 0;
+
+       if (cfg->divs.h_divisor == 2)
+               clkdiv |= S3C2410_CLKDIVN_HDIVN;
+
+       if (cfg->divs.p_divisor != cfg->divs.h_divisor)
+               clkdiv |= S3C2410_CLKDIVN_PDIVN;
+
+       __raw_writel(clkdiv, S3C2410_CLKDIVN);
+}
+
+static int s3c2410_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
+{
+       unsigned long hclk, fclk, pclk;
+       unsigned int hdiv, pdiv;
+       unsigned long hclk_max;
+
+       fclk = cfg->freq.fclk;
+       hclk_max = cfg->max.hclk;
+
+       cfg->freq.armclk = fclk;
+
+       s3c_freq_dbg("%s: fclk is %lu, max hclk %lu\n",
+                     __func__, fclk, hclk_max);
+
+       hdiv = (fclk > cfg->max.hclk) ? 2 : 1;
+       hclk = fclk / hdiv;
+
+       if (hclk > cfg->max.hclk) {
+               s3c_freq_dbg("%s: hclk too big\n", __func__);
+               return -EINVAL;
+       }
+
+       pdiv = (hclk > cfg->max.pclk) ? 2 : 1;
+       pclk = hclk / pdiv;
+
+       if (pclk > cfg->max.pclk) {
+               s3c_freq_dbg("%s: pclk too big\n", __func__);
+               return -EINVAL;
+       }
+
+       pdiv *= hdiv;
+
+       /* record the result */
+       cfg->divs.p_divisor = pdiv;
+       cfg->divs.h_divisor = hdiv;
+
+       return 0;
+}
+
+static struct s3c_cpufreq_info s3c2410_cpufreq_info = {
+       .max            = {
+               .fclk   = 200000000,
+               .hclk   = 100000000,
+               .pclk   =  50000000,
+       },
+
+       /* transition latency is about 5ms worst-case, so
+        * set 10ms to be sure */
+       .latency        = 10000000,
+
+       .locktime_m     = 150,
+       .locktime_u     = 150,
+       .locktime_bits  = 12,
+
+       .need_pll       = 1,
+
+       .name           = "s3c2410",
+       .calc_iotiming  = s3c2410_iotiming_calc,
+       .set_iotiming   = s3c2410_iotiming_set,
+       .get_iotiming   = s3c2410_iotiming_get,
+       .resume_clocks  = s3c2410_setup_clocks,
+
+       .set_fvco       = s3c2410_set_fvco,
+       .set_refresh    = s3c2410_cpufreq_setrefresh,
+       .set_divs       = s3c2410_cpufreq_setdivs,
+       .calc_divs      = s3c2410_cpufreq_calcdivs,
+
+       .debug_io_show  = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs),
+};
+
+static int s3c2410_cpufreq_add(struct device *dev,
+                              struct subsys_interface *sif)
+{
+       return s3c_cpufreq_register(&s3c2410_cpufreq_info);
+}
+
+static struct subsys_interface s3c2410_cpufreq_interface = {
+       .name           = "s3c2410_cpufreq",
+       .subsys         = &s3c2410_subsys,
+       .add_dev        = s3c2410_cpufreq_add,
+};
+
+static int __init s3c2410_cpufreq_init(void)
+{
+       return subsys_interface_register(&s3c2410_cpufreq_interface);
+}
+arch_initcall(s3c2410_cpufreq_init);
+
+static int s3c2410a_cpufreq_add(struct device *dev,
+                               struct subsys_interface *sif)
+{
+       /* alter the maximum freq settings for S3C2410A. If a board knows
+        * it only has a maximum of 200, then it should register its own
+        * limits. */
+
+       s3c2410_cpufreq_info.max.fclk = 266000000;
+       s3c2410_cpufreq_info.max.hclk = 133000000;
+       s3c2410_cpufreq_info.max.pclk =  66500000;
+       s3c2410_cpufreq_info.name = "s3c2410a";
+
+       return s3c2410_cpufreq_add(dev, sif);
+}
+
+static struct subsys_interface s3c2410a_cpufreq_interface = {
+       .name           = "s3c2410a_cpufreq",
+       .subsys         = &s3c2410a_subsys,
+       .add_dev        = s3c2410a_cpufreq_add,
+};
+
+static int __init s3c2410a_cpufreq_init(void)
+{
+       return subsys_interface_register(&s3c2410a_cpufreq_interface);
+}
+arch_initcall(s3c2410a_cpufreq_init);