diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2012-11-28 12:55:30 -0500 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2013-04-09 10:52:52 -0400 |
commit | c20736f1aba75bd4251e96ef3f487beebbaf41cc (patch) | |
tree | eb30f0b230a4fdbd33a9626ba256a7a11a9ca4d0 | |
parent | 52c9aa946154a355f03e66f67545597f7cdf5b5a (diff) |
ARM: mx27: Replace clk_register_clkdev with clock DT lookup
Similarly as it was done for mx6q, use a DT lookup in order to make maintainance
task for the clock devices easier.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
-rw-r--r-- | Documentation/devicetree/bindings/clock/imx27-clock.txt | 117 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx27.dtsi | 31 | ||||
-rw-r--r-- | arch/arm/mach-imx/clk-imx27.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx27-dt.c | 18 |
4 files changed, 158 insertions, 17 deletions
diff --git a/Documentation/devicetree/bindings/clock/imx27-clock.txt b/Documentation/devicetree/bindings/clock/imx27-clock.txt new file mode 100644 index 000000000000..ab1a56e9de9d --- /dev/null +++ b/Documentation/devicetree/bindings/clock/imx27-clock.txt | |||
@@ -0,0 +1,117 @@ | |||
1 | * Clock bindings for Freescale i.MX27 | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Should be "fsl,imx27-ccm" | ||
5 | - reg: Address and length of the register set | ||
6 | - interrupts: Should contain CCM interrupt | ||
7 | - #clock-cells: Should be <1> | ||
8 | |||
9 | The clock consumer should specify the desired clock by having the clock | ||
10 | ID in its "clocks" phandle cell. The following is a full list of i.MX27 | ||
11 | clocks and IDs. | ||
12 | |||
13 | Clock ID | ||
14 | ----------------------- | ||
15 | dummy 0 | ||
16 | ckih 1 | ||
17 | ckil 2 | ||
18 | mpll 3 | ||
19 | spll 4 | ||
20 | mpll_main2 5 | ||
21 | ahb 6 | ||
22 | ipg 7 | ||
23 | nfc_div 8 | ||
24 | per1_div 9 | ||
25 | per2_div 10 | ||
26 | per3_div 11 | ||
27 | per4_div 12 | ||
28 | vpu_sel 13 | ||
29 | vpu_div 14 | ||
30 | usb_div 15 | ||
31 | cpu_sel 16 | ||
32 | clko_sel 17 | ||
33 | cpu_div 18 | ||
34 | clko_div 19 | ||
35 | ssi1_sel 20 | ||
36 | ssi2_sel 21 | ||
37 | ssi1_div 22 | ||
38 | ssi2_div 23 | ||
39 | clko_en 24 | ||
40 | ssi2_ipg_gate 25 | ||
41 | ssi1_ipg_gate 26 | ||
42 | slcdc_ipg_gate 27 | ||
43 | sdhc3_ipg_gate 28 | ||
44 | sdhc2_ipg_gate 29 | ||
45 | sdhc1_ipg_gate 30 | ||
46 | scc_ipg_gate 31 | ||
47 | sahara_ipg_gate 32 | ||
48 | rtc_ipg_gate 33 | ||
49 | pwm_ipg_gate 34 | ||
50 | owire_ipg_gate 35 | ||
51 | lcdc_ipg_gate 36 | ||
52 | kpp_ipg_gate 37 | ||
53 | iim_ipg_gate 38 | ||
54 | i2c2_ipg_gate 39 | ||
55 | i2c1_ipg_gate 40 | ||
56 | gpt6_ipg_gate 41 | ||
57 | gpt5_ipg_gate 42 | ||
58 | gpt4_ipg_gate 43 | ||
59 | gpt3_ipg_gate 44 | ||
60 | gpt2_ipg_gate 45 | ||
61 | gpt1_ipg_gate 46 | ||
62 | gpio_ipg_gate 47 | ||
63 | fec_ipg_gate 48 | ||
64 | emma_ipg_gate 49 | ||
65 | dma_ipg_gate 50 | ||
66 | cspi3_ipg_gate 51 | ||
67 | cspi2_ipg_gate 52 | ||
68 | cspi1_ipg_gate 53 | ||
69 | nfc_baud_gate 54 | ||
70 | ssi2_baud_gate 55 | ||
71 | ssi1_baud_gate 56 | ||
72 | vpu_baud_gate 57 | ||
73 | per4_gate 58 | ||
74 | per3_gate 59 | ||
75 | per2_gate 60 | ||
76 | per1_gate 61 | ||
77 | usb_ahb_gate 62 | ||
78 | slcdc_ahb_gate 63 | ||
79 | sahara_ahb_gate 64 | ||
80 | lcdc_ahb_gate 65 | ||
81 | vpu_ahb_gate 66 | ||
82 | fec_ahb_gate 67 | ||
83 | emma_ahb_gate 68 | ||
84 | emi_ahb_gate 69 | ||
85 | dma_ahb_gate 70 | ||
86 | csi_ahb_gate 71 | ||
87 | brom_ahb_gate 72 | ||
88 | ata_ahb_gate 73 | ||
89 | wdog_ipg_gate 74 | ||
90 | usb_ipg_gate 75 | ||
91 | uart6_ipg_gate 76 | ||
92 | uart5_ipg_gate 77 | ||
93 | uart4_ipg_gate 78 | ||
94 | uart3_ipg_gate 79 | ||
95 | uart2_ipg_gate 80 | ||
96 | uart1_ipg_gate 81 | ||
97 | ckih_div1p5 82 | ||
98 | fpm 83 | ||
99 | mpll_osc_sel 84 | ||
100 | mpll_sel 85 | ||
101 | |||
102 | Examples: | ||
103 | |||
104 | clks: ccm@10027000{ | ||
105 | compatible = "fsl,imx27-ccm"; | ||
106 | reg = <0x10027000 0x1000>; | ||
107 | #clock-cells = <1>; | ||
108 | }; | ||
109 | |||
110 | uart1: serial@1000a000 { | ||
111 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; | ||
112 | reg = <0x1000a000 0x1000>; | ||
113 | interrupts = <20>; | ||
114 | clocks = <&clks 81>, <&clks 61>; | ||
115 | clock-names = "ipg", "per"; | ||
116 | status = "disabled"; | ||
117 | }; | ||
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi index 324130f2e685..c3bdc72150d6 100644 --- a/arch/arm/boot/dts/imx27.dtsi +++ b/arch/arm/boot/dts/imx27.dtsi | |||
@@ -62,12 +62,15 @@ | |||
62 | compatible = "fsl,imx27-wdt", "fsl,imx21-wdt"; | 62 | compatible = "fsl,imx27-wdt", "fsl,imx21-wdt"; |
63 | reg = <0x10002000 0x4000>; | 63 | reg = <0x10002000 0x4000>; |
64 | interrupts = <27>; | 64 | interrupts = <27>; |
65 | clocks = <&clks 0>; | ||
65 | }; | 66 | }; |
66 | 67 | ||
67 | uart1: serial@1000a000 { | 68 | uart1: serial@1000a000 { |
68 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; | 69 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; |
69 | reg = <0x1000a000 0x1000>; | 70 | reg = <0x1000a000 0x1000>; |
70 | interrupts = <20>; | 71 | interrupts = <20>; |
72 | clocks = <&clks 81>, <&clks 61>; | ||
73 | clock-names = "ipg", "per"; | ||
71 | status = "disabled"; | 74 | status = "disabled"; |
72 | }; | 75 | }; |
73 | 76 | ||
@@ -75,6 +78,8 @@ | |||
75 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; | 78 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; |
76 | reg = <0x1000b000 0x1000>; | 79 | reg = <0x1000b000 0x1000>; |
77 | interrupts = <19>; | 80 | interrupts = <19>; |
81 | clocks = <&clks 80>, <&clks 61>; | ||
82 | clock-names = "ipg", "per"; | ||
78 | status = "disabled"; | 83 | status = "disabled"; |
79 | }; | 84 | }; |
80 | 85 | ||
@@ -82,6 +87,8 @@ | |||
82 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; | 87 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; |
83 | reg = <0x1000c000 0x1000>; | 88 | reg = <0x1000c000 0x1000>; |
84 | interrupts = <18>; | 89 | interrupts = <18>; |
90 | clocks = <&clks 79>, <&clks 61>; | ||
91 | clock-names = "ipg", "per"; | ||
85 | status = "disabled"; | 92 | status = "disabled"; |
86 | }; | 93 | }; |
87 | 94 | ||
@@ -89,6 +96,8 @@ | |||
89 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; | 96 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; |
90 | reg = <0x1000d000 0x1000>; | 97 | reg = <0x1000d000 0x1000>; |
91 | interrupts = <17>; | 98 | interrupts = <17>; |
99 | clocks = <&clks 78>, <&clks 61>; | ||
100 | clock-names = "ipg", "per"; | ||
92 | status = "disabled"; | 101 | status = "disabled"; |
93 | }; | 102 | }; |
94 | 103 | ||
@@ -98,6 +107,8 @@ | |||
98 | compatible = "fsl,imx27-cspi"; | 107 | compatible = "fsl,imx27-cspi"; |
99 | reg = <0x1000e000 0x1000>; | 108 | reg = <0x1000e000 0x1000>; |
100 | interrupts = <16>; | 109 | interrupts = <16>; |
110 | clocks = <&clks 53>, <&clks 0>; | ||
111 | clock-names = "ipg", "per"; | ||
101 | status = "disabled"; | 112 | status = "disabled"; |
102 | }; | 113 | }; |
103 | 114 | ||
@@ -107,6 +118,8 @@ | |||
107 | compatible = "fsl,imx27-cspi"; | 118 | compatible = "fsl,imx27-cspi"; |
108 | reg = <0x1000f000 0x1000>; | 119 | reg = <0x1000f000 0x1000>; |
109 | interrupts = <15>; | 120 | interrupts = <15>; |
121 | clocks = <&clks 52>, <&clks 0>; | ||
122 | clock-names = "ipg", "per"; | ||
110 | status = "disabled"; | 123 | status = "disabled"; |
111 | }; | 124 | }; |
112 | 125 | ||
@@ -116,6 +129,7 @@ | |||
116 | compatible = "fsl,imx27-i2c", "fsl,imx21-i2c"; | 129 | compatible = "fsl,imx27-i2c", "fsl,imx21-i2c"; |
117 | reg = <0x10012000 0x1000>; | 130 | reg = <0x10012000 0x1000>; |
118 | interrupts = <12>; | 131 | interrupts = <12>; |
132 | clocks = <&clks 40>; | ||
119 | status = "disabled"; | 133 | status = "disabled"; |
120 | }; | 134 | }; |
121 | 135 | ||
@@ -185,6 +199,8 @@ | |||
185 | compatible = "fsl,imx27-cspi"; | 199 | compatible = "fsl,imx27-cspi"; |
186 | reg = <0x10017000 0x1000>; | 200 | reg = <0x10017000 0x1000>; |
187 | interrupts = <6>; | 201 | interrupts = <6>; |
202 | clocks = <&clks 51>, <&clks 0>; | ||
203 | clock-names = "ipg", "per"; | ||
188 | status = "disabled"; | 204 | status = "disabled"; |
189 | }; | 205 | }; |
190 | 206 | ||
@@ -192,6 +208,8 @@ | |||
192 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; | 208 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; |
193 | reg = <0x1001b000 0x1000>; | 209 | reg = <0x1001b000 0x1000>; |
194 | interrupts = <49>; | 210 | interrupts = <49>; |
211 | clocks = <&clks 77>, <&clks 61>; | ||
212 | clock-names = "ipg", "per"; | ||
195 | status = "disabled"; | 213 | status = "disabled"; |
196 | }; | 214 | }; |
197 | 215 | ||
@@ -199,6 +217,8 @@ | |||
199 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; | 217 | compatible = "fsl,imx27-uart", "fsl,imx21-uart"; |
200 | reg = <0x1001c000 0x1000>; | 218 | reg = <0x1001c000 0x1000>; |
201 | interrupts = <48>; | 219 | interrupts = <48>; |
220 | clocks = <&clks 78>, <&clks 61>; | ||
221 | clock-names = "ipg", "per"; | ||
202 | status = "disabled"; | 222 | status = "disabled"; |
203 | }; | 223 | }; |
204 | 224 | ||
@@ -208,6 +228,7 @@ | |||
208 | compatible = "fsl,imx27-i2c", "fsl,imx21-i2c"; | 228 | compatible = "fsl,imx27-i2c", "fsl,imx21-i2c"; |
209 | reg = <0x1001d000 0x1000>; | 229 | reg = <0x1001d000 0x1000>; |
210 | interrupts = <1>; | 230 | interrupts = <1>; |
231 | clocks = <&clks 39>; | ||
211 | status = "disabled"; | 232 | status = "disabled"; |
212 | }; | 233 | }; |
213 | 234 | ||
@@ -224,10 +245,19 @@ | |||
224 | compatible = "fsl,imx27-fec"; | 245 | compatible = "fsl,imx27-fec"; |
225 | reg = <0x1002b000 0x4000>; | 246 | reg = <0x1002b000 0x4000>; |
226 | interrupts = <50>; | 247 | interrupts = <50>; |
248 | clocks = <&clks 48>, <&clks 67>, <&clks 0>; | ||
249 | clock-names = "ipg", "ahb", "ptp"; | ||
227 | status = "disabled"; | 250 | status = "disabled"; |
228 | }; | 251 | }; |
252 | |||
253 | clks: ccm@10027000{ | ||
254 | compatible = "fsl,imx27-ccm"; | ||
255 | reg = <0x10027000 0x1000>; | ||
256 | #clock-cells = <1>; | ||
257 | }; | ||
229 | }; | 258 | }; |
230 | 259 | ||
260 | |||
231 | nfc: nand@d8000000 { | 261 | nfc: nand@d8000000 { |
232 | #address-cells = <1>; | 262 | #address-cells = <1>; |
233 | #size-cells = <1>; | 263 | #size-cells = <1>; |
@@ -235,6 +265,7 @@ | |||
235 | compatible = "fsl,imx27-nand"; | 265 | compatible = "fsl,imx27-nand"; |
236 | reg = <0xd8000000 0x1000>; | 266 | reg = <0xd8000000 0x1000>; |
237 | interrupts = <29>; | 267 | interrupts = <29>; |
268 | clocks = <&clks 54>; | ||
238 | status = "disabled"; | 269 | status = "disabled"; |
239 | }; | 270 | }; |
240 | }; | 271 | }; |
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 8e3b65719106..faf629eeaf64 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c | |||
@@ -86,10 +86,12 @@ enum mx27_clks { | |||
86 | }; | 86 | }; |
87 | 87 | ||
88 | static struct clk *clk[clk_max]; | 88 | static struct clk *clk[clk_max]; |
89 | static struct clk_onecell_data clk_data; | ||
89 | 90 | ||
90 | int __init mx27_clocks_init(unsigned long fref) | 91 | int __init mx27_clocks_init(unsigned long fref) |
91 | { | 92 | { |
92 | int i; | 93 | int i; |
94 | struct device_node *np; | ||
93 | 95 | ||
94 | clk[dummy] = imx_clk_fixed("dummy", 0); | 96 | clk[dummy] = imx_clk_fixed("dummy", 0); |
95 | clk[ckih] = imx_clk_fixed("ckih", fref); | 97 | clk[ckih] = imx_clk_fixed("ckih", fref); |
@@ -198,6 +200,13 @@ int __init mx27_clocks_init(unsigned long fref) | |||
198 | pr_err("i.MX27 clk %d: register failed with %ld\n", | 200 | pr_err("i.MX27 clk %d: register failed with %ld\n", |
199 | i, PTR_ERR(clk[i])); | 201 | i, PTR_ERR(clk[i])); |
200 | 202 | ||
203 | np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm"); | ||
204 | if (np) { | ||
205 | clk_data.clks = clk; | ||
206 | clk_data.clk_num = ARRAY_SIZE(clk); | ||
207 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
208 | } | ||
209 | |||
201 | clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0"); | 210 | clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0"); |
202 | clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.0"); | 211 | clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.0"); |
203 | clk_register_clkdev(clk[uart2_ipg_gate], "ipg", "imx21-uart.1"); | 212 | clk_register_clkdev(clk[uart2_ipg_gate], "ipg", "imx21-uart.1"); |
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c index c915a490a11c..7ee59a718c79 100644 --- a/arch/arm/mach-imx/imx27-dt.c +++ b/arch/arm/mach-imx/imx27-dt.c | |||
@@ -18,25 +18,9 @@ | |||
18 | #include "common.h" | 18 | #include "common.h" |
19 | #include "mx27.h" | 19 | #include "mx27.h" |
20 | 20 | ||
21 | static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = { | ||
22 | OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART1_BASE_ADDR, "imx21-uart.0", NULL), | ||
23 | OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART2_BASE_ADDR, "imx21-uart.1", NULL), | ||
24 | OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART3_BASE_ADDR, "imx21-uart.2", NULL), | ||
25 | OF_DEV_AUXDATA("fsl,imx27-fec", MX27_FEC_BASE_ADDR, "imx27-fec.0", NULL), | ||
26 | OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C1_BASE_ADDR, "imx21-i2c.0", NULL), | ||
27 | OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C2_BASE_ADDR, "imx21-i2c.1", NULL), | ||
28 | OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI1_BASE_ADDR, "imx27-cspi.0", NULL), | ||
29 | OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI2_BASE_ADDR, "imx27-cspi.1", NULL), | ||
30 | OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI3_BASE_ADDR, "imx27-cspi.2", NULL), | ||
31 | OF_DEV_AUXDATA("fsl,imx27-wdt", MX27_WDOG_BASE_ADDR, "imx2-wdt.0", NULL), | ||
32 | OF_DEV_AUXDATA("fsl,imx27-nand", MX27_NFC_BASE_ADDR, "imx27-nand.0", NULL), | ||
33 | { /* sentinel */ } | ||
34 | }; | ||
35 | |||
36 | static void __init imx27_dt_init(void) | 21 | static void __init imx27_dt_init(void) |
37 | { | 22 | { |
38 | of_platform_populate(NULL, of_default_bus_match_table, | 23 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
39 | imx27_auxdata_lookup, NULL); | ||
40 | } | 24 | } |
41 | 25 | ||
42 | static const char * const imx27_dt_board_compat[] __initconst = { | 26 | static const char * const imx27_dt_board_compat[] __initconst = { |