aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2012-03-13 19:19:19 -0400
committerMike Turquette <mturquette@linaro.org>2012-07-11 20:58:47 -0400
commit8d4d9f52081cd45bde42b9452eba95f38feb7dae (patch)
tree81b614f5f842150c910737a9e1f5414de3b49b4b /arch
parent260b6aa03edd87a3a85c137e7b95305d9eb40485 (diff)
clk: add highbank clock support
This adds real clock support to Calxeda Highbank SOC using the common clock infrastructure. Signed-off-by: Rob Herring <rob.herring@calxeda.com> [mturquette@linaro.org: fixed up invalid writes to const struct member] Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/boot/dts/highbank.dts91
-rw-r--r--arch/arm/mach-highbank/Makefile2
-rw-r--r--arch/arm/mach-highbank/clock.c62
-rw-r--r--arch/arm/mach-highbank/highbank.c7
5 files changed, 99 insertions, 64 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6f8cf405d3ec..f3c60ff41692 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -352,6 +352,7 @@ config ARCH_HIGHBANK
352 select ARM_TIMER_SP804 352 select ARM_TIMER_SP804
353 select CACHE_L2X0 353 select CACHE_L2X0
354 select CLKDEV_LOOKUP 354 select CLKDEV_LOOKUP
355 select COMMON_CLK
355 select CPU_V7 356 select CPU_V7
356 select GENERIC_CLOCKEVENTS 357 select GENERIC_CLOCKEVENTS
357 select HAVE_ARM_SCU 358 select HAVE_ARM_SCU
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts
index 83e72294aefb..2e1cfa00c25b 100644
--- a/arch/arm/boot/dts/highbank.dts
+++ b/arch/arm/boot/dts/highbank.dts
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2011 Calxeda, Inc. 2 * Copyright 2011-2012 Calxeda, Inc.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -24,6 +24,7 @@
24 compatible = "calxeda,highbank"; 24 compatible = "calxeda,highbank";
25 #address-cells = <1>; 25 #address-cells = <1>;
26 #size-cells = <1>; 26 #size-cells = <1>;
27 clock-ranges;
27 28
28 cpus { 29 cpus {
29 #address-cells = <1>; 30 #address-cells = <1>;
@@ -33,24 +34,32 @@
33 compatible = "arm,cortex-a9"; 34 compatible = "arm,cortex-a9";
34 reg = <0>; 35 reg = <0>;
35 next-level-cache = <&L2>; 36 next-level-cache = <&L2>;
37 clocks = <&a9pll>;
38 clock-names = "cpu";
36 }; 39 };
37 40
38 cpu@1 { 41 cpu@1 {
39 compatible = "arm,cortex-a9"; 42 compatible = "arm,cortex-a9";
40 reg = <1>; 43 reg = <1>;
41 next-level-cache = <&L2>; 44 next-level-cache = <&L2>;
45 clocks = <&a9pll>;
46 clock-names = "cpu";
42 }; 47 };
43 48
44 cpu@2 { 49 cpu@2 {
45 compatible = "arm,cortex-a9"; 50 compatible = "arm,cortex-a9";
46 reg = <2>; 51 reg = <2>;
47 next-level-cache = <&L2>; 52 next-level-cache = <&L2>;
53 clocks = <&a9pll>;
54 clock-names = "cpu";
48 }; 55 };
49 56
50 cpu@3 { 57 cpu@3 {
51 compatible = "arm,cortex-a9"; 58 compatible = "arm,cortex-a9";
52 reg = <3>; 59 reg = <3>;
53 next-level-cache = <&L2>; 60 next-level-cache = <&L2>;
61 clocks = <&a9pll>;
62 clock-names = "cpu";
54 }; 63 };
55 }; 64 };
56 65
@@ -75,12 +84,14 @@
75 compatible = "arm,cortex-a9-twd-timer"; 84 compatible = "arm,cortex-a9-twd-timer";
76 reg = <0xfff10600 0x20>; 85 reg = <0xfff10600 0x20>;
77 interrupts = <1 13 0xf01>; 86 interrupts = <1 13 0xf01>;
87 clocks = <&a9periphclk>;
78 }; 88 };
79 89
80 watchdog@fff10620 { 90 watchdog@fff10620 {
81 compatible = "arm,cortex-a9-twd-wdt"; 91 compatible = "arm,cortex-a9-twd-wdt";
82 reg = <0xfff10620 0x20>; 92 reg = <0xfff10620 0x20>;
83 interrupts = <1 14 0xf01>; 93 interrupts = <1 14 0xf01>;
94 clocks = <&a9periphclk>;
84 }; 95 };
85 96
86 intc: interrupt-controller@fff11000 { 97 intc: interrupt-controller@fff11000 {
@@ -116,12 +127,15 @@
116 compatible = "calxeda,hb-sdhci"; 127 compatible = "calxeda,hb-sdhci";
117 reg = <0xffe0e000 0x1000>; 128 reg = <0xffe0e000 0x1000>;
118 interrupts = <0 90 4>; 129 interrupts = <0 90 4>;
130 clocks = <&eclk>;
119 }; 131 };
120 132
121 ipc@fff20000 { 133 ipc@fff20000 {
122 compatible = "arm,pl320", "arm,primecell"; 134 compatible = "arm,pl320", "arm,primecell";
123 reg = <0xfff20000 0x1000>; 135 reg = <0xfff20000 0x1000>;
124 interrupts = <0 7 4>; 136 interrupts = <0 7 4>;
137 clocks = <&pclk>;
138 clock-names = "apb_pclk";
125 }; 139 };
126 140
127 gpioe: gpio@fff30000 { 141 gpioe: gpio@fff30000 {
@@ -130,6 +144,8 @@
130 gpio-controller; 144 gpio-controller;
131 reg = <0xfff30000 0x1000>; 145 reg = <0xfff30000 0x1000>;
132 interrupts = <0 14 4>; 146 interrupts = <0 14 4>;
147 clocks = <&pclk>;
148 clock-names = "apb_pclk";
133 }; 149 };
134 150
135 gpiof: gpio@fff31000 { 151 gpiof: gpio@fff31000 {
@@ -138,6 +154,8 @@
138 gpio-controller; 154 gpio-controller;
139 reg = <0xfff31000 0x1000>; 155 reg = <0xfff31000 0x1000>;
140 interrupts = <0 15 4>; 156 interrupts = <0 15 4>;
157 clocks = <&pclk>;
158 clock-names = "apb_pclk";
141 }; 159 };
142 160
143 gpiog: gpio@fff32000 { 161 gpiog: gpio@fff32000 {
@@ -146,6 +164,8 @@
146 gpio-controller; 164 gpio-controller;
147 reg = <0xfff32000 0x1000>; 165 reg = <0xfff32000 0x1000>;
148 interrupts = <0 16 4>; 166 interrupts = <0 16 4>;
167 clocks = <&pclk>;
168 clock-names = "apb_pclk";
149 }; 169 };
150 170
151 gpioh: gpio@fff33000 { 171 gpioh: gpio@fff33000 {
@@ -154,24 +174,32 @@
154 gpio-controller; 174 gpio-controller;
155 reg = <0xfff33000 0x1000>; 175 reg = <0xfff33000 0x1000>;
156 interrupts = <0 17 4>; 176 interrupts = <0 17 4>;
177 clocks = <&pclk>;
178 clock-names = "apb_pclk";
157 }; 179 };
158 180
159 timer { 181 timer {
160 compatible = "arm,sp804", "arm,primecell"; 182 compatible = "arm,sp804", "arm,primecell";
161 reg = <0xfff34000 0x1000>; 183 reg = <0xfff34000 0x1000>;
162 interrupts = <0 18 4>; 184 interrupts = <0 18 4>;
185 clocks = <&pclk>;
186 clock-names = "apb_pclk";
163 }; 187 };
164 188
165 rtc@fff35000 { 189 rtc@fff35000 {
166 compatible = "arm,pl031", "arm,primecell"; 190 compatible = "arm,pl031", "arm,primecell";
167 reg = <0xfff35000 0x1000>; 191 reg = <0xfff35000 0x1000>;
168 interrupts = <0 19 4>; 192 interrupts = <0 19 4>;
193 clocks = <&pclk>;
194 clock-names = "apb_pclk";
169 }; 195 };
170 196
171 serial@fff36000 { 197 serial@fff36000 {
172 compatible = "arm,pl011", "arm,primecell"; 198 compatible = "arm,pl011", "arm,primecell";
173 reg = <0xfff36000 0x1000>; 199 reg = <0xfff36000 0x1000>;
174 interrupts = <0 20 4>; 200 interrupts = <0 20 4>;
201 clocks = <&pclk>;
202 clock-names = "apb_pclk";
175 }; 203 };
176 204
177 smic@fff3a000 { 205 smic@fff3a000 {
@@ -186,12 +214,73 @@
186 sregs@fff3c000 { 214 sregs@fff3c000 {
187 compatible = "calxeda,hb-sregs"; 215 compatible = "calxeda,hb-sregs";
188 reg = <0xfff3c000 0x1000>; 216 reg = <0xfff3c000 0x1000>;
217
218 clocks {
219 #address-cells = <1>;
220 #size-cells = <0>;
221
222 osc: oscillator {
223 #clock-cells = <0>;
224 compatible = "fixed-clock";
225 clock-frequency = <33333000>;
226 };
227
228 ddrpll: ddrpll {
229 #clock-cells = <0>;
230 compatible = "calxeda,hb-pll-clock";
231 clocks = <&osc>;
232 reg = <0x108>;
233 };
234
235 a9pll: a9pll {
236 #clock-cells = <0>;
237 compatible = "calxeda,hb-pll-clock";
238 clocks = <&osc>;
239 reg = <0x100>;
240 };
241
242 a9periphclk: a9periphclk {
243 #clock-cells = <0>;
244 compatible = "calxeda,hb-a9periph-clock";
245 clocks = <&a9pll>;
246 reg = <0x104>;
247 };
248
249 a9bclk: a9bclk {
250 #clock-cells = <0>;
251 compatible = "calxeda,hb-a9bus-clock";
252 clocks = <&a9pll>;
253 reg = <0x104>;
254 };
255
256 emmcpll: emmcpll {
257 #clock-cells = <0>;
258 compatible = "calxeda,hb-pll-clock";
259 clocks = <&osc>;
260 reg = <0x10C>;
261 };
262
263 eclk: eclk {
264 #clock-cells = <0>;
265 compatible = "calxeda,hb-emmc-clock";
266 clocks = <&emmcpll>;
267 reg = <0x114>;
268 };
269
270 pclk: pclk {
271 #clock-cells = <0>;
272 compatible = "fixed-clock";
273 clock-frequency = <150000000>;
274 };
275 };
189 }; 276 };
190 277
191 dma@fff3d000 { 278 dma@fff3d000 {
192 compatible = "arm,pl330", "arm,primecell"; 279 compatible = "arm,pl330", "arm,primecell";
193 reg = <0xfff3d000 0x1000>; 280 reg = <0xfff3d000 0x1000>;
194 interrupts = <0 92 4>; 281 interrupts = <0 92 4>;
282 clocks = <&pclk>;
283 clock-names = "apb_pclk";
195 }; 284 };
196 285
197 ethernet@fff50000 { 286 ethernet@fff50000 {
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile
index ded4652ada80..3ec8bdd25d09 100644
--- a/arch/arm/mach-highbank/Makefile
+++ b/arch/arm/mach-highbank/Makefile
@@ -1,4 +1,4 @@
1obj-y := clock.o highbank.o system.o smc.o 1obj-y := highbank.o system.o smc.o
2 2
3plus_sec := $(call as-instr,.arch_extension sec,+sec) 3plus_sec := $(call as-instr,.arch_extension sec,+sec)
4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) 4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec)
diff --git a/arch/arm/mach-highbank/clock.c b/arch/arm/mach-highbank/clock.c
deleted file mode 100644
index c25a2ae4fde1..000000000000
--- a/arch/arm/mach-highbank/clock.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Copyright 2011 Calxeda, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/errno.h>
19#include <linux/clk.h>
20#include <linux/clkdev.h>
21
22struct clk {
23 unsigned long rate;
24};
25
26int clk_enable(struct clk *clk)
27{
28 return 0;
29}
30
31void clk_disable(struct clk *clk)
32{}
33
34unsigned long clk_get_rate(struct clk *clk)
35{
36 return clk->rate;
37}
38
39long clk_round_rate(struct clk *clk, unsigned long rate)
40{
41 return clk->rate;
42}
43
44int clk_set_rate(struct clk *clk, unsigned long rate)
45{
46 return 0;
47}
48
49static struct clk eclk = { .rate = 200000000 };
50static struct clk pclk = { .rate = 150000000 };
51
52static struct clk_lookup lookups[] = {
53 { .clk = &pclk, .con_id = "apb_pclk", },
54 { .clk = &pclk, .dev_id = "sp804", },
55 { .clk = &eclk, .dev_id = "ffe0e000.sdhci", },
56 { .clk = &pclk, .dev_id = "fff36000.serial", },
57};
58
59void __init highbank_clocks_init(void)
60{
61 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
62}
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 8777612b1a42..d75b0a78d88a 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -105,6 +105,11 @@ static void __init highbank_init_irq(void)
105#endif 105#endif
106} 106}
107 107
108static struct clk_lookup lookup = {
109 .dev_id = "sp804",
110 .con_id = NULL,
111};
112
108static void __init highbank_timer_init(void) 113static void __init highbank_timer_init(void)
109{ 114{
110 int irq; 115 int irq;
@@ -122,6 +127,8 @@ static void __init highbank_timer_init(void)
122 irq = irq_of_parse_and_map(np, 0); 127 irq = irq_of_parse_and_map(np, 0);
123 128
124 highbank_clocks_init(); 129 highbank_clocks_init();
130 lookup.clk = of_clk_get(np, 0);
131 clkdev_add(&lookup);
125 132
126 sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1"); 133 sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1");
127 sp804_clockevents_init(timer_base, irq, "timer0"); 134 sp804_clockevents_init(timer_base, irq, "timer0");