2 * ADM5120 GPIO wrappers for arch-neutral GPIO calls
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
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.
12 #ifndef _ASM_MACH_ADM5120_GPIO_H
13 #define _ASM_MACH_ADM5120_GPIO_H
15 #include <asm/mach-adm5120/adm5120_switch.h>
17 #define ADM5120_GPIO_PIN0 0
18 #define ADM5120_GPIO_PIN1 1
19 #define ADM5120_GPIO_PIN2 2
20 #define ADM5120_GPIO_PIN3 3
21 #define ADM5120_GPIO_PIN4 4
22 #define ADM5120_GPIO_PIN5 5
23 #define ADM5120_GPIO_PIN6 6
24 #define ADM5120_GPIO_PIN7 7
25 #define ADM5120_GPIO_P0L0 8
26 #define ADM5120_GPIO_P0L1 9
27 #define ADM5120_GPIO_P0L2 10
28 #define ADM5120_GPIO_P1L0 11
29 #define ADM5120_GPIO_P1L1 12
30 #define ADM5120_GPIO_P1L2 13
31 #define ADM5120_GPIO_P2L0 14
32 #define ADM5120_GPIO_P2L1 15
33 #define ADM5120_GPIO_P2L2 16
34 #define ADM5120_GPIO_P3L0 17
35 #define ADM5120_GPIO_P3L1 18
36 #define ADM5120_GPIO_P3L2 19
37 #define ADM5120_GPIO_P4L0 20
38 #define ADM5120_GPIO_P4L1 21
39 #define ADM5120_GPIO_P4L2 22
40 #define ADM5120_GPIO_MAX 22
41 #define ADM5120_GPIO_COUNT ADM5120_GPIO_MAX+1
43 #define ADM5120_GPIO_LOW 0
44 #define ADM5120_GPIO_HIGH 1
46 #define ADM5120_GPIO_SWITCH 0x10
47 #define ADM5120_GPIO_FLASH (ADM5120_GPIO_SWITCH | LED_MODE_FLASH)
48 #define ADM5120_GPIO_LINK (ADM5120_GPIO_SWITCH | LED_MODE_LINK)
49 #define ADM5120_GPIO_SPEED (ADM5120_GPIO_SWITCH | LED_MODE_SPEED)
50 #define ADM5120_GPIO_DUPLEX (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX)
51 #define ADM5120_GPIO_ACT (ADM5120_GPIO_SWITCH | LED_MODE_ACT)
52 #define ADM5120_GPIO_COLL (ADM5120_GPIO_SWITCH | LED_MODE_COLL)
53 #define ADM5120_GPIO_LINK_ACT (ADM5120_GPIO_SWITCH | LED_MODE_LINK_ACT)
54 #define ADM5120_GPIO_DUPLEX_COLL (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX_COLL)
55 #define ADM5120_GPIO_10M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_10M_ACT)
56 #define ADM5120_GPIO_100M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_100M_ACT)
58 extern int adm5120_gpio_direction_input(unsigned gpio
);
59 extern int adm5120_gpio_direction_output(unsigned gpio
, int value
);
60 extern int adm5120_gpio_get_value(unsigned gpio
);
61 extern void adm5120_gpio_set_value(unsigned gpio
, int value
);
62 extern int adm5120_gpio_request(unsigned gpio
, const char *label
);
63 extern void adm5120_gpio_free(unsigned gpio
);
64 extern int adm5120_gpio_to_irq(unsigned gpio
);
65 extern int adm5120_irq_to_gpio(unsigned irq
);
68 * Wrappers for the generic GPIO layer
70 static inline int gpio_direction_input(unsigned gpio
)
72 return adm5120_gpio_direction_input(gpio
);
75 static inline int gpio_direction_output(unsigned gpio
, int value
)
77 return adm5120_gpio_direction_output(gpio
,value
);
80 static inline int gpio_get_value(unsigned gpio
)
82 return adm5120_gpio_get_value(gpio
);
85 static inline void gpio_set_value(unsigned gpio
, int value
)
87 adm5120_gpio_set_value(gpio
, value
);
90 static inline int gpio_request(unsigned gpio
, const char *label
)
92 return adm5120_gpio_request(gpio
, label
);
95 static inline void gpio_free(unsigned gpio
)
97 adm5120_gpio_free(gpio
);
100 static inline int gpio_to_irq(unsigned gpio
)
102 return adm5120_gpio_to_irq(gpio
);
105 static inline int irq_to_gpio(unsigned irq
)
107 return adm5120_irq_to_gpio(irq
);
110 #include <asm-generic/gpio.h> /* cansleep wrappers */
112 #endif /* _ASM_MACH_ADM5120_GPIO_H */
This page took 0.058019 seconds and 5 git commands to generate.