hardware.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* arch/arm/mach-s3c2410/include/mach/hardware.h
  2. *
  3. * Copyright (c) 2003 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * S3C2410 - hardware
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __ASM_ARCH_HARDWARE_H
  13. #define __ASM_ARCH_HARDWARE_H
  14. #ifndef __ASSEMBLY__
  15. /* external functions for GPIO support
  16. *
  17. * These allow various different clients to access the same GPIO
  18. * registers without conflicting. If your driver only owns the entire
  19. * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.
  20. */
  21. /* s3c2410_gpio_cfgpin
  22. *
  23. * set the configuration of the given pin to the value passed.
  24. *
  25. * eg:
  26. * s3c2410_gpio_cfgpin(S3C2410_GPA0, S3C2410_GPA0_ADDR0);
  27. * s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1);
  28. */
  29. extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function);
  30. extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
  31. /* s3c2410_gpio_getirq
  32. *
  33. * turn the given pin number into the corresponding IRQ number
  34. *
  35. * returns:
  36. * < 0 = no interrupt for this pin
  37. * >=0 = interrupt number for the pin
  38. */
  39. extern int s3c2410_gpio_getirq(unsigned int pin);
  40. /* s3c2410_gpio_irq2pin
  41. *
  42. * turn the given irq number into the corresponding GPIO number
  43. *
  44. * returns:
  45. * < 0 = no pin
  46. * >=0 = gpio pin number
  47. */
  48. extern int s3c2410_gpio_irq2pin(unsigned int irq);
  49. #ifdef CONFIG_CPU_S3C2400
  50. extern int s3c2400_gpio_getirq(unsigned int pin);
  51. #endif /* CONFIG_CPU_S3C2400 */
  52. /* s3c2410_gpio_irqfilter
  53. *
  54. * set the irq filtering on the given pin
  55. *
  56. * on = 0 => disable filtering
  57. * 1 => enable filtering
  58. *
  59. * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
  60. * width of filter (0 through 63)
  61. *
  62. *
  63. */
  64. extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
  65. unsigned int config);
  66. /* s3c2410_gpio_pullup
  67. *
  68. * configure the pull-up control on the given pin
  69. *
  70. * to = 1 => disable the pull-up
  71. * 0 => enable the pull-up
  72. *
  73. * eg;
  74. *
  75. * s3c2410_gpio_pullup(S3C2410_GPB0, 0);
  76. * s3c2410_gpio_pullup(S3C2410_GPE8, 0);
  77. */
  78. extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
  79. /* s3c2410_gpio_getpull
  80. *
  81. * Read the state of the pull-up on a given pin
  82. *
  83. * return:
  84. * < 0 => error code
  85. * 0 => enabled
  86. * 1 => disabled
  87. */
  88. extern int s3c2410_gpio_getpull(unsigned int pin);
  89. extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
  90. extern unsigned int s3c2410_gpio_getpin(unsigned int pin);
  91. extern unsigned int s3c2410_modify_misccr(unsigned int clr, unsigned int chg);
  92. #ifdef CONFIG_CPU_S3C2440
  93. extern int s3c2440_set_dsc(unsigned int pin, unsigned int value);
  94. #endif /* CONFIG_CPU_S3C2440 */
  95. #ifdef CONFIG_CPU_S3C2412
  96. extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state);
  97. #endif /* CONFIG_CPU_S3C2412 */
  98. #endif /* __ASSEMBLY__ */
  99. #include <asm/sizes.h>
  100. #include <mach/map.h>
  101. /* machine specific hardware definitions should go after this */
  102. /* currently here until moved into config (todo) */
  103. #define CONFIG_NO_MULTIWORD_IO
  104. #endif /* __ASM_ARCH_HARDWARE_H */