aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/include/mach
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-davinci/include/mach')
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
index 5e7c36b202f1..efe3281364e6 100644
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -28,23 +28,18 @@
28 * go through boot loaders. 28 * go through boot loaders.
29 * 29 *
30 * the gpio clock will be turned on when gpios are used, and you may also 30 * the gpio clock will be turned on when gpios are used, and you may also
31 * need to pay attention to PINMUX0 and PINMUX1 to be sure those pins are 31 * need to pay attention to PINMUX registers to be sure those pins are
32 * used as gpios, not with other peripherals. 32 * used as gpios, not with other peripherals.
33 * 33 *
34 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation, 34 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation,
35 * and maybe for later updates, code should write GPIO(N) or: 35 * and maybe for later updates, code may write GPIO(N). These may be
36 * - GPIOV18(N) for 1.8V pins, N in 0..53; same as GPIO(0)..GPIO(53) 36 * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip
37 * - GPIOV33(N) for 3.3V pins, N in 0..17; same as GPIO(54)..GPIO(70) 37 * may not support all the GPIOs in that range.
38 *
39 * For GPIO IRQs use gpio_to_irq(GPIO(N)) or gpio_to_irq(GPIOV33(N)) etc
40 * for now, that's != GPIO(N)
41 * 38 *
42 * GPIOs can also be on external chips, numbered after the ones built-in 39 * GPIOs can also be on external chips, numbered after the ones built-in
43 * to the DaVinci chip. For now, they won't be usable as IRQ sources. 40 * to the DaVinci chip. For now, they won't be usable as IRQ sources.
44 */ 41 */
45#define GPIO(X) (X) /* 0 <= X <= 70 */ 42#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
46#define GPIOV18(X) (X) /* 1.8V i/o; 0 <= X <= 53 */
47#define GPIOV33(X) ((X)+54) /* 3.3V i/o; 0 <= X <= 17 */
48 43
49struct gpio_controller { 44struct gpio_controller {
50 u32 dir; 45 u32 dir;
@@ -73,12 +68,14 @@ __gpio_to_controller(unsigned gpio)
73{ 68{
74 void *__iomem ptr; 69 void *__iomem ptr;
75 70
76 if (gpio < 32) 71 if (gpio < 32 * 1)
77 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x10); 72 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x10);
78 else if (gpio < 64) 73 else if (gpio < 32 * 2)
79 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x38); 74 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x38);
80 else if (gpio < DAVINCI_N_GPIO) 75 else if (gpio < 32 * 3)
81 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x60); 76 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x60);
77 else if (gpio < 32 * 4)
78 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x88);
82 else 79 else
83 ptr = NULL; 80 ptr = NULL;
84 return ptr; 81 return ptr;