* [PATCH v2] gpio: mvebu: Add clk support to prevent lockup
@ 2013-02-03 10:34 Andrew Lunn
2013-02-03 19:48 ` Simon Baatz
2013-02-04 1:44 ` Jason Cooper
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Lunn @ 2013-02-03 10:34 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
Since v1:
ChangeLog: tclk->runit clock
arch/arm/boot/dts/kirkwood.dtsi | 2 ++
drivers/gpio/gpio-mvebu.c | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index d6ab442..6c5d75f 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -38,6 +38,7 @@
interrupt-controller;
#interrupt-cells = <2>;
interrupts = <35>, <36>, <37>, <38>;
+ clocks = <&gate_clk 7>;
};
gpio1: gpio at 10140 {
@@ -49,6 +50,7 @@
interrupt-controller;
#interrupt-cells = <2>;
interrupts = <39>, <40>, <41>;
+ clocks = <&gate_clk 7>;
};
serial at 12000 {
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 6819d63..456663c 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -41,6 +41,7 @@
#include <linux/io.h>
#include <linux/of_irq.h>
#include <linux/of_device.h>
+#include <linux/clk.h>
#include <linux/pinctrl/consumer.h>
/*
@@ -495,6 +496,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
struct resource *res;
struct irq_chip_generic *gc;
struct irq_chip_type *ct;
+ struct clk *clk;
unsigned int ngpios;
int soc_variant;
int i, cpu, id;
@@ -528,6 +530,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
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->chip.label = dev_name(&pdev->dev);
mvchip->chip.dev = &pdev->dev;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] gpio: mvebu: Add clk support to prevent lockup
2013-02-03 10:34 [PATCH v2] gpio: mvebu: Add clk support to prevent lockup Andrew Lunn
@ 2013-02-03 19:48 ` Simon Baatz
2013-02-04 1:44 ` Jason Cooper
1 sibling, 0 replies; 4+ messages in thread
From: Simon Baatz @ 2013-02-03 19:48 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Feb 03, 2013 at 11:34:26AM +0100, Andrew Lunn wrote:
> 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>
After boot (GPIO is the only driver enabling runit at this point in
time):
# cat /sys/kernel/debug/clk/tclk/runit/clk_enable_count
2
- Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] gpio: mvebu: Add clk support to prevent lockup
2013-02-03 10:34 [PATCH v2] gpio: mvebu: Add clk support to prevent lockup Andrew Lunn
2013-02-03 19:48 ` Simon Baatz
@ 2013-02-04 1:44 ` Jason Cooper
2013-02-04 20:45 ` Linus Walleij
1 sibling, 1 reply; 4+ messages in thread
From: Jason Cooper @ 2013-02-04 1:44 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Feb 03, 2013 at 11:34:26AM +0100, Andrew Lunn wrote:
> 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>
> ---
> Since v1:
> ChangeLog: tclk->runit clock
>
> arch/arm/boot/dts/kirkwood.dtsi | 2 ++
> drivers/gpio/gpio-mvebu.c | 7 +++++++
> 2 files changed, 9 insertions(+)
Linus,
I merge-tested this against your gpio/fixes branch since you had a patch
to the same file:
11c0cee gpio: mvebu: Don't free chip label memory
There were no conflicts. If you don't mind, I'd like to take this
through mvebu/fixes -> arm-soc since this is one of four patches to fix
one reported issue. I'd like to keep them in the same branch.
If this causes a headache for you, please let me know and you can take
it.
Otherwise, applied to mvebu/fixes with Simon's Tested-by:
thx,
Jason.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] gpio: mvebu: Add clk support to prevent lockup
2013-02-04 1:44 ` Jason Cooper
@ 2013-02-04 20:45 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2013-02-04 20:45 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Feb 4, 2013 at 2:44 AM, Jason Cooper <jason@lakedaemon.net> wrote:
> On Sun, Feb 03, 2013 at 11:34:26AM +0100, Andrew Lunn wrote:
>> 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>
>> ---
>> Since v1:
>> ChangeLog: tclk->runit clock
>>
>> arch/arm/boot/dts/kirkwood.dtsi | 2 ++
>> drivers/gpio/gpio-mvebu.c | 7 +++++++
>> 2 files changed, 9 insertions(+)
>
> Linus,
>
> I merge-tested this against your gpio/fixes branch since you had a patch
> to the same file:
>
> 11c0cee gpio: mvebu: Don't free chip label memory
>
> There were no conflicts. If you don't mind, I'd like to take this
> through mvebu/fixes -> arm-soc since this is one of four patches to fix
> one reported issue. I'd like to keep them in the same branch.
No problem, go ahead.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-04 20:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-03 10:34 [PATCH v2] gpio: mvebu: Add clk support to prevent lockup Andrew Lunn
2013-02-03 19:48 ` Simon Baatz
2013-02-04 1:44 ` Jason Cooper
2013-02-04 20:45 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox