summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorRichard Genoud <richard.genoud@gmail.com>2017-06-01 08:18:26 -0400
committerLinus Walleij <linus.walleij@linaro.org>2017-06-09 03:38:27 -0400
commitfc7a90686777e7d2da7a08cf0202c21f3b96febb (patch)
tree3da8fd5d68eb64b67e583c2c936ce87db82abe5d /drivers/gpio
parentc528eb27a3be2600e724c8a57cb69eab1fd9afa2 (diff)
gpio: mvebu: fix gpio bank registration when pwm is used
If more than one gpio bank has the "pwm" property, only one will be registered successfully, all the others will fail with: mvebu-gpio: probe of f1018140.gpio failed with error -17 That's because in alloc_pwms(), the chip->base (aka "int pwm"), was not set (thus, ==0) ; and 0 is a meaningful start value in alloc_pwm(). What was intended is mvpwm->chip->base = -1. Like that, the numbering will be done auto-magically Moreover, as the region might be already occupied by another pwm, we shouldn't force: mvpwm->chip->base = 0 nor mvpwm->chip->base = id * MVEBU_MAX_GPIO_PER_BANK; Tested on clearfog-pro (Marvell 88F6828) Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support") Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-mvebu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index cdef2c78cb3b..5104b6398139 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -768,6 +768,13 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
768 mvpwm->chip.dev = dev; 768 mvpwm->chip.dev = dev;
769 mvpwm->chip.ops = &mvebu_pwm_ops; 769 mvpwm->chip.ops = &mvebu_pwm_ops;
770 mvpwm->chip.npwm = mvchip->chip.ngpio; 770 mvpwm->chip.npwm = mvchip->chip.ngpio;
771 /*
772 * There may already be some PWM allocated, so we can't force
773 * mvpwm->chip.base to a fixed point like mvchip->chip.base.
774 * So, we let pwmchip_add() do the numbering and take the next free
775 * region.
776 */
777 mvpwm->chip.base = -1;
771 778
772 spin_lock_init(&mvpwm->lock); 779 spin_lock_init(&mvpwm->lock);
773 780