aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2012-11-17 09:22:27 -0500
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2012-11-20 08:46:50 -0500
commit5b03df9ace680d7cdd34a69dfd85ca5f74159d18 (patch)
tree76b36620fe07ceaa61a471e626f6cdfdf3cec93d
parent307c2bf467e3682c6df1b8186365224fd2d581d3 (diff)
ARM: dove: switch to DT clock providers
With true DT clock providers available switch Dove clock setup in DT- enabled boards. While AUXDATA can be removed completely from bus probing, some devices still don't know about DT at all. Therefore, some clock aliases are created until the devices also move to DT. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/boot/dts/dove.dtsi20
-rw-r--r--arch/arm/mach-dove/Kconfig2
-rw-r--r--arch/arm/mach-dove/common.c63
4 files changed, 71 insertions, 15 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ade7e924bef..05900997af9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -533,6 +533,7 @@ config ARCH_IXP4XX
533config ARCH_DOVE 533config ARCH_DOVE
534 bool "Marvell Dove" 534 bool "Marvell Dove"
535 select ARCH_REQUIRE_GPIOLIB 535 select ARCH_REQUIRE_GPIOLIB
536 select COMMON_CLK_DOVE
536 select CPU_V7 537 select CPU_V7
537 select GENERIC_CLOCKEVENTS 538 select GENERIC_CLOCKEVENTS
538 select MIGHT_HAVE_PCI 539 select MIGHT_HAVE_PCI
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 5a00022383e..b524ee377f8 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -31,6 +31,19 @@
31 reg = <0x20204 0x04>, <0x20214 0x04>; 31 reg = <0x20204 0x04>, <0x20214 0x04>;
32 }; 32 };
33 33
34 core_clk: core-clocks@d0214 {
35 compatible = "marvell,dove-core-clock";
36 reg = <0xd0214 0x4>;
37 #clock-cells = <1>;
38 };
39
40 gate_clk: clock-gating-control@d0038 {
41 compatible = "marvell,dove-gating-clock";
42 reg = <0xd0038 0x4>;
43 clocks = <&core_clk 0>;
44 #clock-cells = <1>;
45 };
46
34 uart0: serial@12000 { 47 uart0: serial@12000 {
35 compatible = "ns16550a"; 48 compatible = "ns16550a";
36 reg = <0x12000 0x100>; 49 reg = <0x12000 0x100>;
@@ -100,6 +113,7 @@
100 cell-index = <0>; 113 cell-index = <0>;
101 interrupts = <6>; 114 interrupts = <6>;
102 reg = <0x10600 0x28>; 115 reg = <0x10600 0x28>;
116 clocks = <&core_clk 0>;
103 status = "disabled"; 117 status = "disabled";
104 }; 118 };
105 119
@@ -110,6 +124,7 @@
110 cell-index = <1>; 124 cell-index = <1>;
111 interrupts = <5>; 125 interrupts = <5>;
112 reg = <0x14600 0x28>; 126 reg = <0x14600 0x28>;
127 clocks = <&core_clk 0>;
113 status = "disabled"; 128 status = "disabled";
114 }; 129 };
115 130
@@ -121,6 +136,7 @@
121 interrupts = <11>; 136 interrupts = <11>;
122 clock-frequency = <400000>; 137 clock-frequency = <400000>;
123 timeout-ms = <1000>; 138 timeout-ms = <1000>;
139 clocks = <&core_clk 0>;
124 status = "disabled"; 140 status = "disabled";
125 }; 141 };
126 142
@@ -128,6 +144,7 @@
128 compatible = "marvell,dove-sdhci"; 144 compatible = "marvell,dove-sdhci";
129 reg = <0x92000 0x100>; 145 reg = <0x92000 0x100>;
130 interrupts = <35>, <37>; 146 interrupts = <35>, <37>;
147 clocks = <&gate_clk 8>;
131 status = "disabled"; 148 status = "disabled";
132 }; 149 };
133 150
@@ -135,6 +152,7 @@
135 compatible = "marvell,dove-sdhci"; 152 compatible = "marvell,dove-sdhci";
136 reg = <0x90000 0x100>; 153 reg = <0x90000 0x100>;
137 interrupts = <36>, <38>; 154 interrupts = <36>, <38>;
155 clocks = <&gate_clk 9>;
138 status = "disabled"; 156 status = "disabled";
139 }; 157 };
140 158
@@ -142,6 +160,7 @@
142 compatible = "marvell,orion-sata"; 160 compatible = "marvell,orion-sata";
143 reg = <0xa0000 0x2400>; 161 reg = <0xa0000 0x2400>;
144 interrupts = <62>; 162 interrupts = <62>;
163 clocks = <&gate_clk 3>;
145 nr-ports = <1>; 164 nr-ports = <1>;
146 status = "disabled"; 165 status = "disabled";
147 }; 166 };
@@ -152,6 +171,7 @@
152 <0xc8000000 0x800>; 171 <0xc8000000 0x800>;
153 reg-names = "regs", "sram"; 172 reg-names = "regs", "sram";
154 interrupts = <31>; 173 interrupts = <31>;
174 clocks = <&gate_clk 15>;
155 status = "okay"; 175 status = "okay";
156 }; 176 };
157 }; 177 };
diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index 00154e74ce6..603c5fd99e8 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -17,6 +17,8 @@ config MACH_CM_A510
17 17
18config MACH_DOVE_DT 18config MACH_DOVE_DT
19 bool "Marvell Dove Flattened Device Tree" 19 bool "Marvell Dove Flattened Device Tree"
20 select MVEBU_CLK_CORE
21 select MVEBU_CLK_GATING
20 select USE_OF 22 select USE_OF
21 help 23 help
22 Say 'Y' here if you want your kernel to support the 24 Say 'Y' here if you want your kernel to support the
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index f723fe13d0f..6a2c4dc413a 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -14,6 +14,7 @@
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-provider.h> 16#include <linux/clk-provider.h>
17#include <linux/clk/mvebu.h>
17#include <linux/ata_platform.h> 18#include <linux/ata_platform.h>
18#include <linux/gpio.h> 19#include <linux/gpio.h>
19#include <linux/of.h> 20#include <linux/of.h>
@@ -376,19 +377,52 @@ void dove_restart(char mode, const char *cmd)
376 377
377#if defined(CONFIG_MACH_DOVE_DT) 378#if defined(CONFIG_MACH_DOVE_DT)
378/* 379/*
379 * Auxdata required until real OF clock provider 380 * There are still devices that doesn't even know about DT,
381 * get clock gates here and add a clock lookup.
380 */ 382 */
381struct of_dev_auxdata dove_auxdata_lookup[] __initdata = { 383static void __init dove_legacy_clk_init(void)
382 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), 384{
383 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1014600, "orion_spi.1", NULL), 385 struct device_node *np = of_find_compatible_node(NULL, NULL,
384 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL), 386 "marvell,dove-gating-clock");
385 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", 387 struct of_phandle_args clkspec;
386 NULL), 388
387 OF_DEV_AUXDATA("marvell,orion-sata", 0xf10a0000, "sata_mv.0", NULL), 389 clkspec.np = np;
388 OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1092000, "sdhci-dove.0", NULL), 390 clkspec.args_count = 1;
389 OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1090000, "sdhci-dove.1", NULL), 391
390 {}, 392 clkspec.args[0] = CLOCK_GATING_BIT_USB0;
391}; 393 orion_clkdev_add(NULL, "orion-ehci.0",
394 of_clk_get_from_provider(&clkspec));
395
396 clkspec.args[0] = CLOCK_GATING_BIT_USB1;
397 orion_clkdev_add(NULL, "orion-ehci.1",
398 of_clk_get_from_provider(&clkspec));
399
400 clkspec.args[0] = CLOCK_GATING_BIT_GBE;
401 orion_clkdev_add(NULL, "mv643xx_eth_port.0",
402 of_clk_get_from_provider(&clkspec));
403
404 clkspec.args[0] = CLOCK_GATING_BIT_PCIE0;
405 orion_clkdev_add("0", "pcie",
406 of_clk_get_from_provider(&clkspec));
407
408 clkspec.args[0] = CLOCK_GATING_BIT_PCIE1;
409 orion_clkdev_add("1", "pcie",
410 of_clk_get_from_provider(&clkspec));
411
412 clkspec.args[0] = CLOCK_GATING_BIT_XOR0;
413 orion_clkdev_add(NULL, "mv_xor_shared.0",
414 of_clk_get_from_provider(&clkspec));
415
416 clkspec.args[0] = CLOCK_GATING_BIT_XOR1;
417 orion_clkdev_add(NULL, "mv_xor_shared.1",
418 of_clk_get_from_provider(&clkspec));
419}
420
421static void __init dove_of_clk_init(void)
422{
423 mvebu_clocks_init();
424 dove_legacy_clk_init();
425}
392 426
393static struct mv643xx_eth_platform_data dove_dt_ge00_data = { 427static struct mv643xx_eth_platform_data dove_dt_ge00_data = {
394 .phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT, 428 .phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT,
@@ -405,7 +439,7 @@ static void __init dove_dt_init(void)
405 dove_setup_cpu_mbus(); 439 dove_setup_cpu_mbus();
406 440
407 /* Setup root of clk tree */ 441 /* Setup root of clk tree */
408 dove_clk_init(); 442 dove_of_clk_init();
409 443
410 /* Internal devices not ported to DT yet */ 444 /* Internal devices not ported to DT yet */
411 dove_rtc_init(); 445 dove_rtc_init();
@@ -417,8 +451,7 @@ static void __init dove_dt_init(void)
417 dove_ehci1_init(); 451 dove_ehci1_init();
418 dove_pcie_init(1, 1); 452 dove_pcie_init(1, 1);
419 453
420 of_platform_populate(NULL, of_default_bus_match_table, 454 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
421 dove_auxdata_lookup, NULL);
422} 455}
423 456
424static const char * const dove_dt_board_compat[] = { 457static const char * const dove_dt_board_compat[] = {