pcmcia.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /*
  2. * (C) Copyright 2000-2004
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef _PCMCIA_H
  8. #define _PCMCIA_H
  9. #include <common.h>
  10. #include <config.h>
  11. /*
  12. * Allow configuration to select PCMCIA slot,
  13. * or try to generate a useful default
  14. */
  15. #if defined(CONFIG_CMD_PCMCIA) || \
  16. (defined(CONFIG_CMD_IDE) && \
  17. (defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) ) )
  18. #if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
  19. #if defined(CONFIG_TQM8xxL)
  20. # define CONFIG_PCMCIA_SLOT_B /* The TQM8xxL use SLOT_B */
  21. #elif defined(CONFIG_IVMS8) || defined(CONFIG_IVML24) /* The IVM* use SLOT_A */
  22. # define CONFIG_PCMCIA_SLOT_A
  23. #elif defined(CONFIG_LWMON) /* The LWMON use SLOT_B */
  24. # define CONFIG_PCMCIA_SLOT_B
  25. #elif defined(CONFIG_R360MPI) /* The R360MPI use SLOT_B */
  26. # define CONFIG_PCMCIA_SLOT_B
  27. #elif defined(CONFIG_ATC) /* The ATC use SLOT_A */
  28. # define CONFIG_PCMCIA_SLOT_A
  29. #else
  30. # error "PCMCIA Slot not configured"
  31. #endif
  32. #endif /* !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B) */
  33. /* Make sure exactly one slot is defined - we support only one for now */
  34. #if !defined(CONFIG_PCMCIA_SLOT_A) && !defined(CONFIG_PCMCIA_SLOT_B)
  35. #error Neither CONFIG_PCMCIA_SLOT_A nor CONFIG_PCMCIA_SLOT_B configured
  36. #endif
  37. #if defined(CONFIG_PCMCIA_SLOT_A) && defined(CONFIG_PCMCIA_SLOT_B)
  38. #error Both CONFIG_PCMCIA_SLOT_A and CONFIG_PCMCIA_SLOT_B configured
  39. #endif
  40. #ifndef PCMCIA_SOCKETS_NO
  41. #define PCMCIA_SOCKETS_NO 1
  42. #endif
  43. #ifndef PCMCIA_MEM_WIN_NO
  44. #define PCMCIA_MEM_WIN_NO 4
  45. #endif
  46. #define PCMCIA_IO_WIN_NO 2
  47. /* define _slot_ to be able to optimize macros */
  48. #ifdef CONFIG_PCMCIA_SLOT_A
  49. # define _slot_ 0
  50. # define PCMCIA_SLOT_MSG "slot A"
  51. # define PCMCIA_SLOT_x PCMCIA_PSLOT_A
  52. #else
  53. # define _slot_ 1
  54. # define PCMCIA_SLOT_MSG "slot B"
  55. # define PCMCIA_SLOT_x PCMCIA_PSLOT_B
  56. #endif
  57. /*
  58. * The TQM850L hardware has two pins swapped! Grrrrgh!
  59. */
  60. #ifdef CONFIG_TQM850L
  61. #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXOE
  62. #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXRESET
  63. #else
  64. #define __MY_PCMCIA_GCRX_CXRESET PCMCIA_GCRX_CXRESET
  65. #define __MY_PCMCIA_GCRX_CXOE PCMCIA_GCRX_CXOE
  66. #endif
  67. /*
  68. * This structure is used to address each window in the PCMCIA controller.
  69. *
  70. * Keep in mind that we assume that pcmcia_win_t[n+1] is mapped directly
  71. * after pcmcia_win_t[n]...
  72. */
  73. typedef struct {
  74. ulong br;
  75. ulong or;
  76. } pcmcia_win_t;
  77. /*
  78. * Definitions for PCMCIA control registers to operate in IDE mode
  79. *
  80. * All timing related setup (PCMCIA_SHT, PCMCIA_SST, PCMCIA_SL)
  81. * to be done later (depending on CPU clock)
  82. */
  83. /* Window 0:
  84. * Base: 0xFE100000 CS1
  85. * Port Size: 2 Bytes
  86. * Port Size: 16 Bit
  87. * Common Memory Space
  88. */
  89. #define CONFIG_SYS_PCMCIA_PBR0 0xFE100000
  90. #define CONFIG_SYS_PCMCIA_POR0 ( PCMCIA_BSIZE_2 \
  91. | PCMCIA_PPS_16 \
  92. | PCMCIA_PRS_MEM \
  93. | PCMCIA_SLOT_x \
  94. | PCMCIA_PV \
  95. )
  96. /* Window 1:
  97. * Base: 0xFE100080 CS1
  98. * Port Size: 8 Bytes
  99. * Port Size: 8 Bit
  100. * Common Memory Space
  101. */
  102. #define CONFIG_SYS_PCMCIA_PBR1 0xFE100080
  103. #define CONFIG_SYS_PCMCIA_POR1 ( PCMCIA_BSIZE_8 \
  104. | PCMCIA_PPS_8 \
  105. | PCMCIA_PRS_MEM \
  106. | PCMCIA_SLOT_x \
  107. | PCMCIA_PV \
  108. )
  109. /* Window 2:
  110. * Base: 0xFE100100 CS2
  111. * Port Size: 8 Bytes
  112. * Port Size: 8 Bit
  113. * Common Memory Space
  114. */
  115. #define CONFIG_SYS_PCMCIA_PBR2 0xFE100100
  116. #define CONFIG_SYS_PCMCIA_POR2 ( PCMCIA_BSIZE_8 \
  117. | PCMCIA_PPS_8 \
  118. | PCMCIA_PRS_MEM \
  119. | PCMCIA_SLOT_x \
  120. | PCMCIA_PV \
  121. )
  122. /* Window 3:
  123. * not used
  124. */
  125. #define CONFIG_SYS_PCMCIA_PBR3 0
  126. #define CONFIG_SYS_PCMCIA_POR3 0
  127. /* Window 4:
  128. * Base: 0xFE100C00 CS1
  129. * Port Size: 2 Bytes
  130. * Port Size: 16 Bit
  131. * Common Memory Space
  132. */
  133. #define CONFIG_SYS_PCMCIA_PBR4 0xFE100C00
  134. #define CONFIG_SYS_PCMCIA_POR4 ( PCMCIA_BSIZE_2 \
  135. | PCMCIA_PPS_16 \
  136. | PCMCIA_PRS_MEM \
  137. | PCMCIA_SLOT_x \
  138. | PCMCIA_PV \
  139. )
  140. /* Window 5:
  141. * Base: 0xFE100C80 CS1
  142. * Port Size: 8 Bytes
  143. * Port Size: 8 Bit
  144. * Common Memory Space
  145. */
  146. #define CONFIG_SYS_PCMCIA_PBR5 0xFE100C80
  147. #define CONFIG_SYS_PCMCIA_POR5 ( PCMCIA_BSIZE_8 \
  148. | PCMCIA_PPS_8 \
  149. | PCMCIA_PRS_MEM \
  150. | PCMCIA_SLOT_x \
  151. | PCMCIA_PV \
  152. )
  153. /* Window 6:
  154. * Base: 0xFE100D00 CS2
  155. * Port Size: 8 Bytes
  156. * Port Size: 8 Bit
  157. * Common Memory Space
  158. */
  159. #define CONFIG_SYS_PCMCIA_PBR6 0xFE100D00
  160. #define CONFIG_SYS_PCMCIA_POR6 ( PCMCIA_BSIZE_8 \
  161. | PCMCIA_PPS_8 \
  162. | PCMCIA_PRS_MEM \
  163. | PCMCIA_SLOT_x \
  164. | PCMCIA_PV \
  165. )
  166. /* Window 7:
  167. * not used
  168. */
  169. #define CONFIG_SYS_PCMCIA_PBR7 0
  170. #define CONFIG_SYS_PCMCIA_POR7 0
  171. /**********************************************************************/
  172. /*
  173. * CIS Tupel codes
  174. */
  175. #define CISTPL_NULL 0x00
  176. #define CISTPL_DEVICE 0x01
  177. #define CISTPL_LONGLINK_CB 0x02
  178. #define CISTPL_INDIRECT 0x03
  179. #define CISTPL_CONFIG_CB 0x04
  180. #define CISTPL_CFTABLE_ENTRY_CB 0x05
  181. #define CISTPL_LONGLINK_MFC 0x06
  182. #define CISTPL_BAR 0x07
  183. #define CISTPL_PWR_MGMNT 0x08
  184. #define CISTPL_EXTDEVICE 0x09
  185. #define CISTPL_CHECKSUM 0x10
  186. #define CISTPL_LONGLINK_A 0x11
  187. #define CISTPL_LONGLINK_C 0x12
  188. #define CISTPL_LINKTARGET 0x13
  189. #define CISTPL_NO_LINK 0x14
  190. #define CISTPL_VERS_1 0x15
  191. #define CISTPL_ALTSTR 0x16
  192. #define CISTPL_DEVICE_A 0x17
  193. #define CISTPL_JEDEC_C 0x18
  194. #define CISTPL_JEDEC_A 0x19
  195. #define CISTPL_CONFIG 0x1a
  196. #define CISTPL_CFTABLE_ENTRY 0x1b
  197. #define CISTPL_DEVICE_OC 0x1c
  198. #define CISTPL_DEVICE_OA 0x1d
  199. #define CISTPL_DEVICE_GEO 0x1e
  200. #define CISTPL_DEVICE_GEO_A 0x1f
  201. #define CISTPL_MANFID 0x20
  202. #define CISTPL_FUNCID 0x21
  203. #define CISTPL_FUNCE 0x22
  204. #define CISTPL_SWIL 0x23
  205. #define CISTPL_END 0xff
  206. /*
  207. * CIS Function ID codes
  208. */
  209. #define CISTPL_FUNCID_MULTI 0x00
  210. #define CISTPL_FUNCID_MEMORY 0x01
  211. #define CISTPL_FUNCID_SERIAL 0x02
  212. #define CISTPL_FUNCID_PARALLEL 0x03
  213. #define CISTPL_FUNCID_FIXED 0x04
  214. #define CISTPL_FUNCID_VIDEO 0x05
  215. #define CISTPL_FUNCID_NETWORK 0x06
  216. #define CISTPL_FUNCID_AIMS 0x07
  217. #define CISTPL_FUNCID_SCSI 0x08
  218. /*
  219. * Fixed Disk FUNCE codes
  220. */
  221. #define CISTPL_IDE_INTERFACE 0x01
  222. #define CISTPL_FUNCE_IDE_IFACE 0x01
  223. #define CISTPL_FUNCE_IDE_MASTER 0x02
  224. #define CISTPL_FUNCE_IDE_SLAVE 0x03
  225. /* First feature byte */
  226. #define CISTPL_IDE_SILICON 0x04
  227. #define CISTPL_IDE_UNIQUE 0x08
  228. #define CISTPL_IDE_DUAL 0x10
  229. /* Second feature byte */
  230. #define CISTPL_IDE_HAS_SLEEP 0x01
  231. #define CISTPL_IDE_HAS_STANDBY 0x02
  232. #define CISTPL_IDE_HAS_IDLE 0x04
  233. #define CISTPL_IDE_LOW_POWER 0x08
  234. #define CISTPL_IDE_REG_INHIBIT 0x10
  235. #define CISTPL_IDE_HAS_INDEX 0x20
  236. #define CISTPL_IDE_IOIS16 0x40
  237. #endif
  238. #ifdef CONFIG_8xx
  239. extern u_int *pcmcia_pgcrx[];
  240. #define PCMCIA_PGCRX(slot) (*pcmcia_pgcrx[slot])
  241. #endif
  242. #if defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD)
  243. extern int check_ide_device(int slot);
  244. #endif
  245. #endif /* _PCMCIA_H */