hw_mmchs.h 131 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919
  1. //*****************************************************************************
  2. //
  3. // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
  4. //
  5. //
  6. // Redistribution and use in source and binary forms, with or without
  7. // modification, are permitted provided that the following conditions
  8. // are met:
  9. //
  10. // Redistributions of source code must retain the above copyright
  11. // notice, this list of conditions and the following disclaimer.
  12. //
  13. // Redistributions in binary form must reproduce the above copyright
  14. // notice, this list of conditions and the following disclaimer in the
  15. // documentation and/or other materials provided with the
  16. // distribution.
  17. //
  18. // Neither the name of Texas Instruments Incorporated nor the names of
  19. // its contributors may be used to endorse or promote products derived
  20. // from this software without specific prior written permission.
  21. //
  22. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. //
  34. //*****************************************************************************
  35. #ifndef __HW_MMCHS_H__
  36. #define __HW_MMCHS_H__
  37. //*****************************************************************************
  38. //
  39. // The following are defines for the MMCHS register offsets.
  40. //
  41. //*****************************************************************************
  42. #define MMCHS_O_HL_REV 0x00000000 // IP Revision Identifier (X.Y.R)
  43. // Used by software to track
  44. // features bugs and compatibility
  45. #define MMCHS_O_HL_HWINFO 0x00000004 // Information about the IP
  46. // module's hardware configuration
  47. // i.e. typically the module's HDL
  48. // generics (if any). Actual field
  49. // format and encoding is up to the
  50. // module's designer to decide.
  51. #define MMCHS_O_HL_SYSCONFIG 0x00000010 // Clock management configuration
  52. #define MMCHS_O_SYSCONFIG 0x00000110 // System Configuration Register
  53. // This register allows controlling
  54. // various parameters of the OCP
  55. // interface.
  56. #define MMCHS_O_SYSSTATUS 0x00000114 // System Status Register This
  57. // register provides status
  58. // information about the module
  59. // excluding the interrupt status
  60. // information
  61. #define MMCHS_O_CSRE 0x00000124 // Card status response error This
  62. // register enables the host
  63. // controller to detect card status
  64. // errors of response type R1 R1b
  65. // for all cards and of R5 R5b and
  66. // R6 response for cards types SD or
  67. // SDIO. When a bit MMCHS_CSRE[i] is
  68. // set to 1 if the corresponding bit
  69. // at the same position in the
  70. // response MMCHS_RSP0[i] is set to
  71. // 1 the host controller indicates a
  72. // card error (MMCHS_STAT[CERR])
  73. // interrupt status to avoid the
  74. // host driver reading the response
  75. // register (MMCHS_RSP0). Note: No
  76. // automatic card error detection
  77. // for autoCMD12 is implemented; the
  78. // host system has to check
  79. // autoCMD12 response register
  80. // (MMCHS_RESP76) for possible card
  81. // errors.
  82. #define MMCHS_O_SYSTEST 0x00000128 // System Test register This
  83. // register is used to control the
  84. // signals that connect to I/O pins
  85. // when the module is configured in
  86. // system test (SYSTEST) mode for
  87. // boundary connectivity
  88. // verification. Note: In SYSTEST
  89. // mode a write into MMCHS_CMD
  90. // register will not start a
  91. // transfer. The buffer behaves as a
  92. // stack accessible only by the
  93. // local host (push and pop
  94. // operations). In this mode the
  95. // Transfer Block Size
  96. // (MMCHS_BLK[BLEN]) and the Blocks
  97. // count for current transfer
  98. // (MMCHS_BLK[NBLK]) are needed to
  99. // generate a Buffer write ready
  100. // interrupt (MMCHS_STAT[BWR]) or a
  101. // Buffer read ready interrupt
  102. // (MMCHS_STAT[BRR]) and DMA
  103. // requests if enabled.
  104. #define MMCHS_O_CON 0x0000012C // Configuration register This
  105. // register is used: - to select the
  106. // functional mode or the SYSTEST
  107. // mode for any card. - to send an
  108. // initialization sequence to any
  109. // card. - to enable the detection
  110. // on DAT[1] of a card interrupt for
  111. // SDIO cards only. and also to
  112. // configure : - specific data and
  113. // command transfers for MMC cards
  114. // only. - the parameters related to
  115. // the card detect and write protect
  116. // input signals.
  117. #define MMCHS_O_PWCNT 0x00000130 // Power counter register This
  118. // register is used to program a mmc
  119. // counter to delay command
  120. // transfers after activating the
  121. // PAD power this value depends on
  122. // PAD characteristics and voltage.
  123. #define MMCHS_O_BLK 0x00000204 // Transfer Length Configuration
  124. // register MMCHS_BLK[BLEN] is the
  125. // block size register.
  126. // MMCHS_BLK[NBLK] is the block
  127. // count register. This register
  128. // shall be used for any card.
  129. #define MMCHS_O_ARG 0x00000208 // Command argument Register This
  130. // register contains command
  131. // argument specified as bit 39-8 of
  132. // Command-Format These registers
  133. // must be initialized prior to
  134. // sending the command itself to the
  135. // card (write action into the
  136. // register MMCHS_CMD register).
  137. // Only exception is for a command
  138. // index specifying stuff bits in
  139. // arguments making a write
  140. // unnecessary.
  141. #define MMCHS_O_CMD 0x0000020C // Command and transfer mode
  142. // register MMCHS_CMD[31:16] = the
  143. // command register MMCHS_CMD[15:0]
  144. // = the transfer mode. This
  145. // register configures the data and
  146. // command transfers. A write into
  147. // the most significant byte send
  148. // the command. A write into
  149. // MMCHS_CMD[15:0] registers during
  150. // data transfer has no effect. This
  151. // register shall be used for any
  152. // card. Note: In SYSTEST mode a
  153. // write into MMCHS_CMD register
  154. // will not start a transfer.
  155. #define MMCHS_O_RSP10 0x00000210 // Command response[31:0] Register
  156. // This 32-bit register holds bits
  157. // positions [31:0] of command
  158. // response type
  159. // R1/R1b/R2/R3/R4/R5/R5b/R6
  160. #define MMCHS_O_RSP32 0x00000214 // Command response[63:32] Register
  161. // This 32-bit register holds bits
  162. // positions [63:32] of command
  163. // response type R2
  164. #define MMCHS_O_RSP54 0x00000218 // Command response[95:64] Register
  165. // This 32-bit register holds bits
  166. // positions [95:64] of command
  167. // response type R2
  168. #define MMCHS_O_RSP76 0x0000021C // Command response[127:96]
  169. // Register This 32-bit register
  170. // holds bits positions [127:96] of
  171. // command response type R2
  172. #define MMCHS_O_DATA 0x00000220 // Data Register This register is
  173. // the 32-bit entry point of the
  174. // buffer for read or write data
  175. // transfers. The buffer size is
  176. // 32bits x256(1024 bytes). Bytes
  177. // within a word are stored and read
  178. // in little endian format. This
  179. // buffer can be used as two 512
  180. // byte buffers to transfer data
  181. // efficiently without reducing the
  182. // throughput. Sequential and
  183. // contiguous access is necessary to
  184. // increment the pointer correctly.
  185. // Random or skipped access is not
  186. // allowed. In little endian if the
  187. // local host accesses this register
  188. // byte-wise or 16bit-wise the least
  189. // significant byte (bits [7:0])
  190. // must always be written/read
  191. // first. The update of the buffer
  192. // address is done on the most
  193. // significant byte write for full
  194. // 32-bit DATA register or on the
  195. // most significant byte of the last
  196. // word of block transfer. Example
  197. // 1: Byte or 16-bit access
  198. // Mbyteen[3:0]=0001 (1-byte) =>
  199. // Mbyteen[3:0]=0010 (1-byte) =>
  200. // Mbyteen[3:0]=1100 (2-bytes) OK
  201. // Mbyteen[3:0]=0001 (1-byte) =>
  202. // Mbyteen[3:0]=0010 (1-byte) =>
  203. // Mbyteen[3:0]=0100 (1-byte) OK
  204. // Mbyteen[3:0]=0001 (1-byte) =>
  205. // Mbyteen[3:0]=0010 (1-byte) =>
  206. // Mbyteen[3:0]=1000 (1-byte) Bad
  207. #define MMCHS_O_PSTATE 0x00000224 // Present state register The Host
  208. // can get status of the Host
  209. // Controller from this 32-bit read
  210. // only register.
  211. #define MMCHS_O_HCTL 0x00000228 // Control register This register
  212. // defines the host controls to set
  213. // power wakeup and transfer
  214. // parameters. MMCHS_HCTL[31:24] =
  215. // Wakeup control MMCHS_HCTL[23:16]
  216. // = Block gap control
  217. // MMCHS_HCTL[15:8] = Power control
  218. // MMCHS_HCTL[7:0] = Host control
  219. #define MMCHS_O_SYSCTL 0x0000022C // SD system control register This
  220. // register defines the system
  221. // controls to set software resets
  222. // clock frequency management and
  223. // data timeout. MMCHS_SYSCTL[31:24]
  224. // = Software resets
  225. // MMCHS_SYSCTL[23:16] = Timeout
  226. // control MMCHS_SYSCTL[15:0] =
  227. // Clock control
  228. #define MMCHS_O_STAT 0x00000230 // Interrupt status register The
  229. // interrupt status regroups all the
  230. // status of the module internal
  231. // events that can generate an
  232. // interrupt. MMCHS_STAT[31:16] =
  233. // Error Interrupt Status
  234. // MMCHS_STAT[15:0] = Normal
  235. // Interrupt Status
  236. #define MMCHS_O_IE 0x00000234 // Interrupt SD enable register
  237. // This register allows to
  238. // enable/disable the module to set
  239. // status bits on an event-by-event
  240. // basis. MMCHS_IE[31:16] = Error
  241. // Interrupt Status Enable
  242. // MMCHS_IE[15:0] = Normal Interrupt
  243. // Status Enable
  244. #define MMCHS_O_ISE 0x00000238 // Interrupt signal enable register
  245. // This register allows to
  246. // enable/disable the module
  247. // internal sources of status on an
  248. // event-by-event basis.
  249. // MMCHS_ISE[31:16] = Error
  250. // Interrupt Signal Enable
  251. // MMCHS_ISE[15:0] = Normal
  252. // Interrupt Signal Enable
  253. #define MMCHS_O_AC12 0x0000023C // Auto CMD12 Error Status Register
  254. // The host driver may determine
  255. // which of the errors cases related
  256. // to Auto CMD12 has occurred by
  257. // checking this MMCHS_AC12 register
  258. // when an Auto CMD12 Error
  259. // interrupt occurs. This register
  260. // is valid only when Auto CMD12 is
  261. // enabled (MMCHS_CMD[ACEN]) and
  262. // Auto CMD12Error (MMCHS_STAT[ACE])
  263. // is set to 1. Note: These bits are
  264. // automatically reset when starting
  265. // a new adtc command with data.
  266. #define MMCHS_O_CAPA 0x00000240 // Capabilities register This
  267. // register lists the capabilities
  268. // of the MMC/SD/SDIO host
  269. // controller.
  270. #define MMCHS_O_CUR_CAPA 0x00000248 // Maximum current capabilities
  271. // Register This register indicates
  272. // the maximum current capability
  273. // for each voltage. The value is
  274. // meaningful if the voltage support
  275. // is set in the capabilities
  276. // register (MMCHS_CAPA).
  277. // Initialization of this register
  278. // (via a write access to this
  279. // register) depends on the system
  280. // capabilities. The host driver
  281. // shall not modify this register
  282. // after the initilaization. This
  283. // register is only reinitialized by
  284. // a hard reset (via RESETN signal)
  285. #define MMCHS_O_FE 0x00000250 // Force Event Register for Error
  286. // Interrupt status The force Event
  287. // Register is not a physically
  288. // implemented register. Rather it
  289. // is an address at which the Error
  290. // Interrupt Status register can be
  291. // written. The effect of a write to
  292. // this address will be reflected in
  293. // the Error Interrupt Status
  294. // Register if corresponding bit of
  295. // the Error Interrupt Status Enable
  296. // Register is set.
  297. #define MMCHS_O_ADMAES 0x00000254 // ADMA Error Status Register When
  298. // ADMA Error Interrupt is occurred
  299. // the ADMA Error States field in
  300. // this register holds the ADMA
  301. // state and the ADMA System Address
  302. // Register holds the address around
  303. // the error descriptor. For
  304. // recovering the error the Host
  305. // Driver requires the ADMA state to
  306. // identify the error descriptor
  307. // address as follows: ST_STOP:
  308. // Previous location set in the ADMA
  309. // System Address register is the
  310. // error descriptor address ST_FDS:
  311. // Current location set in the ADMA
  312. // System Address register is the
  313. // error descriptor address ST_CADR:
  314. // This sate is never set because do
  315. // not generate ADMA error in this
  316. // state. ST_TFR: Previous location
  317. // set in the ADMA System Address
  318. // register is the error descriptor
  319. // address In case of write
  320. // operation the Host Driver should
  321. // use ACMD22 to get the number of
  322. // written block rather than using
  323. // this information since unwritten
  324. // data may exist in the Host
  325. // Controller. The Host Controller
  326. // generates the ADMA Error
  327. // Interrupt when it detects invalid
  328. // descriptor data (Valid=0) at the
  329. // ST_FDS state. In this case ADMA
  330. // Error State indicates that an
  331. // error occurs at ST_FDS state. The
  332. // Host Driver may find that the
  333. // Valid bit is not set in the error
  334. // descriptor.
  335. #define MMCHS_O_ADMASAL 0x00000258 // ADMA System address Low bits
  336. #define MMCHS_O_REV 0x000002FC // Versions Register This register
  337. // contains the hard coded RTL
  338. // vendor revision number the
  339. // version number of SD
  340. // specification compliancy and a
  341. // slot status bit. MMCHS_REV[31:16]
  342. // = Host controller version
  343. // MMCHS_REV[15:0] = Slot Interrupt
  344. // Status
  345. //******************************************************************************
  346. //
  347. // The following are defines for the bit fields in the MMCHS_O_HL_REV register.
  348. //
  349. //******************************************************************************
  350. #define MMCHS_HL_REV_SCHEME_M 0xC0000000
  351. #define MMCHS_HL_REV_SCHEME_S 30
  352. #define MMCHS_HL_REV_FUNC_M 0x0FFF0000 // Function indicates a software
  353. // compatible module family. If
  354. // there is no level of software
  355. // compatibility a new Func number
  356. // (and hence REVISION) should be
  357. // assigned.
  358. #define MMCHS_HL_REV_FUNC_S 16
  359. #define MMCHS_HL_REV_R_RTL_M 0x0000F800 // RTL Version (R) maintained by IP
  360. // design owner. RTL follows a
  361. // numbering such as X.Y.R.Z which
  362. // are explained in this table. R
  363. // changes ONLY when: (1) PDS
  364. // uploads occur which may have been
  365. // due to spec changes (2) Bug fixes
  366. // occur (3) Resets to '0' when X or
  367. // Y changes. Design team has an
  368. // internal 'Z' (customer invisible)
  369. // number which increments on every
  370. // drop that happens due to DV and
  371. // RTL updates. Z resets to 0 when R
  372. // increments.
  373. #define MMCHS_HL_REV_R_RTL_S 11
  374. #define MMCHS_HL_REV_X_MAJOR_M 0x00000700 // Major Revision (X) maintained by
  375. // IP specification owner. X changes
  376. // ONLY when: (1) There is a major
  377. // feature addition. An example
  378. // would be adding Master Mode to
  379. // Utopia Level2. The Func field (or
  380. // Class/Type in old PID format)
  381. // will remain the same. X does NOT
  382. // change due to: (1) Bug fixes (2)
  383. // Change in feature parameters.
  384. #define MMCHS_HL_REV_X_MAJOR_S 8
  385. #define MMCHS_HL_REV_CUSTOM_M 0x000000C0
  386. #define MMCHS_HL_REV_CUSTOM_S 6
  387. #define MMCHS_HL_REV_Y_MINOR_M 0x0000003F // Minor Revision (Y) maintained by
  388. // IP specification owner. Y changes
  389. // ONLY when: (1) Features are
  390. // scaled (up or down). Flexibility
  391. // exists in that this feature
  392. // scalability may either be
  393. // represented in the Y change or a
  394. // specific register in the IP that
  395. // indicates which features are
  396. // exactly available. (2) When
  397. // feature creeps from Is-Not list
  398. // to Is list. But this may not be
  399. // the case once it sees silicon; in
  400. // which case X will change. Y does
  401. // NOT change due to: (1) Bug fixes
  402. // (2) Typos or clarifications (3)
  403. // major functional/feature
  404. // change/addition/deletion. Instead
  405. // these changes may be reflected
  406. // via R S X as applicable. Spec
  407. // owner maintains a
  408. // customer-invisible number 'S'
  409. // which changes due to: (1)
  410. // Typos/clarifications (2) Bug
  411. // documentation. Note that this bug
  412. // is not due to a spec change but
  413. // due to implementation.
  414. // Nevertheless the spec tracks the
  415. // IP bugs. An RTL release (say for
  416. // silicon PG1.1) that occurs due to
  417. // bug fix should document the
  418. // corresponding spec number (X.Y.S)
  419. // in its release notes.
  420. #define MMCHS_HL_REV_Y_MINOR_S 0
  421. //******************************************************************************
  422. //
  423. // The following are defines for the bit fields in the MMCHS_O_HL_HWINFO register.
  424. //
  425. //******************************************************************************
  426. #define MMCHS_HL_HWINFO_RETMODE 0x00000040
  427. #define MMCHS_HL_HWINFO_MEM_SIZE_M \
  428. 0x0000003C
  429. #define MMCHS_HL_HWINFO_MEM_SIZE_S 2
  430. #define MMCHS_HL_HWINFO_MERGE_MEM \
  431. 0x00000002
  432. #define MMCHS_HL_HWINFO_MADMA_EN \
  433. 0x00000001
  434. //******************************************************************************
  435. //
  436. // The following are defines for the bit fields in the
  437. // MMCHS_O_HL_SYSCONFIG register.
  438. //
  439. //******************************************************************************
  440. #define MMCHS_HL_SYSCONFIG_STANDBYMODE_M \
  441. 0x00000030 // Configuration of the local
  442. // initiator state management mode.
  443. // By definition initiator may
  444. // generate read/write transaction
  445. // as long as it is out of STANDBY
  446. // state. 0x0 Force-standby mode:
  447. // local initiator is
  448. // unconditionally placed in standby
  449. // state.Backup mode for debug only.
  450. // 0x1 No-standby mode: local
  451. // initiator is unconditionally
  452. // placed out of standby
  453. // state.Backup mode for debug only.
  454. // 0x2 Smart-standby mode: local
  455. // initiator standby status depends
  456. // on local conditions i.e. the
  457. // module's functional requirement
  458. // from the initiator.IP module
  459. // shall not generate
  460. // (initiator-related) wakeup
  461. // events. 0x3 "Smart-Standby
  462. // wakeup-capable mode: local
  463. // initiator standby status depends
  464. // on local conditions i.e. the
  465. // module's functional requirement
  466. // from the initiator. IP module may
  467. // generate (master-related) wakeup
  468. // events when in standby state.Mode
  469. // is only relevant if the
  470. // appropriate IP module ""mwakeup""
  471. // output is implemented."
  472. #define MMCHS_HL_SYSCONFIG_STANDBYMODE_S 4
  473. #define MMCHS_HL_SYSCONFIG_IDLEMODE_M \
  474. 0x0000000C // Configuration of the local
  475. // target state management mode. By
  476. // definition target can handle
  477. // read/write transaction as long as
  478. // it is out of IDLE state. 0x0
  479. // Force-idle mode: local target's
  480. // idle state follows (acknowledges)
  481. // the system's idle requests
  482. // unconditionally i.e. regardless
  483. // of the IP module's internal
  484. // requirements.Backup mode for
  485. // debug only. 0x1 No-idle mode:
  486. // local target never enters idle
  487. // state.Backup mode for debug only.
  488. // 0x2 Smart-idle mode: local
  489. // target's idle state eventually
  490. // follows (acknowledges) the
  491. // system's idle requests depending
  492. // on the IP module's internal
  493. // requirements.IP module shall not
  494. // generate (IRQ- or
  495. // DMA-request-related) wakeup
  496. // events. 0x3 "Smart-idle
  497. // wakeup-capable mode: local
  498. // target's idle state eventually
  499. // follows (acknowledges) the
  500. // system's idle requests depending
  501. // on the IP module's internal
  502. // requirements.IP module may
  503. // generate (IRQ- or
  504. // DMA-request-related) wakeup
  505. // events when in idle state.Mode is
  506. // only relevant if the appropriate
  507. // IP module ""swakeup"" output(s)
  508. // is (are) implemented."
  509. #define MMCHS_HL_SYSCONFIG_IDLEMODE_S 2
  510. #define MMCHS_HL_SYSCONFIG_FREEEMU \
  511. 0x00000002 // Sensitivity to emulation (debug)
  512. // suspend input signal.
  513. // Functionality NOT implemented in
  514. // MMCHS. 0 IP module is sensitive
  515. // to emulation suspend 1 IP module
  516. // is not sensitive to emulation
  517. // suspend
  518. #define MMCHS_HL_SYSCONFIG_SOFTRESET \
  519. 0x00000001
  520. //******************************************************************************
  521. //
  522. // The following are defines for the bit fields in the MMCHS_O_SYSCONFIG register.
  523. //
  524. //******************************************************************************
  525. #define MMCHS_SYSCONFIG_STANDBYMODE_M \
  526. 0x00003000 // Master interface power
  527. // Management standby/wait control.
  528. // The bit field is only useful when
  529. // generic parameter MADMA_EN
  530. // (Master ADMA enable) is set as
  531. // active otherwise it is a read
  532. // only register read a '0'. 0x0
  533. // Force-standby. Mstandby is forced
  534. // unconditionnaly. 0x1 No-standby.
  535. // Mstandby is never asserted. 0x2
  536. // Smart-standby mode: local
  537. // initiator standby status depends
  538. // on local conditions i.e. the
  539. // module's functional requirement
  540. // from the initiator.IP module
  541. // shall not generate
  542. // (initiator-related) wakeup
  543. // events. 0x3 Smart-Standby
  544. // wakeup-capable mode: "local
  545. // initiator standby status depends
  546. // on local conditions i.e. the
  547. // module's functional requirement
  548. // from the initiator. IP module may
  549. // generate (master-related) wakeup
  550. // events when in standby state.Mode
  551. // is only relevant if the
  552. // appropriate IP module ""mwakeup""
  553. // output is implemented."
  554. #define MMCHS_SYSCONFIG_STANDBYMODE_S 12
  555. #define MMCHS_SYSCONFIG_CLOCKACTIVITY_M \
  556. 0x00000300 // Clocks activity during wake up
  557. // mode period. Bit8: OCP interface
  558. // clock Bit9: Functional clock 0x0
  559. // OCP and Functional clock may be
  560. // switched off. 0x1 OCP clock is
  561. // maintained. Functional clock may
  562. // be switched-off. 0x2 Functional
  563. // clock is maintained. OCP clock
  564. // may be switched-off. 0x3 OCP and
  565. // Functional clocks are maintained.
  566. #define MMCHS_SYSCONFIG_CLOCKACTIVITY_S 8
  567. #define MMCHS_SYSCONFIG_SIDLEMODE_M \
  568. 0x00000018 // Power management 0x0 If an idle
  569. // request is detected the MMCHS
  570. // acknowledges it unconditionally
  571. // and goes in Inactive mode.
  572. // Interrupt and DMA requests are
  573. // unconditionally de-asserted. 0x1
  574. // If an idle request is detected
  575. // the request is ignored and the
  576. // module keeps on behaving
  577. // normally. 0x2 Smart-idle mode:
  578. // local target's idle state
  579. // eventually follows (acknowledges)
  580. // the system's idle requests
  581. // depending on the IP module's
  582. // internal requirements.IP module
  583. // shall not generate (IRQ- or
  584. // DMA-request-related) wakeup
  585. // events. 0x3 Smart-idle
  586. // wakeup-capable mode: "local
  587. // target's idle state eventually
  588. // follows (acknowledges) the
  589. // system's idle requests depending
  590. // on the IP module's internal
  591. // requirements.IP module may
  592. // generate (IRQ- or
  593. // DMA-request-related) wakeup
  594. // events when in idle state.Mode is
  595. // only relevant if the appropriate
  596. // IP module ""swakeup"" output(s)
  597. // is (are) implemented."
  598. #define MMCHS_SYSCONFIG_SIDLEMODE_S 3
  599. #define MMCHS_SYSCONFIG_ENAWAKEUP \
  600. 0x00000004 // Wakeup feature control 0 Wakeup
  601. // capability is disabled 1 Wakeup
  602. // capability is enabled
  603. #define MMCHS_SYSCONFIG_SOFTRESET \
  604. 0x00000002
  605. #define MMCHS_SYSCONFIG_AUTOIDLE \
  606. 0x00000001 // Internal Clock gating strategy 0
  607. // Clocks are free-running 1
  608. // Automatic clock gating strategy
  609. // is applied based on the OCP and
  610. // MMC interface activity
  611. //******************************************************************************
  612. //
  613. // The following are defines for the bit fields in the MMCHS_O_SYSSTATUS register.
  614. //
  615. //******************************************************************************
  616. #define MMCHS_SYSSTATUS_RESETDONE \
  617. 0x00000001
  618. //******************************************************************************
  619. //
  620. // The following are defines for the bit fields in the MMCHS_O_CSRE register.
  621. //
  622. //******************************************************************************
  623. #define MMCHS_CSRE_CSRE_M 0xFFFFFFFF // Card status response error
  624. #define MMCHS_CSRE_CSRE_S 0
  625. //******************************************************************************
  626. //
  627. // The following are defines for the bit fields in the MMCHS_O_SYSTEST register.
  628. //
  629. //******************************************************************************
  630. #define MMCHS_SYSTEST_OBI 0x00010000
  631. #define MMCHS_SYSTEST_SDCD 0x00008000
  632. #define MMCHS_SYSTEST_SDWP 0x00004000
  633. #define MMCHS_SYSTEST_WAKD 0x00002000
  634. #define MMCHS_SYSTEST_SSB 0x00001000
  635. #define MMCHS_SYSTEST_D7D 0x00000800
  636. #define MMCHS_SYSTEST_D6D 0x00000400
  637. #define MMCHS_SYSTEST_D5D 0x00000200
  638. #define MMCHS_SYSTEST_D4D 0x00000100
  639. #define MMCHS_SYSTEST_D3D 0x00000080
  640. #define MMCHS_SYSTEST_D2D 0x00000040
  641. #define MMCHS_SYSTEST_D1D 0x00000020
  642. #define MMCHS_SYSTEST_D0D 0x00000010
  643. #define MMCHS_SYSTEST_DDIR 0x00000008
  644. #define MMCHS_SYSTEST_CDAT 0x00000004
  645. #define MMCHS_SYSTEST_CDIR 0x00000002
  646. #define MMCHS_SYSTEST_MCKD 0x00000001
  647. //******************************************************************************
  648. //
  649. // The following are defines for the bit fields in the MMCHS_O_CON register.
  650. //
  651. //******************************************************************************
  652. #define MMCHS_CON_SDMA_LNE 0x00200000 // Slave DMA Level/Edge Request:
  653. // The waveform of the DMA request
  654. // can be configured either edge
  655. // sensitive with early de-assertion
  656. // on first access to MMCHS_DATA
  657. // register or late de-assertion
  658. // request remains active until last
  659. // allowed data written into
  660. // MMCHS_DATA. 0 Slave DMA edge
  661. // sensitive Early DMA de-assertion
  662. // 1 Slave DMA level sensitive Late
  663. // DMA de-assertion
  664. #define MMCHS_CON_DMA_MNS 0x00100000 // DMA Master or Slave selection:
  665. // When this bit is set and the
  666. // controller is configured to use
  667. // the DMA Ocp master interface is
  668. // used to get datas from system
  669. // using ADMA2 procedure (direct
  670. // access to the memory).This option
  671. // is only available if generic
  672. // parameter MADMA_EN is asserted to
  673. // '1'. 0 The controller is slave on
  674. // data transfers with system. 1 The
  675. // controller is master on data
  676. // exchange with system controller
  677. // must be configured as using DMA.
  678. #define MMCHS_CON_DDR 0x00080000 // Dual Data Rate mode: When this
  679. // register is set the controller
  680. // uses both clock edge to emit or
  681. // receive data. Odd bytes are
  682. // transmitted on falling edges and
  683. // even bytes are transmitted on
  684. // rise edges. It only applies on
  685. // Data bytes and CRC Start end bits
  686. // and CRC status are kept full
  687. // cycle. This bit field is only
  688. // meaningful and active for even
  689. // clock divider ratio of
  690. // MMCHS_SYSCTL[CLKD] it is
  691. // insensitive to MMCHS_HCTL[HSPE]
  692. // setting. 0 Standard mode : data
  693. // are transmitted on a single edge
  694. // depending on MMCHS_HCTRL[HSPE]. 1
  695. // Data Bytes and CRC are
  696. // transmitted on both edge.
  697. #define MMCHS_CON_BOOT_CF0 0x00040000
  698. #define MMCHS_CON_BOOT_ACK 0x00020000 // Book acknowledge received: When
  699. // this bit is set the controller
  700. // should receive a boot status on
  701. // DAT0 line after next command
  702. // issued. If no status is received
  703. // a data timeout will be generated.
  704. // 0 No acknowledge to be received 1
  705. // A boot status will be received on
  706. // DAT0 line after issuing a
  707. // command.
  708. #define MMCHS_CON_CLKEXTFREE 0x00010000 // External clock free running:
  709. // This register is used to maintain
  710. // card clock out of transfer
  711. // transaction to enable slave
  712. // module for example to generate a
  713. // synchronous interrupt on DAT[1].
  714. // The Clock will be maintain only
  715. // if MMCHS_SYSCTL[CEN] is set. 0
  716. // External card clock is cut off
  717. // outside active transaction
  718. // period. 1 External card clock is
  719. // maintain even out of active
  720. // transaction period only if
  721. // MMCHS_SYSCTL[CEN] is set.
  722. #define MMCHS_CON_PADEN 0x00008000 // Control Power for MMC Lines:
  723. // This register is only useful when
  724. // MMC PADs contain power saving
  725. // mechanism to minimize its leakage
  726. // power. It works as a GPIO that
  727. // directly control the ACTIVE pin
  728. // of PADs. Excepted for DAT[1] the
  729. // signal is also combine outside
  730. // the module with the dedicated
  731. // power control MMCHS_CON[CTPL]
  732. // bit. 0 ADPIDLE module pin is not
  733. // forced it is automatically
  734. // generated by the MMC fsms. 1
  735. // ADPIDLE module pin is forced to
  736. // active state.
  737. #define MMCHS_CON_OBIE 0x00004000 // Out-of-Band Interrupt Enable MMC
  738. // cards only: This bit enables the
  739. // detection of Out-of-Band
  740. // Interrupt on MMCOBI input pin.
  741. // The usage of the Out-of-Band
  742. // signal (OBI) is optional and
  743. // depends on the system
  744. // integration. 0 Out-of-Band
  745. // interrupt detection disabled 1
  746. // Out-of-Band interrupt detection
  747. // enabled
  748. #define MMCHS_CON_OBIP 0x00002000 // Out-of-Band Interrupt Polarity
  749. // MMC cards only: This bit selects
  750. // the active level of the
  751. // out-of-band interrupt coming from
  752. // MMC cards. The usage of the
  753. // Out-of-Band signal (OBI) is
  754. // optional and depends on the
  755. // system integration. 0 active high
  756. // level 1 active low level
  757. #define MMCHS_CON_CEATA 0x00001000 // CE-ATA control mode MMC cards
  758. // compliant with CE-ATA:By default
  759. // this bit is set to 0. It is use
  760. // to indicate that next commands
  761. // are considered as specific CE-ATA
  762. // commands that potentially use
  763. // 'command completion' features. 0
  764. // Standard MMC/SD/SDIO mode. 1
  765. // CE-ATA mode next commands are
  766. // considered as CE-ATA commands.
  767. #define MMCHS_CON_CTPL 0x00000800 // Control Power for DAT[1] line
  768. // MMC and SD cards: By default this
  769. // bit is set to 0 and the host
  770. // controller automatically disables
  771. // all the input buffers outside of
  772. // a transaction to minimize the
  773. // leakage current. SDIO cards: When
  774. // this bit is set to 1 the host
  775. // controller automatically disables
  776. // all the input buffers except the
  777. // buffer of DAT[1] outside of a
  778. // transaction in order to detect
  779. // asynchronous card interrupt on
  780. // DAT[1] line and minimize the
  781. // leakage current of the buffers. 0
  782. // Disable all the input buffers
  783. // outside of a transaction. 1
  784. // Disable all the input buffers
  785. // except the buffer of DAT[1]
  786. // outside of a transaction.
  787. #define MMCHS_CON_DVAL_M 0x00000600 // Debounce filter value All cards
  788. // This register is used to define a
  789. // debounce period to filter the
  790. // card detect input signal (SDCD).
  791. // The usage of the card detect
  792. // input signal (SDCD) is optional
  793. // and depends on the system
  794. // integration and the type of the
  795. // connector housing that
  796. // accommodates the card. 0x0 33 us
  797. // debounce period 0x1 231 us
  798. // debounce period 0x2 1 ms debounce
  799. // period 0x3 84 ms debounce period
  800. #define MMCHS_CON_DVAL_S 9
  801. #define MMCHS_CON_WPP 0x00000100 // Write protect polarity For SD
  802. // and SDIO cards only This bit
  803. // selects the active level of the
  804. // write protect input signal
  805. // (SDWP). The usage of the write
  806. // protect input signal (SDWP) is
  807. // optional and depends on the
  808. // system integration and the type
  809. // of the connector housing that
  810. // accommodates the card. 0 active
  811. // high level 1 active low level
  812. #define MMCHS_CON_CDP 0x00000080 // Card detect polarity All cards
  813. // This bit selects the active level
  814. // of the card detect input signal
  815. // (SDCD). The usage of the card
  816. // detect input signal (SDCD) is
  817. // optional and depends on the
  818. // system integration and the type
  819. // of the connector housing that
  820. // accommodates the card. 0 active
  821. // high level 1 active low level
  822. #define MMCHS_CON_MIT 0x00000040 // MMC interrupt command Only for
  823. // MMC cards. This bit must be set
  824. // to 1 when the next write access
  825. // to the command register
  826. // (MMCHS_CMD) is for writing a MMC
  827. // interrupt command (CMD40)
  828. // requiring the command timeout
  829. // detection to be disabled for the
  830. // command response. 0 Command
  831. // timeout enabled 1 Command timeout
  832. // disabled
  833. #define MMCHS_CON_DW8 0x00000020 // 8-bit mode MMC select For
  834. // SD/SDIO cards this bit must be
  835. // set to 0. For MMC card this bit
  836. // must be set following a valid
  837. // SWITCH command (CMD6) with the
  838. // correct value and extend CSD
  839. // index written in the argument.
  840. // Prior to this command the MMC
  841. // card configuration register (CSD
  842. // and EXT_CSD) must be verified for
  843. // compliancy with MMC standard
  844. // specification 4.x (see section
  845. // 3.6). 0 1-bit or 4-bit Data width
  846. // (DAT[0] used MMC SD cards) 1
  847. // 8-bit Data width (DAT[7:0] used
  848. // MMC cards)
  849. #define MMCHS_CON_MODE 0x00000010 // Mode select All cards These bits
  850. // select between Functional mode
  851. // and SYSTEST mode. 0 Functional
  852. // mode. Transfers to the
  853. // MMC/SD/SDIO cards follow the card
  854. // protocol. MMC clock is enabled.
  855. // MMC/SD transfers are operated
  856. // under the control of the CMD
  857. // register. 1 SYSTEST mode The
  858. // signal pins are configured as
  859. // general-purpose input/output and
  860. // the 1024-byte buffer is
  861. // configured as a stack memory
  862. // accessible only by the local host
  863. // or system DMA. The pins retain
  864. // their default type (input output
  865. // or in-out). SYSTEST mode is
  866. // operated under the control of the
  867. // SYSTEST register.
  868. #define MMCHS_CON_STR 0x00000008 // Stream command Only for MMC
  869. // cards. This bit must be set to 1
  870. // only for the stream data
  871. // transfers (read or write) of the
  872. // adtc commands. Stream read is a
  873. // class 1 command (CMD11:
  874. // READ_DAT_UNTIL_STOP). Stream
  875. // write is a class 3 command
  876. // (CMD20: WRITE_DAT_UNTIL_STOP). 0
  877. // Block oriented data transfer 1
  878. // Stream oriented data transfer
  879. #define MMCHS_CON_HR 0x00000004 // Broadcast host response Only for
  880. // MMC cards. This register is used
  881. // to force the host to generate a
  882. // 48-bit response for bc command
  883. // type. "It can be used to
  884. // terminate the interrupt mode by
  885. // generating a CMD40 response by
  886. // the core (see section 4.3
  887. // ""Interrupt Mode"" in the MMC [1]
  888. // specification). In order to have
  889. // the host response to be generated
  890. // in open drain mode the register
  891. // MMCHS_CON[OD] must be set to 1."
  892. // When MMCHS_CON[CEATA] is set to 1
  893. // and MMCHS_ARG set to 0x00000000
  894. // when writing 0x00000000 into
  895. // MMCHS_CMD register the host
  896. // controller performs a 'command
  897. // completion signal disable' token
  898. // i.e. CMD line held to '0' during
  899. // 47 cycles followed by a 1. 0 The
  900. // host does not generate a 48-bit
  901. // response instead of a command. 1
  902. // The host generates a 48-bit
  903. // response instead of a command or
  904. // a command completion signal
  905. // disable token.
  906. #define MMCHS_CON_INIT 0x00000002 // Send initialization stream All
  907. // cards. When this bit is set to 1
  908. // and the card is idle an
  909. // initialization sequence is sent
  910. // to the card. "An initialization
  911. // sequence consists of setting the
  912. // CMD line to 1 during 80 clock
  913. // cycles. The initialisation
  914. // sequence is mandatory - but it is
  915. // not required to do it through
  916. // this bit - this bit makes it
  917. // easier. Clock divider
  918. // (MMCHS_SYSCTL[CLKD]) should be
  919. // set to ensure that 80 clock
  920. // periods are greater than 1ms.
  921. // (see section 9.3 ""Power-Up"" in
  922. // the MMC card specification [1] or
  923. // section 6.4 in the SD card
  924. // specification [2])." Note: in
  925. // this mode there is no command
  926. // sent to the card and no response
  927. // is expected 0 The host does not
  928. // send an initialization sequence.
  929. // 1 The host sends an
  930. // initialization sequence.
  931. #define MMCHS_CON_OD 0x00000001 // Card open drain mode. Only for
  932. // MMC cards. This bit must be set
  933. // to 1 for MMC card commands 1 2 3
  934. // and 40 and if the MMC card bus is
  935. // operating in open-drain mode
  936. // during the response phase to the
  937. // command sent. Typically during
  938. // card identification mode when the
  939. // card is either in idle ready or
  940. // ident state. It is also necessary
  941. // to set this bit to 1 for a
  942. // broadcast host response (see
  943. // Broadcast host response register
  944. // MMCHS_CON[HR]) 0 No Open Drain 1
  945. // Open Drain or Broadcast host
  946. // response
  947. //******************************************************************************
  948. //
  949. // The following are defines for the bit fields in the MMCHS_O_PWCNT register.
  950. //
  951. //******************************************************************************
  952. #define MMCHS_PWCNT_PWRCNT_M 0x0000FFFF // Power counter register. This
  953. // register is used to introduce a
  954. // delay between the PAD ACTIVE pin
  955. // assertion and the command issued.
  956. // 0x0000 No additional delay added
  957. // 0x0001 TCF delay (card clock
  958. // period) 0x0002 TCF x 2 delay
  959. // (card clock period) 0xFFFE TCF x
  960. // 65534 delay (card clock period)
  961. // 0xFFFF TCF x 65535 delay (card
  962. // clock period)
  963. #define MMCHS_PWCNT_PWRCNT_S 0
  964. //******************************************************************************
  965. //
  966. // The following are defines for the bit fields in the MMCHS_O_BLK register.
  967. //
  968. //******************************************************************************
  969. #define MMCHS_BLK_NBLK_M 0xFFFF0000 // Blocks count for current
  970. // transfer This register is enabled
  971. // when Block count Enable
  972. // (MMCHS_CMD[BCE]) is set to 1 and
  973. // is valid only for multiple block
  974. // transfers. Setting the block
  975. // count to 0 results no data blocks
  976. // being transferred. Note: The host
  977. // controller decrements the block
  978. // count after each block transfer
  979. // and stops when the count reaches
  980. // zero. This register can be
  981. // accessed only if no transaction
  982. // is executing (i.e after a
  983. // transaction has stopped). Read
  984. // operations during transfers may
  985. // return an invalid value and write
  986. // operation will be ignored. In
  987. // suspend context the number of
  988. // blocks yet to be transferred can
  989. // be determined by reading this
  990. // register. When restoring transfer
  991. // context prior to issuing a Resume
  992. // command The local host shall
  993. // restore the previously saved
  994. // block count. 0x0000 Stop count
  995. // 0x0001 1 block 0x0002 2 blocks
  996. // 0xFFFF 65535 blocks
  997. #define MMCHS_BLK_NBLK_S 16
  998. #define MMCHS_BLK_BLEN_M 0x00000FFF // Transfer Block Size. This
  999. // register specifies the block size
  1000. // for block data transfers. Read
  1001. // operations during transfers may
  1002. // return an invalid value and write
  1003. // operations are ignored. When a
  1004. // CMD12 command is issued to stop
  1005. // the transfer a read of the BLEN
  1006. // field after transfer completion
  1007. // (MMCHS_STAT[TC] set to 1) will
  1008. // not return the true byte number
  1009. // of data length while the stop
  1010. // occurs but the value written in
  1011. // this register before transfer is
  1012. // launched. 0x000 No data transfer
  1013. // 0x001 1 byte block length 0x002 2
  1014. // bytes block length 0x003 3 bytes
  1015. // block length 0x1FF 511 bytes
  1016. // block length 0x200 512 bytes
  1017. // block length 0x7FF 2047 bytes
  1018. // block length 0x800 2048 bytes
  1019. // block length
  1020. #define MMCHS_BLK_BLEN_S 0
  1021. //******************************************************************************
  1022. //
  1023. // The following are defines for the bit fields in the MMCHS_O_ARG register.
  1024. //
  1025. //******************************************************************************
  1026. #define MMCHS_ARG_ARG_M 0xFFFFFFFF // Command argument bits [31:0]
  1027. #define MMCHS_ARG_ARG_S 0
  1028. //******************************************************************************
  1029. //
  1030. // The following are defines for the bit fields in the MMCHS_O_CMD register.
  1031. //
  1032. //******************************************************************************
  1033. #define MMCHS_CMD_INDX_M 0x3F000000 // Command index Binary encoded
  1034. // value from 0 to 63 specifying the
  1035. // command number send to card 0x00
  1036. // CMD0 or ACMD0 0x01 CMD1 or ACMD1
  1037. // 0x02 CMD2 or ACMD2 0x03 CMD3 or
  1038. // ACMD3 0x04 CMD4 or ACMD4 0x05
  1039. // CMD5 or ACMD5 0x06 CMD6 or ACMD6
  1040. // 0x07 CMD7 or ACMD7 0x08 CMD8 or
  1041. // ACMD8 0x09 CMD9 or ACMD9 0x0A
  1042. // CMD10 or ACMD10 0x0B CMD11 or
  1043. // ACMD11 0x0C CMD12 or ACMD12 0x0D
  1044. // CMD13 or ACMD13 0x0E CMD14 or
  1045. // ACMD14 0x0F CMD15 or ACMD15 0x10
  1046. // CMD16 or ACMD16 0x11 CMD17 or
  1047. // ACMD17 0x12 CMD18 or ACMD18 0x13
  1048. // CMD19 or ACMD19 0x14 CMD20 or
  1049. // ACMD20 0x15 CMD21 or ACMD21 0x16
  1050. // CMD22 or ACMD22 0x17 CMD23 or
  1051. // ACMD23 0x18 CMD24 or ACMD24 0x19
  1052. // CMD25 or ACMD25 0x1A CMD26 or
  1053. // ACMD26 0x1B CMD27 or ACMD27 0x1C
  1054. // CMD28 or ACMD28 0x1D CMD29 or
  1055. // ACMD29 0x1E CMD30 or ACMD30 0x1F
  1056. // CMD31 or ACMD31 0x20 CMD32 or
  1057. // ACMD32 0x21 CMD33 or ACMD33 0x22
  1058. // CMD34 or ACMD34 0x23 CMD35 or
  1059. // ACMD35 0x24 CMD36 or ACMD36 0x25
  1060. // CMD37 or ACMD37 0x26 CMD38 or
  1061. // ACMD38 0x27 CMD39 or ACMD39 0x28
  1062. // CMD40 or ACMD40 0x29 CMD41 or
  1063. // ACMD41 0x2A CMD42 or ACMD42 0x2B
  1064. // CMD43 or ACMD43 0x2C CMD44 or
  1065. // ACMD44 0x2D CMD45 or ACMD45 0x2E
  1066. // CMD46 or ACMD46 0x2F CMD47 or
  1067. // ACMD47 0x30 CMD48 or ACMD48 0x31
  1068. // CMD49 or ACMD49 0x32 CMD50 or
  1069. // ACMD50 0x33 CMD51 or ACMD51 0x34
  1070. // CMD52 or ACMD52 0x35 CMD53 or
  1071. // ACMD53 0x36 CMD54 or ACMD54 0x37
  1072. // CMD55 or ACMD55 0x38 CMD56 or
  1073. // ACMD56 0x39 CMD57 or ACMD57 0x3A
  1074. // CMD58 or ACMD58 0x3B CMD59 or
  1075. // ACMD59 0x3C CMD60 or ACMD60 0x3D
  1076. // CMD61 or ACMD61 0x3E CMD62 or
  1077. // ACMD62 0x3F CMD63 or ACMD63
  1078. #define MMCHS_CMD_INDX_S 24
  1079. #define MMCHS_CMD_CMD_TYPE_M 0x00C00000 // Command type This register
  1080. // specifies three types of special
  1081. // command: Suspend Resume and
  1082. // Abort. These bits shall be set to
  1083. // 00b for all other commands. 0x0
  1084. // Others Commands 0x1 "CMD52 for
  1085. // writing ""Bus Suspend"" in CCCR"
  1086. // 0x2 "CMD52 for writing ""Function
  1087. // Select"" in CCCR" 0x3 "Abort
  1088. // command CMD12 CMD52 for writing
  1089. // "" I/O Abort"" in CCCR"
  1090. #define MMCHS_CMD_CMD_TYPE_S 22
  1091. #define MMCHS_CMD_DP 0x00200000 // Data present select This
  1092. // register indicates that data is
  1093. // present and DAT line shall be
  1094. // used. It must be set to 0 in the
  1095. // following conditions: - command
  1096. // using only CMD line - command
  1097. // with no data transfer but using
  1098. // busy signal on DAT[0] - Resume
  1099. // command 0 Command with no data
  1100. // transfer 1 Command with data
  1101. // transfer
  1102. #define MMCHS_CMD_CICE 0x00100000 // Command Index check enable This
  1103. // bit must be set to 1 to enable
  1104. // index check on command response
  1105. // to compare the index field in the
  1106. // response against the index of the
  1107. // command. If the index is not the
  1108. // same in the response as in the
  1109. // command it is reported as a
  1110. // command index error
  1111. // (MMCHS_STAT[CIE] set to1) Note:
  1112. // The register CICE cannot be
  1113. // configured for an Auto CMD12 then
  1114. // index check is automatically
  1115. // checked when this command is
  1116. // issued. 0 Index check disable 1
  1117. // Index check enable
  1118. #define MMCHS_CMD_CCCE 0x00080000 // Command CRC check enable This
  1119. // bit must be set to 1 to enable
  1120. // CRC7 check on command response to
  1121. // protect the response against
  1122. // transmission errors on the bus.
  1123. // If an error is detected it is
  1124. // reported as a command CRC error
  1125. // (MMCHS_STAT[CCRC] set to 1).
  1126. // Note: The register CCCE cannot be
  1127. // configured for an Auto CMD12 and
  1128. // then CRC check is automatically
  1129. // checked when this command is
  1130. // issued. 0 CRC7 check disable 1
  1131. // CRC7 check enable
  1132. #define MMCHS_CMD_RSP_TYPE_M 0x00030000 // Response type This bits defines
  1133. // the response type of the command
  1134. // 0x0 No response 0x1 Response
  1135. // Length 136 bits 0x2 Response
  1136. // Length 48 bits 0x3 Response
  1137. // Length 48 bits with busy after
  1138. // response
  1139. #define MMCHS_CMD_RSP_TYPE_S 16
  1140. #define MMCHS_CMD_MSBS 0x00000020 // Multi/Single block select This
  1141. // bit must be set to 1 for data
  1142. // transfer in case of multi block
  1143. // command. For any others command
  1144. // this bit shall be set to 0. 0
  1145. // Single block. If this bit is 0 it
  1146. // is not necessary to set the
  1147. // register MMCHS_BLK[NBLK]. 1 Multi
  1148. // block. When Block Count is
  1149. // disabled (MMCHS_CMD[BCE] is set
  1150. // to 0) in Multiple block transfers
  1151. // (MMCHS_CMD[MSBS] is set to 1) the
  1152. // module can perform infinite
  1153. // transfer.
  1154. #define MMCHS_CMD_DDIR 0x00000010 // Data transfer Direction Select
  1155. // This bit defines either data
  1156. // transfer will be a read or a
  1157. // write. 0 Data Write (host to
  1158. // card) 1 Data Read (card to host)
  1159. #define MMCHS_CMD_ACEN 0x00000004 // Auto CMD12 Enable SD card only.
  1160. // When this bit is set to 1 the
  1161. // host controller issues a CMD12
  1162. // automatically after the transfer
  1163. // completion of the last block. The
  1164. // Host Driver shall not set this
  1165. // bit to issue commands that do not
  1166. // require CMD12 to stop data
  1167. // transfer. In particular secure
  1168. // commands do not require CMD12. 0
  1169. // Auto CMD12 disable 1 Auto CMD12
  1170. // enable or CCS detection enabled.
  1171. #define MMCHS_CMD_BCE 0x00000002 // Block Count Enable Multiple
  1172. // block transfers only. This bit is
  1173. // used to enable the block count
  1174. // register (MMCHS_BLK[NBLK]). When
  1175. // Block Count is disabled
  1176. // (MMCHS_CMD[BCE] is set to 0) in
  1177. // Multiple block transfers
  1178. // (MMCHS_CMD[MSBS] is set to 1) the
  1179. // module can perform infinite
  1180. // transfer. 0 Block count disabled
  1181. // for infinite transfer. 1 Block
  1182. // count enabled for multiple block
  1183. // transfer with known number of
  1184. // blocks
  1185. #define MMCHS_CMD_DE 0x00000001 // DMA Enable This bit is used to
  1186. // enable DMA mode for host data
  1187. // access. 0 DMA mode disable 1 DMA
  1188. // mode enable
  1189. //******************************************************************************
  1190. //
  1191. // The following are defines for the bit fields in the MMCHS_O_RSP10 register.
  1192. //
  1193. //******************************************************************************
  1194. #define MMCHS_RSP10_RSP1_M 0xFFFF0000 // Command Response [31:16]
  1195. #define MMCHS_RSP10_RSP1_S 16
  1196. #define MMCHS_RSP10_RSP0_M 0x0000FFFF // Command Response [15:0]
  1197. #define MMCHS_RSP10_RSP0_S 0
  1198. //******************************************************************************
  1199. //
  1200. // The following are defines for the bit fields in the MMCHS_O_RSP32 register.
  1201. //
  1202. //******************************************************************************
  1203. #define MMCHS_RSP32_RSP3_M 0xFFFF0000 // Command Response [63:48]
  1204. #define MMCHS_RSP32_RSP3_S 16
  1205. #define MMCHS_RSP32_RSP2_M 0x0000FFFF // Command Response [47:32]
  1206. #define MMCHS_RSP32_RSP2_S 0
  1207. //******************************************************************************
  1208. //
  1209. // The following are defines for the bit fields in the MMCHS_O_RSP54 register.
  1210. //
  1211. //******************************************************************************
  1212. #define MMCHS_RSP54_RSP5_M 0xFFFF0000 // Command Response [95:80]
  1213. #define MMCHS_RSP54_RSP5_S 16
  1214. #define MMCHS_RSP54_RSP4_M 0x0000FFFF // Command Response [79:64]
  1215. #define MMCHS_RSP54_RSP4_S 0
  1216. //******************************************************************************
  1217. //
  1218. // The following are defines for the bit fields in the MMCHS_O_RSP76 register.
  1219. //
  1220. //******************************************************************************
  1221. #define MMCHS_RSP76_RSP7_M 0xFFFF0000 // Command Response [127:112]
  1222. #define MMCHS_RSP76_RSP7_S 16
  1223. #define MMCHS_RSP76_RSP6_M 0x0000FFFF // Command Response [111:96]
  1224. #define MMCHS_RSP76_RSP6_S 0
  1225. //******************************************************************************
  1226. //
  1227. // The following are defines for the bit fields in the MMCHS_O_DATA register.
  1228. //
  1229. //******************************************************************************
  1230. #define MMCHS_DATA_DATA_M 0xFFFFFFFF // Data Register [31:0] In
  1231. // functional mode (MMCHS_CON[MODE]
  1232. // set to the default value 0) A
  1233. // read access to this register is
  1234. // allowed only when the buffer read
  1235. // enable status is set to 1
  1236. // (MMCHS_PSTATE[BRE]) otherwise a
  1237. // bad access (MMCHS_STAT[BADA]) is
  1238. // signaled. A write access to this
  1239. // register is allowed only when the
  1240. // buffer write enable status is set
  1241. // to 1(MMCHS_STATE[BWE]) otherwise
  1242. // a bad access (MMCHS_STAT[BADA])
  1243. // is signaled and the data is not
  1244. // written.
  1245. #define MMCHS_DATA_DATA_S 0
  1246. //******************************************************************************
  1247. //
  1248. // The following are defines for the bit fields in the MMCHS_O_PSTATE register.
  1249. //
  1250. //******************************************************************************
  1251. #define MMCHS_PSTATE_CLEV 0x01000000
  1252. #define MMCHS_PSTATE_DLEV_M 0x00F00000 // DAT[3:0] line signal level
  1253. // DAT[3] => bit 23 DAT[2] => bit 22
  1254. // DAT[1] => bit 21 DAT[0] => bit 20
  1255. // This status is used to check DAT
  1256. // line level to recover from errors
  1257. // and for debugging. This is
  1258. // especially useful in detecting
  1259. // the busy signal level from
  1260. // DAT[0]. The value of these
  1261. // registers after reset depends on
  1262. // the DAT lines level at that time.
  1263. #define MMCHS_PSTATE_DLEV_S 20
  1264. #define MMCHS_PSTATE_WP 0x00080000
  1265. #define MMCHS_PSTATE_CDPL 0x00040000
  1266. #define MMCHS_PSTATE_CSS 0x00020000
  1267. #define MMCHS_PSTATE_CINS 0x00010000
  1268. #define MMCHS_PSTATE_BRE 0x00000800
  1269. #define MMCHS_PSTATE_BWE 0x00000400
  1270. #define MMCHS_PSTATE_RTA 0x00000200
  1271. #define MMCHS_PSTATE_WTA 0x00000100
  1272. #define MMCHS_PSTATE_DLA 0x00000004
  1273. #define MMCHS_PSTATE_DATI 0x00000002
  1274. #define MMCHS_PSTATE_CMDI 0x00000001
  1275. //******************************************************************************
  1276. //
  1277. // The following are defines for the bit fields in the MMCHS_O_HCTL register.
  1278. //
  1279. //******************************************************************************
  1280. #define MMCHS_HCTL_OBWE 0x08000000 // Wakeup event enable for
  1281. // 'Out-of-Band' Interrupt. This bit
  1282. // enables wakeup events for
  1283. // 'Out-of-Band' assertion. Wakeup
  1284. // is generated if the wakeup
  1285. // feature is enabled
  1286. // (MMCHS_SYSCONFIG[ENAWAKEUP]). The
  1287. // write to this register is ignored
  1288. // when MMCHS_CON[OBIE] is not set.
  1289. // 0 Disable wakeup on 'Out-of-Band'
  1290. // Interrupt 1 Enable wakeup on
  1291. // 'Out-of-Band' Interrupt
  1292. #define MMCHS_HCTL_REM 0x04000000 // Wakeup event enable on SD card
  1293. // removal This bit enables wakeup
  1294. // events for card removal
  1295. // assertion. Wakeup is generated if
  1296. // the wakeup feature is enabled
  1297. // (MMCHS_SYSCONFIG[ENAWAKEUP]). 0
  1298. // Disable wakeup on card removal 1
  1299. // Enable wakeup on card removal
  1300. #define MMCHS_HCTL_INS 0x02000000 // Wakeup event enable on SD card
  1301. // insertion This bit enables wakeup
  1302. // events for card insertion
  1303. // assertion. Wakeup is generated if
  1304. // the wakeup feature is enabled
  1305. // (MMCHS_SYSCONFIG[ENAWAKEUP]). 0
  1306. // Disable wakeup on card insertion
  1307. // 1 Enable wakeup on card insertion
  1308. #define MMCHS_HCTL_IWE 0x01000000 // Wakeup event enable on SD card
  1309. // interrupt This bit enables wakeup
  1310. // events for card interrupt
  1311. // assertion. Wakeup is generated if
  1312. // the wakeup feature is enabled
  1313. // (MMCHS_SYSCONFIG[ENAWAKEUP]). 0
  1314. // Disable wakeup on card interrupt
  1315. // 1 Enable wakeup on card interrupt
  1316. #define MMCHS_HCTL_IBG 0x00080000 // Interrupt block at gap This bit
  1317. // is valid only in 4-bit mode of
  1318. // SDIO card to enable interrupt
  1319. // detection in the interrupt cycle
  1320. // at block gap for a multiple block
  1321. // transfer. For MMC cards and for
  1322. // SD card this bit should be set to
  1323. // 0. 0 Disable interrupt detection
  1324. // at the block gap in 4-bit mode 1
  1325. // Enable interrupt detection at the
  1326. // block gap in 4-bit mode
  1327. #define MMCHS_HCTL_RWC 0x00040000 // Read wait control The read wait
  1328. // function is optional only for
  1329. // SDIO cards. If the card supports
  1330. // read wait this bit must be
  1331. // enabled then requesting a stop at
  1332. // block gap (MMCHS_HCTL[SBGR])
  1333. // generates a read wait period
  1334. // after the current end of block.
  1335. // Be careful if read wait is not
  1336. // supported it may cause a conflict
  1337. // on DAT line. 0 Disable Read Wait
  1338. // Control. Suspend/Resume cannot be
  1339. // supported. 1 Enable Read Wait
  1340. // Control
  1341. #define MMCHS_HCTL_CR 0x00020000 // Continue request This bit is
  1342. // used to restart a transaction
  1343. // that was stopped by requesting a
  1344. // stop at block gap
  1345. // (MMCHS_HCTL[SBGR]). Set this bit
  1346. // to 1 restarts the transfer. The
  1347. // bit is automatically set to 0 by
  1348. // the host controller when transfer
  1349. // has restarted i.e DAT line is
  1350. // active (MMCHS_PSTATE[DLA]) or
  1351. // transferring data
  1352. // (MMCHS_PSTATE[WTA]). The Stop at
  1353. // block gap request must be
  1354. // disabled (MMCHS_HCTL[SBGR]=0)
  1355. // before setting this bit. 0 No
  1356. // affect 1 transfer restart
  1357. #define MMCHS_HCTL_SBGR 0x00010000 // Stop at block gap request This
  1358. // bit is used to stop executing a
  1359. // transaction at the next block
  1360. // gap. The transfer can restart
  1361. // with a continue request
  1362. // (MMHS_HCTL[CR]) or during a
  1363. // suspend/resume sequence. In case
  1364. // of read transfer the card must
  1365. // support read wait control. In
  1366. // case of write transfer the host
  1367. // driver shall set this bit after
  1368. // all block data written. Until the
  1369. // transfer completion
  1370. // (MMCHS_STAT[TC] set to 1) the
  1371. // host driver shall leave this bit
  1372. // set to 1. If this bit is set the
  1373. // local host shall not write to the
  1374. // data register (MMCHS_DATA). 0
  1375. // Transfer mode 1 Stop at block gap
  1376. #define MMCHS_HCTL_SDVS_M 0x00000E00 // SD bus voltage select All cards.
  1377. // The host driver should set to
  1378. // these bits to select the voltage
  1379. // level for the card according to
  1380. // the voltage supported by the
  1381. // system (MMCHS_CAPA[VS18VS30VS33])
  1382. // before starting a transfer. 0x5
  1383. // 1.8V (Typical) 0x6 3.0V (Typical)
  1384. // 0x7 3.3V (Typical)
  1385. #define MMCHS_HCTL_SDVS_S 9
  1386. #define MMCHS_HCTL_SDBP 0x00000100 // SD bus power Before setting this
  1387. // bit the host driver shall select
  1388. // the SD bus voltage
  1389. // (MMCHS_HCTL[SDVS]). If the host
  1390. // controller detects the No card
  1391. // state this bit is automatically
  1392. // set to 0. If the module is power
  1393. // off a write in the command
  1394. // register (MMCHS_CMD) will not
  1395. // start the transfer. A write to
  1396. // this bit has no effect if the
  1397. // selected SD bus voltage
  1398. // MMCHS_HCTL[SDVS] is not supported
  1399. // according to capability register
  1400. // (MMCHS_CAPA[VS*]). 0 Power off 1
  1401. // Power on
  1402. #define MMCHS_HCTL_CDSS 0x00000080 // Card Detect Signal Selection
  1403. // This bit selects source for the
  1404. // card detection.When the source
  1405. // for the card detection is
  1406. // switched the interrupt should be
  1407. // disabled during the switching
  1408. // period by clearing the Interrupt
  1409. // Status/Signal Enable register in
  1410. // order to mask unexpected
  1411. // interrupt being caused by the
  1412. // glitch. The Interrupt
  1413. // Status/Signal Enable should be
  1414. // disabled during over the period
  1415. // of debouncing. 0 SDCD# is
  1416. // selected (for normal use) 1 The
  1417. // Card Detect Test Level is
  1418. // selected (for test purpose)
  1419. #define MMCHS_HCTL_CDTL 0x00000040 // Card Detect Test Level: This bit
  1420. // is enabled while the Card Detect
  1421. // Signal Selection is set to 1 and
  1422. // it indicates card inserted or
  1423. // not. 0 No Card 1 Card Inserted
  1424. #define MMCHS_HCTL_DMAS_M 0x00000018 // DMA Select Mode: One of
  1425. // supported DMA modes can be
  1426. // selected. The host driver shall
  1427. // check support of DMA modes by
  1428. // referring the Capabilities
  1429. // register. Use of selected DMA is
  1430. // determined by DMA Enable of the
  1431. // Transfer Mode register. This
  1432. // register is only meaningful when
  1433. // MADMA_EN is set to 1. When
  1434. // MADMA_EN is set to 0 the bit
  1435. // field is read only and returned
  1436. // value is 0. 0x0 Reserved 0x1
  1437. // Reserved 0x2 32-bit Address ADMA2
  1438. // is selected 0x3 Reserved
  1439. #define MMCHS_HCTL_DMAS_S 3
  1440. #define MMCHS_HCTL_HSPE 0x00000004 // High Speed Enable: Before
  1441. // setting this bit the Host Driver
  1442. // shall check the High Speed
  1443. // Support in the Capabilities
  1444. // register. If this bit is set to 0
  1445. // (default) the Host Controller
  1446. // outputs CMD line and DAT lines at
  1447. // the falling edge of the SD Clock.
  1448. // If this bit is set to 1 the Host
  1449. // Controller outputs CMD line and
  1450. // DAT lines at the rising edge of
  1451. // the SD Clock.This bit shall not
  1452. // be set when dual data rate mode
  1453. // is activated in MMCHS_CON[DDR]. 0
  1454. // Normal speed mode 1 High speed
  1455. // mode
  1456. #define MMCHS_HCTL_DTW 0x00000002 // Data transfer width For MMC card
  1457. // this bit must be set following a
  1458. // valid SWITCH command (CMD6) with
  1459. // the correct value and extend CSD
  1460. // index written in the argument.
  1461. // Prior to this command the MMC
  1462. // card configuration register (CSD
  1463. // and EXT_CSD) must be verified for
  1464. // compliance with MMC standard
  1465. // specification 4.x (see section
  1466. // 3.6). This register has no effect
  1467. // when the MMC 8-bit mode is
  1468. // selected (register MMCHS_CON[DW8]
  1469. // set to1 ) For SD/SDIO cards this
  1470. // bit must be set following a valid
  1471. // SET_BUS_WIDTH command (ACMD6)
  1472. // with the value written in bit 1
  1473. // of the argument. Prior to this
  1474. // command the SD card configuration
  1475. // register (SCR) must be verified
  1476. // for the supported bus width by
  1477. // the SD card. 0 1-bit Data width
  1478. // (DAT[0] used) 1 4-bit Data width
  1479. // (DAT[3:0] used)
  1480. //******************************************************************************
  1481. //
  1482. // The following are defines for the bit fields in the MMCHS_O_SYSCTL register.
  1483. //
  1484. //******************************************************************************
  1485. #define MMCHS_SYSCTL_SRD 0x04000000 // Software reset for DAT line This
  1486. // bit is set to 1 for reset and
  1487. // released to 0 when completed. DAT
  1488. // finite state machine in both
  1489. // clock domain are also reset. Here
  1490. // below are the registers cleared
  1491. // by MMCHS_SYSCTL[SRD]: #VALUE! -
  1492. // MMCHS_PSTATE: BRE BWE RTA WTA DLA
  1493. // and DATI - MMCHS_HCTL: SBGR and
  1494. // CR - MMCHS_STAT: BRR BWR BGE and
  1495. // TC OCP and MMC buffer data
  1496. // management is reinitialized. 0
  1497. // Reset completed 1 Software reset
  1498. // for DAT line
  1499. #define MMCHS_SYSCTL_SRC 0x02000000 // Software reset for CMD line This
  1500. // bit is set to 1 for reset and
  1501. // released to 0 when completed. CMD
  1502. // finite state machine in both
  1503. // clock domain are also reset. Here
  1504. // below the registers cleared by
  1505. // MMCHS_SYSCTL[SRC]: -
  1506. // MMCHS_PSTATE: CMDI - MMCHS_STAT:
  1507. // CC OCP and MMC command status
  1508. // management is reinitialized. 0
  1509. // Reset completed 1 Software reset
  1510. // for CMD line
  1511. #define MMCHS_SYSCTL_SRA 0x01000000 // Software reset for all This bit
  1512. // is set to 1 for reset and
  1513. // released to 0 when completed.
  1514. // This reset affects the entire
  1515. // host controller except for the
  1516. // card detection circuit and
  1517. // capabilities registers. 0 Reset
  1518. // completed 1 Software reset for
  1519. // all the design
  1520. #define MMCHS_SYSCTL_DTO_M 0x000F0000 // Data timeout counter value and
  1521. // busy timeout. This value
  1522. // determines the interval by which
  1523. // DAT lines timeouts are detected.
  1524. // The host driver needs to set this
  1525. // bitfield based on - the maximum
  1526. // read access time (NAC) (Refer to
  1527. // the SD Specification Part1
  1528. // Physical Layer) - the data read
  1529. // access time values (TAAC and
  1530. // NSAC) in the card specific data
  1531. // register (CSD) of the card - the
  1532. // timeout clock base frequency
  1533. // (MMCHS_CAPA[TCF]). If the card
  1534. // does not respond within the
  1535. // specified number of cycles a data
  1536. // timeout error occurs
  1537. // (MMCHS_STA[DTO]). The
  1538. // MMCHS_SYSCTL[DTO] register is
  1539. // also used to check busy duration
  1540. // to generate busy timeout for
  1541. // commands with busy response or
  1542. // for busy programming during a
  1543. // write command. Timeout on CRC
  1544. // status is generated if no CRC
  1545. // token is present after a block
  1546. // write. 0x0 TCF x 2^13 0x1 TCF x
  1547. // 2^14 0xE TCF x 2^27 0xF Reserved
  1548. #define MMCHS_SYSCTL_DTO_S 16
  1549. #define MMCHS_SYSCTL_CLKD_M 0x0000FFC0 // Clock frequency select These
  1550. // bits define the ratio between a
  1551. // reference clock frequency (system
  1552. // dependant) and the output clock
  1553. // frequency on the CLK pin of
  1554. // either the memory card (MMC SD or
  1555. // SDIO). 0x000 Clock Ref bypass
  1556. // 0x001 Clock Ref bypass 0x002
  1557. // Clock Ref / 2 0x003 Clock Ref / 3
  1558. // 0x3FF Clock Ref / 1023
  1559. #define MMCHS_SYSCTL_CLKD_S 6
  1560. #define MMCHS_SYSCTL_CEN 0x00000004 // Clock enable This bit controls
  1561. // if the clock is provided to the
  1562. // card or not. 0 The clock is not
  1563. // provided to the card . Clock
  1564. // frequency can be changed . 1 The
  1565. // clock is provided to the card and
  1566. // can be automatically gated when
  1567. // MMCHS_SYSCONFIG[AUTOIDLE] is set
  1568. // to 1 (default value) . The host
  1569. // driver shall wait to set this bit
  1570. // to 1 until the Internal clock is
  1571. // stable (MMCHS_SYSCTL[ICS]).
  1572. #define MMCHS_SYSCTL_ICS 0x00000002
  1573. #define MMCHS_SYSCTL_ICE 0x00000001 // Internal clock enable This
  1574. // register controls the internal
  1575. // clock activity. In very low power
  1576. // state the internal clock is
  1577. // stopped. Note: The activity of
  1578. // the debounce clock (used for
  1579. // wakeup events) and the OCP clock
  1580. // (used for reads and writes to the
  1581. // module register map) are not
  1582. // affected by this register. 0 The
  1583. // internal clock is stopped (very
  1584. // low power state). 1 The internal
  1585. // clock oscillates and can be
  1586. // automatically gated when
  1587. // MMCHS_SYSCONFIG[AUTOIDLE] is set
  1588. // to 1 (default value) .
  1589. //******************************************************************************
  1590. //
  1591. // The following are defines for the bit fields in the MMCHS_O_STAT register.
  1592. //
  1593. //******************************************************************************
  1594. #define MMCHS_STAT_BADA 0x20000000
  1595. #define MMCHS_STAT_CERR 0x10000000
  1596. #define MMCHS_STAT_ADMAE 0x02000000
  1597. #define MMCHS_STAT_ACE 0x01000000
  1598. #define MMCHS_STAT_DEB 0x00400000
  1599. #define MMCHS_STAT_DCRC 0x00200000
  1600. #define MMCHS_STAT_DTO 0x00100000
  1601. #define MMCHS_STAT_CIE 0x00080000
  1602. #define MMCHS_STAT_CEB 0x00040000
  1603. #define MMCHS_STAT_CCRC 0x00020000
  1604. #define MMCHS_STAT_CTO 0x00010000
  1605. #define MMCHS_STAT_ERRI 0x00008000
  1606. #define MMCHS_STAT_BSR 0x00000400
  1607. #define MMCHS_STAT_OBI 0x00000200
  1608. #define MMCHS_STAT_CIRQ 0x00000100
  1609. #define MMCHS_STAT_CREM 0x00000080
  1610. #define MMCHS_STAT_CINS 0x00000040
  1611. #define MMCHS_STAT_BRR 0x00000020
  1612. #define MMCHS_STAT_BWR 0x00000010
  1613. #define MMCHS_STAT_DMA 0x00000008
  1614. #define MMCHS_STAT_BGE 0x00000004
  1615. #define MMCHS_STAT_TC 0x00000002
  1616. #define MMCHS_STAT_CC 0x00000001
  1617. //******************************************************************************
  1618. //
  1619. // The following are defines for the bit fields in the MMCHS_O_IE register.
  1620. //
  1621. //******************************************************************************
  1622. #define MMCHS_IE_BADA_ENABLE 0x20000000 // Bad access to data space
  1623. // Interrupt Enable 0 Masked 1
  1624. // Enabled
  1625. #define MMCHS_IE_CERR_ENABLE 0x10000000 // Card error interrupt Enable 0
  1626. // Masked 1 Enabled
  1627. #define MMCHS_IE_ADMAE_ENABLE 0x02000000 // ADMA error Interrupt Enable 0
  1628. // Masked 1 Enabled
  1629. #define MMCHS_IE_ACE_ENABLE 0x01000000 // Auto CMD12 error Interrupt
  1630. // Enable 0 Masked 1 Enabled
  1631. #define MMCHS_IE_DEB_ENABLE 0x00400000 // Data end bit error Interrupt
  1632. // Enable 0 Masked 1 Enabled
  1633. #define MMCHS_IE_DCRC_ENABLE 0x00200000 // Data CRC error Interrupt Enable
  1634. // 0 Masked 1 Enabled
  1635. #define MMCHS_IE_DTO_ENABLE 0x00100000 // Data timeout error Interrupt
  1636. // Enable 0 The data timeout
  1637. // detection is deactivated. The
  1638. // host controller provides the
  1639. // clock to the card until the card
  1640. // sends the data or the transfer is
  1641. // aborted. 1 The data timeout
  1642. // detection is enabled.
  1643. #define MMCHS_IE_CIE_ENABLE 0x00080000 // Command index error Interrupt
  1644. // Enable 0 Masked 1 Enabled
  1645. #define MMCHS_IE_CEB_ENABLE 0x00040000 // Command end bit error Interrupt
  1646. // Enable 0 Masked 1 Enabled
  1647. #define MMCHS_IE_CCRC_ENABLE 0x00020000 // Command CRC error Interrupt
  1648. // Enable 0 Masked 1 Enabled
  1649. #define MMCHS_IE_CTO_ENABLE 0x00010000 // Command timeout error Interrupt
  1650. // Enable 0 Masked 1 Enabled
  1651. #define MMCHS_IE_NULL 0x00008000 // Fixed to 0 The host driver shall
  1652. // control error interrupts using
  1653. // the Error Interrupt Signal Enable
  1654. // register. Writes to this bit are
  1655. // ignored
  1656. #define MMCHS_IE_BSR_ENABLE 0x00000400 // Boot status interrupt Enable A
  1657. // write to this register when
  1658. // MMCHS_CON[BOOT_ACK] is set to 0x0
  1659. // is ignored. 0 Masked 1 Enabled
  1660. #define MMCHS_IE_OBI_ENABLE 0x00000200 // Out-of-Band interrupt Enable A
  1661. // write to this register when
  1662. // MMCHS_CON[OBIE] is set to '0' is
  1663. // ignored. 0 Masked 1 Enabled
  1664. #define MMCHS_IE_CIRQ_ENABLE 0x00000100 // Card interrupt Enable A clear of
  1665. // this bit also clears the
  1666. // corresponding status bit. During
  1667. // 1-bit mode if the interrupt
  1668. // routine doesn't remove the source
  1669. // of a card interrupt in the SDIO
  1670. // card the status bit is reasserted
  1671. // when this bit is set to 1. 0
  1672. // Masked 1 Enabled
  1673. #define MMCHS_IE_CREM_ENABLE 0x00000080 // Card removal Interrupt Enable 0
  1674. // Masked 1 Enabled
  1675. #define MMCHS_IE_CINS_ENABLE 0x00000040 // Card insertion Interrupt Enable
  1676. // 0 Masked 1 Enabled
  1677. #define MMCHS_IE_BRR_ENABLE 0x00000020 // Buffer Read Ready Interrupt
  1678. // Enable 0 Masked 1 Enabled
  1679. #define MMCHS_IE_BWR_ENABLE 0x00000010 // Buffer Write Ready Interrupt
  1680. // Enable 0 Masked 1 Enabled
  1681. #define MMCHS_IE_DMA_ENABLE 0x00000008 // DMA interrupt Enable 0 Masked 1
  1682. // Enabled
  1683. #define MMCHS_IE_BGE_ENABLE 0x00000004 // Block Gap Event Interrupt Enable
  1684. // 0 Masked 1 Enabled
  1685. #define MMCHS_IE_TC_ENABLE 0x00000002 // Transfer completed Interrupt
  1686. // Enable 0 Masked 1 Enabled
  1687. #define MMCHS_IE_CC_ENABLE 0x00000001 // Command completed Interrupt
  1688. // Enable 0 Masked 1 Enabled
  1689. //******************************************************************************
  1690. //
  1691. // The following are defines for the bit fields in the MMCHS_O_ISE register.
  1692. //
  1693. //******************************************************************************
  1694. #define MMCHS_ISE_BADA_SIGEN 0x20000000 // Bad access to data space signal
  1695. // status Enable 0 Masked 1 Enabled
  1696. #define MMCHS_ISE_CERR_SIGEN 0x10000000 // Card error interrupt signal
  1697. // status Enable 0 Masked 1 Enabled
  1698. #define MMCHS_ISE_ADMAE_SIGEN 0x02000000 // ADMA error signal status Enable
  1699. // 0 Masked 1 Enabled
  1700. #define MMCHS_ISE_ACE_SIGEN 0x01000000 // Auto CMD12 error signal status
  1701. // Enable 0 Masked 1 Enabled
  1702. #define MMCHS_ISE_DEB_SIGEN 0x00400000 // Data end bit error signal status
  1703. // Enable 0 Masked 1 Enabled
  1704. #define MMCHS_ISE_DCRC_SIGEN 0x00200000 // Data CRC error signal status
  1705. // Enable 0 Masked 1 Enabled
  1706. #define MMCHS_ISE_DTO_SIGEN 0x00100000 // Data timeout error signal status
  1707. // Enable 0 Masked 1 Enabled
  1708. #define MMCHS_ISE_CIE_SIGEN 0x00080000 // Command index error signal
  1709. // status Enable 0 Masked 1 Enabled
  1710. #define MMCHS_ISE_CEB_SIGEN 0x00040000 // Command end bit error signal
  1711. // status Enable 0 Masked 1 Enabled
  1712. #define MMCHS_ISE_CCRC_SIGEN 0x00020000 // Command CRC error signal status
  1713. // Enable 0 Masked 1 Enabled
  1714. #define MMCHS_ISE_CTO_SIGEN 0x00010000 // Command timeout error signal
  1715. // status Enable 0 Masked 1 Enabled
  1716. #define MMCHS_ISE_NULL 0x00008000 // Fixed to 0 The host driver shall
  1717. // control error interrupts using
  1718. // the Error Interrupt Signal Enable
  1719. // register. Writes to this bit are
  1720. // ignored
  1721. #define MMCHS_ISE_BSR_SIGEN 0x00000400 // Boot status signal status
  1722. // EnableA write to this register
  1723. // when MMCHS_CON[BOOT_ACK] is set
  1724. // to 0x0 is ignored. 0 Masked 1
  1725. // Enabled
  1726. #define MMCHS_ISE_OBI_SIGEN 0x00000200 // Out-Of-Band Interrupt signal
  1727. // status Enable A write to this
  1728. // register when MMCHS_CON[OBIE] is
  1729. // set to '0' is ignored. 0 Masked 1
  1730. // Enabled
  1731. #define MMCHS_ISE_CIRQ_SIGEN 0x00000100 // Card interrupt signal status
  1732. // Enable 0 Masked 1 Enabled
  1733. #define MMCHS_ISE_CREM_SIGEN 0x00000080 // Card removal signal status
  1734. // Enable 0 Masked 1 Enabled
  1735. #define MMCHS_ISE_CINS_SIGEN 0x00000040 // Card insertion signal status
  1736. // Enable 0 Masked 1 Enabled
  1737. #define MMCHS_ISE_BRR_SIGEN 0x00000020 // Buffer Read Ready signal status
  1738. // Enable 0 Masked 1 Enabled
  1739. #define MMCHS_ISE_BWR_SIGEN 0x00000010 // Buffer Write Ready signal status
  1740. // Enable 0 Masked 1 Enabled
  1741. #define MMCHS_ISE_DMA_SIGEN 0x00000008 // DMA interrupt Signal status
  1742. // enable 0 Masked 1 Enabled
  1743. #define MMCHS_ISE_BGE_SIGEN 0x00000004 // Black Gap Event signal status
  1744. // Enable 0 Masked 1 Enabled
  1745. #define MMCHS_ISE_TC_SIGEN 0x00000002 // Transfer completed signal status
  1746. // Enable 0 Masked 1 Enabled
  1747. #define MMCHS_ISE_CC_SIGEN 0x00000001 // Command completed signal status
  1748. // Enable 0 Masked 1 Enabled
  1749. //******************************************************************************
  1750. //
  1751. // The following are defines for the bit fields in the MMCHS_O_AC12 register.
  1752. //
  1753. //******************************************************************************
  1754. #define MMCHS_AC12_CNI 0x00000080
  1755. #define MMCHS_AC12_ACIE 0x00000010
  1756. #define MMCHS_AC12_ACEB 0x00000008
  1757. #define MMCHS_AC12_ACCE 0x00000004
  1758. #define MMCHS_AC12_ACTO 0x00000002
  1759. #define MMCHS_AC12_ACNE 0x00000001
  1760. //******************************************************************************
  1761. //
  1762. // The following are defines for the bit fields in the MMCHS_O_CAPA register.
  1763. //
  1764. //******************************************************************************
  1765. #define MMCHS_CAPA_BIT64 0x10000000
  1766. #define MMCHS_CAPA_VS18 0x04000000
  1767. #define MMCHS_CAPA_VS30 0x02000000
  1768. #define MMCHS_CAPA_VS33 0x01000000
  1769. #define MMCHS_CAPA_SRS 0x00800000
  1770. #define MMCHS_CAPA_DS 0x00400000
  1771. #define MMCHS_CAPA_HSS 0x00200000
  1772. #define MMCHS_CAPA_AD2S 0x00080000
  1773. #define MMCHS_CAPA_MBL_M 0x00030000
  1774. #define MMCHS_CAPA_MBL_S 16
  1775. #define MMCHS_CAPA_BCF_M 0x00003F00
  1776. #define MMCHS_CAPA_BCF_S 8
  1777. #define MMCHS_CAPA_TCU 0x00000080
  1778. #define MMCHS_CAPA_TCF_M 0x0000003F
  1779. #define MMCHS_CAPA_TCF_S 0
  1780. //******************************************************************************
  1781. //
  1782. // The following are defines for the bit fields in the MMCHS_O_CUR_CAPA register.
  1783. //
  1784. //******************************************************************************
  1785. #define MMCHS_CUR_CAPA_CUR_1V8_M \
  1786. 0x00FF0000
  1787. #define MMCHS_CUR_CAPA_CUR_1V8_S 16
  1788. #define MMCHS_CUR_CAPA_CUR_3V0_M \
  1789. 0x0000FF00
  1790. #define MMCHS_CUR_CAPA_CUR_3V0_S 8
  1791. #define MMCHS_CUR_CAPA_CUR_3V3_M \
  1792. 0x000000FF
  1793. #define MMCHS_CUR_CAPA_CUR_3V3_S 0
  1794. //******************************************************************************
  1795. //
  1796. // The following are defines for the bit fields in the MMCHS_O_FE register.
  1797. //
  1798. //******************************************************************************
  1799. #define MMCHS_FE_FE_BADA 0x20000000
  1800. #define MMCHS_FE_FE_CERR 0x10000000
  1801. #define MMCHS_FE_FE_ADMAE 0x02000000
  1802. #define MMCHS_FE_FE_ACE 0x01000000
  1803. #define MMCHS_FE_FE_DEB 0x00400000
  1804. #define MMCHS_FE_FE_DCRC 0x00200000
  1805. #define MMCHS_FE_FE_DTO 0x00100000
  1806. #define MMCHS_FE_FE_CIE 0x00080000
  1807. #define MMCHS_FE_FE_CEB 0x00040000
  1808. #define MMCHS_FE_FE_CCRC 0x00020000
  1809. #define MMCHS_FE_FE_CTO 0x00010000
  1810. #define MMCHS_FE_FE_CNI 0x00000080
  1811. #define MMCHS_FE_FE_ACIE 0x00000010
  1812. #define MMCHS_FE_FE_ACEB 0x00000008
  1813. #define MMCHS_FE_FE_ACCE 0x00000004
  1814. #define MMCHS_FE_FE_ACTO 0x00000002
  1815. #define MMCHS_FE_FE_ACNE 0x00000001
  1816. //******************************************************************************
  1817. //
  1818. // The following are defines for the bit fields in the MMCHS_O_ADMAES register.
  1819. //
  1820. //******************************************************************************
  1821. #define MMCHS_ADMAES_LME 0x00000004 // ADMA Length Mismatch Error: (1)
  1822. // While Block Count Enable being
  1823. // set the total data length
  1824. // specified by the Descriptor table
  1825. // is different from that specified
  1826. // by the Block Count and Block
  1827. // Length. (2) Total data length can
  1828. // not be divided by the block
  1829. // length. 0 No Error 1 Error
  1830. #define MMCHS_ADMAES_AES_M 0x00000003 // ADMA Error State his field
  1831. // indicates the state of ADMA when
  1832. // error is occurred during ADMA
  1833. // data transfer. "This field never
  1834. // indicates ""10"" because ADMA
  1835. // never stops in this state." 0x0
  1836. // ST_STOP (Stop DMA)Contents of
  1837. // SYS_SDR register 0x1 ST_STOP
  1838. // (Stop DMA)Points the error
  1839. // descriptor 0x2 Never set this
  1840. // state(Not used) 0x3 ST_TFR
  1841. // (Transfer Data)Points the next of
  1842. // the error descriptor
  1843. #define MMCHS_ADMAES_AES_S 0
  1844. //******************************************************************************
  1845. //
  1846. // The following are defines for the bit fields in the MMCHS_O_ADMASAL register.
  1847. //
  1848. //******************************************************************************
  1849. #define MMCHS_ADMASAL_ADMA_A32B_M \
  1850. 0xFFFFFFFF // ADMA System address 32 bits.This
  1851. // register holds byte address of
  1852. // executing command of the
  1853. // Descriptor table. 32-bit Address
  1854. // Descriptor uses lower 32-bit of
  1855. // this register. At the start of
  1856. // ADMA the Host Driver shall set
  1857. // start address of the Descriptor
  1858. // table. The ADMA increments this
  1859. // register address which points to
  1860. // next line when every fetching a
  1861. // Descriptor line. When the ADMA
  1862. // Error Interrupt is generated this
  1863. // register shall hold valid
  1864. // Descriptor address depending on
  1865. // the ADMA state. The Host Driver
  1866. // shall program Descriptor Table on
  1867. // 32-bit boundary and set 32-bit
  1868. // boundary address to this
  1869. // register. ADMA2 ignores lower
  1870. // 2-bit of this register and
  1871. // assumes it to be 00b.
  1872. #define MMCHS_ADMASAL_ADMA_A32B_S 0
  1873. //******************************************************************************
  1874. //
  1875. // The following are defines for the bit fields in the MMCHS_O_REV register.
  1876. //
  1877. //******************************************************************************
  1878. #define MMCHS_REV_VREV_M 0xFF000000 // Vendor Version Number: IP
  1879. // revision [7:4] Major revision
  1880. // [3:0] Minor revision Examples:
  1881. // 0x10 for 1.0 0x21 for 2.1
  1882. #define MMCHS_REV_VREV_S 24
  1883. #define MMCHS_REV_SREV_M 0x00FF0000
  1884. #define MMCHS_REV_SREV_S 16
  1885. #define MMCHS_REV_SIS 0x00000001 // Slot Interrupt Status This
  1886. // status bit indicates the inverted
  1887. // state of interrupt signal for the
  1888. // module. By a power on reset or by
  1889. // setting a software reset for all
  1890. // (MMCHS_HCTL[SRA]) the interrupt
  1891. // signal shall be de-asserted and
  1892. // this status shall read 0.
  1893. #endif // __HW_MMCHS_H__