Skip to content

Commit de1d0d1

Browse files
refractionwareBartosz Golaszewski
authored andcommitted
gpio: bcm-kona: Fix GPIO lock/unlock for banks above bank 0
The GPIO lock/unlock functions clear/write a bit to the relevant register for each bank. However, due to an oversight the bit that was being written was based on the total GPIO number, not the index of the GPIO within the relevant bank, causing it to fail for any GPIO above 32 (thus any GPIO for banks above bank 0). Fix lock/unlock for these banks by using the correct bit. Fixes: bdb93c0 ("gpio: bcm281xx: Centralize register locking") Reviewed-by: Florian Fainelli <[email protected]> Reviewed-by: Markus Mayer <[email protected]> Signed-off-by: Artur Weber <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent a64dcfb commit de1d0d1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpio/gpio-bcm-kona.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ static void bcm_kona_gpio_lock_gpio(struct bcm_kona_gpio *kona_gpio,
8686
u32 val;
8787
unsigned long flags;
8888
int bank_id = GPIO_BANK(gpio);
89+
int bit = GPIO_BIT(gpio);
8990

9091
raw_spin_lock_irqsave(&kona_gpio->lock, flags);
9192

9293
val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));
93-
val |= BIT(gpio);
94+
val |= BIT(bit);
9495
bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);
9596

9697
raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);
@@ -102,11 +103,12 @@ static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,
102103
u32 val;
103104
unsigned long flags;
104105
int bank_id = GPIO_BANK(gpio);
106+
int bit = GPIO_BIT(gpio);
105107

106108
raw_spin_lock_irqsave(&kona_gpio->lock, flags);
107109

108110
val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));
109-
val &= ~BIT(gpio);
111+
val &= ~BIT(bit);
110112
bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);
111113

112114
raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);

0 commit comments

Comments
 (0)