aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-aaec2000/Makefile2
-rw-r--r--arch/arm/mach-aaec2000/clock.c99
-rw-r--r--arch/arm/mach-aaec2000/clock.h23
-rw-r--r--arch/arm/mach-aaec2000/core.c29
-rw-r--r--arch/arm/mach-ep93xx/clock.c68
-rw-r--r--arch/arm/mach-ep93xx/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-lh7a40x/clocks.c92
-rw-r--r--arch/arm/mach-netx/fb.c7
-rw-r--r--drivers/mmc/host/mmci.c2
-rw-r--r--drivers/serial/amba-pl010.c2
-rw-r--r--drivers/serial/amba-pl011.c2
-rw-r--r--drivers/video/amba-clcd.c2
13 files changed, 65 insertions, 271 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 29759cd25553..131b7120995e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -271,6 +271,7 @@ config ARCH_EP93XX
271 select ARM_VIC 271 select ARM_VIC
272 select GENERIC_GPIO 272 select GENERIC_GPIO
273 select HAVE_CLK 273 select HAVE_CLK
274 select COMMON_CLKDEV
274 select ARCH_REQUIRE_GPIOLIB 275 select ARCH_REQUIRE_GPIOLIB
275 help 276 help
276 This enables support for the Cirrus EP93xx series of CPUs. 277 This enables support for the Cirrus EP93xx series of CPUs.
diff --git a/arch/arm/mach-aaec2000/Makefile b/arch/arm/mach-aaec2000/Makefile
index a8e462f58bc9..20ec83896c37 100644
--- a/arch/arm/mach-aaec2000/Makefile
+++ b/arch/arm/mach-aaec2000/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support (must be linked before board specific support) 5# Common support (must be linked before board specific support)
6obj-y += core.o clock.o 6obj-y += core.o
7 7
8# Specific board support 8# Specific board support
9obj-$(CONFIG_MACH_AAED2000) += aaed2000.o 9obj-$(CONFIG_MACH_AAED2000) += aaed2000.o
diff --git a/arch/arm/mach-aaec2000/clock.c b/arch/arm/mach-aaec2000/clock.c
deleted file mode 100644
index e10ee158d720..000000000000
--- a/arch/arm/mach-aaec2000/clock.c
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * linux/arch/arm/mach-aaec2000/clock.c
3 *
4 * Copyright (C) 2005 Nicolas Bellido Y Ortega
5 *
6 * Based on linux/arch/arm/mach-integrator/clock.c
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.
11 */
12#include <linux/module.h>
13#include <linux/kernel.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 "clock.h"
22
23static LIST_HEAD(clocks);
24static DEFINE_MUTEX(clocks_mutex);
25
26struct clk *clk_get(struct device *dev, const char *id)
27{
28 struct clk *p, *clk = ERR_PTR(-ENOENT);
29
30 mutex_lock(&clocks_mutex);
31 list_for_each_entry(p, &clocks, node) {
32 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
33 clk = p;
34 break;
35 }
36 }
37 mutex_unlock(&clocks_mutex);
38
39 return clk;
40}
41EXPORT_SYMBOL(clk_get);
42
43void clk_put(struct clk *clk)
44{
45 module_put(clk->owner);
46}
47EXPORT_SYMBOL(clk_put);
48
49int clk_enable(struct clk *clk)
50{
51 return 0;
52}
53EXPORT_SYMBOL(clk_enable);
54
55void clk_disable(struct clk *clk)
56{
57}
58EXPORT_SYMBOL(clk_disable);
59
60unsigned long clk_get_rate(struct clk *clk)
61{
62 return clk->rate;
63}
64EXPORT_SYMBOL(clk_get_rate);
65
66long clk_round_rate(struct clk *clk, unsigned long rate)
67{
68 return rate;
69}
70EXPORT_SYMBOL(clk_round_rate);
71
72int clk_set_rate(struct clk *clk, unsigned long rate)
73{
74 return 0;
75}
76EXPORT_SYMBOL(clk_set_rate);
77
78int clk_register(struct clk *clk)
79{
80 mutex_lock(&clocks_mutex);
81 list_add(&clk->node, &clocks);
82 mutex_unlock(&clocks_mutex);
83 return 0;
84}
85EXPORT_SYMBOL(clk_register);
86
87void clk_unregister(struct clk *clk)
88{
89 mutex_lock(&clocks_mutex);
90 list_del(&clk->node);
91 mutex_unlock(&clocks_mutex);
92}
93EXPORT_SYMBOL(clk_unregister);
94
95static int __init clk_init(void)
96{
97 return 0;
98}
99arch_initcall(clk_init);
diff --git a/arch/arm/mach-aaec2000/clock.h b/arch/arm/mach-aaec2000/clock.h
deleted file mode 100644
index d4bb74ff613f..000000000000
--- a/arch/arm/mach-aaec2000/clock.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-aaec2000/clock.h
3 *
4 * Copyright (C) 2005 Nicolas Bellido Y Ortega
5 *
6 * Based on linux/arch/arm/mach-integrator/clock.h
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.
11 */
12struct module;
13
14struct clk {
15 struct list_head node;
16 unsigned long rate;
17 struct module *owner;
18 const char *name;
19 void *data;
20};
21
22int clk_register(struct clk *clk);
23void clk_unregister(struct clk *clk);
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index dfb26bc23d1a..50e13965dfed 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -19,6 +19,7 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/timex.h> 20#include <linux/timex.h>
21#include <linux/signal.h> 21#include <linux/signal.h>
22#include <linux/clk.h>
22 23
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <asm/irq.h> 25#include <asm/irq.h>
@@ -30,7 +31,6 @@
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31 32
32#include "core.h" 33#include "core.h"
33#include "clock.h"
34 34
35/* 35/*
36 * Common I/O mapping: 36 * Common I/O mapping:
@@ -229,9 +229,28 @@ static struct amba_device *amba_devs[] __initdata = {
229 &clcd_device, 229 &clcd_device,
230}; 230};
231 231
232static struct clk aaec2000_clcd_clk = { 232void clk_disable(struct clk *clk)
233 .name = "CLCDCLK", 233{
234}; 234}
235
236int clk_set_rate(struct clk *clk, unsigned long rate)
237{
238 return 0;
239}
240
241int clk_enable(struct clk *clk)
242{
243 return 0;
244}
245
246struct clk *clk_get(struct device *dev, const char *id)
247{
248 return dev && strcmp(dev_name(dev), "mb:16") == 0 ? NULL : ERR_PTR(-ENOENT);
249}
250
251void clk_put(struct clk *clk)
252{
253}
235 254
236void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *clcd) 255void __init aaec2000_set_clcd_plat_data(struct aaec2000_clcd_info *clcd)
237{ 256{
@@ -265,8 +284,6 @@ static int __init aaec2000_init(void)
265{ 284{
266 int i; 285 int i;
267 286
268 clk_register(&aaec2000_clcd_clk);
269
270 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 287 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
271 struct amba_device *d = amba_devs[i]; 288 struct amba_device *d = amba_devs[i];
272 amba_device_register(d, &iomem_resource); 289 amba_device_register(d, &iomem_resource);
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 8c9f2491dccc..96049283a10a 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -16,11 +16,12 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/io.h> 18#include <linux/io.h>
19
20#include <asm/clkdev.h>
19#include <asm/div64.h> 21#include <asm/div64.h>
20#include <mach/hardware.h> 22#include <mach/hardware.h>
21 23
22struct clk { 24struct clk {
23 char *name;
24 unsigned long rate; 25 unsigned long rate;
25 int users; 26 int users;
26 u32 enable_reg; 27 u32 enable_reg;
@@ -28,53 +29,33 @@ struct clk {
28}; 29};
29 30
30static struct clk clk_uart = { 31static struct clk clk_uart = {
31 .name = "UARTCLK",
32 .rate = 14745600, 32 .rate = 14745600,
33}; 33};
34static struct clk clk_pll1 = { 34static struct clk clk_pll1;
35 .name = "pll1", 35static struct clk clk_f;
36}; 36static struct clk clk_h;
37static struct clk clk_f = { 37static struct clk clk_p;
38 .name = "fclk", 38static struct clk clk_pll2;
39};
40static struct clk clk_h = {
41 .name = "hclk",
42};
43static struct clk clk_p = {
44 .name = "pclk",
45};
46static struct clk clk_pll2 = {
47 .name = "pll2",
48};
49static struct clk clk_usb_host = { 39static struct clk clk_usb_host = {
50 .name = "usb_host",
51 .enable_reg = EP93XX_SYSCON_CLOCK_CONTROL, 40 .enable_reg = EP93XX_SYSCON_CLOCK_CONTROL,
52 .enable_mask = EP93XX_SYSCON_CLOCK_USH_EN, 41 .enable_mask = EP93XX_SYSCON_CLOCK_USH_EN,
53}; 42};
54 43
55 44#define INIT_CK(dev,con,ck) \
56static struct clk *clocks[] = { 45 { .dev_id = dev, .con_id = con, .clk = ck }
57 &clk_uart, 46
58 &clk_pll1, 47static struct clk_lookup clocks[] = {
59 &clk_f, 48 INIT_CK("apb:uart1", NULL, &clk_uart),
60 &clk_h, 49 INIT_CK("apb:uart2", NULL, &clk_uart),
61 &clk_p, 50 INIT_CK("apb:uart3", NULL, &clk_uart),
62 &clk_pll2, 51 INIT_CK(NULL, "pll1", &clk_pll1),
63 &clk_usb_host, 52 INIT_CK(NULL, "fclk", &clk_f),
53 INIT_CK(NULL, "hclk", &clk_h),
54 INIT_CK(NULL, "pclk", &clk_p),
55 INIT_CK(NULL, "pll2", &clk_pll2),
56 INIT_CK(NULL, "usb_host", &clk_usb_host),
64}; 57};
65 58
66struct clk *clk_get(struct device *dev, const char *id)
67{
68 int i;
69
70 for (i = 0; i < ARRAY_SIZE(clocks); i++) {
71 if (!strcmp(clocks[i]->name, id))
72 return clocks[i];
73 }
74
75 return ERR_PTR(-ENOENT);
76}
77EXPORT_SYMBOL(clk_get);
78 59
79int clk_enable(struct clk *clk) 60int clk_enable(struct clk *clk)
80{ 61{
@@ -106,12 +87,6 @@ unsigned long clk_get_rate(struct clk *clk)
106} 87}
107EXPORT_SYMBOL(clk_get_rate); 88EXPORT_SYMBOL(clk_get_rate);
108 89
109void clk_put(struct clk *clk)
110{
111}
112EXPORT_SYMBOL(clk_put);
113
114
115 90
116static char fclk_divisors[] = { 1, 2, 4, 8, 16, 1, 1, 1 }; 91static char fclk_divisors[] = { 1, 2, 4, 8, 16, 1, 1, 1 };
117static char hclk_divisors[] = { 1, 2, 4, 5, 6, 8, 16, 32 }; 92static char hclk_divisors[] = { 1, 2, 4, 5, 6, 8, 16, 32 };
@@ -138,6 +113,7 @@ static unsigned long calc_pll_rate(u32 config_word)
138static int __init ep93xx_clock_init(void) 113static int __init ep93xx_clock_init(void)
139{ 114{
140 u32 value; 115 u32 value;
116 int i;
141 117
142 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); 118 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1);
143 if (!(value & 0x00800000)) { /* PLL1 bypassed? */ 119 if (!(value & 0x00800000)) { /* PLL1 bypassed? */
@@ -165,6 +141,8 @@ static int __init ep93xx_clock_init(void)
165 clk_f.rate / 1000000, clk_h.rate / 1000000, 141 clk_f.rate / 1000000, clk_h.rate / 1000000,
166 clk_p.rate / 1000000); 142 clk_p.rate / 1000000);
167 143
144 for (i = 0; i < ARRAY_SIZE(clocks); i++)
145 clkdev_add(&clocks[i]);
168 return 0; 146 return 0;
169} 147}
170arch_initcall(ep93xx_clock_init); 148arch_initcall(ep93xx_clock_init);
diff --git a/arch/arm/mach-ep93xx/include/mach/clkdev.h b/arch/arm/mach-ep93xx/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-lh7a40x/clocks.c b/arch/arm/mach-lh7a40x/clocks.c
index 4fb23ac6b5ac..6182f5410b4d 100644
--- a/arch/arm/mach-lh7a40x/clocks.c
+++ b/arch/arm/mach-lh7a40x/clocks.c
@@ -14,21 +14,14 @@
14#include <linux/err.h> 14#include <linux/err.h>
15 15
16struct module; 16struct module;
17struct icst525_params;
18 17
19struct clk { 18struct clk {
20 struct list_head node; 19 struct list_head node;
21 unsigned long rate; 20 unsigned long rate;
22 struct module *owner; 21 struct module *owner;
23 const char *name; 22 const char *name;
24// void *data;
25// const struct icst525_params *params;
26// void (*setvco)(struct clk *, struct icst525_vco vco);
27}; 23};
28 24
29int clk_register(struct clk *clk);
30void clk_unregister(struct clk *clk);
31
32/* ----- */ 25/* ----- */
33 26
34#define MAINDIV1(c) (((c) >> 7) & 0x0f) 27#define MAINDIV1(c) (((c) >> 7) & 0x0f)
@@ -79,31 +72,15 @@ unsigned int pclkfreq_get (void)
79 72
80/* ----- */ 73/* ----- */
81 74
82static LIST_HEAD(clocks);
83static DECLARE_MUTEX(clocks_sem);
84
85struct clk *clk_get (struct device *dev, const char *id) 75struct clk *clk_get (struct device *dev, const char *id)
86{ 76{
87 struct clk *p; 77 return dev && strcmp(dev_name(dev), "cldc-lh7a40x") == 0
88 struct clk *clk = ERR_PTR(-ENOENT); 78 ? NULL : ERR_PTR(-ENOENT);
89
90 down (&clocks_sem);
91 list_for_each_entry (p, &clocks, node) {
92 if (strcmp (id, p->name) == 0
93 && try_module_get(p->owner)) {
94 clk = p;
95 break;
96 }
97 }
98 up (&clocks_sem);
99
100 return clk;
101} 79}
102EXPORT_SYMBOL(clk_get); 80EXPORT_SYMBOL(clk_get);
103 81
104void clk_put (struct clk *clk) 82void clk_put (struct clk *clk)
105{ 83{
106 module_put(clk->owner);
107} 84}
108EXPORT_SYMBOL(clk_put); 85EXPORT_SYMBOL(clk_put);
109 86
@@ -118,20 +95,9 @@ void clk_disable (struct clk *clk)
118} 95}
119EXPORT_SYMBOL(clk_disable); 96EXPORT_SYMBOL(clk_disable);
120 97
121int clk_use (struct clk *clk)
122{
123 return 0;
124}
125EXPORT_SYMBOL(clk_use);
126
127void clk_unuse (struct clk *clk)
128{
129}
130EXPORT_SYMBOL(clk_unuse);
131
132unsigned long clk_get_rate (struct clk *clk) 98unsigned long clk_get_rate (struct clk *clk)
133{ 99{
134 return clk->rate; 100 return 0;
135} 101}
136EXPORT_SYMBOL(clk_get_rate); 102EXPORT_SYMBOL(clk_get_rate);
137 103
@@ -143,56 +109,6 @@ EXPORT_SYMBOL(clk_round_rate);
143 109
144int clk_set_rate (struct clk *clk, unsigned long rate) 110int clk_set_rate (struct clk *clk, unsigned long rate)
145{ 111{
146 int ret = -EIO; 112 return -EIO;
147 return ret;
148} 113}
149EXPORT_SYMBOL(clk_set_rate); 114EXPORT_SYMBOL(clk_set_rate);
150
151#if 0
152/*
153 * These are fixed clocks.
154 */
155static struct clk kmi_clk = {
156 .name = "KMIREFCLK",
157 .rate = 24000000,
158};
159
160static struct clk uart_clk = {
161 .name = "UARTCLK",
162 .rate = 24000000,
163};
164
165static struct clk mmci_clk = {
166 .name = "MCLK",
167 .rate = 33000000,
168};
169#endif
170
171static struct clk clcd_clk = {
172 .name = "CLCDCLK",
173 .rate = 0,
174};
175
176int clk_register (struct clk *clk)
177{
178 down (&clocks_sem);
179 list_add (&clk->node, &clocks);
180 up (&clocks_sem);
181 return 0;
182}
183EXPORT_SYMBOL(clk_register);
184
185void clk_unregister (struct clk *clk)
186{
187 down (&clocks_sem);
188 list_del (&clk->node);
189 up (&clocks_sem);
190}
191EXPORT_SYMBOL(clk_unregister);
192
193static int __init clk_init (void)
194{
195 clk_register(&clcd_clk);
196 return 0;
197}
198arch_initcall(clk_init);
diff --git a/arch/arm/mach-netx/fb.c b/arch/arm/mach-netx/fb.c
index 24c79650f9f3..8f1f992f002e 100644
--- a/arch/arm/mach-netx/fb.c
+++ b/arch/arm/mach-netx/fb.c
@@ -22,14 +22,11 @@
22#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/amba/bus.h> 23#include <linux/amba/bus.h>
24#include <linux/amba/clcd.h> 24#include <linux/amba/clcd.h>
25#include <linux/err.h>
25 26
26#include <mach/netx-regs.h> 27#include <mach/netx-regs.h>
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28 29
29struct clk {};
30
31static struct clk fb_clk;
32
33static struct clcd_panel *netx_panel; 30static struct clcd_panel *netx_panel;
34 31
35void netx_clcd_enable(struct clcd_fb *fb) 32void netx_clcd_enable(struct clcd_fb *fb)
@@ -85,7 +82,7 @@ int clk_enable(struct clk *clk)
85 82
86struct clk *clk_get(struct device *dev, const char *id) 83struct clk *clk_get(struct device *dev, const char *id)
87{ 84{
88 return &fb_clk; 85 return dev && strcmp(dev_name(dev), "fb") == 0 ? NULL : ERR_PTR(-ENOENT);
89} 86}
90 87
91void clk_put(struct clk *clk) 88void clk_put(struct clk *clk)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 2fadf323c696..1bcbdd6763ac 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -500,7 +500,7 @@ static int mmci_probe(struct amba_device *dev, void *id)
500 } 500 }
501 501
502 host = mmc_priv(mmc); 502 host = mmc_priv(mmc);
503 host->clk = clk_get(&dev->dev, "MCLK"); 503 host->clk = clk_get(&dev->dev, NULL);
504 if (IS_ERR(host->clk)) { 504 if (IS_ERR(host->clk)) {
505 ret = PTR_ERR(host->clk); 505 ret = PTR_ERR(host->clk);
506 host->clk = NULL; 506 host->clk = NULL;
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 71562689116f..e3a5ad5ef1d6 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -692,7 +692,7 @@ static int pl010_probe(struct amba_device *dev, void *id)
692 goto free; 692 goto free;
693 } 693 }
694 694
695 uap->clk = clk_get(&dev->dev, "UARTCLK"); 695 uap->clk = clk_get(&dev->dev, NULL);
696 if (IS_ERR(uap->clk)) { 696 if (IS_ERR(uap->clk)) {
697 ret = PTR_ERR(uap->clk); 697 ret = PTR_ERR(uap->clk);
698 goto unmap; 698 goto unmap;
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index b7180046f8db..8b2b9700f3e4 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -756,7 +756,7 @@ static int pl011_probe(struct amba_device *dev, void *id)
756 goto free; 756 goto free;
757 } 757 }
758 758
759 uap->clk = clk_get(&dev->dev, "UARTCLK"); 759 uap->clk = clk_get(&dev->dev, NULL);
760 if (IS_ERR(uap->clk)) { 760 if (IS_ERR(uap->clk)) {
761 ret = PTR_ERR(uap->clk); 761 ret = PTR_ERR(uap->clk);
762 goto unmap; 762 goto unmap;
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index 70ba1bd845fb..2ac52fd8cc11 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -343,7 +343,7 @@ static int clcdfb_register(struct clcd_fb *fb)
343{ 343{
344 int ret; 344 int ret;
345 345
346 fb->clk = clk_get(&fb->dev->dev, "CLCDCLK"); 346 fb->clk = clk_get(&fb->dev->dev, NULL);
347 if (IS_ERR(fb->clk)) { 347 if (IS_ERR(fb->clk)) {
348 ret = PTR_ERR(fb->clk); 348 ret = PTR_ERR(fb->clk);
349 goto out; 349 goto out;