ARM: u300: convert MMC/SD clock to device tree
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 23 May 2013 17:18:28 +0000 (19:18 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 17 Jun 2013 11:54:37 +0000 (13:54 +0200)
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>
Documentation/devicetree/bindings/clock/ste-u300-syscon-clock.txt
arch/arm/boot/dts/ste-u300.dts
drivers/clk/clk-u300.c

index b6a30f5eb580507c35fe0876ba9f75e4dda728a9..7cafcb98ead79b89b1dd3938de7ff109c7128ef2 100644 (file)
@@ -55,3 +55,26 @@ gpio: gpio@c0016000 {
        (...)
        clocks = <&gpio_clk>;
 };
+
+
+Bindings for the MMC/SD card clock:
+
+Required properties:
+- compatible: must be "stericsson,u300-syscon-mclk"
+- #clock-cells: must be <0>
+
+Optional properties:
+- clocks: parent clock(s)
+
+mmc_mclk: mmc_mclk {
+       #clock-cells = <0>;
+       compatible = "stericsson,u300-syscon-mclk";
+       clocks = <&mmc_pclk>;
+};
+
+mmcsd: mmcsd@c0001000 {
+       compatible = "arm,pl18x", "arm,primecell";
+       clocks = <&mmc_pclk>, <&mmc_mclk>;
+       clock-names = "apb_pclk", "mclk";
+       (...)
+};
index 7edc5e58a5a5091a1b2667d50e19b3b5cfe8ca0b..05a082164c10878ea1b17ed93465855d75d85ed7 100644 (file)
                        clock-id = <5>;
                        clocks = <&fast_clk>;
                };
+               mmc_mclk: mmc_mclk {
+                       #clock-cells = <0>;
+                       compatible = "stericsson,u300-syscon-mclk";
+                       clocks = <&mmc_pclk>;
+               };
                spi_clk: spi_p_clk@26M {
                        #clock-cells = <0>;
                        compatible = "stericsson,u300-syscon-clk";
                        reg = <0xc0001000 0x1000>;
                        interrupt-parent = <&vicb>;
                        interrupts = <6 7>;
-                       clocks = <&mmc_pclk>;
-                       clock-names = "apb_pclk";
+                       clocks = <&mmc_pclk>, <&mmc_mclk>;
+                       clock-names = "apb_pclk", "mclk";
                        max-frequency = <24000000>;
                        bus-width = <4>; // SD-card slot
                        mmc-cap-mmc-highspeed;
index 5f234d37ccbe52b33e5574dba6ad930c81312af6..8774e058cb6cb5db9e290d2d45091ae839c149b3 100644 (file)
@@ -1139,6 +1139,18 @@ mclk_clk_register(struct device *dev, const char *name,
        return clk;
 }
 
+static void __init of_u300_syscon_mclk_init(struct device_node *np)
+{
+       struct clk *clk = ERR_PTR(-EINVAL);
+       const char *clk_name = np->name;
+       const char *parent_name;
+
+       parent_name = of_clk_get_parent_name(np, 0);
+       clk = mclk_clk_register(NULL, clk_name, parent_name, false);
+       if (!IS_ERR(clk))
+               of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
+
 static const __initconst struct of_device_id u300_clk_match[] = {
        {
                .compatible = "fixed-clock",
@@ -1152,12 +1164,16 @@ static const __initconst struct of_device_id u300_clk_match[] = {
                .compatible = "stericsson,u300-syscon-clk",
                .data = of_u300_syscon_clk_init,
        },
+       {
+               .compatible = "stericsson,u300-syscon-mclk",
+               .data = of_u300_syscon_mclk_init,
+       },
 };
 
+
 void __init u300_clk_init(void __iomem *base)
 {
        u16 val;
-       struct clk *clk;
 
        syscon_vbase = base;
 
@@ -1175,8 +1191,4 @@ void __init u300_clk_init(void __iomem *base)
        writew(val, syscon_vbase + U300_SYSCON_PMCR);
 
        of_clk_init(u300_clk_match);
-
-       /* Then this special MMC/SD clock */
-       clk = mclk_clk_register(NULL, "mmc_clk", "mmc_p_clk", false);
-       clk_register_clkdev(clk, NULL, "mmci");
 }