spin_unlock_irqrestore(&bank->lock, flags);
}
-static int rk30_gpiolib_pull_updown(struct gpio_chip *chip, unsigned offset, unsigned enable)
+static int rk30_gpiolib_pull_updown(struct gpio_chip *chip, unsigned offset, enum GPIOPullType type)
{
#if !defined(CONFIG_ARCH_RK3066B)
struct rk30_gpio_bank *bank = to_rk30_gpio_bank(chip);
- unsigned long flags;
-
- spin_lock_irqsave(&bank->lock, flags);
- if(offset>=16)
- rk30_gpio_bit_op((void *__iomem) RK30_GRF_BASE, GRF_GPIO0H_PULL + bank->id * 8, (1<<offset) | offset_to_bit(offset-16), !enable);
+ /*
+ * Values written to this register independently
+ * control Pullup/Pulldown or not for the
+ * corresponding data bit in GPIO.
+ * 0: pull up/down enable, PAD type will decide
+ * to be up or down, not related with this value
+ * 1: pull up/down disable
+ */
+ u32 val = (type == PullDisable) ? 1 : 0;
+ void __iomem *base = RK30_GRF_BASE + bank->id * 8;
+
+ if (offset >= 16)
+ __raw_writel((1 << offset) | (val << (offset - 16)), base + GRF_GPIO0H_PULL);
else
- rk30_gpio_bit_op((void *__iomem) RK30_GRF_BASE, GRF_GPIO0L_PULL + bank->id * 8, (1<<(offset+16)) | offset_to_bit(offset), !enable);
- spin_unlock_irqrestore(&bank->lock, flags);
+ __raw_writel((1 << (offset + 16)) | (val << offset), base + GRF_GPIO0L_PULL);
#endif
return 0;
}