diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2013-05-30 06:37:28 -0400 |
---|---|---|
committer | Steven Miao <realmz6@gmail.com> | 2013-11-15 04:33:42 -0500 |
commit | 54e4ff4d402450af5cec599f1cd9ab34997b3149 (patch) | |
tree | 2b4c53899c774b45fa37dbfc0440e459b2fdc16b /arch/blackfin/include | |
parent | 036c5df1839f709ed2018d4cd3bed1934eb26b83 (diff) |
blackfin: adi gpio driver and pinctrl driver support
Remove gpio driver for new gpio controller on BF54x and BF60x.
Build the bfin_gpio driver only when other BF5xx processors are selected.
Replace the prefix of some gpio and peripheral functions with adi.
add portmux platform data in machine portmux.h
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Steven Miao <realmz6@gmail.com>
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r-- | arch/blackfin/include/asm/gpio.h | 157 | ||||
-rw-r--r-- | arch/blackfin/include/asm/irq.h | 3 | ||||
-rw-r--r-- | arch/blackfin/include/asm/irq_handler.h | 6 | ||||
-rw-r--r-- | arch/blackfin/include/asm/portmux.h | 19 |
4 files changed, 41 insertions, 144 deletions
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index 98d0133346b5..99d338ca2ea4 100644 --- a/arch/blackfin/include/asm/gpio.h +++ b/arch/blackfin/include/asm/gpio.h | |||
@@ -25,8 +25,12 @@ | |||
25 | 25 | ||
26 | #ifndef __ASSEMBLY__ | 26 | #ifndef __ASSEMBLY__ |
27 | 27 | ||
28 | #ifndef CONFIG_PINCTRL | ||
29 | |||
28 | #include <linux/compiler.h> | 30 | #include <linux/compiler.h> |
29 | #include <linux/gpio.h> | 31 | #include <asm/blackfin.h> |
32 | #include <asm/portmux.h> | ||
33 | #include <asm/irq_handler.h> | ||
30 | 34 | ||
31 | /*********************************************************** | 35 | /*********************************************************** |
32 | * | 36 | * |
@@ -45,7 +49,6 @@ | |||
45 | * MODIFICATION HISTORY : | 49 | * MODIFICATION HISTORY : |
46 | **************************************************************/ | 50 | **************************************************************/ |
47 | 51 | ||
48 | #if !BFIN_GPIO_PINT | ||
49 | void set_gpio_dir(unsigned, unsigned short); | 52 | void set_gpio_dir(unsigned, unsigned short); |
50 | void set_gpio_inen(unsigned, unsigned short); | 53 | void set_gpio_inen(unsigned, unsigned short); |
51 | void set_gpio_polar(unsigned, unsigned short); | 54 | void set_gpio_polar(unsigned, unsigned short); |
@@ -115,7 +118,6 @@ struct gpio_port_t { | |||
115 | unsigned short dummy16; | 118 | unsigned short dummy16; |
116 | unsigned short inen; | 119 | unsigned short inen; |
117 | }; | 120 | }; |
118 | #endif | ||
119 | 121 | ||
120 | #ifdef BFIN_SPECIAL_GPIO_BANKS | 122 | #ifdef BFIN_SPECIAL_GPIO_BANKS |
121 | void bfin_special_gpio_free(unsigned gpio); | 123 | void bfin_special_gpio_free(unsigned gpio); |
@@ -127,25 +129,21 @@ void bfin_special_gpio_pm_hibernate_suspend(void); | |||
127 | #endif | 129 | #endif |
128 | 130 | ||
129 | #ifdef CONFIG_PM | 131 | #ifdef CONFIG_PM |
130 | int bfin_pm_standby_ctrl(unsigned ctrl); | 132 | void bfin_gpio_pm_hibernate_restore(void); |
133 | void bfin_gpio_pm_hibernate_suspend(void); | ||
134 | int bfin_gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl); | ||
135 | int bfin_gpio_pm_standby_ctrl(unsigned ctrl); | ||
131 | 136 | ||
132 | static inline int bfin_pm_standby_setup(void) | 137 | static inline int bfin_pm_standby_setup(void) |
133 | { | 138 | { |
134 | return bfin_pm_standby_ctrl(1); | 139 | return bfin_gpio_pm_standby_ctrl(1); |
135 | } | 140 | } |
136 | 141 | ||
137 | static inline void bfin_pm_standby_restore(void) | 142 | static inline void bfin_pm_standby_restore(void) |
138 | { | 143 | { |
139 | bfin_pm_standby_ctrl(0); | 144 | bfin_gpio_pm_standby_ctrl(0); |
140 | } | 145 | } |
141 | 146 | ||
142 | void bfin_gpio_pm_hibernate_restore(void); | ||
143 | void bfin_gpio_pm_hibernate_suspend(void); | ||
144 | void bfin_pint_suspend(void); | ||
145 | void bfin_pint_resume(void); | ||
146 | |||
147 | # if !BFIN_GPIO_PINT | ||
148 | int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl); | ||
149 | 147 | ||
150 | struct gpio_port_s { | 148 | struct gpio_port_s { |
151 | unsigned short data; | 149 | unsigned short data; |
@@ -161,7 +159,6 @@ struct gpio_port_s { | |||
161 | unsigned short reserved; | 159 | unsigned short reserved; |
162 | unsigned short mux; | 160 | unsigned short mux; |
163 | }; | 161 | }; |
164 | # endif | ||
165 | #endif /*CONFIG_PM*/ | 162 | #endif /*CONFIG_PM*/ |
166 | 163 | ||
167 | /*********************************************************** | 164 | /*********************************************************** |
@@ -178,36 +175,29 @@ struct gpio_port_s { | |||
178 | ************************************************************* | 175 | ************************************************************* |
179 | * MODIFICATION HISTORY : | 176 | * MODIFICATION HISTORY : |
180 | **************************************************************/ | 177 | **************************************************************/ |
181 | |||
182 | int bfin_gpio_request(unsigned gpio, const char *label); | ||
183 | void bfin_gpio_free(unsigned gpio); | ||
184 | int bfin_gpio_irq_request(unsigned gpio, const char *label); | 178 | int bfin_gpio_irq_request(unsigned gpio, const char *label); |
185 | void bfin_gpio_irq_free(unsigned gpio); | 179 | void bfin_gpio_irq_free(unsigned gpio); |
186 | int bfin_gpio_direction_input(unsigned gpio); | 180 | void bfin_gpio_irq_prepare(unsigned gpio); |
187 | int bfin_gpio_direction_output(unsigned gpio, int value); | 181 | |
188 | int bfin_gpio_get_value(unsigned gpio); | 182 | static inline int irq_to_gpio(unsigned irq) |
189 | void bfin_gpio_set_value(unsigned gpio, int value); | 183 | { |
184 | return irq - GPIO_IRQ_BASE; | ||
185 | } | ||
186 | #endif /* CONFIG_PINCTRL */ | ||
190 | 187 | ||
191 | #include <asm/irq.h> | 188 | #include <asm/irq.h> |
192 | #include <asm/errno.h> | 189 | #include <asm/errno.h> |
193 | 190 | ||
194 | #ifdef CONFIG_GPIOLIB | ||
195 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | 191 | #include <asm-generic/gpio.h> /* cansleep wrappers */ |
196 | 192 | ||
197 | static inline int gpio_get_value(unsigned int gpio) | 193 | static inline int gpio_get_value(unsigned int gpio) |
198 | { | 194 | { |
199 | if (gpio < MAX_BLACKFIN_GPIOS) | 195 | return __gpio_get_value(gpio); |
200 | return bfin_gpio_get_value(gpio); | ||
201 | else | ||
202 | return __gpio_get_value(gpio); | ||
203 | } | 196 | } |
204 | 197 | ||
205 | static inline void gpio_set_value(unsigned int gpio, int value) | 198 | static inline void gpio_set_value(unsigned int gpio, int value) |
206 | { | 199 | { |
207 | if (gpio < MAX_BLACKFIN_GPIOS) | 200 | __gpio_set_value(gpio, value); |
208 | bfin_gpio_set_value(gpio, value); | ||
209 | else | ||
210 | __gpio_set_value(gpio, value); | ||
211 | } | 201 | } |
212 | 202 | ||
213 | static inline int gpio_cansleep(unsigned int gpio) | 203 | static inline int gpio_cansleep(unsigned int gpio) |
@@ -219,113 +209,6 @@ static inline int gpio_to_irq(unsigned gpio) | |||
219 | { | 209 | { |
220 | return __gpio_to_irq(gpio); | 210 | return __gpio_to_irq(gpio); |
221 | } | 211 | } |
222 | |||
223 | #else /* !CONFIG_GPIOLIB */ | ||
224 | |||
225 | static inline int gpio_request(unsigned gpio, const char *label) | ||
226 | { | ||
227 | return bfin_gpio_request(gpio, label); | ||
228 | } | ||
229 | |||
230 | static inline void gpio_free(unsigned gpio) | ||
231 | { | ||
232 | return bfin_gpio_free(gpio); | ||
233 | } | ||
234 | |||
235 | static inline int gpio_direction_input(unsigned gpio) | ||
236 | { | ||
237 | return bfin_gpio_direction_input(gpio); | ||
238 | } | ||
239 | |||
240 | static inline int gpio_direction_output(unsigned gpio, int value) | ||
241 | { | ||
242 | return bfin_gpio_direction_output(gpio, value); | ||
243 | } | ||
244 | |||
245 | static inline int gpio_set_debounce(unsigned gpio, unsigned debounce) | ||
246 | { | ||
247 | return -EINVAL; | ||
248 | } | ||
249 | |||
250 | static inline int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | ||
251 | { | ||
252 | int err; | ||
253 | |||
254 | err = bfin_gpio_request(gpio, label); | ||
255 | if (err) | ||
256 | return err; | ||
257 | |||
258 | if (flags & GPIOF_DIR_IN) | ||
259 | err = bfin_gpio_direction_input(gpio); | ||
260 | else | ||
261 | err = bfin_gpio_direction_output(gpio, | ||
262 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); | ||
263 | |||
264 | if (err) | ||
265 | bfin_gpio_free(gpio); | ||
266 | |||
267 | return err; | ||
268 | } | ||
269 | |||
270 | static inline int gpio_request_array(const struct gpio *array, size_t num) | ||
271 | { | ||
272 | int i, err; | ||
273 | |||
274 | for (i = 0; i < num; i++, array++) { | ||
275 | err = gpio_request_one(array->gpio, array->flags, array->label); | ||
276 | if (err) | ||
277 | goto err_free; | ||
278 | } | ||
279 | return 0; | ||
280 | |||
281 | err_free: | ||
282 | while (i--) | ||
283 | bfin_gpio_free((--array)->gpio); | ||
284 | return err; | ||
285 | } | ||
286 | |||
287 | static inline void gpio_free_array(const struct gpio *array, size_t num) | ||
288 | { | ||
289 | while (num--) | ||
290 | bfin_gpio_free((array++)->gpio); | ||
291 | } | ||
292 | |||
293 | static inline int __gpio_get_value(unsigned gpio) | ||
294 | { | ||
295 | return bfin_gpio_get_value(gpio); | ||
296 | } | ||
297 | |||
298 | static inline void __gpio_set_value(unsigned gpio, int value) | ||
299 | { | ||
300 | return bfin_gpio_set_value(gpio, value); | ||
301 | } | ||
302 | |||
303 | static inline int gpio_get_value(unsigned gpio) | ||
304 | { | ||
305 | return __gpio_get_value(gpio); | ||
306 | } | ||
307 | |||
308 | static inline void gpio_set_value(unsigned gpio, int value) | ||
309 | { | ||
310 | return __gpio_set_value(gpio, value); | ||
311 | } | ||
312 | |||
313 | static inline int gpio_to_irq(unsigned gpio) | ||
314 | { | ||
315 | if (likely(gpio < MAX_BLACKFIN_GPIOS)) | ||
316 | return gpio + GPIO_IRQ_BASE; | ||
317 | |||
318 | return -EINVAL; | ||
319 | } | ||
320 | |||
321 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
322 | #endif /* !CONFIG_GPIOLIB */ | ||
323 | |||
324 | static inline int irq_to_gpio(unsigned irq) | ||
325 | { | ||
326 | return (irq - GPIO_IRQ_BASE); | ||
327 | } | ||
328 | |||
329 | #endif /* __ASSEMBLY__ */ | 212 | #endif /* __ASSEMBLY__ */ |
330 | 213 | ||
331 | #endif /* __ARCH_BLACKFIN_GPIO_H__ */ | 214 | #endif /* __ARCH_BLACKFIN_GPIO_H__ */ |
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h index 4ae1144a4578..2fd04f10cc26 100644 --- a/arch/blackfin/include/asm/irq.h +++ b/arch/blackfin/include/asm/irq.h | |||
@@ -23,8 +23,7 @@ | |||
23 | /* | 23 | /* |
24 | * pm save bfin pint registers | 24 | * pm save bfin pint registers |
25 | */ | 25 | */ |
26 | struct bfin_pm_pint_save { | 26 | struct adi_pm_pint_save { |
27 | u32 mask_set; | ||
28 | u32 assign; | 27 | u32 assign; |
29 | u32 edge_set; | 28 | u32 edge_set; |
30 | u32 invert_set; | 29 | u32 invert_set; |
diff --git a/arch/blackfin/include/asm/irq_handler.h b/arch/blackfin/include/asm/irq_handler.h index 4fbf83575db1..4b2a992794d7 100644 --- a/arch/blackfin/include/asm/irq_handler.h +++ b/arch/blackfin/include/asm/irq_handler.h | |||
@@ -12,11 +12,11 @@ | |||
12 | #include <mach/irq.h> | 12 | #include <mach/irq.h> |
13 | 13 | ||
14 | /* init functions only */ | 14 | /* init functions only */ |
15 | extern int __init init_arch_irq(void); | 15 | extern int init_arch_irq(void); |
16 | extern void init_exception_vectors(void); | 16 | extern void init_exception_vectors(void); |
17 | extern void __init program_IAR(void); | 17 | extern void program_IAR(void); |
18 | #ifdef init_mach_irq | 18 | #ifdef init_mach_irq |
19 | extern void __init init_mach_irq(void); | 19 | extern void init_mach_irq(void); |
20 | #else | 20 | #else |
21 | # define init_mach_irq() | 21 | # define init_mach_irq() |
22 | #endif | 22 | #endif |
diff --git a/arch/blackfin/include/asm/portmux.h b/arch/blackfin/include/asm/portmux.h index 9b1e2c37b324..7aa20436e799 100644 --- a/arch/blackfin/include/asm/portmux.h +++ b/arch/blackfin/include/asm/portmux.h | |||
@@ -17,14 +17,29 @@ | |||
17 | #define P_MAYSHARE 0x2000 | 17 | #define P_MAYSHARE 0x2000 |
18 | #define P_DONTCARE 0x1000 | 18 | #define P_DONTCARE 0x1000 |
19 | 19 | ||
20 | 20 | #ifdef CONFIG_PINCTRL | |
21 | #include <asm/irq_handler.h> | ||
22 | |||
23 | #define gpio_pint_regs bfin_pint_regs | ||
24 | #define adi_internal_set_wake bfin_internal_set_wake | ||
25 | |||
26 | #define peripheral_request(per, label) 0 | ||
27 | #define peripheral_free(per) | ||
28 | #define peripheral_request_list(per, label) \ | ||
29 | (pdev ? (IS_ERR(devm_pinctrl_get_select_default(&pdev->dev)) \ | ||
30 | ? -EINVAL : 0) : 0) | ||
31 | #define peripheral_free_list(per) | ||
32 | #else | ||
21 | int peripheral_request(unsigned short per, const char *label); | 33 | int peripheral_request(unsigned short per, const char *label); |
22 | void peripheral_free(unsigned short per); | 34 | void peripheral_free(unsigned short per); |
23 | int peripheral_request_list(const unsigned short per[], const char *label); | 35 | int peripheral_request_list(const unsigned short per[], const char *label); |
24 | void peripheral_free_list(const unsigned short per[]); | 36 | void peripheral_free_list(const unsigned short per[]); |
37 | #endif | ||
25 | 38 | ||
26 | #include <asm/gpio.h> | 39 | #include <linux/err.h> |
40 | #include <linux/pinctrl/pinctrl.h> | ||
27 | #include <mach/portmux.h> | 41 | #include <mach/portmux.h> |
42 | #include <linux/gpio.h> | ||
28 | 43 | ||
29 | #ifndef P_SPORT2_TFS | 44 | #ifndef P_SPORT2_TFS |
30 | #define P_SPORT2_TFS P_UNDEF | 45 | #define P_SPORT2_TFS P_UNDEF |