1 From 3932e0f5c4c05200c030b60606ed2eb83550f4bb Mon Sep 17 00:00:00 2001
2 From: Dmitry Baryshkov <dbaryshkov@gmail.com>
3 Date: Mon, 4 Feb 2008 03:01:04 +0300
4 Subject: [PATCH 43/64] Use clocklib for sa1100 sub-arch.
6 Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
9 arch/arm/mach-sa1100/clock.c | 95 ++---------------------------------------
10 2 files changed, 6 insertions(+), 90 deletions(-)
12 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
13 index 47f3c73..fa47201 100644
14 --- a/arch/arm/Kconfig
15 +++ b/arch/arm/Kconfig
16 @@ -370,6 +370,7 @@ config ARCH_SA1100
20 + select HAVE_CLOCK_LIB
22 Support for StrongARM 11x0 based boards.
24 diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c
25 index fc97fe5..6b3cc51 100644
26 --- a/arch/arm/mach-sa1100/clock.c
27 +++ b/arch/arm/mach-sa1100/clock.c
29 #include <linux/err.h>
30 #include <linux/string.h>
31 #include <linux/clk.h>
32 +#include <linux/clklib.h>
33 #include <linux/spinlock.h>
34 #include <linux/mutex.h>
36 #include <asm/hardware.h>
39 - * Very simple clock implementation - we only have one clock to
40 - * deal with at the moment, so we only match using the "name".
43 - struct list_head node;
46 - unsigned int enabled;
47 - void (*enable)(void);
48 - void (*disable)(void);
51 -static LIST_HEAD(clocks);
52 -static DEFINE_MUTEX(clocks_mutex);
53 -static DEFINE_SPINLOCK(clocks_lock);
55 -struct clk *clk_get(struct device *dev, const char *id)
57 - struct clk *p, *clk = ERR_PTR(-ENOENT);
59 - mutex_lock(&clocks_mutex);
60 - list_for_each_entry(p, &clocks, node) {
61 - if (strcmp(id, p->name) == 0) {
66 - mutex_unlock(&clocks_mutex);
70 -EXPORT_SYMBOL(clk_get);
72 -void clk_put(struct clk *clk)
75 -EXPORT_SYMBOL(clk_put);
77 -int clk_enable(struct clk *clk)
79 - unsigned long flags;
81 - spin_lock_irqsave(&clocks_lock, flags);
82 - if (clk->enabled++ == 0)
84 - spin_unlock_irqrestore(&clocks_lock, flags);
87 -EXPORT_SYMBOL(clk_enable);
89 -void clk_disable(struct clk *clk)
91 - unsigned long flags;
93 - WARN_ON(clk->enabled == 0);
95 - spin_lock_irqsave(&clocks_lock, flags);
96 - if (--clk->enabled == 0)
98 - spin_unlock_irqrestore(&clocks_lock, flags);
100 -EXPORT_SYMBOL(clk_disable);
102 -unsigned long clk_get_rate(struct clk *clk)
106 -EXPORT_SYMBOL(clk_get_rate);
109 -static void clk_gpio27_enable(void)
110 +static int clk_gpio27_enable(struct clk *clk)
113 * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
114 @@ -93,9 +23,11 @@ static void clk_gpio27_enable(void)
115 GAFR |= GPIO_32_768kHz;
116 GPDR |= GPIO_32_768kHz;
117 TUCR = TUCR_3_6864MHz;
122 -static void clk_gpio27_disable(void)
123 +static void clk_gpio27_disable(struct clk *clk)
126 GPDR &= ~GPIO_32_768kHz;
127 @@ -109,23 +41,6 @@ static struct clk clk_gpio27 = {
128 .disable = clk_gpio27_disable,
131 -int clk_register(struct clk *clk)
133 - mutex_lock(&clocks_mutex);
134 - list_add(&clk->node, &clocks);
135 - mutex_unlock(&clocks_mutex);
138 -EXPORT_SYMBOL(clk_register);
140 -void clk_unregister(struct clk *clk)
142 - mutex_lock(&clocks_mutex);
143 - list_del(&clk->node);
144 - mutex_unlock(&clocks_mutex);
146 -EXPORT_SYMBOL(clk_unregister);
148 static int __init clk_init(void)
150 clk_register(&clk_gpio27);