lkml.org 
[lkml]   [2013]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[ 088/100] gpio: mvebu: Add clk support to prevent lockup
    Date
    3.8-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Andrew Lunn <andrew@lunn.ch>

    commit de88747f514a4e0cca416a8871de2302f4f77790 upstream.

    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>
    Signed-off-by: Jason Cooper <jason@lakedaemon.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    arch/arm/boot/dts/kirkwood.dtsi | 2 ++
    drivers/gpio/gpio-mvebu.c | 7 +++++++
    2 files changed, 9 insertions(+)

    --- 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@10140 {
    @@ -49,6 +50,7 @@
    interrupt-controller;
    #interrupt-cells = <2>;
    interrupts = <39>, <40>, <41>;
    + clocks = <&gate_clk 7>;
    };

    serial@12000 {
    --- 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 platf
    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 platf
    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;



    \
     
     \ /
      Last update: 2013-03-13 00:41    [W:4.079 / U:1.244 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site