vrc4173.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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 <yuasa@hh.iij4u.or.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 <linux/config.h>
  27. #include <asm/io.h>
  28. /*
  29. * Interrupt Number
  30. */
  31. #define VRC4173_IRQ_BASE 72
  32. #define VRC4173_IRQ(x) (VRC4173_IRQ_BASE + (x))
  33. #define VRC4173_USB_IRQ VRC4173_IRQ(0)
  34. #define VRC4173_PCMCIA2_IRQ VRC4173_IRQ(1)
  35. #define VRC4173_PCMCIA1_IRQ VRC4173_IRQ(2)
  36. #define VRC4173_PS2CH2_IRQ VRC4173_IRQ(3)
  37. #define VRC4173_PS2CH1_IRQ VRC4173_IRQ(4)
  38. #define VRC4173_PIU_IRQ VRC4173_IRQ(5)
  39. #define VRC4173_AIU_IRQ VRC4173_IRQ(6)
  40. #define VRC4173_KIU_IRQ VRC4173_IRQ(7)
  41. #define VRC4173_GIU_IRQ VRC4173_IRQ(8)
  42. #define VRC4173_AC97_IRQ VRC4173_IRQ(9)
  43. #define VRC4173_AC97INT1_IRQ VRC4173_IRQ(10)
  44. /* RFU */
  45. #define VRC4173_DOZEPIU_IRQ VRC4173_IRQ(13)
  46. #define VRC4173_IRQ_LAST VRC4173_DOZEPIU_IRQ
  47. /*
  48. * PCI I/O accesses
  49. */
  50. #ifdef CONFIG_VRC4173
  51. extern unsigned long vrc4173_io_offset;
  52. #define set_vrc4173_io_offset(offset) do { vrc4173_io_offset = (offset); } while (0)
  53. #define vrc4173_outb(val,port) outb((val), vrc4173_io_offset+(port))
  54. #define vrc4173_outw(val,port) outw((val), vrc4173_io_offset+(port))
  55. #define vrc4173_outl(val,port) outl((val), vrc4173_io_offset+(port))
  56. #define vrc4173_outb_p(val,port) outb_p((val), vrc4173_io_offset+(port))
  57. #define vrc4173_outw_p(val,port) outw_p((val), vrc4173_io_offset+(port))
  58. #define vrc4173_outl_p(val,port) outl_p((val), vrc4173_io_offset+(port))
  59. #define vrc4173_inb(port) inb(vrc4173_io_offset+(port))
  60. #define vrc4173_inw(port) inw(vrc4173_io_offset+(port))
  61. #define vrc4173_inl(port) inl(vrc4173_io_offset+(port))
  62. #define vrc4173_inb_p(port) inb_p(vrc4173_io_offset+(port))
  63. #define vrc4173_inw_p(port) inw_p(vrc4173_io_offset+(port))
  64. #define vrc4173_inl_p(port) inl_p(vrc4173_io_offset+(port))
  65. #define vrc4173_outsb(port,addr,count) outsb(vrc4173_io_offset+(port),(addr),(count))
  66. #define vrc4173_outsw(port,addr,count) outsw(vrc4173_io_offset+(port),(addr),(count))
  67. #define vrc4173_outsl(port,addr,count) outsl(vrc4173_io_offset+(port),(addr),(count))
  68. #define vrc4173_insb(port,addr,count) insb(vrc4173_io_offset+(port),(addr),(count))
  69. #define vrc4173_insw(port,addr,count) insw(vrc4173_io_offset+(port),(addr),(count))
  70. #define vrc4173_insl(port,addr,count) insl(vrc4173_io_offset+(port),(addr),(count))
  71. #else
  72. #define set_vrc4173_io_offset(offset) do {} while (0)
  73. #define vrc4173_outb(val,port) do {} while (0)
  74. #define vrc4173_outw(val,port) do {} while (0)
  75. #define vrc4173_outl(val,port) do {} while (0)
  76. #define vrc4173_outb_p(val,port) do {} while (0)
  77. #define vrc4173_outw_p(val,port) do {} while (0)
  78. #define vrc4173_outl_p(val,port) do {} while (0)
  79. #define vrc4173_inb(port) 0
  80. #define vrc4173_inw(port) 0
  81. #define vrc4173_inl(port) 0
  82. #define vrc4173_inb_p(port) 0
  83. #define vrc4173_inw_p(port) 0
  84. #define vrc4173_inl_p(port) 0
  85. #define vrc4173_outsb(port,addr,count) do {} while (0)
  86. #define vrc4173_outsw(port,addr,count) do {} while (0)
  87. #define vrc4173_outsl(port,addr,count) do {} while (0)
  88. #define vrc4173_insb(port,addr,count) do {} while (0)
  89. #define vrc4173_insw(port,addr,count) do {} while (0)
  90. #define vrc4173_insl(port,addr,count) do {} while (0)
  91. #endif
  92. /*
  93. * Clock Mask Unit
  94. */
  95. typedef enum vrc4173_clock {
  96. VRC4173_PIU_CLOCK,
  97. VRC4173_KIU_CLOCK,
  98. VRC4173_AIU_CLOCK,
  99. VRC4173_PS2_CH1_CLOCK,
  100. VRC4173_PS2_CH2_CLOCK,
  101. VRC4173_USBU_PCI_CLOCK,
  102. VRC4173_CARDU1_PCI_CLOCK,
  103. VRC4173_CARDU2_PCI_CLOCK,
  104. VRC4173_AC97U_PCI_CLOCK,
  105. VRC4173_USBU_48MHz_CLOCK,
  106. VRC4173_EXT_48MHz_CLOCK,
  107. VRC4173_48MHz_CLOCK,
  108. } vrc4173_clock_t;
  109. #ifdef CONFIG_VRC4173
  110. extern void vrc4173_supply_clock(vrc4173_clock_t clock);
  111. extern void vrc4173_mask_clock(vrc4173_clock_t clock);
  112. #else
  113. static inline void vrc4173_supply_clock(vrc4173_clock_t clock) {}
  114. static inline void vrc4173_mask_clock(vrc4173_clock_t clock) {}
  115. #endif
  116. /*
  117. * Interupt Control Unit
  118. */
  119. #define VRC4173_PIUINT_COMMAND 0x0040
  120. #define VRC4173_PIUINT_DATA 0x0020
  121. #define VRC4173_PIUINT_PAGE1 0x0010
  122. #define VRC4173_PIUINT_PAGE0 0x0008
  123. #define VRC4173_PIUINT_DATALOST 0x0004
  124. #define VRC4173_PIUINT_STATUSCHANGE 0x0001
  125. #ifdef CONFIG_VRC4173
  126. extern void vrc4173_enable_piuint(uint16_t mask);
  127. extern void vrc4173_disable_piuint(uint16_t mask);
  128. #else
  129. static inline void vrc4173_enable_piuint(uint16_t mask) {}
  130. static inline void vrc4173_disable_piuint(uint16_t mask) {}
  131. #endif
  132. #define VRC4173_AIUINT_INPUT_DMAEND 0x0800
  133. #define VRC4173_AIUINT_INPUT_DMAHALT 0x0400
  134. #define VRC4173_AIUINT_INPUT_DATALOST 0x0200
  135. #define VRC4173_AIUINT_INPUT_DATA 0x0100
  136. #define VRC4173_AIUINT_OUTPUT_DMAEND 0x0008
  137. #define VRC4173_AIUINT_OUTPUT_DMAHALT 0x0004
  138. #define VRC4173_AIUINT_OUTPUT_NODATA 0x0002
  139. #ifdef CONFIG_VRC4173
  140. extern void vrc4173_enable_aiuint(uint16_t mask);
  141. extern void vrc4173_disable_aiuint(uint16_t mask);
  142. #else
  143. static inline void vrc4173_enable_aiuint(uint16_t mask) {}
  144. static inline void vrc4173_disable_aiuint(uint16_t mask) {}
  145. #endif
  146. #define VRC4173_KIUINT_DATALOST 0x0004
  147. #define VRC4173_KIUINT_DATAREADY 0x0002
  148. #define VRC4173_KIUINT_SCAN 0x0001
  149. #ifdef CONFIG_VRC4173
  150. extern void vrc4173_enable_kiuint(uint16_t mask);
  151. extern void vrc4173_disable_kiuint(uint16_t mask);
  152. #else
  153. static inline void vrc4173_enable_kiuint(uint16_t mask) {}
  154. static inline void vrc4173_disable_kiuint(uint16_t mask) {}
  155. #endif
  156. /*
  157. * General-Purpose I/O Unit
  158. */
  159. typedef enum vrc4173_function {
  160. PS2_CHANNEL1,
  161. PS2_CHANNEL2,
  162. TOUCHPANEL,
  163. KEYBOARD_8SCANLINES,
  164. KEYBOARD_10SCANLINES,
  165. KEYBOARD_12SCANLINES,
  166. GPIO_0_15PINS,
  167. GPIO_16_20PINS,
  168. } vrc4173_function_t;
  169. #ifdef CONFIG_VRC4173
  170. extern void vrc4173_select_function(vrc4173_function_t function);
  171. #else
  172. static inline void vrc4173_select_function(vrc4173_function_t function) {}
  173. #endif
  174. #endif /* __NEC_VRC4173_H */