vrc4173.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * vrc4173.h, Include file for NEC VRC4173.
  3. *
  4. * Copyright (C) 2000 Michael R. McDonald
  5. * Copyright (C) 2001-2003 Montavista Software Inc.
  6. * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
  7. * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
  8. * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. */
  24. #ifndef __NEC_VRC4173_H
  25. #define __NEC_VRC4173_H
  26. #include <asm/io.h>
  27. /*
  28. * PCI I/O accesses
  29. */
  30. #ifdef CONFIG_VRC4173
  31. extern unsigned long vrc4173_io_offset;
  32. #define set_vrc4173_io_offset(offset) do { vrc4173_io_offset = (offset); } while (0)
  33. #define vrc4173_outb(val,port) outb((val), vrc4173_io_offset+(port))
  34. #define vrc4173_outw(val,port) outw((val), vrc4173_io_offset+(port))
  35. #define vrc4173_outl(val,port) outl((val), vrc4173_io_offset+(port))
  36. #define vrc4173_outb_p(val,port) outb_p((val), vrc4173_io_offset+(port))
  37. #define vrc4173_outw_p(val,port) outw_p((val), vrc4173_io_offset+(port))
  38. #define vrc4173_outl_p(val,port) outl_p((val), vrc4173_io_offset+(port))
  39. #define vrc4173_inb(port) inb(vrc4173_io_offset+(port))
  40. #define vrc4173_inw(port) inw(vrc4173_io_offset+(port))
  41. #define vrc4173_inl(port) inl(vrc4173_io_offset+(port))
  42. #define vrc4173_inb_p(port) inb_p(vrc4173_io_offset+(port))
  43. #define vrc4173_inw_p(port) inw_p(vrc4173_io_offset+(port))
  44. #define vrc4173_inl_p(port) inl_p(vrc4173_io_offset+(port))
  45. #define vrc4173_outsb(port,addr,count) outsb(vrc4173_io_offset+(port),(addr),(count))
  46. #define vrc4173_outsw(port,addr,count) outsw(vrc4173_io_offset+(port),(addr),(count))
  47. #define vrc4173_outsl(port,addr,count) outsl(vrc4173_io_offset+(port),(addr),(count))
  48. #define vrc4173_insb(port,addr,count) insb(vrc4173_io_offset+(port),(addr),(count))
  49. #define vrc4173_insw(port,addr,count) insw(vrc4173_io_offset+(port),(addr),(count))
  50. #define vrc4173_insl(port,addr,count) insl(vrc4173_io_offset+(port),(addr),(count))
  51. #else
  52. #define set_vrc4173_io_offset(offset) do {} while (0)
  53. #define vrc4173_outb(val,port) do {} while (0)
  54. #define vrc4173_outw(val,port) do {} while (0)
  55. #define vrc4173_outl(val,port) do {} while (0)
  56. #define vrc4173_outb_p(val,port) do {} while (0)
  57. #define vrc4173_outw_p(val,port) do {} while (0)
  58. #define vrc4173_outl_p(val,port) do {} while (0)
  59. #define vrc4173_inb(port) 0
  60. #define vrc4173_inw(port) 0
  61. #define vrc4173_inl(port) 0
  62. #define vrc4173_inb_p(port) 0
  63. #define vrc4173_inw_p(port) 0
  64. #define vrc4173_inl_p(port) 0
  65. #define vrc4173_outsb(port,addr,count) do {} while (0)
  66. #define vrc4173_outsw(port,addr,count) do {} while (0)
  67. #define vrc4173_outsl(port,addr,count) do {} while (0)
  68. #define vrc4173_insb(port,addr,count) do {} while (0)
  69. #define vrc4173_insw(port,addr,count) do {} while (0)
  70. #define vrc4173_insl(port,addr,count) do {} while (0)
  71. #endif
  72. /*
  73. * Clock Mask Unit
  74. */
  75. typedef enum vrc4173_clock {
  76. VRC4173_PIU_CLOCK,
  77. VRC4173_KIU_CLOCK,
  78. VRC4173_AIU_CLOCK,
  79. VRC4173_PS2_CH1_CLOCK,
  80. VRC4173_PS2_CH2_CLOCK,
  81. VRC4173_USBU_PCI_CLOCK,
  82. VRC4173_CARDU1_PCI_CLOCK,
  83. VRC4173_CARDU2_PCI_CLOCK,
  84. VRC4173_AC97U_PCI_CLOCK,
  85. VRC4173_USBU_48MHz_CLOCK,
  86. VRC4173_EXT_48MHz_CLOCK,
  87. VRC4173_48MHz_CLOCK,
  88. } vrc4173_clock_t;
  89. #ifdef CONFIG_VRC4173
  90. extern void vrc4173_supply_clock(vrc4173_clock_t clock);
  91. extern void vrc4173_mask_clock(vrc4173_clock_t clock);
  92. #else
  93. static inline void vrc4173_supply_clock(vrc4173_clock_t clock) {}
  94. static inline void vrc4173_mask_clock(vrc4173_clock_t clock) {}
  95. #endif
  96. /*
  97. * Interupt Control Unit
  98. */
  99. #define VRC4173_PIUINT_COMMAND 0x0040
  100. #define VRC4173_PIUINT_DATA 0x0020
  101. #define VRC4173_PIUINT_PAGE1 0x0010
  102. #define VRC4173_PIUINT_PAGE0 0x0008
  103. #define VRC4173_PIUINT_DATALOST 0x0004
  104. #define VRC4173_PIUINT_STATUSCHANGE 0x0001
  105. #ifdef CONFIG_VRC4173
  106. extern void vrc4173_enable_piuint(uint16_t mask);
  107. extern void vrc4173_disable_piuint(uint16_t mask);
  108. #else
  109. static inline void vrc4173_enable_piuint(uint16_t mask) {}
  110. static inline void vrc4173_disable_piuint(uint16_t mask) {}
  111. #endif
  112. #define VRC4173_AIUINT_INPUT_DMAEND 0x0800
  113. #define VRC4173_AIUINT_INPUT_DMAHALT 0x0400
  114. #define VRC4173_AIUINT_INPUT_DATALOST 0x0200
  115. #define VRC4173_AIUINT_INPUT_DATA 0x0100
  116. #define VRC4173_AIUINT_OUTPUT_DMAEND 0x0008
  117. #define VRC4173_AIUINT_OUTPUT_DMAHALT 0x0004
  118. #define VRC4173_AIUINT_OUTPUT_NODATA 0x0002
  119. #ifdef CONFIG_VRC4173
  120. extern void vrc4173_enable_aiuint(uint16_t mask);
  121. extern void vrc4173_disable_aiuint(uint16_t mask);
  122. #else
  123. static inline void vrc4173_enable_aiuint(uint16_t mask) {}
  124. static inline void vrc4173_disable_aiuint(uint16_t mask) {}
  125. #endif
  126. #define VRC4173_KIUINT_DATALOST 0x0004
  127. #define VRC4173_KIUINT_DATAREADY 0x0002
  128. #define VRC4173_KIUINT_SCAN 0x0001
  129. #ifdef CONFIG_VRC4173
  130. extern void vrc4173_enable_kiuint(uint16_t mask);
  131. extern void vrc4173_disable_kiuint(uint16_t mask);
  132. #else
  133. static inline void vrc4173_enable_kiuint(uint16_t mask) {}
  134. static inline void vrc4173_disable_kiuint(uint16_t mask) {}
  135. #endif
  136. /*
  137. * General-Purpose I/O Unit
  138. */
  139. typedef enum vrc4173_function {
  140. PS2_CHANNEL1,
  141. PS2_CHANNEL2,
  142. TOUCHPANEL,
  143. KEYBOARD_8SCANLINES,
  144. KEYBOARD_10SCANLINES,
  145. KEYBOARD_12SCANLINES,
  146. GPIO_0_15PINS,
  147. GPIO_16_20PINS,
  148. } vrc4173_function_t;
  149. #ifdef CONFIG_VRC4173
  150. extern void vrc4173_select_function(vrc4173_function_t function);
  151. #else
  152. static inline void vrc4173_select_function(vrc4173_function_t function) {}
  153. #endif
  154. #endif /* __NEC_VRC4173_H */