aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorGreg Ungerer2012-07-13 01:08:44 -0500
committerGreg Ungerer2012-12-04 18:51:35 -0600
commit280ef31a00073b4092bb47814fcb0a1f1f27b2bd (patch)
tree94a5c50222e4988853df2965e5c0f5d690488dde /arch/m68k
parent98122d7329e76d00dad25dc0324ec9475f128181 (diff)
downloadam43-linux-kernel-280ef31a00073b4092bb47814fcb0a1f1f27b2bd.tar.gz
am43-linux-kernel-280ef31a00073b4092bb47814fcb0a1f1f27b2bd.tar.xz
am43-linux-kernel-280ef31a00073b4092bb47814fcb0a1f1f27b2bd.zip
m68knommu: modify clock code so it can be used by all ColdFire CPU types
The existing clk.c code for ColdFire CPUs has one set of functions to support those CPU types that have selectable clocks (those with a PPMCR register), and a duplicate simpler set for those with static clocks. Modify the clk.c code so there is just one set of support functions. All CPU types now define a list of clocks (in "struct clk"s), so we only need a single set of clock functions. Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/platform/coldfire/clk.c100
1 files changed, 38 insertions, 62 deletions
diff --git a/arch/m68k/platform/coldfire/clk.c b/arch/m68k/platform/coldfire/clk.c
index 9cd13b4ce42..fddfdccae63 100644
--- a/arch/m68k/platform/coldfire/clk.c
+++ b/arch/m68k/platform/coldfire/clk.c
@@ -19,37 +19,58 @@
19#include <asm/mcfsim.h> 19#include <asm/mcfsim.h>
20#include <asm/mcfclk.h> 20#include <asm/mcfclk.h>
21 21
22/***************************************************************************/ 22static DEFINE_SPINLOCK(clk_lock);
23#ifndef MCFPM_PPMCR0 23
24struct clk *clk_get(struct device *dev, const char *id) 24#ifdef MCFPM_PPMCR0
25/*
26 * For more advanced ColdFire parts that have clocks that can be enabled
27 * we supply enable/disable functions. These must properly define their
28 * clocks in their platform specific code.
29 */
30void __clk_init_enabled(struct clk *clk)
25{ 31{
26 return NULL; 32 clk->enabled = 1;
33 clk->clk_ops->enable(clk);
27} 34}
28EXPORT_SYMBOL(clk_get);
29 35
30int clk_enable(struct clk *clk) 36void __clk_init_disabled(struct clk *clk)
31{ 37{
32 return 0; 38 clk->enabled = 0;
39 clk->clk_ops->disable(clk);
33} 40}
34EXPORT_SYMBOL(clk_enable);
35 41
36void clk_disable(struct clk *clk) 42static void __clk_enable0(struct clk *clk)
37{ 43{
44 __raw_writeb(clk->slot, MCFPM_PPMCR0);
38} 45}
39EXPORT_SYMBOL(clk_disable);
40 46
41void clk_put(struct clk *clk) 47static void __clk_disable0(struct clk *clk)
48{
49 __raw_writeb(clk->slot, MCFPM_PPMSR0);
50}
51
52struct clk_ops clk_ops0 = {
53 .enable = __clk_enable0,
54 .disable = __clk_disable0,
55};
56
57#ifdef MCFPM_PPMCR1
58static void __clk_enable1(struct clk *clk)
42{ 59{
60 __raw_writeb(clk->slot, MCFPM_PPMCR1);
43} 61}
44EXPORT_SYMBOL(clk_put);
45 62
46unsigned long clk_get_rate(struct clk *clk) 63static void __clk_disable1(struct clk *clk)
47{ 64{
48 return MCF_CLK; 65 __raw_writeb(clk->slot, MCFPM_PPMSR1);
49} 66}
50EXPORT_SYMBOL(clk_get_rate); 67
51#else 68struct clk_ops clk_ops1 = {
52static DEFINE_SPINLOCK(clk_lock); 69 .enable = __clk_enable1,
70 .disable = __clk_disable1,
71};
72#endif /* MCFPM_PPMCR1 */
73#endif /* MCFPM_PPMCR0 */
53 74
54struct clk *clk_get(struct device *dev, const char *id) 75struct clk *clk_get(struct device *dev, const char *id)
55{ 76{
@@ -101,48 +122,3 @@ unsigned long clk_get_rate(struct clk *clk)
101EXPORT_SYMBOL(clk_get_rate); 122EXPORT_SYMBOL(clk_get_rate);
102 123
103/***************************************************************************/ 124/***************************************************************************/
104
105void __clk_init_enabled(struct clk *clk)
106{
107 clk->enabled = 1;
108 clk->clk_ops->enable(clk);
109}
110
111void __clk_init_disabled(struct clk *clk)
112{
113 clk->enabled = 0;
114 clk->clk_ops->disable(clk);
115}
116
117static void __clk_enable0(struct clk *clk)
118{
119 __raw_writeb(clk->slot, MCFPM_PPMCR0);
120}
121
122static void __clk_disable0(struct clk *clk)
123{
124 __raw_writeb(clk->slot, MCFPM_PPMSR0);
125}
126
127struct clk_ops clk_ops0 = {
128 .enable = __clk_enable0,
129 .disable = __clk_disable0,
130};
131
132#ifdef MCFPM_PPMCR1
133static void __clk_enable1(struct clk *clk)
134{
135 __raw_writeb(clk->slot, MCFPM_PPMCR1);
136}
137
138static void __clk_disable1(struct clk *clk)
139{
140 __raw_writeb(clk->slot, MCFPM_PPMSR1);
141}
142
143struct clk_ops clk_ops1 = {
144 .enable = __clk_enable1,
145 .disable = __clk_disable1,
146};
147#endif /* MCFPM_PPMCR1 */
148#endif /* MCFPM_PPMCR0 */