Commit de88747f authored by Andrew Lunn's avatar Andrew Lunn Committed by Jason Cooper

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: default avatarSimon Baatz <gmbnomis@gmail.com>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Tested-by: default avatarSimon Baatz <gmbnomis@gmail.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
parent 7bf5b408
...@@ -38,6 +38,7 @@ gpio0: gpio@10100 { ...@@ -38,6 +38,7 @@ gpio0: gpio@10100 {
interrupt-controller; interrupt-controller;
#interrupt-cells = <2>; #interrupt-cells = <2>;
interrupts = <35>, <36>, <37>, <38>; interrupts = <35>, <36>, <37>, <38>;
clocks = <&gate_clk 7>;
}; };
gpio1: gpio@10140 { gpio1: gpio@10140 {
...@@ -49,6 +50,7 @@ gpio1: gpio@10140 { ...@@ -49,6 +50,7 @@ gpio1: gpio@10140 {
interrupt-controller; interrupt-controller;
#interrupt-cells = <2>; #interrupt-cells = <2>;
interrupts = <39>, <40>, <41>; interrupts = <39>, <40>, <41>;
clocks = <&gate_clk 7>;
}; };
serial@12000 { serial@12000 {
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/clk.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
/* /*
...@@ -496,6 +497,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) ...@@ -496,6 +497,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct irq_chip_generic *gc; struct irq_chip_generic *gc;
struct irq_chip_type *ct; struct irq_chip_type *ct;
struct clk *clk;
unsigned int ngpios; unsigned int ngpios;
int soc_variant; int soc_variant;
int i, cpu, id; int i, cpu, id;
...@@ -529,6 +531,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev) ...@@ -529,6 +531,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
return id; return id;
} }
clk = devm_clk_get(&pdev->dev, NULL);
/* Not all SoCs require a clock.*/
if (!IS_ERR(clk))
clk_prepare_enable(clk);
mvchip->soc_variant = soc_variant; mvchip->soc_variant = soc_variant;
mvchip->chip.label = dev_name(&pdev->dev); mvchip->chip.label = dev_name(&pdev->dev);
mvchip->chip.dev = &pdev->dev; mvchip->chip.dev = &pdev->dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment