2 * File: arch/blackfin/kernel/bfin_gpio.h
4 * Author: Michael Hennerich (hennerich@blackfin.uclinux.org)
10 * Copyright 2004-2006 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 * Number BF537/6/4 BF561 BF533/2/1
43 * GPIO_10 PF10 PF10 PF10
44 * GPIO_11 PF11 PF11 PF11
45 * GPIO_12 PF12 PF12 PF12
46 * GPIO_13 PF13 PF13 PF13
47 * GPIO_14 PF14 PF14 PF14
48 * GPIO_15 PF15 PF15 PF15
83 #ifndef __ARCH_BLACKFIN_GPIO_H__
84 #define __ARCH_BLACKFIN_GPIO_H__
86 #define gpio_bank(x) ((x) >> 4)
87 #define gpio_bit(x) (1<<((x) & 0xF))
88 #define gpio_sub_n(x) ((x) & 0xF)
90 #define GPIO_BANKSIZE 16
142 #define PERIPHERAL_USAGE 1
146 #define MAX_BLACKFIN_GPIOS 16
150 #define MAX_BLACKFIN_GPIOS 48
201 #define PORT_F GPIO_PF0
202 #define PORT_G GPIO_PG0
203 #define PORT_H GPIO_PH0
208 #include <asm-blackfin/mach-bf548/gpio.h>
212 #define MAX_BLACKFIN_GPIOS 48
263 #define PORT_FIO0 GPIO_0
264 #define PORT_FIO1 GPIO_16
265 #define PORT_FIO2 GPIO_32
270 /***********************************************************
272 * FUNCTIONS: Blackfin General Purpose Ports Access Functions
275 * gpio - GPIO Number between 0 and MAX_BLACKFIN_GPIOS
278 * DESCRIPTION: These functions abstract direct register access
279 * to Blackfin processor General Purpose
282 * CAUTION: These functions do not belong to the GPIO Driver API
283 *************************************************************
284 * MODIFICATION HISTORY :
285 **************************************************************/
288 void set_gpio_dir(unsigned short, unsigned short);
289 void set_gpio_inen(unsigned short, unsigned short);
290 void set_gpio_polar(unsigned short, unsigned short);
291 void set_gpio_edge(unsigned short, unsigned short);
292 void set_gpio_both(unsigned short, unsigned short);
293 void set_gpio_data(unsigned short, unsigned short);
294 void set_gpio_maska(unsigned short, unsigned short);
295 void set_gpio_maskb(unsigned short, unsigned short);
296 void set_gpio_toggle(unsigned short);
297 void set_gpiop_dir(unsigned short, unsigned short);
298 void set_gpiop_inen(unsigned short, unsigned short);
299 void set_gpiop_polar(unsigned short, unsigned short);
300 void set_gpiop_edge(unsigned short, unsigned short);
301 void set_gpiop_both(unsigned short, unsigned short);
302 void set_gpiop_data(unsigned short, unsigned short);
303 void set_gpiop_maska(unsigned short, unsigned short);
304 void set_gpiop_maskb(unsigned short, unsigned short);
305 unsigned short get_gpio_dir(unsigned short);
306 unsigned short get_gpio_inen(unsigned short);
307 unsigned short get_gpio_polar(unsigned short);
308 unsigned short get_gpio_edge(unsigned short);
309 unsigned short get_gpio_both(unsigned short);
310 unsigned short get_gpio_maska(unsigned short);
311 unsigned short get_gpio_maskb(unsigned short);
312 unsigned short get_gpio_data(unsigned short);
313 unsigned short get_gpiop_dir(unsigned short);
314 unsigned short get_gpiop_inen(unsigned short);
315 unsigned short get_gpiop_polar(unsigned short);
316 unsigned short get_gpiop_edge(unsigned short);
317 unsigned short get_gpiop_both(unsigned short);
318 unsigned short get_gpiop_maska(unsigned short);
319 unsigned short get_gpiop_maskb(unsigned short);
320 unsigned short get_gpiop_data(unsigned short);
324 unsigned short dummy1
;
325 unsigned short data_clear
;
326 unsigned short dummy2
;
327 unsigned short data_set
;
328 unsigned short dummy3
;
329 unsigned short toggle
;
330 unsigned short dummy4
;
331 unsigned short maska
;
332 unsigned short dummy5
;
333 unsigned short maska_clear
;
334 unsigned short dummy6
;
335 unsigned short maska_set
;
336 unsigned short dummy7
;
337 unsigned short maska_toggle
;
338 unsigned short dummy8
;
339 unsigned short maskb
;
340 unsigned short dummy9
;
341 unsigned short maskb_clear
;
342 unsigned short dummy10
;
343 unsigned short maskb_set
;
344 unsigned short dummy11
;
345 unsigned short maskb_toggle
;
346 unsigned short dummy12
;
348 unsigned short dummy13
;
349 unsigned short polar
;
350 unsigned short dummy14
;
352 unsigned short dummy15
;
354 unsigned short dummy16
;
360 #define PM_WAKE_RISING 0x1
361 #define PM_WAKE_FALLING 0x2
362 #define PM_WAKE_HIGH 0x4
363 #define PM_WAKE_LOW 0x8
364 #define PM_WAKE_BOTH_EDGES (PM_WAKE_RISING | PM_WAKE_FALLING)
366 int gpio_pm_wakeup_request(unsigned short gpio
, unsigned char type
);
367 void gpio_pm_wakeup_free(unsigned short gpio
);
368 unsigned int gpio_pm_setup(void);
369 void gpio_pm_restore(void);
373 unsigned short data_clear
;
374 unsigned short data_set
;
375 unsigned short toggle
;
376 unsigned short maska
;
377 unsigned short maska_clear
;
378 unsigned short maska_set
;
379 unsigned short maska_toggle
;
380 unsigned short maskb
;
381 unsigned short maskb_clear
;
382 unsigned short maskb_set
;
383 unsigned short maskb_toggle
;
385 unsigned short polar
;
391 unsigned short reserved
;
395 /***********************************************************
397 * FUNCTIONS: Blackfin GPIO Driver
400 * gpio - GPIO Number between 0 and MAX_BLACKFIN_GPIOS
403 * DESCRIPTION: Blackfin GPIO Driver API
406 *************************************************************
407 * MODIFICATION HISTORY :
408 **************************************************************/
410 int gpio_request(unsigned short, const char *);
411 void gpio_free(unsigned short);
413 void gpio_set_value(unsigned short gpio
, unsigned short arg
);
414 unsigned short gpio_get_value(unsigned short gpio
);
417 #define gpio_get_value(gpio) get_gpio_data(gpio)
418 #define gpio_set_value(gpio, value) set_gpio_data(gpio, value)
421 void gpio_direction_input(unsigned short gpio
);
422 void gpio_direction_output(unsigned short gpio
);
424 #endif /* __ASSEMBLY__ */
426 #endif /* __ARCH_BLACKFIN_GPIO_H__ */