From 6c1ecba8d84841277d68140ef485335d5be28485 Mon Sep 17 00:00:00 2001 From: Lothar Waßmann Date: Thu, 22 Nov 2012 13:49:14 +0100 Subject: video: mxsfb: fix crash when unblanking the display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The VDCTRL4 register does not provide the MXS SET/CLR/TOGGLE feature. The write in mxsfb_disable_controller() sets the data_cnt for the LCD DMA to 0 which obviously means the max. count for the LCD DMA and leads to overwriting arbitrary memory when the display is unblanked. Signed-off-by: Lothar Waßmann Acked-by: Juergen Beisert Tested-by: Lauri Hintsala Cc: Signed-off-by: Shawn Guo --- drivers/video/mxsfb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 49619b441500..f2a49ef772f3 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -369,7 +369,8 @@ static void mxsfb_disable_controller(struct fb_info *fb_info) loop--; } - writel(VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4 + REG_CLR); + reg = readl(host->base + LCDC_VDCTRL4); + writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4); clk_disable_unprepare(host->clk); -- cgit v1.2.3 From 5343527bbfab3f71f64d8ba5d51ce12dec8d82d0 Mon Sep 17 00:00:00 2001 From: Andrew Lunn Date: Sun, 6 Jan 2013 11:10:35 +0100 Subject: Power: gpio-poweroff: Fix documentation and gpio_is_valid Improve the documentation to clarify level vs edge triggered power off. Improve the comments for level vs edge triggered power off. Make use of gpio_is_valid(). Reported-by: Stephen Warren Signed-off-by: Andrew Lunn Signed-off-by: Jason Cooper --- .../devicetree/bindings/gpio/gpio-poweroff.txt | 20 +++++++++++-- drivers/power/reset/gpio-poweroff.c | 33 ++++++++++------------ 2 files changed, 32 insertions(+), 21 deletions(-) (limited to 'drivers') diff --git a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt index 558cdf3c9abc..d4eab9227ea4 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt @@ -1,4 +1,19 @@ -GPIO line that should be set high/low to power off a device +Driver a GPIO line that can be used to turn the power off. + +The driver supports both level triggered and edge triggered power off. +At driver load time, the driver will request the given gpio line and +install a pm_power_off handler. If the optional properties 'input' is +not found, the GPIO line will be driven in the inactive +state. Otherwise its configured as an input. + +When the pm_power_off is called, the gpio is configured as an output, +and drive active, so triggering a level triggered power off +condition. This will also cause an inactive->active edge condition, so +triggering positive edge triggered power off. After a delay of 100ms, +the GPIO is set to inactive, thus causing an active->inactive edge, +triggering negative edge triggered power off. After another 100ms +delay the GPIO is driver active again. If the power is still on and +the CPU still running after a 3000ms delay, a WARN_ON(1) is emitted. Required properties: - compatible : should be "gpio-poweroff". @@ -13,10 +28,9 @@ Optional properties: property is not specified, the GPIO is initialized as an output in its inactive state. - Examples: gpio-poweroff { compatible = "gpio-poweroff"; - gpios = <&gpio 4 0>; /* GPIO 4 Active Low */ + gpios = <&gpio 4 0>; }; diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c index 0491e5335d02..adc943b3fc3f 100644 --- a/drivers/power/reset/gpio-poweroff.c +++ b/drivers/power/reset/gpio-poweroff.c @@ -29,15 +29,16 @@ static int gpio_active_low; static void gpio_poweroff_do_poweroff(void) { - BUG_ON(gpio_num == -1); + BUG_ON(!gpio_is_valid(gpio_num)); - /* drive it active */ + /* drive it active, also inactive->active edge */ gpio_direction_output(gpio_num, !gpio_active_low); mdelay(100); - /* rising edge or drive inactive */ + /* drive inactive, also active->inactive edge */ gpio_set_value(gpio_num, gpio_active_low); mdelay(100); - /* falling edge */ + + /* drive it active, also inactive->active edge */ gpio_set_value(gpio_num, !gpio_active_low); /* give it some time */ @@ -60,15 +61,12 @@ static int __devinit gpio_poweroff_probe(struct platform_device *pdev) } gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags); - if (gpio_num < 0) { - pr_err("%s: Could not get GPIO configuration: %d", - __func__, gpio_num); - return -ENODEV; - } + if (!gpio_is_valid(gpio_num)) + return gpio_num; + gpio_active_low = flags & OF_GPIO_ACTIVE_LOW; - if (of_get_property(pdev->dev.of_node, "input", NULL)) - input = true; + input = of_property_read_bool(pdev->dev.of_node, "input"); ret = gpio_request(gpio_num, "poweroff-gpio"); if (ret) { @@ -98,8 +96,7 @@ err: static int __devexit gpio_poweroff_remove(struct platform_device *pdev) { - if (gpio_num != -1) - gpio_free(gpio_num); + gpio_free(gpio_num); if (pm_power_off == &gpio_poweroff_do_poweroff) pm_power_off = NULL; @@ -115,15 +112,15 @@ static struct platform_driver gpio_poweroff_driver = { .probe = gpio_poweroff_probe, .remove = __devexit_p(gpio_poweroff_remove), .driver = { - .name = "poweroff-gpio", - .owner = THIS_MODULE, - .of_match_table = of_gpio_poweroff_match, - }, + .name = "poweroff-gpio", + .owner = THIS_MODULE, + .of_match_table = of_gpio_poweroff_match, + }, }; module_platform_driver(gpio_poweroff_driver); MODULE_AUTHOR("Jamie Lentin "); MODULE_DESCRIPTION("GPIO poweroff driver"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:poweroff-gpio"); -- cgit v1.2.3 From 3810e6304185f5a5bc4bb99b0ed467a28e63e9ed Mon Sep 17 00:00:00 2001 From: Joshua Coombs Date: Sun, 6 Jan 2013 11:10:39 +0100 Subject: clk: mvebu: Remove inappropriate __init tagging If the Orion WDT driver is built as a module, an opps occurs during clk lookup when calling mvebu_clk_gating_get_src(). Remove the inappropriate __init tag so the function is available for modules after kernel init. Signed-off-by: Joshua Coombs Signed-off-by: Andrew Lunn Signed-off-by: Jason Cooper --- drivers/clk/mvebu/clk-gating-ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/clk/mvebu/clk-gating-ctrl.c b/drivers/clk/mvebu/clk-gating-ctrl.c index c6d3c263b070..8fa5408b6c7d 100644 --- a/drivers/clk/mvebu/clk-gating-ctrl.c +++ b/drivers/clk/mvebu/clk-gating-ctrl.c @@ -32,7 +32,7 @@ struct mvebu_soc_descr { #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) -static struct clk __init *mvebu_clk_gating_get_src( +static struct clk *mvebu_clk_gating_get_src( struct of_phandle_args *clkspec, void *data) { struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data; -- cgit v1.2.3 From ab6e439fd07aba7cadcadb3fb5e11d3758e19679 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sun, 6 Jan 2013 11:10:43 +0100 Subject: dma: mv_xor: fix error handling of mv_xor_channel_add() When mv_xor_channel_add() fails for one XOR channel, we jump to the err_channel_add label to clean up all previous channels that had been initialized correctly. Unfortunately, while handling this error condition, we were disposing the IRQ mapping before calling mv_xor_channel_remove() (which does the free_irq()), which is incorrect. Instead, do things properly in the reverse order of the initialization: first remove the XOR channel (so that free_irq() is done), and then dispose the IRQ mapping. This avoids ugly warnings when for some reason one of the XOR channel fails to initialize. Signed-off-by: Thomas Petazzoni Signed-off-by: Jason Cooper --- drivers/dma/mv_xor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index ac71f555dd72..cc5d23d3addd 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1361,9 +1361,9 @@ static int mv_xor_probe(struct platform_device *pdev) err_channel_add: for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) if (xordev->channels[i]) { + mv_xor_channel_remove(xordev->channels[i]); if (pdev->dev.of_node) irq_dispose_mapping(xordev->channels[i]->irq); - mv_xor_channel_remove(xordev->channels[i]); } clk_disable_unprepare(xordev->clk); -- cgit v1.2.3 From dab9206445952e64213582b2ab9077972850d65b Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sun, 6 Jan 2013 11:10:44 +0100 Subject: dma: mv_xor: fix error handling for clocks When a channel fails to initialize, we release all ressources, including clocks. However, a XOR unit is not necessarily associated to a clock (some variants of Marvell SoCs have a clock for XOR units, some don't), so we shouldn't unconditionally be releasing the clock. Instead, just like we do in the mv_xor_remove() function, we should check if one clock was found before releasing it. Signed-off-by: Thomas Petazzoni Signed-off-by: Jason Cooper --- drivers/dma/mv_xor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index cc5d23d3addd..e17fad03cb80 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c @@ -1366,8 +1366,11 @@ err_channel_add: irq_dispose_mapping(xordev->channels[i]->irq); } - clk_disable_unprepare(xordev->clk); - clk_put(xordev->clk); + if (!IS_ERR(xordev->clk)) { + clk_disable_unprepare(xordev->clk); + clk_put(xordev->clk); + } + return ret; } -- cgit v1.2.3 From ba607b6238a1f418c45b9d7f73212bcc6922da53 Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Mon, 26 Nov 2012 20:16:39 +0100 Subject: pinctrl: mvebu: make pdma clock on dove mandatory With the ability to pass clocks through DT, now make the pdma clock of dove pinctrl mandatory. Otherwise, pinctrl will hang the system when accessing some registers. Signed-off-by: Sebastian Hesselbarth Signed-off-by: Jason Cooper --- drivers/pinctrl/mvebu/pinctrl-dove.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index 40c9c3eecd94..9cc219f61000 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -595,8 +595,11 @@ static int __devinit dove_pinctrl_probe(struct platform_device *pdev) * grab clk to make sure it is ticking. */ clk = devm_clk_get(&pdev->dev, NULL); - if (!IS_ERR(clk)) - clk_prepare_enable(clk); + if (IS_ERR(clk)) { + dev_err(&pdev->dev, "Unable to get pdma clock"); + return PTR_RET(clk); + } + clk_prepare_enable(clk); return mvebu_pinctrl_probe(pdev); } -- cgit v1.2.3