/* NOTE: If enabling the pull up/down, the caller must ensure that the GPIO is configured as an input. Otherwise, due to the way the controller registers work, this function will change the value output on the pin.  */
void db8500_gpio_set_pull(unsigned gpio, enum db8500_gpio_pull pull)
/* NOTE: If enabling the pull up/down, the caller must ensure that the GPIO is configured as an input. Otherwise, due to the way the controller registers work, this function will change the value output on the pin.  */
void db8500_gpio_set_pull(unsigned gpio, enum db8500_gpio_pull pull)
{
	void __iomem *addr = get_gpio_addr(gpio);
	unsigned offset = get_gpio_offset(gpio);
	u32 bit = 1 << offset;
	u32 pdis;
	pdis = readl(addr + DB8500_GPIO_PDIS);
	if (pull == DB8500_GPIO_PULL_NONE)
		pdis |= bit;
	else
		pdis &= ~bit;
	writel(pdis, addr + DB8500_GPIO_PDIS);
	if (pull == DB8500_GPIO_PULL_UP)
		writel(bit, addr + DB8500_GPIO_DATS);
	else if (pull == DB8500_GPIO_PULL_DOWN)
		writel(bit, addr + DB8500_GPIO_DATC);
}