emmc.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _EMMC_H_
  13. #define _EMMC_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_EMMC_BASE (0x04006000)
  17. typedef volatile struct
  18. {
  19. uint32_t blk_cnt; // 0x00000000
  20. uint32_t blk_size; // 0x00000004
  21. uint32_t argumnet; // 0x00000008
  22. uint32_t tr_mode; // 0x0000000c
  23. uint32_t resp0; // 0x00000010
  24. uint32_t resp1; // 0x00000014
  25. uint32_t resp2; // 0x00000018
  26. uint32_t resp3; // 0x0000001c
  27. uint32_t __32[1]; // 0x00000020
  28. uint32_t pres_state; // 0x00000024
  29. uint32_t host_ctrl1; // 0x00000028
  30. uint32_t clk_ctrl; // 0x0000002c
  31. uint32_t int_st; // 0x00000030
  32. uint32_t int_st_en; // 0x00000034
  33. uint32_t int_sig_en; // 0x00000038
  34. uint32_t host_ctrl2; // 0x0000003c
  35. uint32_t cap1; // 0x00000040
  36. uint32_t cap2; // 0x00000044
  37. uint32_t __72[2]; // 0x00000048
  38. uint32_t frc_evt; // 0x00000050
  39. uint32_t adma_err_sts; // 0x00000054
  40. uint32_t adma2_addr_l; // 0x00000058
  41. uint32_t adma2_addr_h; // 0x0000005c
  42. uint32_t __96[6]; // 0x00000060
  43. uint32_t adma3_addr_l; // 0x00000078
  44. uint32_t adma3_addr_h; // 0x0000007c
  45. uint32_t __128[31]; // 0x00000080
  46. uint32_t host_ver; // 0x000000fc
  47. uint32_t __256[64]; // 0x00000100
  48. uint32_t dll_cfg; // 0x00000200
  49. uint32_t dll_dly; // 0x00000204
  50. uint32_t dll_dly_offset; // 0x00000208
  51. uint32_t __524[1]; // 0x0000020c
  52. uint32_t dll_sts0; // 0x00000210
  53. uint32_t dll_sts1; // 0x00000214
  54. uint32_t __536[2]; // 0x00000218
  55. uint32_t ram_addr_buf_l; // 0x00000220
  56. uint32_t ram_addr_buf_h; // 0x00000224
  57. uint32_t blk_cnt_buf; // 0x00000228
  58. uint32_t blk_cnt_io; // 0x0000022c
  59. uint32_t __560[4]; // 0x00000230
  60. uint32_t adma2_addr_ing_l; // 0x00000240
  61. uint32_t adma2_addr_ing_h; // 0x00000244
  62. uint32_t adma3_addr_ing_l; // 0x00000248
  63. uint32_t adma3_addr_ing_h; // 0x0000024c
  64. uint32_t busy_posi; // 0x00000250
  65. uint32_t fsm_crcerr_sts; // 0x00000254
  66. uint32_t __600[2]; // 0x00000258
  67. uint32_t fsm_debug0; // 0x00000260
  68. uint32_t fsm_debug1; // 0x00000264
  69. uint32_t fsm_debug2; // 0x00000268
  70. uint32_t __620[8]; // 0x0000026c
  71. uint32_t dll_backup; // 0x0000028c
  72. } HWP_EMMC_T;
  73. #define hwp_emmc ((HWP_EMMC_T *)REG_ACCESS_ADDRESS(REG_EMMC_BASE))
  74. // blk_size
  75. typedef union {
  76. uint32_t v;
  77. struct
  78. {
  79. uint32_t blk_size : 12; // [11:0]
  80. uint32_t __31_12 : 20; // [31:12]
  81. } b;
  82. } REG_EMMC_BLK_SIZE_T;
  83. // tr_mode
  84. typedef union {
  85. uint32_t v;
  86. struct
  87. {
  88. uint32_t dma_en : 1; // [0]
  89. uint32_t blk_cnt_en : 1; // [1]
  90. uint32_t auto_cmd_en : 2; // [3:2]
  91. uint32_t data_dir_sel : 1; // [4]
  92. uint32_t mult_blk_sel : 1; // [5]
  93. uint32_t resp_type : 1; // [6]
  94. uint32_t resp_err_chk_en : 1; // [7]
  95. uint32_t resp_int_dis : 1; // [8]
  96. uint32_t __15_9 : 7; // [15:9]
  97. uint32_t resp_type_sel : 2; // [17:16]
  98. uint32_t sub_cmd_flag : 1; // [18]
  99. uint32_t cmd_crc_chk_en : 1; // [19]
  100. uint32_t cmd_ind_chk_en : 1; // [20]
  101. uint32_t data_pre_sel : 1; // [21]
  102. uint32_t cmd_type : 2; // [23:22]
  103. uint32_t cmd_index : 6; // [29:24]
  104. uint32_t cmd_line_boot : 1; // [30]
  105. uint32_t boot_ack : 1; // [31]
  106. } b;
  107. } REG_EMMC_TR_MODE_T;
  108. // pres_state
  109. typedef union {
  110. uint32_t v;
  111. struct
  112. {
  113. uint32_t cmd_inh_cmd : 1; // [0], read only
  114. uint32_t cmd_inh_dat : 1; // [1], read only
  115. uint32_t dat_line_active : 1; // [2], read only
  116. uint32_t __3_3 : 1; // [3]
  117. uint32_t dat_line7_4 : 4; // [7:4], read only
  118. uint32_t write_acitve : 1; // [8], read only
  119. uint32_t read_active : 1; // [9]
  120. uint32_t __19_10 : 10; // [19:10]
  121. uint32_t dat_line3_0 : 4; // [23:20], read only
  122. uint32_t cmd_line : 1; // [24], read only
  123. uint32_t __27_25 : 3; // [27:25]
  124. uint32_t sub_cmd_flag : 1; // [28], read only
  125. uint32_t __31_29 : 3; // [31:29]
  126. } b;
  127. } REG_EMMC_PRES_STATE_T;
  128. // host_ctrl1
  129. typedef union {
  130. uint32_t v;
  131. struct
  132. {
  133. uint32_t __0_0 : 1; // [0]
  134. uint32_t sd4b_mode : 1; // [1]
  135. uint32_t __2_2 : 1; // [2]
  136. uint32_t dma_sel : 2; // [4:3]
  137. uint32_t sd8_mode : 1; // [5]
  138. uint32_t __17_6 : 12; // [17:6]
  139. uint32_t rd_wait_ctrl : 1; // [18]
  140. uint32_t int_at_blk_gap : 1; // [19]
  141. uint32_t __31_20 : 12; // [31:20]
  142. } b;
  143. } REG_EMMC_HOST_CTRL1_T;
  144. // clk_ctrl
  145. typedef union {
  146. uint32_t v;
  147. struct
  148. {
  149. uint32_t int_clk_en : 1; // [0]
  150. uint32_t int_clk_stable : 1; // [1], read only
  151. uint32_t sdclk_en : 1; // [2]
  152. uint32_t __5_3 : 3; // [5:3]
  153. uint32_t freq_div_8_9 : 2; // [7:6]
  154. uint32_t freq_div_0_7 : 8; // [15:8]
  155. uint32_t data_timeout_cnt : 4; // [19:16]
  156. uint32_t __23_20 : 4; // [23:20]
  157. uint32_t sw_rst_all : 1; // [24]
  158. uint32_t sw_rst_cmd : 1; // [25]
  159. uint32_t sw_rst_dat : 1; // [26]
  160. uint32_t hw_rst_card : 1; // [27]
  161. uint32_t __31_28 : 4; // [31:28]
  162. } b;
  163. } REG_EMMC_CLK_CTRL_T;
  164. // int_st
  165. typedef union {
  166. uint32_t v;
  167. struct
  168. {
  169. uint32_t cmd_complete : 1; // [0], write clear
  170. uint32_t tr_complete : 1; // [1], write clear
  171. uint32_t __2_2 : 1; // [2]
  172. uint32_t dma_int : 1; // [3], write clear
  173. uint32_t __7_4 : 4; // [7:4]
  174. uint32_t card_int : 1; // [8], write clear
  175. uint32_t __13_9 : 5; // [13:9]
  176. uint32_t adma3_complete : 1; // [14], write clear
  177. uint32_t err_int : 1; // [15], write clear
  178. uint32_t cmd_timeout_err : 1; // [16], write clear
  179. uint32_t cmd_crc_error : 1; // [17], write clear
  180. uint32_t cmd_end_bit_err : 1; // [18], write clear
  181. uint32_t cmd_ind_err : 1; // [19], write clear
  182. uint32_t data_timeout_err : 1; // [20], write clear
  183. uint32_t data_crc_err : 1; // [21], write clear
  184. uint32_t data_end_bit_err : 1; // [22], write clear
  185. uint32_t __23_23 : 1; // [23]
  186. uint32_t auto_cmd12_err : 1; // [24], write clear
  187. uint32_t adma_error : 1; // [25], write clear
  188. uint32_t __26_26 : 1; // [26]
  189. uint32_t resp_error : 1; // [27], write clear
  190. uint32_t axi_resp_err : 1; // [28], write clear
  191. uint32_t __31_29 : 3; // [31:29]
  192. } b;
  193. } REG_EMMC_INT_ST_T;
  194. // int_st_en
  195. typedef union {
  196. uint32_t v;
  197. struct
  198. {
  199. uint32_t cmd_complete_en : 1; // [0]
  200. uint32_t tr_complete_en : 1; // [1]
  201. uint32_t __2_2 : 1; // [2]
  202. uint32_t dma_int_en : 1; // [3]
  203. uint32_t __7_4 : 4; // [7:4]
  204. uint32_t card_int_en : 1; // [8]
  205. uint32_t __13_9 : 5; // [13:9]
  206. uint32_t adma3_complete_en : 1; // [14]
  207. uint32_t __15_15 : 1; // [15]
  208. uint32_t cmd_timeout_err_en : 1; // [16]
  209. uint32_t cmd_crc_error_en : 1; // [17]
  210. uint32_t cmd_end_bit_err_en : 1; // [18]
  211. uint32_t cmd_ind_err_en : 1; // [19]
  212. uint32_t data_timeout_err_en : 1; // [20]
  213. uint32_t data_crc_err_en : 1; // [21]
  214. uint32_t data_end_bit_err_en : 1; // [22]
  215. uint32_t __23_23 : 1; // [23]
  216. uint32_t auto_cmd12_err_en : 1; // [24]
  217. uint32_t adma_error_en : 1; // [25]
  218. uint32_t __26_26 : 1; // [26]
  219. uint32_t resp_error_en : 1; // [27]
  220. uint32_t axi_resp_err_en : 1; // [28]
  221. uint32_t __31_29 : 3; // [31:29]
  222. } b;
  223. } REG_EMMC_INT_ST_EN_T;
  224. // int_sig_en
  225. typedef union {
  226. uint32_t v;
  227. struct
  228. {
  229. uint32_t cmd_complete_en : 1; // [0]
  230. uint32_t tr_complete_en : 1; // [1]
  231. uint32_t __2_2 : 1; // [2]
  232. uint32_t dma_int_en : 1; // [3]
  233. uint32_t __7_4 : 4; // [7:4]
  234. uint32_t card_int_en : 1; // [8]
  235. uint32_t __13_9 : 5; // [13:9]
  236. uint32_t adma3_complete_en : 1; // [14]
  237. uint32_t __15_15 : 1; // [15]
  238. uint32_t cmd_timeout_err_en : 1; // [16]
  239. uint32_t cmd_crc_error_en : 1; // [17]
  240. uint32_t cmd_end_bit_err_en : 1; // [18]
  241. uint32_t cmd_ind_err_en : 1; // [19]
  242. uint32_t data_timeout_err_en : 1; // [20]
  243. uint32_t data_crc_err_en : 1; // [21]
  244. uint32_t data_end_bit_err_en : 1; // [22]
  245. uint32_t cur_lmt_err_en : 1; // [23]
  246. uint32_t auto_cmd12_err_en : 1; // [24]
  247. uint32_t adma_error_en : 1; // [25]
  248. uint32_t __26_26 : 1; // [26]
  249. uint32_t resp_error_en : 1; // [27]
  250. uint32_t axi_resp_err_en : 1; // [28]
  251. uint32_t __31_29 : 3; // [31:29]
  252. } b;
  253. } REG_EMMC_INT_SIG_EN_T;
  254. // host_ctrl2
  255. typedef union {
  256. uint32_t v;
  257. struct
  258. {
  259. uint32_t acmd12_not_exec : 1; // [0], read only
  260. uint32_t acmd_timeout_err : 1; // [1], read only
  261. uint32_t acmd_crc_err : 1; // [2], read only
  262. uint32_t acmd_end_bit_err : 1; // [3], read only
  263. uint32_t acmd_idx_err : 1; // [4], read only
  264. uint32_t __6_5 : 2; // [6:5]
  265. uint32_t cmd_not_iss_err : 1; // [7], read only
  266. uint32_t __15_8 : 8; // [15:8]
  267. uint32_t uhs_mode : 4; // [19:16]
  268. uint32_t __25_20 : 6; // [25:20]
  269. uint32_t adma2_len_mode : 1; // [26]
  270. uint32_t cmd23_enable : 1; // [27]
  271. uint32_t host_ver_4_en : 1; // [28], read only
  272. uint32_t addr_64bit_en : 1; // [29]
  273. uint32_t __31_30 : 2; // [31:30]
  274. } b;
  275. } REG_EMMC_HOST_CTRL2_T;
  276. // cap1
  277. typedef union {
  278. uint32_t v;
  279. struct
  280. {
  281. uint32_t timeout_clk_frq : 6; // [5:0], read only
  282. uint32_t __6_6 : 1; // [6]
  283. uint32_t timeout_clk_unit : 1; // [7], read only
  284. uint32_t base_clk_frq : 8; // [15:8], read only
  285. uint32_t max_blk_size : 2; // [17:16], read only
  286. uint32_t sup_8bit : 1; // [18], read only
  287. uint32_t adma2_support : 1; // [19], read only
  288. uint32_t __20_20 : 1; // [20]
  289. uint32_t high_speed : 1; // [21], read only
  290. uint32_t dma : 1; // [22], read only
  291. uint32_t susp_res : 1; // [23], read only
  292. uint32_t v33 : 1; // [24], read only
  293. uint32_t v30 : 1; // [25], read only
  294. uint32_t v18 : 1; // [26], read only
  295. uint32_t addr_64bit_sup_v4 : 1; // [27], read only
  296. uint32_t addr_64bit_sup_v3 : 1; // [28], read only
  297. uint32_t async_int : 1; // [29], read only
  298. uint32_t slot_type : 2; // [31:30], read only
  299. } b;
  300. } REG_EMMC_CAP1_T;
  301. // cap2
  302. typedef union {
  303. uint32_t v;
  304. struct
  305. {
  306. uint32_t sdr50_sup : 1; // [0], read only
  307. uint32_t sdr104_sup : 1; // [1], read only
  308. uint32_t ddr50_sup : 1; // [2], read only
  309. uint32_t __26_3 : 24; // [26:3]
  310. uint32_t adma3_support : 1; // [27], read only
  311. uint32_t __31_28 : 4; // [31:28]
  312. } b;
  313. } REG_EMMC_CAP2_T;
  314. // frc_evt
  315. typedef union {
  316. uint32_t v;
  317. struct
  318. {
  319. uint32_t frc_evt_acmd_nexec : 1; // [0]
  320. uint32_t frc_evt_acmd_tout : 1; // [1]
  321. uint32_t frc_evt_acmd_crc : 1; // [2]
  322. uint32_t frc_evt_acmd_end : 1; // [3]
  323. uint32_t frc_evt_acmd_ind : 1; // [4]
  324. uint32_t __6_5 : 2; // [6:5]
  325. uint32_t frc_evt_acmd12 : 1; // [7]
  326. uint32_t __15_8 : 8; // [15:8]
  327. uint32_t frc_evt_cmd_tout : 1; // [16]
  328. uint32_t frc_evt_cmd_crc : 1; // [17]
  329. uint32_t frc_evt_cmd_end : 1; // [18]
  330. uint32_t frc_evt_cmd_ind : 1; // [19]
  331. uint32_t frc_evt_cmd_dat_tout : 1; // [20]
  332. uint32_t frc_evt_cmd_dat_crc : 1; // [21]
  333. uint32_t frc_evt_cmd_dat_end : 1; // [22]
  334. uint32_t __23_23 : 1; // [23]
  335. uint32_t frc_evt_resp_err : 1; // [24]
  336. uint32_t frc_evt_tun_err : 1; // [25]
  337. uint32_t __26_26 : 1; // [26]
  338. uint32_t frc_evt_acmd_err : 1; // [27]
  339. uint32_t __31_28 : 4; // [31:28]
  340. } b;
  341. } REG_EMMC_FRC_EVT_T;
  342. // adma_err_sts
  343. typedef union {
  344. uint32_t v;
  345. struct
  346. {
  347. uint32_t adma_err_state : 2; // [1:0], read only
  348. uint32_t adma_length_mismatch : 1; // [2], read only
  349. uint32_t __15_3 : 13; // [15:3]
  350. uint32_t rresp_err : 2; // [17:16], read only
  351. uint32_t bresp_err : 2; // [19:18], read only
  352. uint32_t __31_20 : 12; // [31:20]
  353. } b;
  354. } REG_EMMC_ADMA_ERR_STS_T;
  355. // host_ver
  356. typedef union {
  357. uint32_t v;
  358. struct
  359. {
  360. uint32_t slt1_int : 1; // [0], read only
  361. uint32_t __15_1 : 15; // [15:1]
  362. uint32_t host_ver : 8; // [23:16], read only
  363. uint32_t __31_24 : 8; // [31:24]
  364. } b;
  365. } REG_EMMC_HOST_VER_T;
  366. // dll_cfg
  367. typedef union {
  368. uint32_t v;
  369. struct
  370. {
  371. uint32_t clk_phase_sel : 1; // [0]
  372. uint32_t dll_phase_interval : 2; // [2:1]
  373. uint32_t __3_3 : 1; // [3]
  374. uint32_t dll_cpst_threshold : 4; // [7:4]
  375. uint32_t dll_init : 7; // [14:8]
  376. uint32_t __15_15 : 1; // [15]
  377. uint32_t dll_half_mode : 1; // [16]
  378. uint32_t dll_cpst_start : 1; // [17]
  379. uint32_t dll_cpst_en : 1; // [18]
  380. uint32_t dll_auto_clr_en : 1; // [19]
  381. uint32_t dll_clr : 1; // [20]
  382. uint32_t dll_en : 1; // [21]
  383. uint32_t dll_clk_sel : 1; // [22]
  384. uint32_t __23_23 : 1; // [23]
  385. uint32_t dll_datwr_cpst_en : 1; // [24]
  386. uint32_t dll_rdcmd_cpst_en : 1; // [25]
  387. uint32_t dll_rdpos_cpst_en : 1; // [26]
  388. uint32_t dll_rdneg_cpst_en : 1; // [27]
  389. uint32_t dll_wait_cnt : 4; // [31:28], read only
  390. } b;
  391. } REG_EMMC_DLL_CFG_T;
  392. // dll_dly
  393. typedef union {
  394. uint32_t v;
  395. struct
  396. {
  397. uint32_t clkdatwr_dly_val : 8; // [7:0]
  398. uint32_t clkcmdrd_dly_val : 8; // [15:8]
  399. uint32_t clkposrd_dly_val : 8; // [23:16]
  400. uint32_t clknegrd_dly_val : 8; // [31:24]
  401. } b;
  402. } REG_EMMC_DLL_DLY_T;
  403. // dll_dly_offset
  404. typedef union {
  405. uint32_t v;
  406. struct
  407. {
  408. uint32_t clkdatwr_dly_offset : 5; // [4:0]
  409. uint32_t clkdatwr_dly_inv : 1; // [5]
  410. uint32_t __7_6 : 2; // [7:6]
  411. uint32_t clkcmdrd_dly_offset : 5; // [12:8]
  412. uint32_t clkcmdrd_dly_inv : 1; // [13]
  413. uint32_t __15_14 : 2; // [15:14]
  414. uint32_t clkposrd_dly_offset : 5; // [20:16]
  415. uint32_t clkposrd_dly_inv : 1; // [21]
  416. uint32_t __23_22 : 2; // [23:22]
  417. uint32_t clknegrd_dly_offset : 5; // [28:24]
  418. uint32_t clknegrd_dly_inv : 1; // [29]
  419. uint32_t __31_30 : 2; // [31:30]
  420. } b;
  421. } REG_EMMC_DLL_DLY_OFFSET_T;
  422. // dll_sts0
  423. typedef union {
  424. uint32_t v;
  425. struct
  426. {
  427. uint32_t dll_cnt : 8; // [7:0], read only
  428. uint32_t dll_st : 4; // [11:8], read only
  429. uint32_t __15_12 : 4; // [15:12]
  430. uint32_t dll_cpst_st : 1; // [16], read only
  431. uint32_t dll_error : 1; // [17], read only
  432. uint32_t dll_locked : 1; // [18], read only
  433. uint32_t dll_phase2 : 1; // [19], read only
  434. uint32_t dll_phase1 : 1; // [20], read only
  435. uint32_t __31_21 : 11; // [31:21]
  436. } b;
  437. } REG_EMMC_DLL_STS0_T;
  438. // dll_sts1
  439. typedef union {
  440. uint32_t v;
  441. struct
  442. {
  443. uint32_t clkdatwr_dly_cnt : 8; // [7:0], read only
  444. uint32_t clkcmdrd_dly_cnt : 8; // [15:8], read only
  445. uint32_t clkposrd_dly_cnt : 8; // [23:16], read only
  446. uint32_t clknegrd_dly_cnt : 8; // [31:24], read only
  447. } b;
  448. } REG_EMMC_DLL_STS1_T;
  449. // busy_posi
  450. typedef union {
  451. uint32_t v;
  452. struct
  453. {
  454. uint32_t read_busy_posi_set : 4; // [3:0]
  455. uint32_t crcsts_posi_set : 4; // [7:4]
  456. uint32_t read_busy_posi_force : 1; // [8]
  457. uint32_t crcsts_posi_force : 1; // [9]
  458. uint32_t sdcard_clk_ie : 1; // [10]
  459. uint32_t sdcard_clk_oe : 1; // [11]
  460. uint32_t mstrs_prot : 3; // [14:12]
  461. uint32_t abort_bug_option : 1; // [15]
  462. uint32_t read_busy_posi_sts : 4; // [19:16]
  463. uint32_t crcsts_posi_sts : 4; // [23:20]
  464. uint32_t innr_clk_auto_en : 1; // [24]
  465. uint32_t outr_clk_auto_en : 1; // [25]
  466. uint32_t __31_26 : 6; // [31:26]
  467. } b;
  468. } REG_EMMC_BUSY_POSI_T;
  469. // fsm_crcerr_sts
  470. typedef union {
  471. uint32_t v;
  472. struct
  473. {
  474. uint32_t rdata_crc_error : 16; // [15:0], read only
  475. uint32_t __31_16 : 16; // [31:16]
  476. } b;
  477. } REG_EMMC_FSM_CRCERR_STS_T;
  478. // fsm_debug0
  479. typedef union {
  480. uint32_t v;
  481. struct
  482. {
  483. uint32_t cmd_fsm : 5; // [4:0], read only
  484. uint32_t __7_5 : 3; // [7:5]
  485. uint32_t trans_fsm : 6; // [13:8], read only
  486. uint32_t __15_14 : 2; // [15:14]
  487. uint32_t recv_fsm : 4; // [19:16], read only
  488. uint32_t __30_20 : 11; // [30:20]
  489. uint32_t clk_pad_out_ind : 1; // [31], read only
  490. } b;
  491. } REG_EMMC_FSM_DEBUG0_T;
  492. // fsm_debug1
  493. typedef union {
  494. uint32_t v;
  495. struct
  496. {
  497. uint32_t io_fsm : 4; // [3:0], read only
  498. uint32_t mst_fsm : 4; // [7:4], read only
  499. uint32_t __8_8 : 1; // [8]
  500. uint32_t adma2_fsm : 3; // [11:9], read only
  501. uint32_t adma3_fsm : 4; // [15:12], read only
  502. uint32_t __31_16 : 16; // [31:16]
  503. } b;
  504. } REG_EMMC_FSM_DEBUG1_T;
  505. // fsm_debug2
  506. typedef union {
  507. uint32_t v;
  508. struct
  509. {
  510. uint32_t addr_fsm : 4; // [3:0], read only
  511. uint32_t data_fsm : 4; // [7:4], read only
  512. uint32_t __31_8 : 24; // [31:8]
  513. } b;
  514. } REG_EMMC_FSM_DEBUG2_T;
  515. // dll_backup
  516. typedef union {
  517. uint32_t v;
  518. struct
  519. {
  520. uint32_t rf_dll_backup : 1; // [0]
  521. uint32_t rf_dll_backup_value : 1; // [1]
  522. uint32_t rf_dll_slice_en_force : 1; // [2]
  523. uint32_t rf_dll_slice_en_value : 1; // [3]
  524. uint32_t oe_ext_optional : 1; // [4]
  525. uint32_t __31_5 : 27; // [31:5]
  526. } b;
  527. } REG_EMMC_DLL_BACKUP_T;
  528. // blk_size
  529. #define EMMC_BLK_SIZE(n) (((n)&0xfff) << 0)
  530. // tr_mode
  531. #define EMMC_DMA_EN (1 << 0)
  532. #define EMMC_BLK_CNT_EN (1 << 1)
  533. #define EMMC_AUTO_CMD_EN(n) (((n)&0x3) << 2)
  534. #define EMMC_DATA_DIR_SEL (1 << 4)
  535. #define EMMC_MULT_BLK_SEL (1 << 5)
  536. #define EMMC_RESP_TYPE (1 << 6)
  537. #define EMMC_RESP_ERR_CHK_EN (1 << 7)
  538. #define EMMC_RESP_INT_DIS (1 << 8)
  539. #define EMMC_RESP_TYPE_SEL(n) (((n)&0x3) << 16)
  540. #define EMMC_TR_MODE_SUB_CMD_FLAG (1 << 18)
  541. #define EMMC_CMD_CRC_CHK_EN (1 << 19)
  542. #define EMMC_CMD_IND_CHK_EN (1 << 20)
  543. #define EMMC_DATA_PRE_SEL (1 << 21)
  544. #define EMMC_CMD_TYPE(n) (((n)&0x3) << 22)
  545. #define EMMC_CMD_INDEX(n) (((n)&0x3f) << 24)
  546. #define EMMC_CMD_LINE_BOOT (1 << 30)
  547. #define EMMC_BOOT_ACK (1 << 31)
  548. // pres_state
  549. #define EMMC_CMD_INH_CMD (1 << 0)
  550. #define EMMC_CMD_INH_DAT (1 << 1)
  551. #define EMMC_DAT_LINE_ACTIVE (1 << 2)
  552. #define EMMC_DAT_LINE7_4(n) (((n)&0xf) << 4)
  553. #define EMMC_WRITE_ACITVE (1 << 8)
  554. #define EMMC_READ_ACTIVE (1 << 9)
  555. #define EMMC_DAT_LINE3_0(n) (((n)&0xf) << 20)
  556. #define EMMC_CMD_LINE (1 << 24)
  557. #define EMMC_PRES_STATE_SUB_CMD_FLAG (1 << 28)
  558. // host_ctrl1
  559. #define EMMC_SD4B_MODE (1 << 1)
  560. #define EMMC_DMA_SEL(n) (((n)&0x3) << 3)
  561. #define EMMC_SD8_MODE (1 << 5)
  562. #define EMMC_RD_WAIT_CTRL (1 << 18)
  563. #define EMMC_INT_AT_BLK_GAP (1 << 19)
  564. // clk_ctrl
  565. #define EMMC_INT_CLK_EN (1 << 0)
  566. #define EMMC_INT_CLK_STABLE (1 << 1)
  567. #define EMMC_SDCLK_EN (1 << 2)
  568. #define EMMC_FREQ_DIV_8_9(n) (((n)&0x3) << 6)
  569. #define EMMC_FREQ_DIV_0_7(n) (((n)&0xff) << 8)
  570. #define EMMC_DATA_TIMEOUT_CNT(n) (((n)&0xf) << 16)
  571. #define EMMC_SW_RST_ALL (1 << 24)
  572. #define EMMC_SW_RST_CMD (1 << 25)
  573. #define EMMC_SW_RST_DAT (1 << 26)
  574. #define EMMC_HW_RST_CARD (1 << 27)
  575. // int_st
  576. #define EMMC_CMD_COMPLETE (1 << 0)
  577. #define EMMC_TR_COMPLETE (1 << 1)
  578. #define EMMC_DMA_INT (1 << 3)
  579. #define EMMC_CARD_INT (1 << 8)
  580. #define EMMC_ADMA3_COMPLETE (1 << 14)
  581. #define EMMC_ERR_INT (1 << 15)
  582. #define EMMC_CMD_TIMEOUT_ERR (1 << 16)
  583. #define EMMC_CMD_CRC_ERROR (1 << 17)
  584. #define EMMC_CMD_END_BIT_ERR (1 << 18)
  585. #define EMMC_CMD_IND_ERR (1 << 19)
  586. #define EMMC_DATA_TIMEOUT_ERR (1 << 20)
  587. #define EMMC_DATA_CRC_ERR (1 << 21)
  588. #define EMMC_DATA_END_BIT_ERR (1 << 22)
  589. #define EMMC_AUTO_CMD12_ERR (1 << 24)
  590. #define EMMC_ADMA_ERROR (1 << 25)
  591. #define EMMC_RESP_ERROR (1 << 27)
  592. #define EMMC_AXI_RESP_ERR (1 << 28)
  593. // int_st_en
  594. #define EMMC_CMD_COMPLETE_EN (1 << 0)
  595. #define EMMC_TR_COMPLETE_EN (1 << 1)
  596. #define EMMC_DMA_INT_EN (1 << 3)
  597. #define EMMC_CARD_INT_EN (1 << 8)
  598. #define EMMC_ADMA3_COMPLETE_EN (1 << 14)
  599. #define EMMC_CMD_TIMEOUT_ERR_EN (1 << 16)
  600. #define EMMC_CMD_CRC_ERROR_EN (1 << 17)
  601. #define EMMC_CMD_END_BIT_ERR_EN (1 << 18)
  602. #define EMMC_CMD_IND_ERR_EN (1 << 19)
  603. #define EMMC_DATA_TIMEOUT_ERR_EN (1 << 20)
  604. #define EMMC_DATA_CRC_ERR_EN (1 << 21)
  605. #define EMMC_DATA_END_BIT_ERR_EN (1 << 22)
  606. #define EMMC_AUTO_CMD12_ERR_EN (1 << 24)
  607. #define EMMC_ADMA_ERROR_EN (1 << 25)
  608. #define EMMC_RESP_ERROR_EN (1 << 27)
  609. #define EMMC_AXI_RESP_ERR_EN (1 << 28)
  610. // int_sig_en
  611. #define EMMC_CMD_COMPLETE_EN (1 << 0)
  612. #define EMMC_TR_COMPLETE_EN (1 << 1)
  613. #define EMMC_DMA_INT_EN (1 << 3)
  614. #define EMMC_CARD_INT_EN (1 << 8)
  615. #define EMMC_ADMA3_COMPLETE_EN (1 << 14)
  616. #define EMMC_CMD_TIMEOUT_ERR_EN (1 << 16)
  617. #define EMMC_CMD_CRC_ERROR_EN (1 << 17)
  618. #define EMMC_CMD_END_BIT_ERR_EN (1 << 18)
  619. #define EMMC_CMD_IND_ERR_EN (1 << 19)
  620. #define EMMC_DATA_TIMEOUT_ERR_EN (1 << 20)
  621. #define EMMC_DATA_CRC_ERR_EN (1 << 21)
  622. #define EMMC_DATA_END_BIT_ERR_EN (1 << 22)
  623. #define EMMC_CUR_LMT_ERR_EN (1 << 23)
  624. #define EMMC_AUTO_CMD12_ERR_EN (1 << 24)
  625. #define EMMC_ADMA_ERROR_EN (1 << 25)
  626. #define EMMC_RESP_ERROR_EN (1 << 27)
  627. #define EMMC_AXI_RESP_ERR_EN (1 << 28)
  628. // host_ctrl2
  629. #define EMMC_ACMD12_NOT_EXEC (1 << 0)
  630. #define EMMC_ACMD_TIMEOUT_ERR (1 << 1)
  631. #define EMMC_ACMD_CRC_ERR (1 << 2)
  632. #define EMMC_ACMD_END_BIT_ERR (1 << 3)
  633. #define EMMC_ACMD_IDX_ERR (1 << 4)
  634. #define EMMC_CMD_NOT_ISS_ERR (1 << 7)
  635. #define EMMC_UHS_MODE(n) (((n)&0xf) << 16)
  636. #define EMMC_ADMA2_LEN_MODE (1 << 26)
  637. #define EMMC_CMD23_ENABLE (1 << 27)
  638. #define EMMC_HOST_VER_4_EN (1 << 28)
  639. #define EMMC_ADDR_64BIT_EN (1 << 29)
  640. // cap1
  641. #define EMMC_TIMEOUT_CLK_FRQ(n) (((n)&0x3f) << 0)
  642. #define EMMC_TIMEOUT_CLK_UNIT (1 << 7)
  643. #define EMMC_BASE_CLK_FRQ(n) (((n)&0xff) << 8)
  644. #define EMMC_MAX_BLK_SIZE(n) (((n)&0x3) << 16)
  645. #define EMMC_SUP_8BIT (1 << 18)
  646. #define EMMC_ADMA2_SUPPORT (1 << 19)
  647. #define EMMC_HIGH_SPEED (1 << 21)
  648. #define EMMC_DMA (1 << 22)
  649. #define EMMC_SUSP_RES (1 << 23)
  650. #define EMMC_V33 (1 << 24)
  651. #define EMMC_V30 (1 << 25)
  652. #define EMMC_V18 (1 << 26)
  653. #define EMMC_ADDR_64BIT_SUP_V4 (1 << 27)
  654. #define EMMC_ADDR_64BIT_SUP_V3 (1 << 28)
  655. #define EMMC_ASYNC_INT (1 << 29)
  656. #define EMMC_SLOT_TYPE(n) (((n)&0x3) << 30)
  657. // cap2
  658. #define EMMC_SDR50_SUP (1 << 0)
  659. #define EMMC_SDR104_SUP (1 << 1)
  660. #define EMMC_DDR50_SUP (1 << 2)
  661. #define EMMC_ADMA3_SUPPORT (1 << 27)
  662. // frc_evt
  663. #define EMMC_FRC_EVT_ACMD_NEXEC (1 << 0)
  664. #define EMMC_FRC_EVT_ACMD_TOUT (1 << 1)
  665. #define EMMC_FRC_EVT_ACMD_CRC (1 << 2)
  666. #define EMMC_FRC_EVT_ACMD_END (1 << 3)
  667. #define EMMC_FRC_EVT_ACMD_IND (1 << 4)
  668. #define EMMC_FRC_EVT_ACMD12 (1 << 7)
  669. #define EMMC_FRC_EVT_CMD_TOUT (1 << 16)
  670. #define EMMC_FRC_EVT_CMD_CRC (1 << 17)
  671. #define EMMC_FRC_EVT_CMD_END (1 << 18)
  672. #define EMMC_FRC_EVT_CMD_IND (1 << 19)
  673. #define EMMC_FRC_EVT_CMD_DAT_TOUT (1 << 20)
  674. #define EMMC_FRC_EVT_CMD_DAT_CRC (1 << 21)
  675. #define EMMC_FRC_EVT_CMD_DAT_END (1 << 22)
  676. #define EMMC_FRC_EVT_RESP_ERR (1 << 24)
  677. #define EMMC_FRC_EVT_TUN_ERR (1 << 25)
  678. #define EMMC_FRC_EVT_ACMD_ERR (1 << 27)
  679. // adma_err_sts
  680. #define EMMC_ADMA_ERR_STATE(n) (((n)&0x3) << 0)
  681. #define EMMC_ADMA_LENGTH_MISMATCH (1 << 2)
  682. #define EMMC_RRESP_ERR(n) (((n)&0x3) << 16)
  683. #define EMMC_BRESP_ERR(n) (((n)&0x3) << 18)
  684. // host_ver
  685. #define EMMC_SLT1_INT (1 << 0)
  686. #define EMMC_HOST_VER(n) (((n)&0xff) << 16)
  687. // dll_cfg
  688. #define EMMC_CLK_PHASE_SEL (1 << 0)
  689. #define EMMC_DLL_PHASE_INTERVAL(n) (((n)&0x3) << 1)
  690. #define EMMC_DLL_CPST_THRESHOLD(n) (((n)&0xf) << 4)
  691. #define EMMC_DLL_INIT(n) (((n)&0x7f) << 8)
  692. #define EMMC_DLL_HALF_MODE (1 << 16)
  693. #define EMMC_DLL_CPST_START (1 << 17)
  694. #define EMMC_DLL_CPST_EN (1 << 18)
  695. #define EMMC_DLL_AUTO_CLR_EN (1 << 19)
  696. #define EMMC_DLL_CLR (1 << 20)
  697. #define EMMC_DLL_EN (1 << 21)
  698. #define EMMC_DLL_CLK_SEL (1 << 22)
  699. #define EMMC_DLL_DATWR_CPST_EN (1 << 24)
  700. #define EMMC_DLL_RDCMD_CPST_EN (1 << 25)
  701. #define EMMC_DLL_RDPOS_CPST_EN (1 << 26)
  702. #define EMMC_DLL_RDNEG_CPST_EN (1 << 27)
  703. #define EMMC_DLL_WAIT_CNT(n) (((n)&0xf) << 28)
  704. // dll_dly
  705. #define EMMC_CLKDATWR_DLY_VAL(n) (((n)&0xff) << 0)
  706. #define EMMC_CLKCMDRD_DLY_VAL(n) (((n)&0xff) << 8)
  707. #define EMMC_CLKPOSRD_DLY_VAL(n) (((n)&0xff) << 16)
  708. #define EMMC_CLKNEGRD_DLY_VAL(n) (((n)&0xff) << 24)
  709. // dll_dly_offset
  710. #define EMMC_CLKDATWR_DLY_OFFSET(n) (((n)&0x1f) << 0)
  711. #define EMMC_CLKDATWR_DLY_INV (1 << 5)
  712. #define EMMC_CLKCMDRD_DLY_OFFSET(n) (((n)&0x1f) << 8)
  713. #define EMMC_CLKCMDRD_DLY_INV (1 << 13)
  714. #define EMMC_CLKPOSRD_DLY_OFFSET(n) (((n)&0x1f) << 16)
  715. #define EMMC_CLKPOSRD_DLY_INV (1 << 21)
  716. #define EMMC_CLKNEGRD_DLY_OFFSET(n) (((n)&0x1f) << 24)
  717. #define EMMC_CLKNEGRD_DLY_INV (1 << 29)
  718. // dll_sts0
  719. #define EMMC_DLL_CNT(n) (((n)&0xff) << 0)
  720. #define EMMC_DLL_ST(n) (((n)&0xf) << 8)
  721. #define EMMC_DLL_CPST_ST (1 << 16)
  722. #define EMMC_DLL_ERROR (1 << 17)
  723. #define EMMC_DLL_LOCKED (1 << 18)
  724. #define EMMC_DLL_PHASE2 (1 << 19)
  725. #define EMMC_DLL_PHASE1 (1 << 20)
  726. // dll_sts1
  727. #define EMMC_CLKDATWR_DLY_CNT(n) (((n)&0xff) << 0)
  728. #define EMMC_CLKCMDRD_DLY_CNT(n) (((n)&0xff) << 8)
  729. #define EMMC_CLKPOSRD_DLY_CNT(n) (((n)&0xff) << 16)
  730. #define EMMC_CLKNEGRD_DLY_CNT(n) (((n)&0xff) << 24)
  731. // busy_posi
  732. #define EMMC_READ_BUSY_POSI_SET(n) (((n)&0xf) << 0)
  733. #define EMMC_CRCSTS_POSI_SET(n) (((n)&0xf) << 4)
  734. #define EMMC_READ_BUSY_POSI_FORCE (1 << 8)
  735. #define EMMC_CRCSTS_POSI_FORCE (1 << 9)
  736. #define EMMC_SDCARD_CLK_IE (1 << 10)
  737. #define EMMC_SDCARD_CLK_OE (1 << 11)
  738. #define EMMC_MSTRS_PROT(n) (((n)&0x7) << 12)
  739. #define EMMC_ABORT_BUG_OPTION (1 << 15)
  740. #define EMMC_READ_BUSY_POSI_STS(n) (((n)&0xf) << 16)
  741. #define EMMC_CRCSTS_POSI_STS(n) (((n)&0xf) << 20)
  742. #define EMMC_INNR_CLK_AUTO_EN (1 << 24)
  743. #define EMMC_OUTR_CLK_AUTO_EN (1 << 25)
  744. // fsm_crcerr_sts
  745. #define EMMC_RDATA_CRC_ERROR(n) (((n)&0xffff) << 0)
  746. // fsm_debug0
  747. #define EMMC_CMD_FSM(n) (((n)&0x1f) << 0)
  748. #define EMMC_TRANS_FSM(n) (((n)&0x3f) << 8)
  749. #define EMMC_RECV_FSM(n) (((n)&0xf) << 16)
  750. #define EMMC_CLK_PAD_OUT_IND (1 << 31)
  751. // fsm_debug1
  752. #define EMMC_IO_FSM(n) (((n)&0xf) << 0)
  753. #define EMMC_MST_FSM(n) (((n)&0xf) << 4)
  754. #define EMMC_ADMA2_FSM(n) (((n)&0x7) << 9)
  755. #define EMMC_ADMA3_FSM(n) (((n)&0xf) << 12)
  756. // fsm_debug2
  757. #define EMMC_ADDR_FSM(n) (((n)&0xf) << 0)
  758. #define EMMC_DATA_FSM(n) (((n)&0xf) << 4)
  759. // dll_backup
  760. #define EMMC_RF_DLL_BACKUP (1 << 0)
  761. #define EMMC_RF_DLL_BACKUP_VALUE (1 << 1)
  762. #define EMMC_RF_DLL_SLICE_EN_FORCE (1 << 2)
  763. #define EMMC_RF_DLL_SLICE_EN_VALUE (1 << 3)
  764. #define EMMC_OE_EXT_OPTIONAL (1 << 4)
  765. #endif // _EMMC_H_