ARM: S3C24XX: Wrapper s3c2410_gpio_setpin and s3c2410_gpio_pullup()
Change s3c2410_gpio_setpin() and s3c2410_gpio_pullup() to use the new s3c_ gpio configuration calls until all their users are converted. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* linux/arch/arm/plat-s3c24xx/gpio.c
|
/* linux/arch/arm/plat-s3c24xx/gpio.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2004-2005 Simtec Electronics
|
* Copyright (c) 2004-2010 Simtec Electronics
|
||||||
* Ben Dooks <ben@simtec.co.uk>
|
* Ben Dooks <ben@simtec.co.uk>
|
||||||
*
|
*
|
||||||
* S3C24XX GPIO support
|
* S3C24XX GPIO support
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
|
#include <linux/gpio.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
|
||||||
#include <mach/hardware.h>
|
#include <mach/hardware.h>
|
||||||
@@ -33,44 +34,34 @@
|
|||||||
|
|
||||||
#include <mach/regs-gpio.h>
|
#include <mach/regs-gpio.h>
|
||||||
|
|
||||||
|
/* gpiolib wrappers until these are totally eliminated */
|
||||||
|
|
||||||
void s3c2410_gpio_pullup(unsigned int pin, unsigned int to)
|
void s3c2410_gpio_pullup(unsigned int pin, unsigned int to)
|
||||||
{
|
{
|
||||||
void __iomem *base = S3C24XX_GPIO_BASE(pin);
|
int ret;
|
||||||
unsigned long offs = S3C2410_GPIO_OFFSET(pin);
|
|
||||||
unsigned long flags;
|
|
||||||
unsigned long up;
|
|
||||||
|
|
||||||
if (pin < S3C2410_GPIO_BANKB)
|
WARN_ON(to); /* should be none of these left */
|
||||||
return;
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
if (!to) {
|
||||||
|
/* if pull is enabled, try first with up, and if that
|
||||||
|
* fails, try using down */
|
||||||
|
|
||||||
up = __raw_readl(base + 0x08);
|
ret = s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP);
|
||||||
up &= ~(1L << offs);
|
if (ret)
|
||||||
up |= to << offs;
|
s3c_gpio_setpull(pin, S3C_GPIO_PULL_DOWN);
|
||||||
__raw_writel(up, base + 0x08);
|
} else {
|
||||||
|
s3c_gpio_setpull(pin, S3C_GPIO_PULL_NONE);
|
||||||
local_irq_restore(flags);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(s3c2410_gpio_pullup);
|
EXPORT_SYMBOL(s3c2410_gpio_pullup);
|
||||||
|
|
||||||
|
|
||||||
void s3c2410_gpio_setpin(unsigned int pin, unsigned int to)
|
void s3c2410_gpio_setpin(unsigned int pin, unsigned int to)
|
||||||
{
|
{
|
||||||
void __iomem *base = S3C24XX_GPIO_BASE(pin);
|
/* do this via gpiolib until all users removed */
|
||||||
unsigned long offs = S3C2410_GPIO_OFFSET(pin);
|
|
||||||
unsigned long flags;
|
|
||||||
unsigned long dat;
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
gpio_request(pin, "temporary");
|
||||||
|
gpio_set_value(pin, to);
|
||||||
dat = __raw_readl(base + 0x04);
|
gpio_free(pin);
|
||||||
dat &= ~(1 << offs);
|
|
||||||
dat |= to << offs;
|
|
||||||
__raw_writel(dat, base + 0x04);
|
|
||||||
|
|
||||||
local_irq_restore(flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(s3c2410_gpio_setpin);
|
EXPORT_SYMBOL(s3c2410_gpio_setpin);
|
||||||
|
Reference in New Issue
Block a user