blob: 83d6b4ed60bbd42f3e912d68611205d720ad98a1 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
2 * arch/arm/mach-ixp4xx/include/mach/gpio.h
3 *
4 * IXP4XX GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Milan Svoboda <msvoboda@ra.rockwell.com>
7 * Based on PXA implementation by Philipp Zabel <philipp.zabel@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef __ASM_ARCH_IXP4XX_GPIO_H
26#define __ASM_ARCH_IXP4XX_GPIO_H
27
Uwe Kleine-König9c656852008-10-29 14:14:54 -070028#include <linux/kernel.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010029#include <mach/hardware.h>
30
Russell King8f3c4532011-08-08 13:58:28 +010031#define __ARM_GPIOLIB_COMPLEX
32
Russell Kinga09e64f2008-08-05 16:14:15 +010033static inline int gpio_request(unsigned gpio, const char *label)
34{
35 return 0;
36}
37
38static inline void gpio_free(unsigned gpio)
39{
Uwe Kleine-König9c656852008-10-29 14:14:54 -070040 might_sleep();
41
Russell Kinga09e64f2008-08-05 16:14:15 +010042 return;
43}
44
45static inline int gpio_direction_input(unsigned gpio)
46{
47 gpio_line_config(gpio, IXP4XX_GPIO_IN);
48 return 0;
49}
50
51static inline int gpio_direction_output(unsigned gpio, int level)
52{
53 gpio_line_set(gpio, level);
54 gpio_line_config(gpio, IXP4XX_GPIO_OUT);
55 return 0;
56}
57
58static inline int gpio_get_value(unsigned gpio)
59{
60 int value;
61
62 gpio_line_get(gpio, &value);
63
64 return value;
65}
66
67static inline void gpio_set_value(unsigned gpio, int value)
68{
69 gpio_line_set(gpio, value);
70}
71
72#include <asm-generic/gpio.h> /* cansleep wrappers */
73
74extern int gpio_to_irq(int gpio);
Russell King01e7dc82011-07-26 11:29:42 +010075#define gpio_to_irq gpio_to_irq
Roel Kluinefec1942009-11-03 23:05:32 +010076extern int irq_to_gpio(unsigned int irq);
Russell Kinga09e64f2008-08-05 16:14:15 +010077
78#endif
79