aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2008-08-23 12:54:34 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-10-11 11:18:47 -0400
commitd888e25b8dd1b501ac75b0c6587c043a394319c3 (patch)
tree31c2705b25ceaff8fa10a8b90324c6d0dd616af7 /include/asm-mips
parent09b7dcf220a37245b16fd4a716923d75bf6edf8b (diff)
MIPS: RB532: Convert to GPIO lib
This patch converts the rb532 code to use gpio library and register its gpio chip. Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/mach-rc32434/gpio.h75
1 files changed, 14 insertions, 61 deletions
diff --git a/include/asm-mips/mach-rc32434/gpio.h b/include/asm-mips/mach-rc32434/gpio.h
index 4fe18dbacaf7..3a70b41cd7a5 100644
--- a/include/asm-mips/mach-rc32434/gpio.h
+++ b/include/asm-mips/mach-rc32434/gpio.h
@@ -15,6 +15,16 @@
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17 17
18#define gpio_get_value __gpio_get_value
19#define gpio_set_value __gpio_set_value
20
21#define gpio_cansleep __gpio_cansleep
22
23#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
24#define irq_to_gpio(irq) IRQ_TO_GPIO(irq)
25
26#include <asm-generic/gpio.h>
27
18struct rb532_gpio_reg { 28struct rb532_gpio_reg {
19 u32 gpiofunc; /* GPIO Function Register 29 u32 gpiofunc; /* GPIO Function Register
20 * gpiofunc[x]==0 bit = gpio 30 * gpiofunc[x]==0 bit = gpio
@@ -62,74 +72,17 @@ struct rb532_gpio_reg {
62#define RC32434_PCI_MSU_GPIO (1 << 13) 72#define RC32434_PCI_MSU_GPIO (1 << 13)
63 73
64/* NAND GPIO signals */ 74/* NAND GPIO signals */
65#define GPIO_RDY (1 << 0x08) 75#define GPIO_RDY 8
66#define GPIO_WPX (1 << 0x09) 76#define GPIO_WPX 9
67#define GPIO_ALE (1 << 0x0a) 77#define GPIO_ALE 10
68#define GPIO_CLE (1 << 0x0b) 78#define GPIO_CLE 11
69 79
70/* Compact Flash GPIO pin */ 80/* Compact Flash GPIO pin */
71#define CF_GPIO_NUM 13 81#define CF_GPIO_NUM 13
72 82
73
74extern void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val); 83extern void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val);
75extern unsigned get_434_reg(unsigned reg_offs); 84extern unsigned get_434_reg(unsigned reg_offs);
76extern void set_latch_u5(unsigned char or_mask, unsigned char nand_mask); 85extern void set_latch_u5(unsigned char or_mask, unsigned char nand_mask);
77extern unsigned char get_latch_u5(void); 86extern unsigned char get_latch_u5(void);
78 87
79extern int rb532_gpio_get_value(unsigned gpio);
80extern void rb532_gpio_set_value(unsigned gpio, int value);
81extern int rb532_gpio_direction_input(unsigned gpio);
82extern int rb532_gpio_direction_output(unsigned gpio, int value);
83extern void rb532_gpio_set_int_level(unsigned gpio, int value);
84extern int rb532_gpio_get_int_level(unsigned gpio);
85extern void rb532_gpio_set_int_status(unsigned gpio, int value);
86extern int rb532_gpio_get_int_status(unsigned gpio);
87
88
89/* Wrappers for the arch-neutral GPIO API */
90
91static inline int gpio_request(unsigned gpio, const char *label)
92{
93 /* Not yet implemented */
94 return 0;
95}
96
97static inline void gpio_free(unsigned gpio)
98{
99 /* Not yet implemented */
100}
101
102static inline int gpio_direction_input(unsigned gpio)
103{
104 return rb532_gpio_direction_input(gpio);
105}
106
107static inline int gpio_direction_output(unsigned gpio, int value)
108{
109 return rb532_gpio_direction_output(gpio, value);
110}
111
112static inline int gpio_get_value(unsigned gpio)
113{
114 return rb532_gpio_get_value(gpio);
115}
116
117static inline void gpio_set_value(unsigned gpio, int value)
118{
119 rb532_gpio_set_value(gpio, value);
120}
121
122static inline int gpio_to_irq(unsigned gpio)
123{
124 return gpio;
125}
126
127static inline int irq_to_gpio(unsigned irq)
128{
129 return irq;
130}
131
132/* For cansleep */
133#include <asm-generic/gpio.h>
134
135#endif /* _RC32434_GPIO_H_ */ 88#endif /* _RC32434_GPIO_H_ */