]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pinctrl: sunxi: add clock support
authorEmilio López <emilio@elopez.com.ar>
Fri, 22 Mar 2013 14:20:40 +0000 (11:20 -0300)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 3 Apr 2013 11:58:38 +0000 (13:58 +0200)
For the port controller to work, we need to enable the apb0_pio gate.
This commit adds the ability to enable one clock specified on the device
tree to the pinctrl driver.

Signed-off-by: Emilio López <emilio@elopez.com.ar>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-sunxi.c

index cb491d6ba6010e2355de62081fc9744f59d1bb1d..617d351a0a44b9ac04fcd65ed2da6a20cf071509 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include <linux/io.h>
+#include <linux/clk.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -1917,6 +1918,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
        struct pinctrl_pin_desc *pins;
        struct sunxi_pinctrl *pctl;
        int i, ret, last_pin;
+       struct clk *clk;
 
        pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
        if (!pctl)
@@ -1987,6 +1989,12 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
                        goto gpiochip_error;
        }
 
+       clk = devm_clk_get(&pdev->dev, NULL);
+       if (IS_ERR(clk))
+               goto gpiochip_error;
+
+       clk_prepare_enable(clk);
+
        dev_info(&pdev->dev, "initialized sunXi PIO driver\n");
 
        return 0;