diff options
author | Boris BREZILLON <boris.brezillon@free-electrons.com> | 2014-04-10 09:52:45 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-04-22 07:47:43 -0400 |
commit | cf2908e4ff9967377b0e1a73ade9416da4d167ff (patch) | |
tree | e8ecfb6a3c9669bb98223f6d9c67c989f2a596f8 | |
parent | d9d0e1f658afa52c5abfaab112e9b102e15dd971 (diff) |
pinctrl: sunxi: add reset control support
The A31 SoC define a reset line for the R_PIO block which needs to be
deasserted.
Try to retrieve a reset control and deassert if one was found.
Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/pinctrl-sunxi.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index 17b5f80dae0d..07af35a127b2 100644 --- a/drivers/pinctrl/pinctrl-sunxi.c +++ b/drivers/pinctrl/pinctrl-sunxi.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/pinctrl/pinconf-generic.h> | 26 | #include <linux/pinctrl/pinconf-generic.h> |
27 | #include <linux/pinctrl/pinmux.h> | 27 | #include <linux/pinctrl/pinmux.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/reset.h> | ||
29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
30 | 31 | ||
31 | #include "core.h" | 32 | #include "core.h" |
@@ -792,6 +793,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) | |||
792 | const struct of_device_id *device; | 793 | const struct of_device_id *device; |
793 | struct pinctrl_pin_desc *pins; | 794 | struct pinctrl_pin_desc *pins; |
794 | struct sunxi_pinctrl *pctl; | 795 | struct sunxi_pinctrl *pctl; |
796 | struct reset_control *rstc; | ||
795 | int i, ret, last_pin; | 797 | int i, ret, last_pin; |
796 | struct clk *clk; | 798 | struct clk *clk; |
797 | 799 | ||
@@ -887,10 +889,17 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) | |||
887 | if (ret) | 889 | if (ret) |
888 | goto gpiochip_error; | 890 | goto gpiochip_error; |
889 | 891 | ||
892 | rstc = devm_reset_control_get_optional(&pdev->dev, NULL); | ||
893 | if (!IS_ERR(rstc)) { | ||
894 | ret = reset_control_deassert(rstc); | ||
895 | if (ret) | ||
896 | goto clk_error; | ||
897 | } | ||
898 | |||
890 | pctl->irq = irq_of_parse_and_map(node, 0); | 899 | pctl->irq = irq_of_parse_and_map(node, 0); |
891 | if (!pctl->irq) { | 900 | if (!pctl->irq) { |
892 | ret = -EINVAL; | 901 | ret = -EINVAL; |
893 | goto clk_error; | 902 | goto rstc_error; |
894 | } | 903 | } |
895 | 904 | ||
896 | pctl->domain = irq_domain_add_linear(node, SUNXI_IRQ_NUMBER, | 905 | pctl->domain = irq_domain_add_linear(node, SUNXI_IRQ_NUMBER, |
@@ -898,7 +907,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) | |||
898 | if (!pctl->domain) { | 907 | if (!pctl->domain) { |
899 | dev_err(&pdev->dev, "Couldn't register IRQ domain\n"); | 908 | dev_err(&pdev->dev, "Couldn't register IRQ domain\n"); |
900 | ret = -ENOMEM; | 909 | ret = -ENOMEM; |
901 | goto clk_error; | 910 | goto rstc_error; |
902 | } | 911 | } |
903 | 912 | ||
904 | for (i = 0; i < SUNXI_IRQ_NUMBER; i++) { | 913 | for (i = 0; i < SUNXI_IRQ_NUMBER; i++) { |
@@ -916,6 +925,9 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) | |||
916 | 925 | ||
917 | return 0; | 926 | return 0; |
918 | 927 | ||
928 | rstc_error: | ||
929 | if (!IS_ERR(rstc)) | ||
930 | reset_control_assert(rstc); | ||
919 | clk_error: | 931 | clk_error: |
920 | clk_disable_unprepare(clk); | 932 | clk_disable_unprepare(clk); |
921 | gpiochip_error: | 933 | gpiochip_error: |