2 * Copyright (C) 2012 Vikram Narayananan
3 * <vikram186@gmail.com>
5 * SPDX-License-Identifier: GPL-2.0+
8 #ifndef _BCM2835_GPIO_H_
9 #define _BCM2835_GPIO_H_
11 #define BCM2835_GPIO_BASE 0x20200000
12 #define BCM2835_GPIO_COUNT 54
14 #define BCM2835_GPIO_FSEL_MASK 0x7
15 #define BCM2835_GPIO_INPUT 0x0
16 #define BCM2835_GPIO_OUTPUT 0x1
17 #define BCM2835_GPIO_ALT0 0x4
18 #define BCM2835_GPIO_ALT1 0x5
19 #define BCM2835_GPIO_ALT2 0x6
20 #define BCM2835_GPIO_ALT3 0x7
21 #define BCM2835_GPIO_ALT4 0x3
22 #define BCM2835_GPIO_ALT5 0x2
24 #define BCM2835_GPIO_COMMON_BANK(gpio) ((gpio < 32) ? 0 : 1)
25 #define BCM2835_GPIO_COMMON_SHIFT(gpio) (gpio & 0x1f)
27 #define BCM2835_GPIO_FSEL_BANK(gpio) (gpio / 10)
28 #define BCM2835_GPIO_FSEL_SHIFT(gpio) ((gpio % 10) * 3)
30 struct bcm2835_gpio_regs {
55 #endif /* _BCM2835_GPIO_H_ */