diff options
Diffstat (limited to 'arch/arm/mach-davinci/include/mach/gpio.h')
-rw-r--r-- | arch/arm/mach-davinci/include/mach/gpio.h | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h deleted file mode 100644 index 960e9de47e1e..000000000000 --- a/arch/arm/mach-davinci/include/mach/gpio.h +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /* | ||
2 | * TI DaVinci GPIO Support | ||
3 | * | ||
4 | * Copyright (c) 2006 David Brownell | ||
5 | * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __DAVINCI_GPIO_H | ||
14 | #define __DAVINCI_GPIO_H | ||
15 | |||
16 | #include <asm-generic/gpio.h> | ||
17 | |||
18 | #define __ARM_GPIOLIB_COMPLEX | ||
19 | |||
20 | /* The inline versions use the static inlines in the driver header */ | ||
21 | #include "gpio-davinci.h" | ||
22 | |||
23 | /* | ||
24 | * The get/set/clear functions will inline when called with constant | ||
25 | * parameters referencing built-in GPIOs, for low-overhead bitbanging. | ||
26 | * | ||
27 | * gpio_set_value() will inline only on traditional Davinci style controllers | ||
28 | * with distinct set/clear registers. | ||
29 | * | ||
30 | * Otherwise, calls with variable parameters or referencing external | ||
31 | * GPIOs (e.g. on GPIO expander chips) use outlined functions. | ||
32 | */ | ||
33 | static inline void gpio_set_value(unsigned gpio, int value) | ||
34 | { | ||
35 | if (__builtin_constant_p(value) && gpio < davinci_soc_info.gpio_num) { | ||
36 | struct davinci_gpio_controller *ctlr; | ||
37 | u32 mask; | ||
38 | |||
39 | ctlr = __gpio_to_controller(gpio); | ||
40 | |||
41 | if (ctlr->set_data != ctlr->clr_data) { | ||
42 | mask = __gpio_mask(gpio); | ||
43 | if (value) | ||
44 | __raw_writel(mask, ctlr->set_data); | ||
45 | else | ||
46 | __raw_writel(mask, ctlr->clr_data); | ||
47 | return; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | __gpio_set_value(gpio, value); | ||
52 | } | ||
53 | |||
54 | /* Returns zero or nonzero; works for gpios configured as inputs OR | ||
55 | * as outputs, at least for built-in GPIOs. | ||
56 | * | ||
57 | * NOTE: for built-in GPIOs, changes in reported values are synchronized | ||
58 | * to the GPIO clock. This is easily seen after calling gpio_set_value() | ||
59 | * and then immediately gpio_get_value(), where the gpio_get_value() will | ||
60 | * return the old value until the GPIO clock ticks and the new value gets | ||
61 | * latched. | ||
62 | */ | ||
63 | static inline int gpio_get_value(unsigned gpio) | ||
64 | { | ||
65 | struct davinci_gpio_controller *ctlr; | ||
66 | |||
67 | if (!__builtin_constant_p(gpio) || gpio >= davinci_soc_info.gpio_num) | ||
68 | return __gpio_get_value(gpio); | ||
69 | |||
70 | ctlr = __gpio_to_controller(gpio); | ||
71 | return __gpio_mask(gpio) & __raw_readl(ctlr->in_data); | ||
72 | } | ||
73 | |||
74 | static inline int gpio_cansleep(unsigned gpio) | ||
75 | { | ||
76 | if (__builtin_constant_p(gpio) && gpio < davinci_soc_info.gpio_num) | ||
77 | return 0; | ||
78 | else | ||
79 | return __gpio_cansleep(gpio); | ||
80 | } | ||
81 | |||
82 | static inline int irq_to_gpio(unsigned irq) | ||
83 | { | ||
84 | /* don't support the reverse mapping */ | ||
85 | return -ENOSYS; | ||
86 | } | ||
87 | |||
88 | #endif /* __DAVINCI_GPIO_H */ | ||