diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-05-23 13:18:28 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-06-17 07:54:37 -0400 |
commit | 85fb28bed813469ba56706a7e48fba596f47c253 (patch) | |
tree | 25a229324358e68059010b070a43b8da37b908d6 | |
parent | bba5f2cc2f0fe4191ad2699c7c03a6def31f54e2 (diff) |
ARM: u300: convert MMC/SD clock to device tree
This converts the last of the U300 clocks to being probed from
the device tree.
Acked-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt | 23 | ||||
-rw-r--r-- | arch/arm/boot/dts/ste-u300.dts | 9 | ||||
-rw-r--r-- | drivers/clk/clk-u300.c | 22 |
3 files changed, 47 insertions, 7 deletions
diff --git a/Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt b/Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt index b6a30f5eb580..7cafcb98ead7 100644 --- a/Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt +++ b/Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt | |||
@@ -55,3 +55,26 @@ gpio: gpio@c0016000 { | |||
55 | (...) | 55 | (...) |
56 | clocks = <&gpio_clk>; | 56 | clocks = <&gpio_clk>; |
57 | }; | 57 | }; |
58 | |||
59 | |||
60 | Bindings for the MMC/SD card clock: | ||
61 | |||
62 | Required properties: | ||
63 | - compatible: must be "stericsson,u300-syscon-mclk" | ||
64 | - #clock-cells: must be <0> | ||
65 | |||
66 | Optional properties: | ||
67 | - clocks: parent clock(s) | ||
68 | |||
69 | mmc_mclk: mmc_mclk { | ||
70 | #clock-cells = <0>; | ||
71 | compatible = "stericsson,u300-syscon-mclk"; | ||
72 | clocks = <&mmc_pclk>; | ||
73 | }; | ||
74 | |||
75 | mmcsd: mmcsd@c0001000 { | ||
76 | compatible = "arm,pl18x", "arm,primecell"; | ||
77 | clocks = <&mmc_pclk>, <&mmc_mclk>; | ||
78 | clock-names = "apb_pclk", "mclk"; | ||
79 | (...) | ||
80 | }; | ||
diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts index 7edc5e58a5a5..05a082164c10 100644 --- a/arch/arm/boot/dts/ste-u300.dts +++ b/arch/arm/boot/dts/ste-u300.dts | |||
@@ -205,6 +205,11 @@ | |||
205 | clock-id = <5>; | 205 | clock-id = <5>; |
206 | clocks = <&fast_clk>; | 206 | clocks = <&fast_clk>; |
207 | }; | 207 | }; |
208 | mmc_mclk: mmc_mclk { | ||
209 | #clock-cells = <0>; | ||
210 | compatible = "stericsson,u300-syscon-mclk"; | ||
211 | clocks = <&mmc_pclk>; | ||
212 | }; | ||
208 | spi_clk: spi_p_clk@26M { | 213 | spi_clk: spi_p_clk@26M { |
209 | #clock-cells = <0>; | 214 | #clock-cells = <0>; |
210 | compatible = "stericsson,u300-syscon-clk"; | 215 | compatible = "stericsson,u300-syscon-clk"; |
@@ -433,8 +438,8 @@ | |||
433 | reg = <0xc0001000 0x1000>; | 438 | reg = <0xc0001000 0x1000>; |
434 | interrupt-parent = <&vicb>; | 439 | interrupt-parent = <&vicb>; |
435 | interrupts = <6 7>; | 440 | interrupts = <6 7>; |
436 | clocks = <&mmc_pclk>; | 441 | clocks = <&mmc_pclk>, <&mmc_mclk>; |
437 | clock-names = "apb_pclk"; | 442 | clock-names = "apb_pclk", "mclk"; |
438 | max-frequency = <24000000>; | 443 | max-frequency = <24000000>; |
439 | bus-width = <4>; // SD-card slot | 444 | bus-width = <4>; // SD-card slot |
440 | mmc-cap-mmc-highspeed; | 445 | mmc-cap-mmc-highspeed; |
diff --git a/drivers/clk/clk-u300.c b/drivers/clk/clk-u300.c index 5f234d37ccbe..8774e058cb6c 100644 --- a/drivers/clk/clk-u300.c +++ b/drivers/clk/clk-u300.c | |||
@@ -1139,6 +1139,18 @@ mclk_clk_register(struct device *dev, const char *name, | |||
1139 | return clk; | 1139 | return clk; |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | static void __init of_u300_syscon_mclk_init(struct device_node *np) | ||
1143 | { | ||
1144 | struct clk *clk = ERR_PTR(-EINVAL); | ||
1145 | const char *clk_name = np->name; | ||
1146 | const char *parent_name; | ||
1147 | |||
1148 | parent_name = of_clk_get_parent_name(np, 0); | ||
1149 | clk = mclk_clk_register(NULL, clk_name, parent_name, false); | ||
1150 | if (!IS_ERR(clk)) | ||
1151 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
1152 | } | ||
1153 | |||
1142 | static const __initconst struct of_device_id u300_clk_match[] = { | 1154 | static const __initconst struct of_device_id u300_clk_match[] = { |
1143 | { | 1155 | { |
1144 | .compatible = "fixed-clock", | 1156 | .compatible = "fixed-clock", |
@@ -1152,12 +1164,16 @@ static const __initconst struct of_device_id u300_clk_match[] = { | |||
1152 | .compatible = "stericsson,u300-syscon-clk", | 1164 | .compatible = "stericsson,u300-syscon-clk", |
1153 | .data = of_u300_syscon_clk_init, | 1165 | .data = of_u300_syscon_clk_init, |
1154 | }, | 1166 | }, |
1167 | { | ||
1168 | .compatible = "stericsson,u300-syscon-mclk", | ||
1169 | .data = of_u300_syscon_mclk_init, | ||
1170 | }, | ||
1155 | }; | 1171 | }; |
1156 | 1172 | ||
1173 | |||
1157 | void __init u300_clk_init(void __iomem *base) | 1174 | void __init u300_clk_init(void __iomem *base) |
1158 | { | 1175 | { |
1159 | u16 val; | 1176 | u16 val; |
1160 | struct clk *clk; | ||
1161 | 1177 | ||
1162 | syscon_vbase = base; | 1178 | syscon_vbase = base; |
1163 | 1179 | ||
@@ -1175,8 +1191,4 @@ void __init u300_clk_init(void __iomem *base) | |||
1175 | writew(val, syscon_vbase + U300_SYSCON_PMCR); | 1191 | writew(val, syscon_vbase + U300_SYSCON_PMCR); |
1176 | 1192 | ||
1177 | of_clk_init(u300_clk_match); | 1193 | of_clk_init(u300_clk_match); |
1178 | |||
1179 | /* Then this special MMC/SD clock */ | ||
1180 | clk = mclk_clk_register(NULL, "mmc_clk", "mmc_p_clk", false); | ||
1181 | clk_register_clkdev(clk, NULL, "mmci"); | ||
1182 | } | 1194 | } |