diff options
author | Andrew Lunn <andrew@lunn.ch> | 2012-11-17 09:22:28 -0500 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2012-11-20 08:46:50 -0500 |
commit | 1611f872513735ac7105535689c0dd668fbf1c04 (patch) | |
tree | d8fdd2f1f9b7df6b6e3543af6435b7d11f5da45e | |
parent | 5b03df9ace680d7cdd34a69dfd85ca5f74159d18 (diff) |
ARM: Kirkwood: switch to DT clock providers
With true DT clock providers available switch Kirkwood clock setup in
DT- enabled boards. While AUXDATA can be removed completely from bus
probing, some devices still don't know about DT. Therefore, some clkdev
aliases are created until these devices also move to DT.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
-rw-r--r-- | arch/arm/boot/dts/kirkwood.dtsi | 22 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dt.c | 71 | ||||
-rw-r--r-- | arch/arm/plat-orion/include/plat/common.h | 1 |
4 files changed, 83 insertions, 13 deletions
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index 4e5b8154a5be..7a9fac0d4251 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi | |||
@@ -19,6 +19,12 @@ | |||
19 | #address-cells = <1>; | 19 | #address-cells = <1>; |
20 | #size-cells = <1>; | 20 | #size-cells = <1>; |
21 | 21 | ||
22 | core_clk: core-clocks@10030 { | ||
23 | compatible = "marvell,kirkwood-core-clock"; | ||
24 | reg = <0x10030 0x4>; | ||
25 | #clock-cells = <1>; | ||
26 | }; | ||
27 | |||
22 | gpio0: gpio@10100 { | 28 | gpio0: gpio@10100 { |
23 | compatible = "marvell,orion-gpio"; | 29 | compatible = "marvell,orion-gpio"; |
24 | #gpio-cells = <2>; | 30 | #gpio-cells = <2>; |
@@ -42,6 +48,7 @@ | |||
42 | reg = <0x12000 0x100>; | 48 | reg = <0x12000 0x100>; |
43 | reg-shift = <2>; | 49 | reg-shift = <2>; |
44 | interrupts = <33>; | 50 | interrupts = <33>; |
51 | clocks = <&gate_clk 7>; | ||
45 | /* set clock-frequency in board dts */ | 52 | /* set clock-frequency in board dts */ |
46 | status = "disabled"; | 53 | status = "disabled"; |
47 | }; | 54 | }; |
@@ -51,6 +58,7 @@ | |||
51 | reg = <0x12100 0x100>; | 58 | reg = <0x12100 0x100>; |
52 | reg-shift = <2>; | 59 | reg-shift = <2>; |
53 | interrupts = <34>; | 60 | interrupts = <34>; |
61 | clocks = <&gate_clk 7>; | ||
54 | /* set clock-frequency in board dts */ | 62 | /* set clock-frequency in board dts */ |
55 | status = "disabled"; | 63 | status = "disabled"; |
56 | }; | 64 | }; |
@@ -68,12 +76,21 @@ | |||
68 | cell-index = <0>; | 76 | cell-index = <0>; |
69 | interrupts = <23>; | 77 | interrupts = <23>; |
70 | reg = <0x10600 0x28>; | 78 | reg = <0x10600 0x28>; |
79 | clocks = <&gate_clk 7>; | ||
71 | status = "disabled"; | 80 | status = "disabled"; |
72 | }; | 81 | }; |
73 | 82 | ||
83 | gate_clk: clock-gating-control@2011c { | ||
84 | compatible = "marvell,kirkwood-gating-clock"; | ||
85 | reg = <0x2011c 0x4>; | ||
86 | clocks = <&core_clk 0>; | ||
87 | #clock-cells = <1>; | ||
88 | }; | ||
89 | |||
74 | wdt@20300 { | 90 | wdt@20300 { |
75 | compatible = "marvell,orion-wdt"; | 91 | compatible = "marvell,orion-wdt"; |
76 | reg = <0x20300 0x28>; | 92 | reg = <0x20300 0x28>; |
93 | clocks = <&gate_clk 7>; | ||
77 | status = "okay"; | 94 | status = "okay"; |
78 | }; | 95 | }; |
79 | 96 | ||
@@ -81,6 +98,8 @@ | |||
81 | compatible = "marvell,orion-sata"; | 98 | compatible = "marvell,orion-sata"; |
82 | reg = <0x80000 0x5000>; | 99 | reg = <0x80000 0x5000>; |
83 | interrupts = <21>; | 100 | interrupts = <21>; |
101 | clocks = <&gate_clk 14>, <&gate_clk 15>; | ||
102 | clock-names = "0", "1"; | ||
84 | status = "disabled"; | 103 | status = "disabled"; |
85 | }; | 104 | }; |
86 | 105 | ||
@@ -94,6 +113,7 @@ | |||
94 | reg = <0x3000000 0x400>; | 113 | reg = <0x3000000 0x400>; |
95 | chip-delay = <25>; | 114 | chip-delay = <25>; |
96 | /* set partition map and/or chip-delay in board dts */ | 115 | /* set partition map and/or chip-delay in board dts */ |
116 | clocks = <&gate_clk 7>; | ||
97 | status = "disabled"; | 117 | status = "disabled"; |
98 | }; | 118 | }; |
99 | 119 | ||
@@ -104,6 +124,7 @@ | |||
104 | #size-cells = <0>; | 124 | #size-cells = <0>; |
105 | interrupts = <29>; | 125 | interrupts = <29>; |
106 | clock-frequency = <100000>; | 126 | clock-frequency = <100000>; |
127 | clocks = <&gate_clk 7>; | ||
107 | status = "disabled"; | 128 | status = "disabled"; |
108 | }; | 129 | }; |
109 | 130 | ||
@@ -113,6 +134,7 @@ | |||
113 | <0xf5000000 0x800>; | 134 | <0xf5000000 0x800>; |
114 | reg-names = "regs", "sram"; | 135 | reg-names = "regs", "sram"; |
115 | interrupts = <22>; | 136 | interrupts = <22>; |
137 | clocks = <&gate_clk 17>; | ||
116 | status = "okay"; | 138 | status = "okay"; |
117 | }; | 139 | }; |
118 | }; | 140 | }; |
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 50bca5032b7e..2833492eb273 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig | |||
@@ -46,6 +46,8 @@ config MACH_GURUPLUG | |||
46 | 46 | ||
47 | config ARCH_KIRKWOOD_DT | 47 | config ARCH_KIRKWOOD_DT |
48 | bool "Marvell Kirkwood Flattened Device Tree" | 48 | bool "Marvell Kirkwood Flattened Device Tree" |
49 | select MVEBU_CLK_CORE | ||
50 | select MVEBU_CLK_GATING | ||
49 | select USE_OF | 51 | select USE_OF |
50 | help | 52 | help |
51 | Say 'Y' here if you want your kernel to support the | 53 | Say 'Y' here if you want your kernel to support the |
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index d94872fed8c0..8bdfaa4db091 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -14,11 +14,15 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/of_platform.h> | 16 | #include <linux/of_platform.h> |
17 | #include <linux/clk-provider.h> | ||
18 | #include <linux/clk/mvebu.h> | ||
17 | #include <linux/kexec.h> | 19 | #include <linux/kexec.h> |
18 | #include <asm/mach/arch.h> | 20 | #include <asm/mach/arch.h> |
19 | #include <asm/mach/map.h> | 21 | #include <asm/mach/map.h> |
20 | #include <mach/bridge-regs.h> | 22 | #include <mach/bridge-regs.h> |
23 | #include <linux/platform_data/usb-ehci-orion.h> | ||
21 | #include <plat/irq.h> | 24 | #include <plat/irq.h> |
25 | #include <plat/common.h> | ||
22 | #include "common.h" | 26 | #include "common.h" |
23 | 27 | ||
24 | static struct of_device_id kirkwood_dt_match_table[] __initdata = { | 28 | static struct of_device_id kirkwood_dt_match_table[] __initdata = { |
@@ -26,16 +30,58 @@ static struct of_device_id kirkwood_dt_match_table[] __initdata = { | |||
26 | { } | 30 | { } |
27 | }; | 31 | }; |
28 | 32 | ||
29 | struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = { | 33 | /* |
30 | OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), | 34 | * There are still devices that doesn't know about DT yet. Get clock |
31 | OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", | 35 | * gates here and add a clock lookup alias, so that old platform |
32 | NULL), | 36 | * devices still work. |
33 | OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL), | 37 | */ |
34 | OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL), | 38 | |
35 | OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL), | 39 | static void __init kirkwood_legacy_clk_init(void) |
36 | OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL), | 40 | { |
37 | {}, | 41 | |
38 | }; | 42 | struct device_node *np = of_find_compatible_node( |
43 | NULL, NULL, "marvell,kirkwood-gating-clock"); | ||
44 | |||
45 | struct of_phandle_args clkspec; | ||
46 | |||
47 | clkspec.np = np; | ||
48 | clkspec.args_count = 1; | ||
49 | |||
50 | clkspec.args[0] = CGC_BIT_GE0; | ||
51 | orion_clkdev_add(NULL, "mv643xx_eth_port.0", | ||
52 | of_clk_get_from_provider(&clkspec)); | ||
53 | |||
54 | clkspec.args[0] = CGC_BIT_PEX0; | ||
55 | orion_clkdev_add("0", "pcie", | ||
56 | of_clk_get_from_provider(&clkspec)); | ||
57 | |||
58 | clkspec.args[0] = CGC_BIT_USB0; | ||
59 | orion_clkdev_add(NULL, "orion-ehci.0", | ||
60 | of_clk_get_from_provider(&clkspec)); | ||
61 | |||
62 | clkspec.args[0] = CGC_BIT_XOR0; | ||
63 | orion_clkdev_add(NULL, "mv_xor_shared.0", | ||
64 | of_clk_get_from_provider(&clkspec)); | ||
65 | |||
66 | clkspec.args[0] = CGC_BIT_XOR1; | ||
67 | orion_clkdev_add(NULL, "mv_xor_shared.1", | ||
68 | of_clk_get_from_provider(&clkspec)); | ||
69 | |||
70 | clkspec.args[0] = CGC_BIT_PEX1; | ||
71 | orion_clkdev_add("1", "pcie", | ||
72 | of_clk_get_from_provider(&clkspec)); | ||
73 | |||
74 | clkspec.args[0] = CGC_BIT_GE1; | ||
75 | orion_clkdev_add(NULL, "mv643xx_eth_port.1", | ||
76 | of_clk_get_from_provider(&clkspec)); | ||
77 | |||
78 | } | ||
79 | |||
80 | static void __init kirkwood_of_clk_init(void) | ||
81 | { | ||
82 | mvebu_clocks_init(); | ||
83 | kirkwood_legacy_clk_init(); | ||
84 | } | ||
39 | 85 | ||
40 | static void __init kirkwood_dt_init(void) | 86 | static void __init kirkwood_dt_init(void) |
41 | { | 87 | { |
@@ -54,7 +100,7 @@ static void __init kirkwood_dt_init(void) | |||
54 | kirkwood_l2_init(); | 100 | kirkwood_l2_init(); |
55 | 101 | ||
56 | /* Setup root of clk tree */ | 102 | /* Setup root of clk tree */ |
57 | kirkwood_clk_init(); | 103 | kirkwood_of_clk_init(); |
58 | 104 | ||
59 | /* internal devices that every board has */ | 105 | /* internal devices that every board has */ |
60 | kirkwood_xor0_init(); | 106 | kirkwood_xor0_init(); |
@@ -94,8 +140,7 @@ static void __init kirkwood_dt_init(void) | |||
94 | if (of_machine_is_compatible("keymile,km_kirkwood")) | 140 | if (of_machine_is_compatible("keymile,km_kirkwood")) |
95 | km_kirkwood_init(); | 141 | km_kirkwood_init(); |
96 | 142 | ||
97 | of_platform_populate(NULL, kirkwood_dt_match_table, | 143 | of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); |
98 | kirkwood_auxdata_lookup, NULL); | ||
99 | } | 144 | } |
100 | 145 | ||
101 | static const char *kirkwood_dt_board_compat[] = { | 146 | static const char *kirkwood_dt_board_compat[] = { |
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h index 6bbc3fe5f58e..e06fc5fefa14 100644 --- a/arch/arm/plat-orion/include/plat/common.h +++ b/arch/arm/plat-orion/include/plat/common.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/mv643xx_eth.h> | 12 | #include <linux/mv643xx_eth.h> |
13 | 13 | ||
14 | struct dsa_platform_data; | 14 | struct dsa_platform_data; |
15 | struct mv_sata_platform_data; | ||
15 | 16 | ||
16 | void __init orion_uart0_init(void __iomem *membase, | 17 | void __init orion_uart0_init(void __iomem *membase, |
17 | resource_size_t mapbase, | 18 | resource_size_t mapbase, |