aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-01-14 07:48:06 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-02 04:35:33 -0400
commitf4b8b319bf21bf3576014ce7336763cd3e1684ef (patch)
tree5f3200e3b82dd23fc58633e010f3996246d81607 /arch
parentc5a0adb51002e51a4254cb7f0ab7190d41d8b930 (diff)
ARM: Realview/Versatile/Integrator: separate out common clock code
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig6
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/mach-integrator/Makefile2
-rw-r--r--arch/arm/mach-realview/Makefile2
-rw-r--r--arch/arm/mach-realview/clock.c64
-rw-r--r--arch/arm/mach-realview/clock.h20
-rw-r--r--arch/arm/mach-realview/core.c2
-rw-r--r--arch/arm/mach-realview/include/mach/clkdev.h9
-rw-r--r--arch/arm/mach-realview/realview_eb.c1
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c1
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c1
-rw-r--r--arch/arm/mach-realview/realview_pba8.c1
-rw-r--r--arch/arm/mach-versatile/Makefile2
-rw-r--r--arch/arm/mach-versatile/clock.c65
-rw-r--r--arch/arm/mach-versatile/clock.h21
-rw-r--r--arch/arm/mach-versatile/core.c2
-rw-r--r--arch/arm/mach-versatile/include/mach/clkdev.h9
-rw-r--r--arch/arm/plat-versatile/Makefile1
-rw-r--r--arch/arm/plat-versatile/clock.c (renamed from arch/arm/mach-integrator/clock.c)4
19 files changed, 33 insertions, 181 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3c436fdbe2a0..e8265f257674 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -243,6 +243,7 @@ config ARCH_INTEGRATOR
243 select ICST 243 select ICST
244 select GENERIC_TIME 244 select GENERIC_TIME
245 select GENERIC_CLOCKEVENTS 245 select GENERIC_CLOCKEVENTS
246 select PLAT_VERSATILE
246 help 247 help
247 Support for ARM's Integrator platform. 248 Support for ARM's Integrator platform.
248 249
@@ -255,6 +256,7 @@ config ARCH_REALVIEW
255 select GENERIC_TIME 256 select GENERIC_TIME
256 select GENERIC_CLOCKEVENTS 257 select GENERIC_CLOCKEVENTS
257 select ARCH_WANT_OPTIONAL_GPIOLIB 258 select ARCH_WANT_OPTIONAL_GPIOLIB
259 select PLAT_VERSATILE
258 help 260 help
259 This enables support for ARM Ltd RealView boards. 261 This enables support for ARM Ltd RealView boards.
260 262
@@ -268,6 +270,7 @@ config ARCH_VERSATILE
268 select GENERIC_TIME 270 select GENERIC_TIME
269 select GENERIC_CLOCKEVENTS 271 select GENERIC_CLOCKEVENTS
270 select ARCH_WANT_OPTIONAL_GPIOLIB 272 select ARCH_WANT_OPTIONAL_GPIOLIB
273 select PLAT_VERSATILE
271 help 274 help
272 This enables support for ARM Ltd Versatile board. 275 This enables support for ARM Ltd Versatile board.
273 276
@@ -938,6 +941,9 @@ config PLAT_ORION
938config PLAT_PXA 941config PLAT_PXA
939 bool 942 bool
940 943
944config PLAT_VERSATILE
945 bool
946
941source arch/arm/mm/Kconfig 947source arch/arm/mm/Kconfig
942 948
943config IWMMXT 949config IWMMXT
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index ed820e737a8a..1962deb90730 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -192,6 +192,7 @@ plat-$(CONFIG_PLAT_PXA) := pxa
192plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx samsung 192plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx samsung
193plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx samsung 193plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx samsung
194plat-$(CONFIG_PLAT_S5P) := s5p samsung 194plat-$(CONFIG_PLAT_S5P) := s5p samsung
195plat-$(CONFIG_PLAT_VERSATILE) := versatile
195 196
196ifeq ($(CONFIG_ARCH_EBSA110),y) 197ifeq ($(CONFIG_ARCH_EBSA110),y)
197# This is what happens if you forget the IOCS16 line. 198# This is what happens if you forget the IOCS16 line.
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile
index 6a5ef8d30b10..ebeef966e1f5 100644
--- a/arch/arm/mach-integrator/Makefile
+++ b/arch/arm/mach-integrator/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := clock.o core.o lm.o 7obj-y := core.o lm.o
8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o 8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o
9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o 9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
10 10
diff --git a/arch/arm/mach-realview/Makefile b/arch/arm/mach-realview/Makefile
index e704edb733c0..a01b76b7c956 100644
--- a/arch/arm/mach-realview/Makefile
+++ b/arch/arm/mach-realview/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := core.o clock.o 5obj-y := core.o
6obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o 6obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o
7obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o 7obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o
8obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o 8obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c
deleted file mode 100644
index 18c545921e41..000000000000
--- a/arch/arm/mach-realview/clock.c
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * linux/arch/arm/mach-realview/clock.c
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/device.h>
14#include <linux/list.h>
15#include <linux/errno.h>
16#include <linux/err.h>
17#include <linux/string.h>
18#include <linux/clk.h>
19#include <linux/mutex.h>
20
21#include <asm/hardware/icst.h>
22
23#include "clock.h"
24
25int clk_enable(struct clk *clk)
26{
27 return 0;
28}
29EXPORT_SYMBOL(clk_enable);
30
31void clk_disable(struct clk *clk)
32{
33}
34EXPORT_SYMBOL(clk_disable);
35
36unsigned long clk_get_rate(struct clk *clk)
37{
38 return clk->rate;
39}
40EXPORT_SYMBOL(clk_get_rate);
41
42long clk_round_rate(struct clk *clk, unsigned long rate)
43{
44 struct icst_vco vco;
45 vco = icst_hz_to_vco(clk->params, rate);
46 return icst_hz(clk->params, vco);
47}
48EXPORT_SYMBOL(clk_round_rate);
49
50int clk_set_rate(struct clk *clk, unsigned long rate)
51{
52 int ret = -EIO;
53
54 if (clk->setvco) {
55 struct icst_vco vco;
56
57 vco = icst_hz_to_vco(clk->params, rate);
58 clk->rate = icst_hz(clk->params, vco);
59 clk->setvco(clk, vco);
60 ret = 0;
61 }
62 return ret;
63}
64EXPORT_SYMBOL(clk_set_rate);
diff --git a/arch/arm/mach-realview/clock.h b/arch/arm/mach-realview/clock.h
deleted file mode 100644
index fa64c854258d..000000000000
--- a/arch/arm/mach-realview/clock.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * linux/arch/arm/mach-realview/clock.h
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <asm/hardware/icst.h>
12
13struct module;
14
15struct clk {
16 unsigned long rate;
17 const struct icst_params *params;
18 void *data;
19 void (*setvco)(struct clk *, struct icst_vco vco);
20};
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index a8c215a406a2..17eb7eb780d8 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -48,11 +48,11 @@
48 48
49#include <asm/hardware/gic.h> 49#include <asm/hardware/gic.h>
50 50
51#include <mach/clkdev.h>
51#include <mach/platform.h> 52#include <mach/platform.h>
52#include <mach/irqs.h> 53#include <mach/irqs.h>
53 54
54#include "core.h" 55#include "core.h"
55#include "clock.h"
56 56
57#define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET) 57#define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET)
58 58
diff --git a/arch/arm/mach-realview/include/mach/clkdev.h b/arch/arm/mach-realview/include/mach/clkdev.h
index 04b37a89801c..fefe4671255c 100644
--- a/arch/arm/mach-realview/include/mach/clkdev.h
+++ b/arch/arm/mach-realview/include/mach/clkdev.h
@@ -1,6 +1,15 @@
1#ifndef __ASM_MACH_CLKDEV_H 1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H 2#define __ASM_MACH_CLKDEV_H
3 3
4#include <asm/hardware/icst.h>
5
6struct clk {
7 unsigned long rate;
8 const struct icst_params *params;
9 u32 oscoff;
10 void (*setvco)(struct clk *, struct icst_vco vco);
11};
12
4#define __clk_get(clk) ({ 1; }) 13#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0) 14#define __clk_put(clk) do { } while (0)
6 15
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 39d953c89d9a..006765fd204c 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -43,7 +43,6 @@
43#include <mach/irqs.h> 43#include <mach/irqs.h>
44 44
45#include "core.h" 45#include "core.h"
46#include "clock.h"
47 46
48static struct map_desc realview_eb_io_desc[] __initdata = { 47static struct map_desc realview_eb_io_desc[] __initdata = {
49 { 48 {
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index a93aac5f473e..217f7c19551e 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -43,7 +43,6 @@
43#include <mach/irqs.h> 43#include <mach/irqs.h>
44 44
45#include "core.h" 45#include "core.h"
46#include "clock.h"
47 46
48static struct map_desc realview_pb1176_io_desc[] __initdata = { 47static struct map_desc realview_pb1176_io_desc[] __initdata = {
49 { 48 {
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index c7c656e235cc..9ef2ecc3c098 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -44,7 +44,6 @@
44#include <mach/irqs.h> 44#include <mach/irqs.h>
45 45
46#include "core.h" 46#include "core.h"
47#include "clock.h"
48 47
49static struct map_desc realview_pb11mp_io_desc[] __initdata = { 48static struct map_desc realview_pb11mp_io_desc[] __initdata = {
50 { 49 {
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index 3e3aaa3a2bc0..2fab3a6d566b 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -41,7 +41,6 @@
41#include <mach/irqs.h> 41#include <mach/irqs.h>
42 42
43#include "core.h" 43#include "core.h"
44#include "clock.h"
45 44
46static struct map_desc realview_pba8_io_desc[] __initdata = { 45static struct map_desc realview_pba8_io_desc[] __initdata = {
47 { 46 {
diff --git a/arch/arm/mach-versatile/Makefile b/arch/arm/mach-versatile/Makefile
index ba81e70ed813..97cf4d831b0c 100644
--- a/arch/arm/mach-versatile/Makefile
+++ b/arch/arm/mach-versatile/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := core.o clock.o 5obj-y := core.o
6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o 6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o
7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o 7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o
8obj-$(CONFIG_PCI) += pci.o 8obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/arm/mach-versatile/clock.c b/arch/arm/mach-versatile/clock.c
deleted file mode 100644
index adc67d771c78..000000000000
--- a/arch/arm/mach-versatile/clock.c
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * linux/arch/arm/mach-versatile/clock.c
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/device.h>
14#include <linux/list.h>
15#include <linux/errno.h>
16#include <linux/err.h>
17#include <linux/string.h>
18#include <linux/clk.h>
19#include <linux/mutex.h>
20
21#include <asm/clkdev.h>
22#include <asm/hardware/icst.h>
23
24#include "clock.h"
25
26int clk_enable(struct clk *clk)
27{
28 return 0;
29}
30EXPORT_SYMBOL(clk_enable);
31
32void clk_disable(struct clk *clk)
33{
34}
35EXPORT_SYMBOL(clk_disable);
36
37unsigned long clk_get_rate(struct clk *clk)
38{
39 return clk->rate;
40}
41EXPORT_SYMBOL(clk_get_rate);
42
43long clk_round_rate(struct clk *clk, unsigned long rate)
44{
45 struct icst_vco vco;
46 vco = icst_hz_to_vco(clk->params, rate);
47 return icst_hz(clk->params, vco);
48}
49EXPORT_SYMBOL(clk_round_rate);
50
51int clk_set_rate(struct clk *clk, unsigned long rate)
52{
53 int ret = -EIO;
54
55 if (clk->setvco) {
56 struct icst_vco vco;
57
58 vco = icst_hz_to_vco(clk->params, rate);
59 clk->rate = icst_hz(clk->params, vco);
60 clk->setvco(clk, vco);
61 ret = 0;
62 }
63 return ret;
64}
65EXPORT_SYMBOL(clk_set_rate);
diff --git a/arch/arm/mach-versatile/clock.h b/arch/arm/mach-versatile/clock.h
deleted file mode 100644
index aed7e22d102b..000000000000
--- a/arch/arm/mach-versatile/clock.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * linux/arch/arm/mach-versatile/clock.h
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <asm/hardware/icst.h>
12
13struct module;
14
15struct clk {
16 unsigned long rate;
17 const struct icst_params *params;
18 u32 oscoff;
19 void *data;
20 void (*setvco)(struct clk *, struct icst_vco vco);
21};
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 3c67691d4e72..e9d255f33674 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -47,11 +47,11 @@
47#include <asm/mach/irq.h> 47#include <asm/mach/irq.h>
48#include <asm/mach/time.h> 48#include <asm/mach/time.h>
49#include <asm/mach/map.h> 49#include <asm/mach/map.h>
50#include <mach/clkdev.h>
50#include <mach/hardware.h> 51#include <mach/hardware.h>
51#include <mach/platform.h> 52#include <mach/platform.h>
52 53
53#include "core.h" 54#include "core.h"
54#include "clock.h"
55 55
56/* 56/*
57 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx 57 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
diff --git a/arch/arm/mach-versatile/include/mach/clkdev.h b/arch/arm/mach-versatile/include/mach/clkdev.h
index 04b37a89801c..fefe4671255c 100644
--- a/arch/arm/mach-versatile/include/mach/clkdev.h
+++ b/arch/arm/mach-versatile/include/mach/clkdev.h
@@ -1,6 +1,15 @@
1#ifndef __ASM_MACH_CLKDEV_H 1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H 2#define __ASM_MACH_CLKDEV_H
3 3
4#include <asm/hardware/icst.h>
5
6struct clk {
7 unsigned long rate;
8 const struct icst_params *params;
9 u32 oscoff;
10 void (*setvco)(struct clk *, struct icst_vco vco);
11};
12
4#define __clk_get(clk) ({ 1; }) 13#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0) 14#define __clk_put(clk) do { } while (0)
6 15
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
new file mode 100644
index 000000000000..2228fd1725ac
--- /dev/null
+++ b/arch/arm/plat-versatile/Makefile
@@ -0,0 +1 @@
obj-y := clock.o
diff --git a/arch/arm/mach-integrator/clock.c b/arch/arm/plat-versatile/clock.c
index 52fc294eac74..2fa34de92325 100644
--- a/arch/arm/mach-integrator/clock.c
+++ b/arch/arm/plat-versatile/clock.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-integrator/clock.c 2 * linux/arch/arm/plat-versatile/clock.c
3 * 3 *
4 * Copyright (C) 2004 ARM Limited. 4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited. 5 * Written by Deep Blue Solutions Limited.
@@ -15,7 +15,7 @@
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16 16
17#include <asm/hardware/icst.h> 17#include <asm/hardware/icst.h>
18#include <asm/clkdev.h> 18
19#include <mach/clkdev.h> 19#include <mach/clkdev.h>
20 20
21int clk_enable(struct clk *clk) 21int clk_enable(struct clk *clk)