diff options
author | Florian Fainelli <florian@openwrt.org> | 2008-08-23 12:54:34 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-10-11 11:18:47 -0400 |
commit | d888e25b8dd1b501ac75b0c6587c043a394319c3 (patch) | |
tree | 31c2705b25ceaff8fa10a8b90324c6d0dd616af7 /include/asm-mips | |
parent | 09b7dcf220a37245b16fd4a716923d75bf6edf8b (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.h | 75 |
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 | |||
18 | struct rb532_gpio_reg { | 28 | struct 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 | |||
74 | extern void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val); | 83 | extern void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val); |
75 | extern unsigned get_434_reg(unsigned reg_offs); | 84 | extern unsigned get_434_reg(unsigned reg_offs); |
76 | extern void set_latch_u5(unsigned char or_mask, unsigned char nand_mask); | 85 | extern void set_latch_u5(unsigned char or_mask, unsigned char nand_mask); |
77 | extern unsigned char get_latch_u5(void); | 86 | extern unsigned char get_latch_u5(void); |
78 | 87 | ||
79 | extern int rb532_gpio_get_value(unsigned gpio); | ||
80 | extern void rb532_gpio_set_value(unsigned gpio, int value); | ||
81 | extern int rb532_gpio_direction_input(unsigned gpio); | ||
82 | extern int rb532_gpio_direction_output(unsigned gpio, int value); | ||
83 | extern void rb532_gpio_set_int_level(unsigned gpio, int value); | ||
84 | extern int rb532_gpio_get_int_level(unsigned gpio); | ||
85 | extern void rb532_gpio_set_int_status(unsigned gpio, int value); | ||
86 | extern int rb532_gpio_get_int_status(unsigned gpio); | ||
87 | |||
88 | |||
89 | /* Wrappers for the arch-neutral GPIO API */ | ||
90 | |||
91 | static inline int gpio_request(unsigned gpio, const char *label) | ||
92 | { | ||
93 | /* Not yet implemented */ | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | static inline void gpio_free(unsigned gpio) | ||
98 | { | ||
99 | /* Not yet implemented */ | ||
100 | } | ||
101 | |||
102 | static inline int gpio_direction_input(unsigned gpio) | ||
103 | { | ||
104 | return rb532_gpio_direction_input(gpio); | ||
105 | } | ||
106 | |||
107 | static inline int gpio_direction_output(unsigned gpio, int value) | ||
108 | { | ||
109 | return rb532_gpio_direction_output(gpio, value); | ||
110 | } | ||
111 | |||
112 | static inline int gpio_get_value(unsigned gpio) | ||
113 | { | ||
114 | return rb532_gpio_get_value(gpio); | ||
115 | } | ||
116 | |||
117 | static inline void gpio_set_value(unsigned gpio, int value) | ||
118 | { | ||
119 | rb532_gpio_set_value(gpio, value); | ||
120 | } | ||
121 | |||
122 | static inline int gpio_to_irq(unsigned gpio) | ||
123 | { | ||
124 | return gpio; | ||
125 | } | ||
126 | |||
127 | static 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_ */ |