Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 1 | /* |
Haavard Skinnemoen | ab0df36 | 2008-08-29 21:09:49 +0200 | [diff] [blame] | 2 | * Copyright (C) 2006, 2008 Atmel Corporation |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 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 | |
Haavard Skinnemoen | 5fee84a | 2007-10-29 13:23:33 +0100 | [diff] [blame] | 25 | #include <asm/arch/chip-features.h> |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 26 | #include <asm/arch/memory-map.h> |
| 27 | |
| 28 | #define NR_GPIO_CONTROLLERS 5 |
| 29 | |
| 30 | /* |
| 31 | * Pin numbers identifying specific GPIO pins on the chip. |
| 32 | */ |
| 33 | #define GPIO_PIOA_BASE (0) |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 34 | #define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 35 | #define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 36 | #define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 37 | #define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32) |
Haavard Skinnemoen | ab0df36 | 2008-08-29 21:09:49 +0200 | [diff] [blame] | 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)) |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 43 | |
Haavard Skinnemoen | ab0df36 | 2008-08-29 21:09:49 +0200 | [diff] [blame] | 44 | static inline void *pio_pin_to_port(unsigned int pin) |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 45 | { |
| 46 | switch (pin >> 5) { |
| 47 | case 0: |
| 48 | return (void *)PIOA_BASE; |
| 49 | case 1: |
| 50 | return (void *)PIOB_BASE; |
| 51 | case 2: |
| 52 | return (void *)PIOC_BASE; |
| 53 | case 3: |
| 54 | return (void *)PIOD_BASE; |
| 55 | case 4: |
| 56 | return (void *)PIOE_BASE; |
| 57 | default: |
| 58 | return NULL; |
| 59 | } |
| 60 | } |
| 61 | |
Haavard Skinnemoen | ab0df36 | 2008-08-29 21:09:49 +0200 | [diff] [blame] | 62 | #include <asm/arch-common/portmux-pio.h> |
Haavard Skinnemoen | df548d3 | 2006-11-19 18:06:53 +0100 | [diff] [blame] | 63 | |
| 64 | #endif /* __ASM_AVR32_ARCH_GPIO_H__ */ |