vrc4173_cardu.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /*
  2. * FILE NAME
  3. * drivers/pcmcia/vrc4173_cardu.h
  4. *
  5. * BRIEF MODULE DESCRIPTION
  6. * Include file for NEC VRC4173 CARDU.
  7. *
  8. * Copyright 2002 Yoichi Yuasa <yuasa@linux-mips.org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  18. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  20. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  21. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  23. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  24. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *
  26. * You should have received a copy of the GNU General Public License along
  27. * with this program; if not, write to the Free Software Foundation, Inc.,
  28. * 675 Mass Ave, Cambridge, MA 02139, USA.
  29. */
  30. #ifndef _VRC4173_CARDU_H
  31. #define _VRC4173_CARDU_H
  32. #include <linux/pci.h>
  33. #include <pcmcia/ss.h>
  34. #define CARDU_MAX_SOCKETS 2
  35. #define CARDU1 0
  36. #define CARDU2 1
  37. /*
  38. * PCI Configuration Registers
  39. */
  40. #define BRGCNT 0x3e
  41. #define POST_WR_EN 0x0400
  42. #define MEM1_PREF_EN 0x0200
  43. #define MEM0_PREF_EN 0x0100
  44. #define IREQ_INT 0x0080
  45. #define CARD_RST 0x0040
  46. #define MABORT_MODE 0x0020
  47. #define VGA_EN 0x0008
  48. #define ISA_EN 0x0004
  49. #define SERR_EN 0x0002
  50. #define PERR_EN 0x0001
  51. #define SYSCNT 0x80
  52. #define BAD_VCC_REQ_DISB 0x00200000
  53. #define PCPCI_EN 0x00080000
  54. #define CH_ASSIGN_MASK 0x00070000
  55. #define CH_ASSIGN_NODMA 0x00040000
  56. #define SUB_ID_WR_EN 0x00000008
  57. #define ASYN_INT_MODE 0x00000004
  58. #define PCI_CLK_RIN 0x00000002
  59. #define DEVCNT 0x91
  60. #define ZOOM_VIDEO_EN 0x40
  61. #define SR_PCI_INT_SEL_MASK 0x18
  62. #define SR_PCI_INT_SEL_NONE 0x00
  63. #define PCI_INT_MODE 0x04
  64. #define IRQ_MODE 0x02
  65. #define IFG 0x01
  66. #define CHIPCNT 0x9c
  67. #define S_PREF_DISB 0x10
  68. #define SERRDIS 0x9f
  69. #define SERR_DIS_MAB 0x10
  70. #define SERR_DIS_TAB 0x08
  71. #define SERR_DIS_DT_PERR 0x04
  72. /*
  73. * ExCA Registers
  74. */
  75. #define EXCA_REGS_BASE 0x800
  76. #define EXCA_REGS_SIZE 0x800
  77. #define ID_REV 0x000
  78. #define IF_TYPE_16BIT 0x80
  79. #define IF_STATUS 0x001
  80. #define CARD_PWR 0x40
  81. #define READY 0x20
  82. #define CARD_WP 0x10
  83. #define CARD_DETECT2 0x08
  84. #define CARD_DETECT1 0x04
  85. #define BV_DETECT_MASK 0x03
  86. #define BV_DETECT_GOOD 0x03 /* Memory card */
  87. #define BV_DETECT_WARN 0x02
  88. #define BV_DETECT_BAD1 0x01
  89. #define BV_DETECT_BAD0 0x00
  90. #define STSCHG 0x02 /* I/O card */
  91. #define SPKR 0x01
  92. #define PWR_CNT 0x002
  93. #define CARD_OUT_EN 0x80
  94. #define VCC_MASK 0x18
  95. #define VCC_3V 0x18
  96. #define VCC_5V 0x10
  97. #define VCC_0V 0x00
  98. #define VPP_MASK 0x03
  99. #define VPP_12V 0x02
  100. #define VPP_VCC 0x01
  101. #define VPP_0V 0x00
  102. #define INT_GEN_CNT 0x003
  103. #define CARD_REST0 0x40
  104. #define CARD_TYPE_MASK 0x20
  105. #define CARD_TYPE_IO 0x20
  106. #define CARD_TYPE_MEM 0x00
  107. #define CARD_SC 0x004
  108. #define CARD_DT_CHG 0x08
  109. #define RDY_CHG 0x04
  110. #define BAT_WAR_CHG 0x02
  111. #define BAT_DEAD_ST_CHG 0x01
  112. #define CARD_SCI 0x005
  113. #define CARD_DT_EN 0x08
  114. #define RDY_EN 0x04
  115. #define BAT_WAR_EN 0x02
  116. #define BAT_DEAD_EN 0x01
  117. #define ADR_WIN_EN 0x006
  118. #define IO_WIN_EN(x) (0x40 << (x))
  119. #define MEM_WIN_EN(x) (0x01 << (x))
  120. #define IO_WIN_CNT 0x007
  121. #define IO_WIN_CNT_MASK(x) (0x03 << ((x) << 2))
  122. #define IO_WIN_DATA_AUTOSZ(x) (0x02 << ((x) << 2))
  123. #define IO_WIN_DATA_16BIT(x) (0x01 << ((x) << 2))
  124. #define IO_WIN_SA(x) (0x008 + ((x) << 2))
  125. #define IO_WIN_EA(x) (0x00a + ((x) << 2))
  126. #define MEM_WIN_SA(x) (0x010 + ((x) << 3))
  127. #define MEM_WIN_DSIZE 0x8000
  128. #define MEM_WIN_EA(x) (0x012 + ((x) << 3))
  129. #define MEM_WIN_OA(x) (0x014 + ((x) << 3))
  130. #define MEM_WIN_WP 0x8000
  131. #define MEM_WIN_REGSET 0x4000
  132. #define GEN_CNT 0x016
  133. #define VS2_STATUS 0x80
  134. #define VS1_STATUS 0x40
  135. #define EXCA_REG_RST_EN 0x02
  136. #define GLO_CNT 0x01e
  137. #define FUN_INT_LEV 0x08
  138. #define INT_WB_CLR 0x04
  139. #define CSC_INT_LEV 0x02
  140. #define IO_WIN_OAL(x) (0x036 + ((x) << 1))
  141. #define IO_WIN_OAH(x) (0x037 + ((x) << 1))
  142. #define MEM_WIN_SAU(x) (0x040 + (x))
  143. #define IO_SETUP_TIM 0x080
  144. #define IO_CMD_TIM 0x081
  145. #define IO_HOLD_TIM 0x082
  146. #define MEM_SETUP_TIM(x) (0x084 + ((x) << 2))
  147. #define MEM_CMD_TIM(x) (0x085 + ((x) << 2))
  148. #define MEM_HOLD_TIM(x) (0x086 + ((x) << 2))
  149. #define TIM_CLOCKS(x) ((x) - 1)
  150. #define MEM_TIM_SEL1 0x08c
  151. #define MEM_TIM_SEL2 0x08d
  152. #define MEM_WIN_TIMSEL1(x) (0x03 << (((x) & 3) << 1))
  153. #define MEM_WIN_PWEN 0x091
  154. #define POSTWEN 0x01
  155. /*
  156. * CardBus Socket Registers
  157. */
  158. #define CARDBUS_SOCKET_REGS_BASE 0x000
  159. #define CARDBUS_SOCKET_REGS_SIZE 0x800
  160. #define SKT_EV 0x000
  161. #define POW_CYC_EV 0x00000008
  162. #define CCD2_EV 0x00000004
  163. #define CCD1_EV 0x00000002
  164. #define CSTSCHG_EV 0x00000001
  165. #define SKT_MASK 0x004
  166. #define POW_CYC_MASK 0x00000008
  167. #define CCD_MASK 0x00000006
  168. #define CSC_MASK 0x00000001
  169. #define SKT_PRE_STATE 0x008
  170. #define SKT_FORCE_EV 0x00c
  171. #define VOL_3V_SKT 0x20000000
  172. #define VOL_5V_SKT 0x10000000
  173. #define CVS_TEST 0x00004000
  174. #define VOL_YV_CARD_DT 0x00002000
  175. #define VOL_XV_CARD_DT 0x00001000
  176. #define VOL_3V_CARD_DT 0x00000800
  177. #define VOL_5V_CARD_DT 0x00000400
  178. #define BAD_VCC_REQ 0x00000200
  179. #define DATA_LOST 0x00000100
  180. #define NOT_A_CARD 0x00000080
  181. #define CREADY 0x00000040
  182. #define CB_CARD_DT 0x00000020
  183. #define R2_CARD_DT 0x00000010
  184. #define POW_UP 0x00000008
  185. #define CCD20 0x00000004
  186. #define CCD10 0x00000002
  187. #define CSTSCHG 0x00000001
  188. #define SKT_CNT 0x010
  189. #define STP_CLK_EN 0x00000080
  190. #define VCC_CNT_MASK 0x00000070
  191. #define VCC_CNT_3V 0x00000030
  192. #define VCC_CNT_5V 0x00000020
  193. #define VCC_CNT_0V 0x00000000
  194. #define VPP_CNT_MASK 0x00000007
  195. #define VPP_CNT_3V 0x00000003
  196. #define VPP_CNT_5V 0x00000002
  197. #define VPP_CNT_12V 0x00000001
  198. #define VPP_CNT_0V 0x00000000
  199. typedef struct vrc4173_socket {
  200. int noprobe;
  201. struct pci_dev *dev;
  202. void *base;
  203. void (*handler)(void *, unsigned int);
  204. void *info;
  205. socket_cap_t cap;
  206. spinlock_t event_lock;
  207. uint16_t events;
  208. struct socket_info_t *pcmcia_socket;
  209. struct work_struct tq_work;
  210. char name[20];
  211. } vrc4173_socket_t;
  212. #endif /* _VRC4173_CARDU_H */