]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/mach-kirkwood/include/mach/gpio.h
bitops: collect BIT macros to include/linux/bitops.h
[people/ms/u-boot.git] / arch / arm / mach-kirkwood / include / mach / gpio.h
CommitLineData
ec164410
DK
1/*
2 * arch/asm-arm/mach-kirkwood/include/mach/gpio.h
3 *
1a459660 4 * SPDX-License-Identifier: GPL-2.0+
ec164410
DK
5 */
6
7/*
8 * Based on (mostly copied from) plat-orion based Linux 2.6 kernel driver.
9 * Removed kernel level irq handling. Took some macros from kernel to
10 * allow build.
11 *
12 * Dieter Kiermaier dk-arm-linux@gmx.de
13 */
14
15#ifndef __KIRKWOOD_GPIO_H
16#define __KIRKWOOD_GPIO_H
17
ec164410
DK
18#define GPIO_MAX 50
19#define GPIO_OFF(pin) (((pin) >> 5) ? 0x0040 : 0x0000)
d5c5132f
SR
20#define GPIO_OUT(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x00)
21#define GPIO_IO_CONF(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x04)
22#define GPIO_BLINK_EN(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x08)
23#define GPIO_IN_POL(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x0c)
24#define GPIO_DATA_IN(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x10)
25#define GPIO_EDGE_CAUSE(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x14)
26#define GPIO_EDGE_MASK(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x18)
27#define GPIO_LEVEL_MASK(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x1c)
ec164410
DK
28
29/*
30 * Kirkwood-specific GPIO API
31 */
57215cd2
HS
32
33void kw_gpio_set_valid(unsigned pin, int mode);
ec164410
DK
34int kw_gpio_is_valid(unsigned pin, int mode);
35int kw_gpio_direction_input(unsigned pin);
36int kw_gpio_direction_output(unsigned pin, int value);
37int kw_gpio_get_value(unsigned pin);
38void kw_gpio_set_value(unsigned pin, int value);
39void kw_gpio_set_blink(unsigned pin, int blink);
40void kw_gpio_set_unused(unsigned pin);
41
42#define GPIO_INPUT_OK (1 << 0)
43#define GPIO_OUTPUT_OK (1 << 1)
44
45#endif