lua: Fixed some cross-platform issues for PPC (and probably other architectures)
[openwrt.git] / target / linux / adm5120 / files / include / asm-mips / mach-adm5120 / gpio.h
1 /*
2 * $Id$
3 *
4 * ADM5120 GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 *
13 */
14
15 #ifndef _ADM5120_GPIO_H_
16 #define _ADM5120_GPIO_H_
17
18 #include <asm/mach-adm5120/adm5120_switch.h>
19
20 #define ADM5120_GPIO_PIN0 0
21 #define ADM5120_GPIO_PIN1 1
22 #define ADM5120_GPIO_PIN2 2
23 #define ADM5120_GPIO_PIN3 3
24 #define ADM5120_GPIO_PIN4 4
25 #define ADM5120_GPIO_PIN5 5
26 #define ADM5120_GPIO_PIN6 6
27 #define ADM5120_GPIO_PIN7 7
28 #define ADM5120_GPIO_P0L0 8
29 #define ADM5120_GPIO_P0L1 9
30 #define ADM5120_GPIO_P0L2 10
31 #define ADM5120_GPIO_P1L0 11
32 #define ADM5120_GPIO_P1L1 12
33 #define ADM5120_GPIO_P1L2 13
34 #define ADM5120_GPIO_P2L0 14
35 #define ADM5120_GPIO_P2L1 15
36 #define ADM5120_GPIO_P2L2 16
37 #define ADM5120_GPIO_P3L0 17
38 #define ADM5120_GPIO_P3L1 18
39 #define ADM5120_GPIO_P3L2 19
40 #define ADM5120_GPIO_P4L0 20
41 #define ADM5120_GPIO_P4L1 21
42 #define ADM5120_GPIO_P4L2 22
43 #define ADM5120_GPIO_MAX 22
44 #define ADM5120_GPIO_COUNT ADM5120_GPIO_MAX+1
45
46 #define ADM5120_GPIO_LOW 0
47 #define ADM5120_GPIO_HIGH 1
48
49 #define ADM5120_GPIO_SWITCH 0x10
50 #define ADM5120_GPIO_FLASH (ADM5120_GPIO_SWITCH | LED_MODE_FLASH)
51 #define ADM5120_GPIO_LINK (ADM5120_GPIO_SWITCH | LED_MODE_LINK)
52 #define ADM5120_GPIO_SPEED (ADM5120_GPIO_SWITCH | LED_MODE_SPEED)
53 #define ADM5120_GPIO_DUPLEX (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX)
54 #define ADM5120_GPIO_ACT (ADM5120_GPIO_SWITCH | LED_MODE_ACT)
55 #define ADM5120_GPIO_COLL (ADM5120_GPIO_SWITCH | LED_MODE_COLL)
56 #define ADM5120_GPIO_LINK_ACT (ADM5120_GPIO_SWITCH | LED_MODE_LINK_ACT)
57 #define ADM5120_GPIO_DUPLEX_COLL (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX_COLL)
58 #define ADM5120_GPIO_10M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_10M_ACT)
59 #define ADM5120_GPIO_100M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_100M_ACT)
60
61 extern int adm5120_gpio_direction_input(unsigned gpio);
62 extern int adm5120_gpio_direction_output(unsigned gpio, int value);
63 extern int adm5120_gpio_get_value(unsigned gpio);
64 extern void adm5120_gpio_set_value(unsigned gpio, int value);
65 extern int adm5120_gpio_request(unsigned gpio, const char *label);
66 extern void adm5120_gpio_free(unsigned gpio);
67 extern int adm5120_gpio_to_irq(unsigned gpio);
68 extern int adm5120_irq_to_gpio(unsigned irq);
69
70 /*
71 * Wrappers for the generic GPIO layer
72 */
73 static inline int gpio_direction_input(unsigned gpio)
74 {
75 return adm5120_gpio_direction_input(gpio);
76 }
77
78 static inline int gpio_direction_output(unsigned gpio, int value)
79 {
80 return adm5120_gpio_direction_output(gpio,value);
81 }
82
83 static inline int gpio_get_value(unsigned gpio)
84 {
85 return adm5120_gpio_get_value(gpio);
86 }
87
88 static inline void gpio_set_value(unsigned gpio, int value)
89 {
90 adm5120_gpio_set_value(gpio, value);
91 }
92
93 static inline int gpio_request(unsigned gpio, const char *label)
94 {
95 return adm5120_gpio_request(gpio, label);
96 }
97
98 static inline void gpio_free(unsigned gpio)
99 {
100 adm5120_gpio_free(gpio);
101 }
102
103 static inline int gpio_to_irq(unsigned gpio)
104 {
105 return adm5120_gpio_to_irq(gpio);
106 }
107
108 static inline int irq_to_gpio(unsigned irq)
109 {
110 return adm5120_irq_to_gpio(irq);
111 }
112
113 #include <asm-generic/gpio.h> /* cansleep wrappers */
114
115 #endif
This page took 0.055082 seconds and 5 git commands to generate.