2 * Copyright (C) 2006, 2008 Atmel Corporation
4 * See file CREDITS for list of people who contributed to this
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.
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.
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,
22 #ifndef __ASM_AVR32_ARCH_GPIO_H__
23 #define __ASM_AVR32_ARCH_GPIO_H__
25 #include <asm/arch/chip-features.h>
26 #include <asm/arch/memory-map.h>
28 #define NR_GPIO_CONTROLLERS 5
31 * Pin numbers identifying specific GPIO pins on the chip.
33 #define GPIO_PIOA_BASE (0)
34 #define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32)
35 #define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32)
36 #define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32)
37 #define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32)
38 #define GPIO_PIN_PA(x) (GPIO_PIOA_BASE + (x))
39 #define GPIO_PIN_PB(x) (GPIO_PIOB_BASE + (x))
40 #define GPIO_PIN_PC(x) (GPIO_PIOC_BASE + (x))
41 #define GPIO_PIN_PD(x) (GPIO_PIOD_BASE + (x))
42 #define GPIO_PIN_PE(x) (GPIO_PIOE_BASE + (x))
44 static inline void *pio_pin_to_port(unsigned int pin)
48 return (void *)PIOA_BASE;
50 return (void *)PIOB_BASE;
52 return (void *)PIOC_BASE;
54 return (void *)PIOD_BASE;
56 return (void *)PIOE_BASE;
62 #include <asm/arch-common/portmux-pio.h>
64 #endif /* __ASM_AVR32_ARCH_GPIO_H__ */