[ramips] move files to files-3.7
[15.05/openwrt.git] / target / linux / ramips / files-3.7 / arch / mips / include / asm / mach-ralink / ramips_gpio.h
1 /*
2  * Ralink SoC specific GPIO support
3  *
4  * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published
8  * by the Free Software Foundation.
9  */
10
11 #ifndef _RAMIPS_GPIO_H
12 #define _RAMIPS_GPIO_H
13
14 #include <linux/gpio.h>
15 #include <linux/spinlock.h>
16
17 enum ramips_gpio_reg {
18         RAMIPS_GPIO_REG_INT = 0,        /* Interrupt status */
19         RAMIPS_GPIO_REG_EDGE,
20         RAMIPS_GPIO_REG_RENA,
21         RAMIPS_GPIO_REG_FENA,
22         RAMIPS_GPIO_REG_DATA,
23         RAMIPS_GPIO_REG_DIR,            /* Direction, 0:in, 1: out */
24         RAMIPS_GPIO_REG_POL,            /* Polarity, 0: normal, 1: invert */
25         RAMIPS_GPIO_REG_SET,
26         RAMIPS_GPIO_REG_RESET,
27         RAMIPS_GPIO_REG_TOGGLE,
28         RAMIPS_GPIO_REG_MAX
29 };
30
31 struct ramips_gpio_chip {
32         struct gpio_chip chip;
33         unsigned long map_base;
34         unsigned long map_size;
35         u8 regs[RAMIPS_GPIO_REG_MAX];
36
37         spinlock_t lock;
38         void __iomem *regs_base;
39 };
40
41 struct ramips_gpio_data {
42         unsigned int num_chips;
43         struct ramips_gpio_chip *chips;
44 };
45
46 int ramips_gpio_init(struct ramips_gpio_data *data);
47
48 #endif /* _RAMIPS_GPIO_H */