gpio.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (c) 2009 Wind River Systems, Inc.
  3. * Tom Rix <Tom.Rix@windriver.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. *
  20. * This work is derived from the linux 2.6.27 kernel source
  21. * To fetch, use the kernel repository
  22. * git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
  23. * Use the v2.6.27 tag.
  24. *
  25. * Below is the original's header including its copyright
  26. *
  27. * linux/arch/arm/plat-omap/gpio.c
  28. *
  29. * Support functions for OMAP GPIO
  30. *
  31. * Copyright (C) 2003-2005 Nokia Corporation
  32. * Written by Juha Yrjölä <juha.yrjola@nokia.com>
  33. *
  34. * This program is free software; you can redistribute it and/or modify
  35. * it under the terms of the GNU General Public License version 2 as
  36. * published by the Free Software Foundation.
  37. */
  38. #ifndef _GPIO_H
  39. #define _GPIO_H
  40. #define OMAP24XX_GPIO_REVISION 0x0000
  41. #define OMAP24XX_GPIO_SYSCONFIG 0x0010
  42. #define OMAP24XX_GPIO_SYSSTATUS 0x0014
  43. #define OMAP24XX_GPIO_IRQSTATUS1 0x0018
  44. #define OMAP24XX_GPIO_IRQSTATUS2 0x0028
  45. #define OMAP24XX_GPIO_IRQENABLE2 0x002c
  46. #define OMAP24XX_GPIO_IRQENABLE1 0x001c
  47. #define OMAP24XX_GPIO_WAKE_EN 0x0020
  48. #define OMAP24XX_GPIO_CTRL 0x0030
  49. #define OMAP24XX_GPIO_OE 0x0034
  50. #define OMAP24XX_GPIO_DATAIN 0x0038
  51. #define OMAP24XX_GPIO_DATAOUT 0x003c
  52. #define OMAP24XX_GPIO_LEVELDETECT0 0x0040
  53. #define OMAP24XX_GPIO_LEVELDETECT1 0x0044
  54. #define OMAP24XX_GPIO_RISINGDETECT 0x0048
  55. #define OMAP24XX_GPIO_FALLINGDETECT 0x004c
  56. #define OMAP24XX_GPIO_DEBOUNCE_EN 0x0050
  57. #define OMAP24XX_GPIO_DEBOUNCE_VAL 0x0054
  58. #define OMAP24XX_GPIO_CLEARIRQENABLE1 0x0060
  59. #define OMAP24XX_GPIO_SETIRQENABLE1 0x0064
  60. #define OMAP24XX_GPIO_CLEARWKUENA 0x0080
  61. #define OMAP24XX_GPIO_SETWKUENA 0x0084
  62. #define OMAP24XX_GPIO_CLEARDATAOUT 0x0090
  63. #define OMAP24XX_GPIO_SETDATAOUT 0x0094
  64. struct gpio_bank {
  65. void *base;
  66. int method;
  67. };
  68. #define METHOD_GPIO_24XX 4
  69. /* This is the interface */
  70. /* Request a gpio before using it */
  71. int omap_request_gpio(int gpio);
  72. /* Reset and free a gpio after using it */
  73. void omap_free_gpio(int gpio);
  74. /* Sets the gpio as input or output */
  75. void omap_set_gpio_direction(int gpio, int is_input);
  76. /* Set or clear a gpio output */
  77. void omap_set_gpio_dataout(int gpio, int enable);
  78. /* Get the value of a gpio input */
  79. int omap_get_gpio_datain(int gpio);
  80. #endif /* _GPIO_H_ */