diff options
author | GuanXuetao <gxt@mprc.pku.edu.cn> | 2011-02-26 21:21:18 +0800 |
---|---|---|
committer | GuanXuetao <gxt@mprc.pku.edu.cn> | 2011-03-17 09:19:19 +0800 |
commit | e5abf78b57199a417eb01ff922a5ea6ff9e10b61 (patch) | |
tree | 6f72a13d44c0dc8c4d575d84885f5694c16ed1da /arch/unicore32/kernel/gpio.c | |
parent | 4517366d870b89d6fb8c0c90deb6c73d975908af (diff) | |
download | op-kernel-dev-e5abf78b57199a417eb01ff922a5ea6ff9e10b61.zip op-kernel-dev-e5abf78b57199a417eb01ff922a5ea6ff9e10b61.tar.gz |
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.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/unicore32/kernel/gpio.c b/arch/unicore32/kernel/gpio.c index 4cb2830..cb12ec3 100644 --- a/arch/unicore32/kernel/gpio.c +++ b/arch/unicore32/kernel/gpio.c @@ -52,15 +52,15 @@ device_initcall(puv3_gpio_leds_init); static int puv3_gpio_get(struct gpio_chip *chip, unsigned offset) { - return GPIO_GPLR & GPIO_GPIO(offset); + return readl(GPIO_GPLR) & GPIO_GPIO(offset); } static void puv3_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { if (value) - GPIO_GPSR = GPIO_GPIO(offset); + writel(GPIO_GPIO(offset), GPIO_GPSR); else - GPIO_GPCR = GPIO_GPIO(offset); + writel(GPIO_GPIO(offset), GPIO_GPCR); } static 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) unsigned long flags; local_irq_save(flags); - GPIO_GPDR &= ~GPIO_GPIO(offset); + writel(readl(GPIO_GPDR) & ~GPIO_GPIO(offset), GPIO_GPDR); local_irq_restore(flags); return 0; } @@ -80,7 +80,7 @@ static int puv3_direction_output(struct gpio_chip *chip, unsigned offset, local_irq_save(flags); puv3_gpio_set(chip, offset, value); - GPIO_GPDR |= GPIO_GPIO(offset); + writel(readl(GPIO_GPDR) | GPIO_GPIO(offset), GPIO_GPDR); local_irq_restore(flags); return 0; } @@ -97,7 +97,7 @@ static struct gpio_chip puv3_gpio_chip = { void __init puv3_init_gpio(void) { - GPIO_GPDR = GPIO_DIR; + writel(GPIO_DIR, GPIO_GPDR); #if defined(CONFIG_PUV3_NB0916) || defined(CONFIG_PUV3_SMW0919) \ || defined(CONFIG_PUV3_DB0913) gpio_set_value(GPO_WIFI_EN, 1); |