pcmcia.h 7.5 KB

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