]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/asm-avr32/arch-at32ap700x/gpio.h
AVR32: Rename at32ap7000 -> at32ap700x
[people/ms/u-boot.git] / include / asm-avr32 / arch-at32ap700x / gpio.h
CommitLineData
df548d3c
HS
1/*
2 * Copyright (C) 2006 Atmel Corporation
3 *
4 * See file CREDITS for list of people who contributed to this
5 * project.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22#ifndef __ASM_AVR32_ARCH_GPIO_H__
23#define __ASM_AVR32_ARCH_GPIO_H__
24
25#include <asm/arch/memory-map.h>
26
27#define NR_GPIO_CONTROLLERS 5
28
29/*
30 * Pin numbers identifying specific GPIO pins on the chip.
31 */
32#define GPIO_PIOA_BASE (0)
33#define GPIO_PIN_PA0 (GPIO_PIOA_BASE + 0)
34#define GPIO_PIN_PA1 (GPIO_PIOA_BASE + 1)
35#define GPIO_PIN_PA2 (GPIO_PIOA_BASE + 2)
36#define GPIO_PIN_PA3 (GPIO_PIOA_BASE + 3)
37#define GPIO_PIN_PA4 (GPIO_PIOA_BASE + 4)
38#define GPIO_PIN_PA5 (GPIO_PIOA_BASE + 5)
39#define GPIO_PIN_PA6 (GPIO_PIOA_BASE + 6)
40#define GPIO_PIN_PA7 (GPIO_PIOA_BASE + 7)
41#define GPIO_PIN_PA8 (GPIO_PIOA_BASE + 8)
42#define GPIO_PIN_PA9 (GPIO_PIOA_BASE + 9)
43#define GPIO_PIN_PA10 (GPIO_PIOA_BASE + 10)
44#define GPIO_PIN_PA11 (GPIO_PIOA_BASE + 11)
45#define GPIO_PIN_PA12 (GPIO_PIOA_BASE + 12)
46#define GPIO_PIN_PA13 (GPIO_PIOA_BASE + 13)
47#define GPIO_PIN_PA14 (GPIO_PIOA_BASE + 14)
48#define GPIO_PIN_PA15 (GPIO_PIOA_BASE + 15)
49#define GPIO_PIN_PA16 (GPIO_PIOA_BASE + 16)
50#define GPIO_PIN_PA17 (GPIO_PIOA_BASE + 17)
51#define GPIO_PIN_PA18 (GPIO_PIOA_BASE + 18)
52#define GPIO_PIN_PA19 (GPIO_PIOA_BASE + 19)
53#define GPIO_PIN_PA20 (GPIO_PIOA_BASE + 20)
54#define GPIO_PIN_PA21 (GPIO_PIOA_BASE + 21)
55#define GPIO_PIN_PA22 (GPIO_PIOA_BASE + 22)
56#define GPIO_PIN_PA23 (GPIO_PIOA_BASE + 23)
57#define GPIO_PIN_PA24 (GPIO_PIOA_BASE + 24)
58#define GPIO_PIN_PA25 (GPIO_PIOA_BASE + 25)
59#define GPIO_PIN_PA26 (GPIO_PIOA_BASE + 26)
60#define GPIO_PIN_PA27 (GPIO_PIOA_BASE + 27)
61#define GPIO_PIN_PA28 (GPIO_PIOA_BASE + 28)
62#define GPIO_PIN_PA29 (GPIO_PIOA_BASE + 29)
63#define GPIO_PIN_PA30 (GPIO_PIOA_BASE + 30)
64#define GPIO_PIN_PA31 (GPIO_PIOA_BASE + 31)
65
66#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32)
67#define GPIO_PIN_PB0 (GPIO_PIOB_BASE + 0)
68#define GPIO_PIN_PB1 (GPIO_PIOB_BASE + 1)
69#define GPIO_PIN_PB2 (GPIO_PIOB_BASE + 2)
70#define GPIO_PIN_PB3 (GPIO_PIOB_BASE + 3)
71#define GPIO_PIN_PB4 (GPIO_PIOB_BASE + 4)
72#define GPIO_PIN_PB5 (GPIO_PIOB_BASE + 5)
73#define GPIO_PIN_PB6 (GPIO_PIOB_BASE + 6)
74#define GPIO_PIN_PB7 (GPIO_PIOB_BASE + 7)
75#define GPIO_PIN_PB8 (GPIO_PIOB_BASE + 8)
76#define GPIO_PIN_PB9 (GPIO_PIOB_BASE + 9)
77#define GPIO_PIN_PB10 (GPIO_PIOB_BASE + 10)
78#define GPIO_PIN_PB11 (GPIO_PIOB_BASE + 11)
79#define GPIO_PIN_PB12 (GPIO_PIOB_BASE + 12)
80#define GPIO_PIN_PB13 (GPIO_PIOB_BASE + 13)
81#define GPIO_PIN_PB14 (GPIO_PIOB_BASE + 14)
82#define GPIO_PIN_PB15 (GPIO_PIOB_BASE + 15)
83#define GPIO_PIN_PB16 (GPIO_PIOB_BASE + 16)
84#define GPIO_PIN_PB17 (GPIO_PIOB_BASE + 17)
85#define GPIO_PIN_PB18 (GPIO_PIOB_BASE + 18)
86#define GPIO_PIN_PB19 (GPIO_PIOB_BASE + 19)
87#define GPIO_PIN_PB20 (GPIO_PIOB_BASE + 20)
88#define GPIO_PIN_PB21 (GPIO_PIOB_BASE + 21)
89#define GPIO_PIN_PB22 (GPIO_PIOB_BASE + 22)
90#define GPIO_PIN_PB23 (GPIO_PIOB_BASE + 23)
91#define GPIO_PIN_PB24 (GPIO_PIOB_BASE + 24)
92#define GPIO_PIN_PB25 (GPIO_PIOB_BASE + 25)
93#define GPIO_PIN_PB26 (GPIO_PIOB_BASE + 26)
94#define GPIO_PIN_PB27 (GPIO_PIOB_BASE + 27)
95#define GPIO_PIN_PB28 (GPIO_PIOB_BASE + 28)
96#define GPIO_PIN_PB29 (GPIO_PIOB_BASE + 29)
97#define GPIO_PIN_PB30 (GPIO_PIOB_BASE + 30)
98
99#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32)
100#define GPIO_PIN_PC0 (GPIO_PIOC_BASE + 0)
101#define GPIO_PIN_PC1 (GPIO_PIOC_BASE + 1)
102#define GPIO_PIN_PC2 (GPIO_PIOC_BASE + 2)
103#define GPIO_PIN_PC3 (GPIO_PIOC_BASE + 3)
104#define GPIO_PIN_PC4 (GPIO_PIOC_BASE + 4)
105#define GPIO_PIN_PC5 (GPIO_PIOC_BASE + 5)
106#define GPIO_PIN_PC6 (GPIO_PIOC_BASE + 6)
107#define GPIO_PIN_PC7 (GPIO_PIOC_BASE + 7)
108#define GPIO_PIN_PC8 (GPIO_PIOC_BASE + 8)
109#define GPIO_PIN_PC9 (GPIO_PIOC_BASE + 9)
110#define GPIO_PIN_PC10 (GPIO_PIOC_BASE + 10)
111#define GPIO_PIN_PC11 (GPIO_PIOC_BASE + 11)
112#define GPIO_PIN_PC12 (GPIO_PIOC_BASE + 12)
113#define GPIO_PIN_PC13 (GPIO_PIOC_BASE + 13)
114#define GPIO_PIN_PC14 (GPIO_PIOC_BASE + 14)
115#define GPIO_PIN_PC15 (GPIO_PIOC_BASE + 15)
116#define GPIO_PIN_PC16 (GPIO_PIOC_BASE + 16)
117#define GPIO_PIN_PC17 (GPIO_PIOC_BASE + 17)
118#define GPIO_PIN_PC18 (GPIO_PIOC_BASE + 18)
119#define GPIO_PIN_PC19 (GPIO_PIOC_BASE + 19)
120#define GPIO_PIN_PC20 (GPIO_PIOC_BASE + 20)
121#define GPIO_PIN_PC21 (GPIO_PIOC_BASE + 21)
122#define GPIO_PIN_PC22 (GPIO_PIOC_BASE + 22)
123#define GPIO_PIN_PC23 (GPIO_PIOC_BASE + 23)
124#define GPIO_PIN_PC24 (GPIO_PIOC_BASE + 24)
125#define GPIO_PIN_PC25 (GPIO_PIOC_BASE + 25)
126#define GPIO_PIN_PC26 (GPIO_PIOC_BASE + 26)
127#define GPIO_PIN_PC27 (GPIO_PIOC_BASE + 27)
128#define GPIO_PIN_PC28 (GPIO_PIOC_BASE + 28)
129#define GPIO_PIN_PC29 (GPIO_PIOC_BASE + 29)
130#define GPIO_PIN_PC30 (GPIO_PIOC_BASE + 30)
131#define GPIO_PIN_PC31 (GPIO_PIOC_BASE + 31)
132
133#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32)
134#define GPIO_PIN_PD0 (GPIO_PIOD_BASE + 0)
135#define GPIO_PIN_PD1 (GPIO_PIOD_BASE + 1)
136#define GPIO_PIN_PD2 (GPIO_PIOD_BASE + 2)
137#define GPIO_PIN_PD3 (GPIO_PIOD_BASE + 3)
138#define GPIO_PIN_PD4 (GPIO_PIOD_BASE + 4)
139#define GPIO_PIN_PD5 (GPIO_PIOD_BASE + 5)
140#define GPIO_PIN_PD6 (GPIO_PIOD_BASE + 6)
141#define GPIO_PIN_PD7 (GPIO_PIOD_BASE + 7)
142#define GPIO_PIN_PD8 (GPIO_PIOD_BASE + 8)
143#define GPIO_PIN_PD9 (GPIO_PIOD_BASE + 9)
144#define GPIO_PIN_PD10 (GPIO_PIOD_BASE + 10)
145#define GPIO_PIN_PD11 (GPIO_PIOD_BASE + 11)
146#define GPIO_PIN_PD12 (GPIO_PIOD_BASE + 12)
147#define GPIO_PIN_PD13 (GPIO_PIOD_BASE + 13)
148#define GPIO_PIN_PD14 (GPIO_PIOD_BASE + 14)
149#define GPIO_PIN_PD15 (GPIO_PIOD_BASE + 15)
150#define GPIO_PIN_PD16 (GPIO_PIOD_BASE + 16)
151#define GPIO_PIN_PD17 (GPIO_PIOD_BASE + 17)
152
153#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32)
154#define GPIO_PIN_PE0 (GPIO_PIOE_BASE + 0)
155#define GPIO_PIN_PE1 (GPIO_PIOE_BASE + 1)
156#define GPIO_PIN_PE2 (GPIO_PIOE_BASE + 2)
157#define GPIO_PIN_PE3 (GPIO_PIOE_BASE + 3)
158#define GPIO_PIN_PE4 (GPIO_PIOE_BASE + 4)
159#define GPIO_PIN_PE5 (GPIO_PIOE_BASE + 5)
160#define GPIO_PIN_PE6 (GPIO_PIOE_BASE + 6)
161#define GPIO_PIN_PE7 (GPIO_PIOE_BASE + 7)
162#define GPIO_PIN_PE8 (GPIO_PIOE_BASE + 8)
163#define GPIO_PIN_PE9 (GPIO_PIOE_BASE + 9)
164#define GPIO_PIN_PE10 (GPIO_PIOE_BASE + 10)
165#define GPIO_PIN_PE11 (GPIO_PIOE_BASE + 11)
166#define GPIO_PIN_PE12 (GPIO_PIOE_BASE + 12)
167#define GPIO_PIN_PE13 (GPIO_PIOE_BASE + 13)
168#define GPIO_PIN_PE14 (GPIO_PIOE_BASE + 14)
169#define GPIO_PIN_PE15 (GPIO_PIOE_BASE + 15)
170#define GPIO_PIN_PE16 (GPIO_PIOE_BASE + 16)
171#define GPIO_PIN_PE17 (GPIO_PIOE_BASE + 17)
172#define GPIO_PIN_PE18 (GPIO_PIOE_BASE + 18)
173#define GPIO_PIN_PE19 (GPIO_PIOE_BASE + 19)
174#define GPIO_PIN_PE20 (GPIO_PIOE_BASE + 20)
175#define GPIO_PIN_PE21 (GPIO_PIOE_BASE + 21)
176#define GPIO_PIN_PE22 (GPIO_PIOE_BASE + 22)
177#define GPIO_PIN_PE23 (GPIO_PIOE_BASE + 23)
178#define GPIO_PIN_PE24 (GPIO_PIOE_BASE + 24)
179#define GPIO_PIN_PE25 (GPIO_PIOE_BASE + 25)
180#define GPIO_PIN_PE26 (GPIO_PIOE_BASE + 26)
181
182static inline void *gpio_pin_to_addr(unsigned int pin)
183{
184 switch (pin >> 5) {
185 case 0:
186 return (void *)PIOA_BASE;
187 case 1:
188 return (void *)PIOB_BASE;
189 case 2:
190 return (void *)PIOC_BASE;
191 case 3:
192 return (void *)PIOD_BASE;
193 case 4:
194 return (void *)PIOE_BASE;
195 default:
196 return NULL;
197 }
198}
199
200void gpio_select_periph_A(unsigned int pin, int use_pullup);
201void gpio_select_periph_B(unsigned int pin, int use_pullup);
202
203void gpio_enable_ebi(void);
204void gpio_enable_usart0(void);
205void gpio_enable_usart1(void);
206void gpio_enable_usart2(void);
207void gpio_enable_usart3(void);
b4ec9c2d
HS
208void gpio_enable_macb0(void);
209void gpio_enable_macb1(void);
05fdab1e 210void gpio_enable_mmci(void);
df548d3c
HS
211
212#endif /* __ASM_AVR32_ARCH_GPIO_H__ */