diff options
author | Andrew Lunn <andrew@lunn.ch> | 2011-12-15 02:15:07 -0500 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2012-05-08 19:33:39 -0400 |
commit | 2f129bf4aab684bef1e82e747b709a5025ecb698 (patch) | |
tree | 4be6e04fc306cfad25b3b86f831cd4d462c10f44 /arch | |
parent | f0948f59dbc8e725a96ba16da666e8f5cdd43ba8 (diff) |
ARM: Orion: Add clocks using the generic clk infrastructure.
Add tclk as a fixed rate clock for all platforms. In addition, on
kirkwood, add a gated clock for most of the clocks which can be gated.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Jamie Lentin <jm@lentin.co.uk>
[mturquette@linaro.org: removed redundant CLKDEV_LOOKUP from Kconfig]
[mturquette@linaro.org: removed redundant clk.h from mach-dove/common.c]
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-dove/common.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dt.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 41 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/bridge-regs.h | 16 | ||||
-rw-r--r-- | arch/arm/mach-mv78xx0/common.c | 27 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/common.c | 15 | ||||
-rw-r--r-- | arch/arm/plat-orion/common.c | 2 |
9 files changed, 115 insertions, 13 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index cf006d40342c..9be624af131f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1139,6 +1139,7 @@ config PLAT_ORION | |||
1139 | bool | 1139 | bool |
1140 | select CLKSRC_MMIO | 1140 | select CLKSRC_MMIO |
1141 | select GENERIC_IRQ_CHIP | 1141 | select GENERIC_IRQ_CHIP |
1142 | select COMMON_CLK | ||
1142 | 1143 | ||
1143 | config PLAT_PXA | 1144 | config PLAT_PXA |
1144 | bool | 1145 | bool |
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index bda7aca04ca0..63fe6e612e98 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | #include <linux/clk.h> | 16 | #include <linux/clk-provider.h> |
17 | #include <linux/ata_platform.h> | 17 | #include <linux/ata_platform.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <asm/page.h> | 19 | #include <asm/page.h> |
@@ -68,6 +68,17 @@ void __init dove_map_io(void) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | /***************************************************************************** | 70 | /***************************************************************************** |
71 | * CLK tree | ||
72 | ****************************************************************************/ | ||
73 | static struct clk *tclk; | ||
74 | |||
75 | static void __init clk_init(void) | ||
76 | { | ||
77 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, | ||
78 | get_tclk()); | ||
79 | } | ||
80 | |||
81 | /***************************************************************************** | ||
71 | * EHCI0 | 82 | * EHCI0 |
72 | ****************************************************************************/ | 83 | ****************************************************************************/ |
73 | void __init dove_ehci0_init(void) | 84 | void __init dove_ehci0_init(void) |
@@ -272,18 +283,17 @@ void __init dove_sdio1_init(void) | |||
272 | 283 | ||
273 | void __init dove_init(void) | 284 | void __init dove_init(void) |
274 | { | 285 | { |
275 | int tclk; | ||
276 | |||
277 | tclk = get_tclk(); | ||
278 | |||
279 | printk(KERN_INFO "Dove 88AP510 SoC, "); | 286 | printk(KERN_INFO "Dove 88AP510 SoC, "); |
280 | printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000); | 287 | printk(KERN_INFO "TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000); |
281 | 288 | ||
282 | #ifdef CONFIG_CACHE_TAUROS2 | 289 | #ifdef CONFIG_CACHE_TAUROS2 |
283 | tauros2_init(); | 290 | tauros2_init(); |
284 | #endif | 291 | #endif |
285 | dove_setup_cpu_mbus(); | 292 | dove_setup_cpu_mbus(); |
286 | 293 | ||
294 | /* Setup root of clk tree */ | ||
295 | clk_init(); | ||
296 | |||
287 | /* internal devices that every board has */ | 297 | /* internal devices that every board has */ |
288 | dove_rtc_init(); | 298 | dove_rtc_init(); |
289 | dove_xor0_init(); | 299 | dove_xor0_init(); |
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index 1c672d9e6656..87856b5a397d 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -42,6 +42,9 @@ static void __init kirkwood_dt_init(void) | |||
42 | kirkwood_l2_init(); | 42 | kirkwood_l2_init(); |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | /* Setup root of clk tree */ | ||
46 | kirkwood_clk_init(); | ||
47 | |||
45 | /* internal devices that every board has */ | 48 | /* internal devices that every board has */ |
46 | kirkwood_wdt_init(); | 49 | kirkwood_wdt_init(); |
47 | kirkwood_xor0_init(); | 50 | kirkwood_xor0_init(); |
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index a02cae881f2f..57b8d1ef3093 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/ata_platform.h> | 15 | #include <linux/ata_platform.h> |
16 | #include <linux/mtd/nand.h> | 16 | #include <linux/mtd/nand.h> |
17 | #include <linux/dma-mapping.h> | 17 | #include <linux/dma-mapping.h> |
18 | #include <linux/clk-provider.h> | ||
19 | #include <linux/spinlock.h> | ||
18 | #include <net/dsa.h> | 20 | #include <net/dsa.h> |
19 | #include <asm/page.h> | 21 | #include <asm/page.h> |
20 | #include <asm/timex.h> | 22 | #include <asm/timex.h> |
@@ -31,6 +33,7 @@ | |||
31 | #include <plat/common.h> | 33 | #include <plat/common.h> |
32 | #include <plat/time.h> | 34 | #include <plat/time.h> |
33 | #include <plat/addr-map.h> | 35 | #include <plat/addr-map.h> |
36 | #include <plat/mv_xor.h> | ||
34 | #include "common.h" | 37 | #include "common.h" |
35 | 38 | ||
36 | /***************************************************************************** | 39 | /***************************************************************************** |
@@ -69,6 +72,41 @@ unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED; | |||
69 | 72 | ||
70 | 73 | ||
71 | /***************************************************************************** | 74 | /***************************************************************************** |
75 | * CLK tree | ||
76 | ****************************************************************************/ | ||
77 | static DEFINE_SPINLOCK(gating_lock); | ||
78 | static struct clk *tclk; | ||
79 | |||
80 | static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx) | ||
81 | { | ||
82 | return clk_register_gate(NULL, name, "tclk", CLK_IGNORE_UNUSED, | ||
83 | (void __iomem *)CLOCK_GATING_CTRL, | ||
84 | bit_idx, 0, &gating_lock); | ||
85 | } | ||
86 | |||
87 | void __init kirkwood_clk_init(void) | ||
88 | { | ||
89 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, | ||
90 | CLK_IS_ROOT, kirkwood_tclk); | ||
91 | |||
92 | kirkwood_register_gate("runit", CGC_BIT_RUNIT); | ||
93 | kirkwood_register_gate("ge0", CGC_BIT_GE0); | ||
94 | kirkwood_register_gate("ge1", CGC_BIT_GE1); | ||
95 | kirkwood_register_gate("sata0", CGC_BIT_SATA0); | ||
96 | kirkwood_register_gate("sata1", CGC_BIT_SATA1); | ||
97 | kirkwood_register_gate("usb0", CGC_BIT_USB0); | ||
98 | kirkwood_register_gate("sdio", CGC_BIT_SDIO); | ||
99 | kirkwood_register_gate("crypto", CGC_BIT_CRYPTO); | ||
100 | kirkwood_register_gate("xor0", CGC_BIT_XOR0); | ||
101 | kirkwood_register_gate("xor1", CGC_BIT_XOR1); | ||
102 | kirkwood_register_gate("pex0", CGC_BIT_PEX0); | ||
103 | kirkwood_register_gate("pex1", CGC_BIT_PEX1); | ||
104 | kirkwood_register_gate("audio", CGC_BIT_AUDIO); | ||
105 | kirkwood_register_gate("tdm", CGC_BIT_TDM); | ||
106 | kirkwood_register_gate("tsu", CGC_BIT_TSU); | ||
107 | } | ||
108 | |||
109 | /***************************************************************************** | ||
72 | * EHCI0 | 110 | * EHCI0 |
73 | ****************************************************************************/ | 111 | ****************************************************************************/ |
74 | void __init kirkwood_ehci_init(void) | 112 | void __init kirkwood_ehci_init(void) |
@@ -465,6 +503,9 @@ void __init kirkwood_init(void) | |||
465 | kirkwood_l2_init(); | 503 | kirkwood_l2_init(); |
466 | #endif | 504 | #endif |
467 | 505 | ||
506 | /* Setup root of clk tree */ | ||
507 | kirkwood_clk_init(); | ||
508 | |||
468 | /* internal devices that every board has */ | 509 | /* internal devices that every board has */ |
469 | kirkwood_rtc_init(); | 510 | kirkwood_rtc_init(); |
470 | kirkwood_wdt_init(); | 511 | kirkwood_wdt_init(); |
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index fa8e7689c436..0729b11a3e2a 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h | |||
@@ -50,6 +50,7 @@ void kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, int delay); | |||
50 | void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts, int (*dev_ready)(struct mtd_info *)); | 50 | void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts, int (*dev_ready)(struct mtd_info *)); |
51 | void kirkwood_audio_init(void); | 51 | void kirkwood_audio_init(void); |
52 | void kirkwood_restart(char, const char *); | 52 | void kirkwood_restart(char, const char *); |
53 | void kirkwood_clk_init(void); | ||
53 | 54 | ||
54 | /* board init functions for boards not fully converted to fdt */ | 55 | /* board init functions for boards not fully converted to fdt */ |
55 | #ifdef CONFIG_MACH_DREAMPLUG_DT | 56 | #ifdef CONFIG_MACH_DREAMPLUG_DT |
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h index 957bd7997d7e..3eee37a3b501 100644 --- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h +++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h | |||
@@ -43,6 +43,22 @@ | |||
43 | #define L2_WRITETHROUGH 0x00000010 | 43 | #define L2_WRITETHROUGH 0x00000010 |
44 | 44 | ||
45 | #define CLOCK_GATING_CTRL (BRIDGE_VIRT_BASE | 0x11c) | 45 | #define CLOCK_GATING_CTRL (BRIDGE_VIRT_BASE | 0x11c) |
46 | #define CGC_BIT_GE0 (0) | ||
47 | #define CGC_BIT_PEX0 (2) | ||
48 | #define CGC_BIT_USB0 (3) | ||
49 | #define CGC_BIT_SDIO (4) | ||
50 | #define CGC_BIT_TSU (5) | ||
51 | #define CGC_BIT_DUNIT (6) | ||
52 | #define CGC_BIT_RUNIT (7) | ||
53 | #define CGC_BIT_XOR0 (8) | ||
54 | #define CGC_BIT_AUDIO (9) | ||
55 | #define CGC_BIT_SATA0 (14) | ||
56 | #define CGC_BIT_SATA1 (15) | ||
57 | #define CGC_BIT_XOR1 (16) | ||
58 | #define CGC_BIT_CRYPTO (17) | ||
59 | #define CGC_BIT_PEX1 (18) | ||
60 | #define CGC_BIT_GE1 (19) | ||
61 | #define CGC_BIT_TDM (20) | ||
46 | #define CGC_GE0 (1 << 0) | 62 | #define CGC_GE0 (1 << 0) |
47 | #define CGC_PEX0 (1 << 2) | 63 | #define CGC_PEX0 (1 << 2) |
48 | #define CGC_USB0 (1 << 3) | 64 | #define CGC_USB0 (1 << 3) |
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c index a5dcf766a3f9..73733207f5a9 100644 --- a/arch/arm/mach-mv78xx0/common.c +++ b/arch/arm/mach-mv78xx0/common.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/serial_8250.h> | 14 | #include <linux/serial_8250.h> |
15 | #include <linux/ata_platform.h> | 15 | #include <linux/ata_platform.h> |
16 | #include <linux/clk-provider.h> | ||
16 | #include <linux/ethtool.h> | 17 | #include <linux/ethtool.h> |
17 | #include <asm/mach/map.h> | 18 | #include <asm/mach/map.h> |
18 | #include <asm/mach/time.h> | 19 | #include <asm/mach/time.h> |
@@ -103,24 +104,24 @@ static void get_pclk_l2clk(int hclk, int core_index, int *pclk, int *l2clk) | |||
103 | 104 | ||
104 | static int get_tclk(void) | 105 | static int get_tclk(void) |
105 | { | 106 | { |
106 | int tclk; | 107 | int tclk_freq; |
107 | 108 | ||
108 | /* | 109 | /* |
109 | * TCLK tick rate is configured by DEV_A[2:0] strap pins. | 110 | * TCLK tick rate is configured by DEV_A[2:0] strap pins. |
110 | */ | 111 | */ |
111 | switch ((readl(SAMPLE_AT_RESET_HIGH) >> 6) & 7) { | 112 | switch ((readl(SAMPLE_AT_RESET_HIGH) >> 6) & 7) { |
112 | case 1: | 113 | case 1: |
113 | tclk = 166666667; | 114 | tclk_freq = 166666667; |
114 | break; | 115 | break; |
115 | case 3: | 116 | case 3: |
116 | tclk = 200000000; | 117 | tclk_freq = 200000000; |
117 | break; | 118 | break; |
118 | default: | 119 | default: |
119 | panic("unknown TCLK PLL setting: %.8x\n", | 120 | panic("unknown TCLK PLL setting: %.8x\n", |
120 | readl(SAMPLE_AT_RESET_HIGH)); | 121 | readl(SAMPLE_AT_RESET_HIGH)); |
121 | } | 122 | } |
122 | 123 | ||
123 | return tclk; | 124 | return tclk_freq; |
124 | } | 125 | } |
125 | 126 | ||
126 | 127 | ||
@@ -166,6 +167,17 @@ void __init mv78xx0_map_io(void) | |||
166 | 167 | ||
167 | 168 | ||
168 | /***************************************************************************** | 169 | /***************************************************************************** |
170 | * CLK tree | ||
171 | ****************************************************************************/ | ||
172 | static struct clk *tclk; | ||
173 | |||
174 | static void __init clk_init(void) | ||
175 | { | ||
176 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, | ||
177 | get_tclk()); | ||
178 | } | ||
179 | |||
180 | /***************************************************************************** | ||
169 | * EHCI | 181 | * EHCI |
170 | ****************************************************************************/ | 182 | ****************************************************************************/ |
171 | void __init mv78xx0_ehci0_init(void) | 183 | void __init mv78xx0_ehci0_init(void) |
@@ -378,25 +390,26 @@ void __init mv78xx0_init(void) | |||
378 | int hclk; | 390 | int hclk; |
379 | int pclk; | 391 | int pclk; |
380 | int l2clk; | 392 | int l2clk; |
381 | int tclk; | ||
382 | 393 | ||
383 | core_index = mv78xx0_core_index(); | 394 | core_index = mv78xx0_core_index(); |
384 | hclk = get_hclk(); | 395 | hclk = get_hclk(); |
385 | get_pclk_l2clk(hclk, core_index, &pclk, &l2clk); | 396 | get_pclk_l2clk(hclk, core_index, &pclk, &l2clk); |
386 | tclk = get_tclk(); | ||
387 | 397 | ||
388 | printk(KERN_INFO "%s ", mv78xx0_id()); | 398 | printk(KERN_INFO "%s ", mv78xx0_id()); |
389 | printk("core #%d, ", core_index); | 399 | printk("core #%d, ", core_index); |
390 | printk("PCLK = %dMHz, ", (pclk + 499999) / 1000000); | 400 | printk("PCLK = %dMHz, ", (pclk + 499999) / 1000000); |
391 | printk("L2 = %dMHz, ", (l2clk + 499999) / 1000000); | 401 | printk("L2 = %dMHz, ", (l2clk + 499999) / 1000000); |
392 | printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000); | 402 | printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000); |
393 | printk("TCLK = %dMHz\n", (tclk + 499999) / 1000000); | 403 | printk("TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000); |
394 | 404 | ||
395 | mv78xx0_setup_cpu_mbus(); | 405 | mv78xx0_setup_cpu_mbus(); |
396 | 406 | ||
397 | #ifdef CONFIG_CACHE_FEROCEON_L2 | 407 | #ifdef CONFIG_CACHE_FEROCEON_L2 |
398 | feroceon_l2_init(is_l2_writethrough()); | 408 | feroceon_l2_init(is_l2_writethrough()); |
399 | #endif | 409 | #endif |
410 | |||
411 | /* Setup root of clk tree */ | ||
412 | clk_init(); | ||
400 | } | 413 | } |
401 | 414 | ||
402 | void mv78xx0_restart(char mode, const char *cmd) | 415 | void mv78xx0_restart(char mode, const char *cmd) |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 24481666d2cd..81660522c6b4 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/mv643xx_i2c.h> | 18 | #include <linux/mv643xx_i2c.h> |
19 | #include <linux/ata_platform.h> | 19 | #include <linux/ata_platform.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/clk-provider.h> | ||
21 | #include <net/dsa.h> | 22 | #include <net/dsa.h> |
22 | #include <asm/page.h> | 23 | #include <asm/page.h> |
23 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
@@ -70,6 +71,17 @@ void __init orion5x_map_io(void) | |||
70 | 71 | ||
71 | 72 | ||
72 | /***************************************************************************** | 73 | /***************************************************************************** |
74 | * CLK tree | ||
75 | ****************************************************************************/ | ||
76 | static struct clk *tclk; | ||
77 | |||
78 | static void __init clk_init(void) | ||
79 | { | ||
80 | tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, | ||
81 | orion5x_tclk); | ||
82 | } | ||
83 | |||
84 | /***************************************************************************** | ||
73 | * EHCI0 | 85 | * EHCI0 |
74 | ****************************************************************************/ | 86 | ****************************************************************************/ |
75 | void __init orion5x_ehci0_init(void) | 87 | void __init orion5x_ehci0_init(void) |
@@ -276,6 +288,9 @@ void __init orion5x_init(void) | |||
276 | */ | 288 | */ |
277 | orion5x_setup_cpu_mbus_bridge(); | 289 | orion5x_setup_cpu_mbus_bridge(); |
278 | 290 | ||
291 | /* Setup root of clk tree */ | ||
292 | clk_init(); | ||
293 | |||
279 | /* | 294 | /* |
280 | * Don't issue "Wait for Interrupt" instruction if we are | 295 | * Don't issue "Wait for Interrupt" instruction if we are |
281 | * running on D0 5281 silicon. | 296 | * running on D0 5281 silicon. |
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index 74daf5ed1432..4fdd2e7e74a1 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/serial_8250.h> | 15 | #include <linux/serial_8250.h> |
16 | #include <linux/ata_platform.h> | 16 | #include <linux/ata_platform.h> |
17 | #include <linux/clk.h> | ||
18 | #include <linux/clkdev.h> | ||
17 | #include <linux/mv643xx_eth.h> | 19 | #include <linux/mv643xx_eth.h> |
18 | #include <linux/mv643xx_i2c.h> | 20 | #include <linux/mv643xx_i2c.h> |
19 | #include <net/dsa.h> | 21 | #include <net/dsa.h> |