aboutsummaryrefslogtreecommitdiffstats
path: root/arch/unicore32/include/asm/gpio.h
diff options
context:
space:
mode:
authorGuanXuetao <gxt@mprc.pku.edu.cn>2011-02-26 21:21:18 +0800
committerGuanXuetao <gxt@mprc.pku.edu.cn>2011-03-17 09:19:19 +0800
commite5abf78b57199a417eb01ff922a5ea6ff9e10b61 (patch)
tree6f72a13d44c0dc8c4d575d84885f5694c16ed1da /arch/unicore32/include/asm/gpio.h
parent4517366d870b89d6fb8c0c90deb6c73d975908af (diff)
downloadkernel_samsung_smdk4412-e5abf78b57199a417eb01ff922a5ea6ff9e10b61.zip
kernel_samsung_smdk4412-e5abf78b57199a417eb01ff922a5ea6ff9e10b61.tar.gz
kernel_samsung_smdk4412-e5abf78b57199a417eb01ff922a5ea6ff9e10b61.tar.bz2
unicore32 io: redefine __REG(x) and re-use readl/writel funcs
-- by advice of Arnd Bergmann Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/unicore32/include/asm/gpio.h')
-rw-r--r--arch/unicore32/include/asm/gpio.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/unicore32/include/asm/gpio.h b/arch/unicore32/include/asm/gpio.h
index 3aaa41e..2716f14 100644
--- a/arch/unicore32/include/asm/gpio.h
+++ b/arch/unicore32/include/asm/gpio.h
@@ -13,6 +13,7 @@
#ifndef __UNICORE_GPIO_H__
#define __UNICORE_GPIO_H__
+#include <linux/io.h>
#include <asm/irq.h>
#include <mach/hardware.h>
#include <asm-generic/gpio.h>
@@ -66,7 +67,7 @@
static inline int gpio_get_value(unsigned gpio)
{
if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
- return GPIO_GPLR & GPIO_GPIO(gpio);
+ return readl(GPIO_GPLR) & GPIO_GPIO(gpio);
else
return __gpio_get_value(gpio);
}
@@ -75,9 +76,9 @@ static inline void gpio_set_value(unsigned gpio, int value)
{
if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
if (value)
- GPIO_GPSR = GPIO_GPIO(gpio);
+ writel(GPIO_GPIO(gpio), GPIO_GPSR);
else
- GPIO_GPCR = GPIO_GPIO(gpio);
+ writel(GPIO_GPIO(gpio), GPIO_GPCR);
else
__gpio_set_value(gpio, value);
}
@@ -86,7 +87,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
static inline unsigned gpio_to_irq(unsigned gpio)
{
- if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & GPIO_GPIR))
+ if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & readl(GPIO_GPIR)))
return IRQ_GPIOLOW0 + gpio;
else
return IRQ_GPIO0 + gpio;