diff options
author | Andrew Lunn <andrew@lunn.ch> | 2013-02-03 05:34:26 -0500 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2013-03-08 16:34:34 -0500 |
commit | de88747f514a4e0cca416a8871de2302f4f77790 (patch) | |
tree | a0a44be0a4ca5f16784bed1ee835b9ec85ddda5a /drivers/gpio | |
parent | 7bf5b408b419fc849578e6e9fbd221bf43638eb6 (diff) |
gpio: mvebu: Add clk support to prevent lockup
The kirkwood SoC GPIO cores use the runit clock. Add code to
clk_prepare_enable() runit, otherwise there is a danger of locking up
the SoC by accessing the GPIO registers when runit clock is not
ticking.
Reported-by: Simon Baatz <gmbnomis@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Simon Baatz <gmbnomis@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-mvebu.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 7472182967ce..61a6fde6c089 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/io.h> | 42 | #include <linux/io.h> |
43 | #include <linux/of_irq.h> | 43 | #include <linux/of_irq.h> |
44 | #include <linux/of_device.h> | 44 | #include <linux/of_device.h> |
45 | #include <linux/clk.h> | ||
45 | #include <linux/pinctrl/consumer.h> | 46 | #include <linux/pinctrl/consumer.h> |
46 | 47 | ||
47 | /* | 48 | /* |
@@ -496,6 +497,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) | |||
496 | struct resource *res; | 497 | struct resource *res; |
497 | struct irq_chip_generic *gc; | 498 | struct irq_chip_generic *gc; |
498 | struct irq_chip_type *ct; | 499 | struct irq_chip_type *ct; |
500 | struct clk *clk; | ||
499 | unsigned int ngpios; | 501 | unsigned int ngpios; |
500 | int soc_variant; | 502 | int soc_variant; |
501 | int i, cpu, id; | 503 | int i, cpu, id; |
@@ -529,6 +531,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev) | |||
529 | return id; | 531 | return id; |
530 | } | 532 | } |
531 | 533 | ||
534 | clk = devm_clk_get(&pdev->dev, NULL); | ||
535 | /* Not all SoCs require a clock.*/ | ||
536 | if (!IS_ERR(clk)) | ||
537 | clk_prepare_enable(clk); | ||
538 | |||
532 | mvchip->soc_variant = soc_variant; | 539 | mvchip->soc_variant = soc_variant; |
533 | mvchip->chip.label = dev_name(&pdev->dev); | 540 | mvchip->chip.label = dev_name(&pdev->dev); |
534 | mvchip->chip.dev = &pdev->dev; | 541 | mvchip->chip.dev = &pdev->dev; |