aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-06-11 11:33:12 -0400
committerMike Turquette <mturquette@linaro.org>2012-07-11 20:58:45 -0400
commita613163dff04cbfcb7d66b06ef4a5f65498ee59b (patch)
tree51841b8f22c1eeb71068e2a71bb92c152e68a543
parent91b87a4795c42b97b8d18c3757eff352458ecef4 (diff)
ARM: integrator: convert to common clock
This converts the Integrator platform to use common clock and the ICST driver. Since from this point not all ARM reference platforms use the clock, we define CONFIG_PLAT_VERSATILE_CLOCK and select it for all platforms except the Integrator. Open issue: I could not use the .init_early() field of the machine descriptor to initialize the clocks, but had to move them to .init_irq(), so presumably .init_early() is so early that common clock is not up, and .init_machine() is too late since it's needed for the clockevent/clocksource initialization. Any suggestions on how to solve this is very welcome. Cc: Russell King <linux@arm.linux.org.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> [mturquette@linaro.org: use 'select' instead of versatile Kconfig] Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r--arch/arm/Kconfig7
-rw-r--r--arch/arm/mach-integrator/core.c45
-rw-r--r--arch/arm/mach-integrator/include/mach/clkdev.h26
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c8
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c63
-rw-r--r--arch/arm/plat-versatile/Kconfig3
-rw-r--r--arch/arm/plat-versatile/Makefile2
-rw-r--r--drivers/clk/versatile/Makefile1
-rw-r--r--drivers/clk/versatile/clk-integrator.c111
-rw-r--r--include/linux/platform_data/clk-integrator.h1
10 files changed, 131 insertions, 136 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c59853738967..6f8cf405d3ec 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -254,8 +254,8 @@ config ARCH_INTEGRATOR
254 bool "ARM Ltd. Integrator family" 254 bool "ARM Ltd. Integrator family"
255 select ARM_AMBA 255 select ARM_AMBA
256 select ARCH_HAS_CPUFREQ 256 select ARCH_HAS_CPUFREQ
257 select CLKDEV_LOOKUP 257 select COMMON_CLK
258 select HAVE_MACH_CLKDEV 258 select CLK_VERSATILE
259 select HAVE_TCM 259 select HAVE_TCM
260 select ICST 260 select ICST
261 select GENERIC_CLOCKEVENTS 261 select GENERIC_CLOCKEVENTS
@@ -277,6 +277,7 @@ config ARCH_REALVIEW
277 select GENERIC_CLOCKEVENTS 277 select GENERIC_CLOCKEVENTS
278 select ARCH_WANT_OPTIONAL_GPIOLIB 278 select ARCH_WANT_OPTIONAL_GPIOLIB
279 select PLAT_VERSATILE 279 select PLAT_VERSATILE
280 select PLAT_VERSATILE_CLOCK
280 select PLAT_VERSATILE_CLCD 281 select PLAT_VERSATILE_CLCD
281 select ARM_TIMER_SP804 282 select ARM_TIMER_SP804
282 select GPIO_PL061 if GPIOLIB 283 select GPIO_PL061 if GPIOLIB
@@ -295,6 +296,7 @@ config ARCH_VERSATILE
295 select ARCH_WANT_OPTIONAL_GPIOLIB 296 select ARCH_WANT_OPTIONAL_GPIOLIB
296 select NEED_MACH_IO_H if PCI 297 select NEED_MACH_IO_H if PCI
297 select PLAT_VERSATILE 298 select PLAT_VERSATILE
299 select PLAT_VERSATILE_CLOCK
298 select PLAT_VERSATILE_CLCD 300 select PLAT_VERSATILE_CLCD
299 select PLAT_VERSATILE_FPGA_IRQ 301 select PLAT_VERSATILE_FPGA_IRQ
300 select ARM_TIMER_SP804 302 select ARM_TIMER_SP804
@@ -314,6 +316,7 @@ config ARCH_VEXPRESS
314 select ICST 316 select ICST
315 select NO_IOPORT 317 select NO_IOPORT
316 select PLAT_VERSATILE 318 select PLAT_VERSATILE
319 select PLAT_VERSATILE_CLOCK
317 select PLAT_VERSATILE_CLCD 320 select PLAT_VERSATILE_CLCD
318 help 321 help
319 This enables support for the ARM Ltd Versatile Express boards. 322 This enables support for the ARM Ltd Versatile Express boards.
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 2a20bba246fb..ebf680bebdf2 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -21,7 +21,6 @@
21#include <linux/amba/bus.h> 21#include <linux/amba/bus.h>
22#include <linux/amba/serial.h> 22#include <linux/amba/serial.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/clkdev.h>
25 24
26#include <mach/hardware.h> 25#include <mach/hardware.h>
27#include <mach/platform.h> 26#include <mach/platform.h>
@@ -61,50 +60,6 @@ static struct amba_device *amba_devs[] __initdata = {
61 &kmi1_device, 60 &kmi1_device,
62}; 61};
63 62
64/*
65 * These are fixed clocks.
66 */
67static struct clk clk24mhz = {
68 .rate = 24000000,
69};
70
71static struct clk uartclk = {
72 .rate = 14745600,
73};
74
75static struct clk dummy_apb_pclk;
76
77static struct clk_lookup lookups[] = {
78 { /* Bus clock */
79 .con_id = "apb_pclk",
80 .clk = &dummy_apb_pclk,
81 }, {
82 /* Integrator/AP timer frequency */
83 .dev_id = "ap_timer",
84 .clk = &clk24mhz,
85 }, { /* UART0 */
86 .dev_id = "uart0",
87 .clk = &uartclk,
88 }, { /* UART1 */
89 .dev_id = "uart1",
90 .clk = &uartclk,
91 }, { /* KMI0 */
92 .dev_id = "kmi0",
93 .clk = &clk24mhz,
94 }, { /* KMI1 */
95 .dev_id = "kmi1",
96 .clk = &clk24mhz,
97 }, { /* MMCI - IntegratorCP */
98 .dev_id = "mmci",
99 .clk = &uartclk,
100 }
101};
102
103void __init integrator_init_early(void)
104{
105 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
106}
107
108static int __init integrator_init(void) 63static int __init integrator_init(void)
109{ 64{
110 int i; 65 int i;
diff --git a/arch/arm/mach-integrator/include/mach/clkdev.h b/arch/arm/mach-integrator/include/mach/clkdev.h
deleted file mode 100644
index bfe07679faec..000000000000
--- a/arch/arm/mach-integrator/include/mach/clkdev.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#include <linux/module.h>
5#include <plat/clock.h>
6
7struct clk {
8 unsigned long rate;
9 const struct clk_ops *ops;
10 struct module *owner;
11 const struct icst_params *params;
12 void __iomem *vcoreg;
13 void *data;
14};
15
16static inline int __clk_get(struct clk *clk)
17{
18 return try_module_get(clk->owner);
19}
20
21static inline void __clk_put(struct clk *clk)
22{
23 module_put(clk->owner);
24}
25
26#endif
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index c857501c5783..7b1055c8e0b9 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -33,6 +33,7 @@
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/mtd/physmap.h> 34#include <linux/mtd/physmap.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/platform_data/clk-integrator.h>
36#include <video/vga.h> 37#include <video/vga.h>
37 38
38#include <mach/hardware.h> 39#include <mach/hardware.h>
@@ -174,6 +175,7 @@ static void __init ap_init_irq(void)
174 175
175 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START, 176 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START,
176 -1, INTEGRATOR_SC_VALID_INT, NULL); 177 -1, INTEGRATOR_SC_VALID_INT, NULL);
178 integrator_clk_init(false);
177} 179}
178 180
179#ifdef CONFIG_PM 181#ifdef CONFIG_PM
@@ -440,6 +442,10 @@ static void integrator_clockevent_init(unsigned long inrate)
440 0xffffU); 442 0xffffU);
441} 443}
442 444
445void __init ap_init_early(void)
446{
447}
448
443/* 449/*
444 * Set up timer(s). 450 * Set up timer(s).
445 */ 451 */
@@ -471,7 +477,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
471 .reserve = integrator_reserve, 477 .reserve = integrator_reserve,
472 .map_io = ap_map_io, 478 .map_io = ap_map_io,
473 .nr_irqs = NR_IRQS_INTEGRATOR_AP, 479 .nr_irqs = NR_IRQS_INTEGRATOR_AP,
474 .init_early = integrator_init_early, 480 .init_early = ap_init_early,
475 .init_irq = ap_init_irq, 481 .init_irq = ap_init_irq,
476 .handle_irq = fpga_handle_irq, 482 .handle_irq = fpga_handle_irq,
477 .timer = &ap_timer, 483 .timer = &ap_timer,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index a8c6480babdd..82d5c837cc74 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -21,8 +21,8 @@
21#include <linux/amba/mmci.h>