aboutsummaryrefslogtreecommitdiffstats
path: root/arch/unicore32/kernel/gpio.c
diff options
context:
space:
mode:
authorGuanXuetao <gxt@mprc.pku.edu.cn>2011-02-26 08:21:18 -0500
committerGuanXuetao <gxt@mprc.pku.edu.cn>2011-03-16 21:19:19 -0400
commite5abf78b57199a417eb01ff922a5ea6ff9e10b61 (patch)
tree6f72a13d44c0dc8c4d575d84885f5694c16ed1da /arch/unicore32/kernel/gpio.c
parent4517366d870b89d6fb8c0c90deb6c73d975908af (diff)
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/kernel/gpio.c')
-rw-r--r--arch/unicore32/kernel/gpio.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/unicore32/kernel/gpio.c b/arch/unicore32/kernel/gpio.c
index 4cb28308bb5f..cb12ec39552c 100644
--- a/arch/unicore32/kernel/gpio.c
+++ b/arch/unicore32/kernel/gpio.c
@@ -52,15 +52,15 @@ device_initcall(puv3_gpio_leds_init);
52 52
53static int puv3_gpio_get(struct gpio_chip *chip, unsigned offset) 53static int puv3_gpio_get(struct gpio_chip *chip, unsigned offset)
54{ 54{
55 return GPIO_GPLR & GPIO_GPIO(offset); 55 return readl(GPIO_GPLR) & GPIO_GPIO(offset);
56} 56}
57 57
58static void puv3_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 58static void puv3_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
59{ 59{
60 if (value) 60 if (value)
61 GPIO_GPSR = GPIO_GPIO(offset); 61 writel(GPIO_GPIO(offset), GPIO_GPSR);
62 else 62 else
63 GPIO_GPCR = GPIO_GPIO(offset); 63 writel(GPIO_GPIO(offset), GPIO_GPCR);
64} 64}
65 65
66static int puv3_direction_input(struct gpio_chip *chip, unsigned offset) 66static int puv3_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -68,7 +68,7 @@ static int puv3_direction_input(struct gpio_chip *chip, unsigned offset)
68 unsigned long flags; 68 unsigned long flags;
69 69
70 local_irq_save(flags); 70 local_irq_save(flags);
71 GPIO_GPDR &= ~GPIO_GPIO(offset); 71 writel(readl(GPIO_GPDR) & ~GPIO_GPIO(offset), GPIO_GPDR);
72 local_irq_restore(flags); 72 local_irq_restore(flags);
73 return 0; 73 return 0;
74} 74}
@@ -80,7 +80,7 @@ static int puv3_direction_output(struct gpio_chip *chip, unsigned offset,
80 80
81 local_irq_save(flags); 81 local_irq_save(flags);
82 puv3_gpio_set(chip, offset, value); 82 puv3_gpio_set(chip, offset, value);
83 GPIO_GPDR |= GPIO_GPIO(offset); 83 writel(readl(GPIO_GPDR) | GPIO_GPIO(offset), GPIO_GPDR);
84 local_irq_restore(flags); 84 local_irq_restore(flags);
85 return 0; 85 return 0;
86} 86}
@@ -97,7 +97,7 @@ static struct gpio_chip puv3_gpio_chip = {
97 97
98void __init puv3_init_gpio(void) 98void __init puv3_init_gpio(void)
99{ 99{
100 GPIO_GPDR = GPIO_DIR; 100 writel(GPIO_DIR, GPIO_GPDR);
101#if defined(CONFIG_PUV3_NB0916) || defined(CONFIG_PUV3_SMW0919) \ 101#if defined(CONFIG_PUV3_NB0916) || defined(CONFIG_PUV3_SMW0919) \
102 || defined(CONFIG_PUV3_DB0913) 102 || defined(CONFIG_PUV3_DB0913)
103 gpio_set_value(GPO_WIFI_EN, 1); 103 gpio_set_value(GPO_WIFI_EN, 1);