diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2011-01-04 15:28:15 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-01-18 13:30:25 -0500 |
commit | 6eae43c57ee92de91f6cc7c391cea97c43295da0 (patch) | |
tree | 5ac5521d28527e6218faea0f31cc888df65dbc9f /arch/mips/include/asm/mach-ath79 | |
parent | d4a67d9dc8a5a80c4ec1814791af8c0252c158b8 (diff) |
MIPS: ath79: add GPIOLIB support
This patch implements generic GPIO routines for the built-in
GPIO controllers of the Atheros AR71XX/AR724X/AR913X SoCs.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: linux-mips@linux-mips.org
Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Cc: Cliff Holden <Cliff.Holden@Atheros.com>
Cc: Kathy Giori <Kathy.Giori@Atheros.com>
Patchwork: https://patchwork.linux-mips.org/patch/1948/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/mach-ath79')
-rw-r--r-- | arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 21 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-ath79/gpio.h | 26 |
2 files changed, 47 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h index 5a9e5e179463..7f2933d8b935 100644 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h | |||
@@ -25,6 +25,8 @@ | |||
25 | #define AR71XX_DDR_CTRL_SIZE 0x100 | 25 | #define AR71XX_DDR_CTRL_SIZE 0x100 |
26 | #define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000) | 26 | #define AR71XX_UART_BASE (AR71XX_APB_BASE + 0x00020000) |
27 | #define AR71XX_UART_SIZE 0x100 | 27 | #define AR71XX_UART_SIZE 0x100 |
28 | #define AR71XX_GPIO_BASE (AR71XX_APB_BASE + 0x00040000) | ||
29 | #define AR71XX_GPIO_SIZE 0x100 | ||
28 | #define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000) | 30 | #define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000) |
29 | #define AR71XX_PLL_SIZE 0x100 | 31 | #define AR71XX_PLL_SIZE 0x100 |
30 | #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000) | 32 | #define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000) |
@@ -204,4 +206,23 @@ | |||
204 | #define AR71XX_SPI_IOC_CS_ALL (AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \ | 206 | #define AR71XX_SPI_IOC_CS_ALL (AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1 | \ |
205 | AR71XX_SPI_IOC_CS2) | 207 | AR71XX_SPI_IOC_CS2) |
206 | 208 | ||
209 | /* | ||
210 | * GPIO block | ||
211 | */ | ||
212 | #define AR71XX_GPIO_REG_OE 0x00 | ||
213 | #define AR71XX_GPIO_REG_IN 0x04 | ||
214 | #define AR71XX_GPIO_REG_OUT 0x08 | ||
215 | #define AR71XX_GPIO_REG_SET 0x0c | ||
216 | #define AR71XX_GPIO_REG_CLEAR 0x10 | ||
217 | #define AR71XX_GPIO_REG_INT_MODE 0x14 | ||
218 | #define AR71XX_GPIO_REG_INT_TYPE 0x18 | ||
219 | #define AR71XX_GPIO_REG_INT_POLARITY 0x1c | ||
220 | #define AR71XX_GPIO_REG_INT_PENDING 0x20 | ||
221 | #define AR71XX_GPIO_REG_INT_ENABLE 0x24 | ||
222 | #define AR71XX_GPIO_REG_FUNC 0x28 | ||
223 | |||
224 | #define AR71XX_GPIO_COUNT 16 | ||
225 | #define AR724X_GPIO_COUNT 18 | ||
226 | #define AR913X_GPIO_COUNT 22 | ||
227 | |||
207 | #endif /* __ASM_MACH_AR71XX_REGS_H */ | 228 | #endif /* __ASM_MACH_AR71XX_REGS_H */ |
diff --git a/arch/mips/include/asm/mach-ath79/gpio.h b/arch/mips/include/asm/mach-ath79/gpio.h new file mode 100644 index 000000000000..60dcb62785b4 --- /dev/null +++ b/arch/mips/include/asm/mach-ath79/gpio.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Atheros AR71XX/AR724X/AR913X GPIO API definitions | ||
3 | * | ||
4 | * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> | ||
5 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published | ||
9 | * by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_MACH_ATH79_GPIO_H | ||
14 | #define __ASM_MACH_ATH79_GPIO_H | ||
15 | |||
16 | #define ARCH_NR_GPIOS 64 | ||
17 | #include <asm-generic/gpio.h> | ||
18 | |||
19 | int gpio_to_irq(unsigned gpio); | ||
20 | int irq_to_gpio(unsigned irq); | ||
21 | int gpio_get_value(unsigned gpio); | ||
22 | void gpio_set_value(unsigned gpio, int value); | ||
23 | |||
24 | #define gpio_cansleep __gpio_cansleep | ||
25 | |||
26 | #endif /* __ASM_MACH_ATH79_GPIO_H */ | ||