]> git.ipfire.org Git - people/ms/u-boot.git/blob - arch/avr32/include/asm/arch-at32ap700x/gpio.h
stm32: Correct positioning of declaration
[people/ms/u-boot.git] / arch / avr32 / include / asm / arch-at32ap700x / gpio.h
1 /*
2 * Copyright (C) 2006, 2008 Atmel Corporation
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6 #ifndef __ASM_AVR32_ARCH_GPIO_H__
7 #define __ASM_AVR32_ARCH_GPIO_H__
8
9 #include <asm/arch/chip-features.h>
10 #include <asm/arch/hardware.h>
11
12 #define NR_GPIO_CONTROLLERS 5
13
14 /*
15 * Pin numbers identifying specific GPIO pins on the chip.
16 */
17 #define GPIO_PIOA_BASE (0)
18 #define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32)
19 #define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32)
20 #define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32)
21 #define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32)
22 #define GPIO_PIN_PA(x) (GPIO_PIOA_BASE + (x))
23 #define GPIO_PIN_PB(x) (GPIO_PIOB_BASE + (x))
24 #define GPIO_PIN_PC(x) (GPIO_PIOC_BASE + (x))
25 #define GPIO_PIN_PD(x) (GPIO_PIOD_BASE + (x))
26 #define GPIO_PIN_PE(x) (GPIO_PIOE_BASE + (x))
27
28 static inline void *pio_pin_to_port(unsigned int pin)
29 {
30 switch (pin >> 5) {
31 case 0:
32 return (void *)ATMEL_BASE_PIOA;
33 case 1:
34 return (void *)ATMEL_BASE_PIOB;
35 case 2:
36 return (void *)ATMEL_BASE_PIOC;
37 case 3:
38 return (void *)ATMEL_BASE_PIOD;
39 case 4:
40 return (void *)ATMEL_BASE_PIOE;
41 default:
42 return NULL;
43 }
44 }
45
46 #include <asm/arch-common/portmux-pio.h>
47
48 #endif /* __ASM_AVR32_ARCH_GPIO_H__ */