2 * Copyright (C) 2012 Vikram Narayananan
3 * <vikram186@gmail.com>
4 * (C) Copyright 2012,2015 Stephen Warren
6 * SPDX-License-Identifier: GPL-2.0+
9 #ifndef _BCM2835_GPIO_H_
10 #define _BCM2835_GPIO_H_
13 #define BCM2835_GPIO_BASE 0x3f200000
15 #define BCM2835_GPIO_BASE 0x20200000
17 #define BCM2835_GPIO_COUNT 54
19 #define BCM2835_GPIO_FSEL_MASK 0x7
20 #define BCM2835_GPIO_INPUT 0x0
21 #define BCM2835_GPIO_OUTPUT 0x1
22 #define BCM2835_GPIO_ALT0 0x4
23 #define BCM2835_GPIO_ALT1 0x5
24 #define BCM2835_GPIO_ALT2 0x6
25 #define BCM2835_GPIO_ALT3 0x7
26 #define BCM2835_GPIO_ALT4 0x3
27 #define BCM2835_GPIO_ALT5 0x2
29 #define BCM2835_GPIO_COMMON_BANK(gpio) ((gpio < 32) ? 0 : 1)
30 #define BCM2835_GPIO_COMMON_SHIFT(gpio) (gpio & 0x1f)
32 #define BCM2835_GPIO_FSEL_BANK(gpio) (gpio / 10)
33 #define BCM2835_GPIO_FSEL_SHIFT(gpio) ((gpio % 10) * 3)
35 struct bcm2835_gpio_regs {
61 * struct bcm2835_gpio_platdata - GPIO platform description
63 * @base: Base address of GPIO controller
65 struct bcm2835_gpio_platdata {
69 #endif /* _BCM2835_GPIO_H_ */