pcmcia.h 6.4 KB

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