]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/avr32/include/asm/arch-at32ap700x/gpio.h
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / arch / avr32 / include / asm / arch-at32ap700x / gpio.h
CommitLineData
df548d3c 1/*
ab0df36f 2 * Copyright (C) 2006, 2008 Atmel Corporation
df548d3c 3 *
1a459660 4 * SPDX-License-Identifier: GPL-2.0+
df548d3c
HS
5 */
6#ifndef __ASM_AVR32_ARCH_GPIO_H__
7#define __ASM_AVR32_ARCH_GPIO_H__
8
5fee84a7 9#include <asm/arch/chip-features.h>
5d73bc7a 10#include <asm/arch/hardware.h>
df548d3c
HS
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)
df548d3c 18#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32)
df548d3c 19#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32)
df548d3c 20#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32)
df548d3c 21#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32)
ab0df36f
HS
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))
df548d3c 27
ab0df36f 28static inline void *pio_pin_to_port(unsigned int pin)
df548d3c
HS
29{
30 switch (pin >> 5) {
31 case 0:
f4278b71 32 return (void *)ATMEL_BASE_PIOA;
df548d3c 33 case 1:
f4278b71 34 return (void *)ATMEL_BASE_PIOB;
df548d3c 35 case 2:
f4278b71 36 return (void *)ATMEL_BASE_PIOC;
df548d3c 37 case 3:
f4278b71 38 return (void *)ATMEL_BASE_PIOD;
df548d3c 39 case 4:
f4278b71 40 return (void *)ATMEL_BASE_PIOE;
df548d3c
HS
41 default:
42 return NULL;
43 }
44}
45
ab0df36f 46#include <asm/arch-common/portmux-pio.h>
df548d3c
HS
47
48#endif /* __ASM_AVR32_ARCH_GPIO_H__ */