spi_flash.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  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 _SPI_FLASH_H_
  13. #define _SPI_FLASH_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_SPI_FLASH_BASE (0x02000000)
  17. #define REG_SPI_FLASH_EXT_BASE (0x02040000)
  18. typedef volatile struct
  19. {
  20. uint32_t spi_cmd_addr; // 0x00000000
  21. uint32_t spi_block_size; // 0x00000004
  22. uint32_t spi_data_fifo; // 0x00000008
  23. uint32_t spi_status; // 0x0000000c
  24. uint32_t spi_read_back; // 0x00000010
  25. uint32_t spi_config; // 0x00000014
  26. uint32_t spi_fifo_control; // 0x00000018
  27. uint32_t spi_cs_size; // 0x0000001c
  28. uint32_t spi_read_cmd; // 0x00000020
  29. uint32_t spi_nand_config; // 0x00000024
  30. uint32_t spi_nand_config2; // 0x00000028
  31. uint32_t spi_256_512_flash_config; // 0x0000002c
  32. uint32_t spi_128_flash_config; // 0x00000030
  33. uint32_t spi_cs4_sel; // 0x00000034
  34. uint32_t page0_addr; // 0x00000038
  35. uint32_t page1_addr; // 0x0000003c
  36. uint32_t page2_addr; // 0x00000040
  37. uint32_t page3_addr; // 0x00000044
  38. uint32_t page4_addr; // 0x00000048
  39. uint32_t page5_addr; // 0x0000004c
  40. uint32_t page6_addr; // 0x00000050
  41. uint32_t page7_addr; // 0x00000054
  42. uint32_t page8_addr; // 0x00000058
  43. uint32_t page9_addr; // 0x0000005c
  44. uint32_t page10_addr; // 0x00000060
  45. uint32_t page11_addr; // 0x00000064
  46. uint32_t page12_addr; // 0x00000068
  47. uint32_t page13_addr; // 0x0000006c
  48. uint32_t page14_addr; // 0x00000070
  49. uint32_t page15_addr; // 0x00000074
  50. uint32_t spi_page_config; // 0x00000078
  51. uint32_t spi_cmd_reconfig; // 0x0000007c
  52. uint32_t page0_col_addr; // 0x00000080
  53. uint32_t page1_col_addr; // 0x00000084
  54. uint32_t page2_col_addr; // 0x00000088
  55. uint32_t page3_col_addr; // 0x0000008c
  56. uint32_t page4_col_addr; // 0x00000090
  57. uint32_t page5_col_addr; // 0x00000094
  58. uint32_t page6_col_addr; // 0x00000098
  59. uint32_t page7_col_addr; // 0x0000009c
  60. uint32_t page8_col_addr; // 0x000000a0
  61. uint32_t page9_col_addr; // 0x000000a4
  62. uint32_t page10_col_addr; // 0x000000a8
  63. uint32_t page11_col_addr; // 0x000000ac
  64. uint32_t page12_col_addr; // 0x000000b0
  65. uint32_t page13_col_addr; // 0x000000b4
  66. uint32_t page14_col_addr; // 0x000000b8
  67. uint32_t page15_col_addr; // 0x000000bc
  68. uint32_t nand_int_mask; // 0x000000c0
  69. } HWP_SPI_FLASH_T;
  70. #define hwp_spiFlash ((HWP_SPI_FLASH_T *)REG_ACCESS_ADDRESS(REG_SPI_FLASH_BASE))
  71. #define hwp_spiFlashExt ((HWP_SPI_FLASH_T *)REG_ACCESS_ADDRESS(REG_SPI_FLASH_EXT_BASE))
  72. // spi_cmd_addr
  73. typedef union {
  74. uint32_t v;
  75. struct
  76. {
  77. uint32_t spi_tx_cmd : 8; // [7:0]
  78. uint32_t spi_address : 24; // [31:8]
  79. } b;
  80. } REG_SPI_FLASH_SPI_CMD_ADDR_T;
  81. // spi_block_size
  82. typedef union {
  83. uint32_t v;
  84. struct
  85. {
  86. uint32_t spi_modebit : 8; // [7:0]
  87. uint32_t spi_rw_blk_size : 14; // [21:8]
  88. uint32_t __23_22 : 2; // [23:22]
  89. uint32_t continuous_enable : 1; // [24]
  90. uint32_t __31_25 : 7; // [31:25]
  91. } b;
  92. } REG_SPI_FLASH_SPI_BLOCK_SIZE_T;
  93. // spi_data_fifo
  94. typedef union {
  95. uint32_t v;
  96. struct
  97. {
  98. uint32_t spi_tx_data : 8; // [7:0]
  99. uint32_t spi_send_type : 1; // [8]
  100. uint32_t __31_9 : 23; // [31:9]
  101. } b;
  102. } REG_SPI_FLASH_SPI_DATA_FIFO_T;
  103. // spi_status
  104. typedef union {
  105. uint32_t v;
  106. struct
  107. {
  108. uint32_t spi_flash_busy : 1; // [0], read only
  109. uint32_t tx_fifo_empty : 1; // [1], read only
  110. uint32_t tx_fifo_full : 1; // [2], read only
  111. uint32_t rx_fifo_empty : 1; // [3], read only
  112. uint32_t rx_fifo_count : 5; // [8:4], read only
  113. uint32_t read_stat_busy : 1; // [9], read only
  114. uint32_t nand_int : 1; // [10], read only
  115. uint32_t spiflash_int : 1; // [11], read only
  116. uint32_t __31_12 : 20; // [31:12]
  117. } b;
  118. } REG_SPI_FLASH_SPI_STATUS_T;
  119. // spi_config
  120. typedef union {
  121. uint32_t v;
  122. struct
  123. {
  124. uint32_t quad_mode : 1; // [0]
  125. uint32_t spi_wprotect_pin : 1; // [1]
  126. uint32_t spi_hold_pin : 1; // [2]
  127. uint32_t __3_3 : 1; // [3]
  128. uint32_t sample_delay : 3; // [6:4]
  129. uint32_t __7_7 : 1; // [7]
  130. uint32_t clk_divider : 8; // [15:8]
  131. uint32_t cmd_quad : 1; // [16]
  132. uint32_t tx_rx_size : 2; // [18:17]
  133. uint32_t __31_19 : 13; // [31:19]
  134. } b;
  135. } REG_SPI_FLASH_SPI_CONFIG_T;
  136. // spi_fifo_control
  137. typedef union {
  138. uint32_t v;
  139. struct
  140. {
  141. uint32_t rx_fifo_clr : 1; // [0]
  142. uint32_t tx_fifo_clr : 1; // [1]
  143. uint32_t __31_2 : 30; // [31:2]
  144. } b;
  145. } REG_SPI_FLASH_SPI_FIFO_CONTROL_T;
  146. // spi_cs_size
  147. typedef union {
  148. uint32_t v;
  149. struct
  150. {
  151. uint32_t spi_cs_num : 1; // [0]
  152. uint32_t spi_size : 2; // [2:1]
  153. uint32_t spi_128m : 1; // [3]
  154. uint32_t ahb_read_disable : 1; // [4]
  155. uint32_t sel_flash_1 : 1; // [5]
  156. uint32_t sel1_flash_1 : 1; // [6]
  157. uint32_t diff_128m_diff_cmd_en : 1; // [7]
  158. uint32_t spi_256m : 1; // [8]
  159. uint32_t spi_512m : 1; // [9]
  160. uint32_t spi_cs1_sel2 : 1; // [10]
  161. uint32_t spi_1g : 1; // [11]
  162. uint32_t spi_2g : 1; // [12]
  163. uint32_t spi_4g : 1; // [13]
  164. uint32_t spi_cs1_sel3 : 1; // [14]
  165. uint32_t spi_cs1_sel4 : 1; // [15]
  166. uint32_t spi_cs1_sel5 : 1; // [16]
  167. uint32_t __31_17 : 15; // [31:17]
  168. } b;
  169. } REG_SPI_FLASH_SPI_CS_SIZE_T;
  170. // spi_read_cmd
  171. typedef union {
  172. uint32_t v;
  173. struct
  174. {
  175. uint32_t qread_cmd : 8; // [7:0]
  176. uint32_t fread_cmd : 8; // [15:8]
  177. uint32_t read_cmd : 8; // [23:16]
  178. uint32_t protect_byte : 8; // [31:24]
  179. } b;
  180. } REG_SPI_FLASH_SPI_READ_CMD_T;
  181. // spi_nand_config
  182. typedef union {
  183. uint32_t v;
  184. struct
  185. {
  186. uint32_t nand_sel : 1; // [0]
  187. uint32_t nand_addr : 2; // [2:1]
  188. uint32_t reuse_nand_ram : 1; // [3]
  189. uint32_t reuse_read : 1; // [4]
  190. uint32_t write_page_hit : 1; // [5]
  191. uint32_t nand_data_trans : 1; // [6]
  192. uint32_t page_size_sel : 1; // [7]
  193. uint32_t page_read_cmd : 8; // [15:8]
  194. uint32_t get_sts_cmd : 8; // [23:16]
  195. uint32_t ram_read_cmd : 8; // [31:24]
  196. } b;
  197. } REG_SPI_FLASH_SPI_NAND_CONFIG_T;
  198. // spi_nand_config2
  199. typedef union {
  200. uint32_t v;
  201. struct
  202. {
  203. uint32_t get_sts_addr : 8; // [7:0]
  204. uint32_t __15_8 : 8; // [15:8]
  205. uint32_t sts_qip : 8; // [23:16]
  206. uint32_t __31_24 : 8; // [31:24]
  207. } b;
  208. } REG_SPI_FLASH_SPI_NAND_CONFIG2_T;
  209. // spi_256_512_flash_config
  210. typedef union {
  211. uint32_t v;
  212. struct
  213. {
  214. uint32_t four_byte_addr : 1; // [0]
  215. uint32_t dummy_cycle_en : 1; // [1]
  216. uint32_t __7_2 : 6; // [7:2]
  217. uint32_t dummy_cycle : 4; // [11:8]
  218. uint32_t wrap_en : 1; // [12]
  219. uint32_t __15_13 : 3; // [15:13]
  220. uint32_t wrap_code : 4; // [19:16]
  221. uint32_t __31_20 : 12; // [31:20]
  222. } b;
  223. } REG_SPI_FLASH_SPI_256_512_FLASH_CONFIG_T;
  224. // spi_128_flash_config
  225. typedef union {
  226. uint32_t v;
  227. struct
  228. {
  229. uint32_t first_128m_cmd : 8; // [7:0]
  230. uint32_t second_128m_cmd : 8; // [15:8]
  231. uint32_t third_128m_cmd : 8; // [23:16]
  232. uint32_t fourth_128m_cmd : 8; // [31:24]
  233. } b;
  234. } REG_SPI_FLASH_SPI_128_FLASH_CONFIG_T;
  235. // spi_cs4_sel
  236. typedef union {
  237. uint32_t v;
  238. struct
  239. {
  240. uint32_t spi_cs4_sel : 3; // [2:0]
  241. uint32_t __31_3 : 29; // [31:3]
  242. } b;
  243. } REG_SPI_FLASH_SPI_CS4_SEL_T;
  244. // page0_addr
  245. typedef union {
  246. uint32_t v;
  247. struct
  248. {
  249. uint32_t page0_addr : 24; // [23:0]
  250. uint32_t __30_24 : 7; // [30:24]
  251. uint32_t page0_valid : 1; // [31]
  252. } b;
  253. } REG_SPI_FLASH_PAGE0_ADDR_T;
  254. // page1_addr
  255. typedef union {
  256. uint32_t v;
  257. struct
  258. {
  259. uint32_t page1_addr : 24; // [23:0]
  260. uint32_t __30_24 : 7; // [30:24]
  261. uint32_t page1_valid : 1; // [31]
  262. } b;
  263. } REG_SPI_FLASH_PAGE1_ADDR_T;
  264. // page2_addr
  265. typedef union {
  266. uint32_t v;
  267. struct
  268. {
  269. uint32_t page2_addr : 24; // [23:0]
  270. uint32_t __30_24 : 7; // [30:24]
  271. uint32_t page2_valid : 1; // [31]
  272. } b;
  273. } REG_SPI_FLASH_PAGE2_ADDR_T;
  274. // page3_addr
  275. typedef union {
  276. uint32_t v;
  277. struct
  278. {
  279. uint32_t page3_addr : 24; // [23:0]
  280. uint32_t __30_24 : 7; // [30:24]
  281. uint32_t page3_valid : 1; // [31]
  282. } b;
  283. } REG_SPI_FLASH_PAGE3_ADDR_T;
  284. // page4_addr
  285. typedef union {
  286. uint32_t v;
  287. struct
  288. {
  289. uint32_t page4_addr : 24; // [23:0]
  290. uint32_t __30_24 : 7; // [30:24]
  291. uint32_t page4_valid : 1; // [31]
  292. } b;
  293. } REG_SPI_FLASH_PAGE4_ADDR_T;
  294. // page5_addr
  295. typedef union {
  296. uint32_t v;
  297. struct
  298. {
  299. uint32_t page5_addr : 24; // [23:0]
  300. uint32_t __30_24 : 7; // [30:24]
  301. uint32_t page5_valid : 1; // [31]
  302. } b;
  303. } REG_SPI_FLASH_PAGE5_ADDR_T;
  304. // page6_addr
  305. typedef union {
  306. uint32_t v;
  307. struct
  308. {
  309. uint32_t page6_addr : 24; // [23:0]
  310. uint32_t __30_24 : 7; // [30:24]
  311. uint32_t page6_valid : 1; // [31]
  312. } b;
  313. } REG_SPI_FLASH_PAGE6_ADDR_T;
  314. // page7_addr
  315. typedef union {
  316. uint32_t v;
  317. struct
  318. {
  319. uint32_t page7_addr : 24; // [23:0]
  320. uint32_t __30_24 : 7; // [30:24]
  321. uint32_t page7_valid : 1; // [31]
  322. } b;
  323. } REG_SPI_FLASH_PAGE7_ADDR_T;
  324. // page8_addr
  325. typedef union {
  326. uint32_t v;
  327. struct
  328. {
  329. uint32_t page8_addr : 24; // [23:0]
  330. uint32_t __30_24 : 7; // [30:24]
  331. uint32_t page8_valid : 1; // [31]
  332. } b;
  333. } REG_SPI_FLASH_PAGE8_ADDR_T;
  334. // page9_addr
  335. typedef union {
  336. uint32_t v;
  337. struct
  338. {
  339. uint32_t page9_addr : 24; // [23:0]
  340. uint32_t __30_24 : 7; // [30:24]
  341. uint32_t page9_valid : 1; // [31]
  342. } b;
  343. } REG_SPI_FLASH_PAGE9_ADDR_T;
  344. // page10_addr
  345. typedef union {
  346. uint32_t v;
  347. struct
  348. {
  349. uint32_t page10_addr : 24; // [23:0]
  350. uint32_t __30_24 : 7; // [30:24]
  351. uint32_t page10_valid : 1; // [31]
  352. } b;
  353. } REG_SPI_FLASH_PAGE10_ADDR_T;
  354. // page11_addr
  355. typedef union {
  356. uint32_t v;
  357. struct
  358. {
  359. uint32_t page11_addr : 24; // [23:0]
  360. uint32_t __30_24 : 7; // [30:24]
  361. uint32_t page11_valid : 1; // [31]
  362. } b;
  363. } REG_SPI_FLASH_PAGE11_ADDR_T;
  364. // page12_addr
  365. typedef union {
  366. uint32_t v;
  367. struct
  368. {
  369. uint32_t page12_addr : 24; // [23:0]
  370. uint32_t __30_24 : 7; // [30:24]
  371. uint32_t page12_valid : 1; // [31]
  372. } b;
  373. } REG_SPI_FLASH_PAGE12_ADDR_T;
  374. // page13_addr
  375. typedef union {
  376. uint32_t v;
  377. struct
  378. {
  379. uint32_t page13_addr : 24; // [23:0]
  380. uint32_t __30_24 : 7; // [30:24]
  381. uint32_t page13_valid : 1; // [31]
  382. } b;
  383. } REG_SPI_FLASH_PAGE13_ADDR_T;
  384. // page14_addr
  385. typedef union {
  386. uint32_t v;
  387. struct
  388. {
  389. uint32_t page14_addr : 24; // [23:0]
  390. uint32_t __30_24 : 7; // [30:24]
  391. uint32_t page14_valid : 1; // [31]
  392. } b;
  393. } REG_SPI_FLASH_PAGE14_ADDR_T;
  394. // page15_addr
  395. typedef union {
  396. uint32_t v;
  397. struct
  398. {
  399. uint32_t page15_addr : 24; // [23:0]
  400. uint32_t __30_24 : 7; // [30:24]
  401. uint32_t page15_valid : 1; // [31]
  402. } b;
  403. } REG_SPI_FLASH_PAGE15_ADDR_T;
  404. // spi_page_config
  405. typedef union {
  406. uint32_t v;
  407. struct
  408. {
  409. uint32_t multi_page_enable_multi_page_start : 1; // [0]
  410. uint32_t __7_1 : 7; // [7:1]
  411. uint32_t page_num : 5; // [12:8]
  412. uint32_t __31_13 : 19; // [31:13]
  413. } b;
  414. } REG_SPI_FLASH_SPI_PAGE_CONFIG_T;
  415. // spi_cmd_reconfig
  416. typedef union {
  417. uint32_t v;
  418. struct
  419. {
  420. uint32_t program_exe_cmd : 8; // [7:0]
  421. uint32_t program_load_cmd : 8; // [15:8]
  422. uint32_t write_enable_cmd : 8; // [23:16]
  423. uint32_t __31_24 : 8; // [31:24]
  424. } b;
  425. } REG_SPI_FLASH_SPI_CMD_RECONFIG_T;
  426. // page0_col_addr
  427. typedef union {
  428. uint32_t v;
  429. struct
  430. {
  431. uint32_t page0_col_addr : 16; // [15:0]
  432. uint32_t __31_16 : 16; // [31:16]
  433. } b;
  434. } REG_SPI_FLASH_PAGE0_COL_ADDR_T;
  435. // page1_col_addr
  436. typedef union {
  437. uint32_t v;
  438. struct
  439. {
  440. uint32_t page1_col_addr : 16; // [15:0]
  441. uint32_t __31_16 : 16; // [31:16]
  442. } b;
  443. } REG_SPI_FLASH_PAGE1_COL_ADDR_T;
  444. // page2_col_addr
  445. typedef union {
  446. uint32_t v;
  447. struct
  448. {
  449. uint32_t page2_col_addr : 16; // [15:0]
  450. uint32_t __31_16 : 16; // [31:16]
  451. } b;
  452. } REG_SPI_FLASH_PAGE2_COL_ADDR_T;
  453. // page3_col_addr
  454. typedef union {
  455. uint32_t v;
  456. struct
  457. {
  458. uint32_t page3_col_addr : 16; // [15:0]
  459. uint32_t __31_16 : 16; // [31:16]
  460. } b;
  461. } REG_SPI_FLASH_PAGE3_COL_ADDR_T;
  462. // page4_col_addr
  463. typedef union {
  464. uint32_t v;
  465. struct
  466. {
  467. uint32_t page4_col_addr : 16; // [15:0]
  468. uint32_t __31_16 : 16; // [31:16]
  469. } b;
  470. } REG_SPI_FLASH_PAGE4_COL_ADDR_T;
  471. // page5_col_addr
  472. typedef union {
  473. uint32_t v;
  474. struct
  475. {
  476. uint32_t page5_col_addr : 16; // [15:0]
  477. uint32_t __31_16 : 16; // [31:16]
  478. } b;
  479. } REG_SPI_FLASH_PAGE5_COL_ADDR_T;
  480. // page6_col_addr
  481. typedef union {
  482. uint32_t v;
  483. struct
  484. {
  485. uint32_t page6_col_addr : 16; // [15:0]
  486. uint32_t __31_16 : 16; // [31:16]
  487. } b;
  488. } REG_SPI_FLASH_PAGE6_COL_ADDR_T;
  489. // page7_col_addr
  490. typedef union {
  491. uint32_t v;
  492. struct
  493. {
  494. uint32_t page7_col_addr : 16; // [15:0]
  495. uint32_t __31_16 : 16; // [31:16]
  496. } b;
  497. } REG_SPI_FLASH_PAGE7_COL_ADDR_T;
  498. // page8_col_addr
  499. typedef union {
  500. uint32_t v;
  501. struct
  502. {
  503. uint32_t page8_col_addr : 16; // [15:0]
  504. uint32_t __31_16 : 16; // [31:16]
  505. } b;
  506. } REG_SPI_FLASH_PAGE8_COL_ADDR_T;
  507. // page9_col_addr
  508. typedef union {
  509. uint32_t v;
  510. struct
  511. {
  512. uint32_t page9_col_addr : 16; // [15:0]
  513. uint32_t __31_16 : 16; // [31:16]
  514. } b;
  515. } REG_SPI_FLASH_PAGE9_COL_ADDR_T;
  516. // page10_col_addr
  517. typedef union {
  518. uint32_t v;
  519. struct
  520. {
  521. uint32_t page10_col_addr : 16; // [15:0]
  522. uint32_t __31_16 : 16; // [31:16]
  523. } b;
  524. } REG_SPI_FLASH_PAGE10_COL_ADDR_T;
  525. // page11_col_addr
  526. typedef union {
  527. uint32_t v;
  528. struct
  529. {
  530. uint32_t page11_col_addr : 16; // [15:0]
  531. uint32_t __31_16 : 16; // [31:16]
  532. } b;
  533. } REG_SPI_FLASH_PAGE11_COL_ADDR_T;
  534. // page12_col_addr
  535. typedef union {
  536. uint32_t v;
  537. struct
  538. {
  539. uint32_t page12_col_addr : 16; // [15:0]
  540. uint32_t __31_16 : 16; // [31:16]
  541. } b;
  542. } REG_SPI_FLASH_PAGE12_COL_ADDR_T;
  543. // page13_col_addr
  544. typedef union {
  545. uint32_t v;
  546. struct
  547. {
  548. uint32_t page13_col_addr : 16; // [15:0]
  549. uint32_t __31_16 : 16; // [31:16]
  550. } b;
  551. } REG_SPI_FLASH_PAGE13_COL_ADDR_T;
  552. // page14_col_addr
  553. typedef union {
  554. uint32_t v;
  555. struct
  556. {
  557. uint32_t page14_col_addr : 16; // [15:0]
  558. uint32_t __31_16 : 16; // [31:16]
  559. } b;
  560. } REG_SPI_FLASH_PAGE14_COL_ADDR_T;
  561. // page15_col_addr
  562. typedef union {
  563. uint32_t v;
  564. struct
  565. {
  566. uint32_t page15_col_addr : 16; // [15:0]
  567. uint32_t __31_16 : 16; // [31:16]
  568. } b;
  569. } REG_SPI_FLASH_PAGE15_COL_ADDR_T;
  570. // nand_int_mask
  571. typedef union {
  572. uint32_t v;
  573. struct
  574. {
  575. uint32_t nand_int_mask : 1; // [0]
  576. uint32_t __31_1 : 31; // [31:1]
  577. } b;
  578. } REG_SPI_FLASH_NAND_INT_MASK_T;
  579. // spi_cmd_addr
  580. #define SPI_FLASH_SPI_TX_CMD(n) (((n)&0xff) << 0)
  581. #define SPI_FLASH_SPI_ADDRESS(n) (((n)&0xffffff) << 8)
  582. // spi_block_size
  583. #define SPI_FLASH_SPI_MODEBIT(n) (((n)&0xff) << 0)
  584. #define SPI_FLASH_SPI_RW_BLK_SIZE(n) (((n)&0x3fff) << 8)
  585. #define SPI_FLASH_CONTINUOUS_ENABLE (1 << 24)
  586. // spi_data_fifo
  587. #define SPI_FLASH_SPI_TX_DATA(n) (((n)&0xff) << 0)
  588. #define SPI_FLASH_SPI_SEND_TYPE (1 << 8)
  589. // spi_status
  590. #define SPI_FLASH_SPI_FLASH_BUSY (1 << 0)
  591. #define SPI_FLASH_TX_FIFO_EMPTY (1 << 1)
  592. #define SPI_FLASH_TX_FIFO_FULL (1 << 2)
  593. #define SPI_FLASH_RX_FIFO_EMPTY (1 << 3)
  594. #define SPI_FLASH_RX_FIFO_COUNT(n) (((n)&0x1f) << 4)
  595. #define SPI_FLASH_READ_STAT_BUSY (1 << 9)
  596. #define SPI_FLASH_NAND_INT (1 << 10)
  597. #define SPI_FLASH_SPIFLASH_INT (1 << 11)
  598. // spi_config
  599. #define SPI_FLASH_QUAD_MODE_SPI_READ (0 << 0)
  600. #define SPI_FLASH_QUAD_MODE_QUAD_READ (1 << 0)
  601. #define SPI_FLASH_SPI_WPROTECT_PIN (1 << 1)
  602. #define SPI_FLASH_SPI_HOLD_PIN (1 << 2)
  603. #define SPI_FLASH_SAMPLE_DELAY(n) (((n)&0x7) << 4)
  604. #define SPI_FLASH_CLK_DIVIDER(n) (((n)&0xff) << 8)
  605. #define SPI_FLASH_CMD_QUAD (1 << 16)
  606. #define SPI_FLASH_TX_RX_SIZE(n) (((n)&0x3) << 17)
  607. #define SPI_FLASH_QUAD_MODE_V_SPI_READ (0)
  608. #define SPI_FLASH_QUAD_MODE_V_QUAD_READ (1)
  609. // spi_fifo_control
  610. #define SPI_FLASH_RX_FIFO_CLR (1 << 0)
  611. #define SPI_FLASH_TX_FIFO_CLR (1 << 1)
  612. // spi_cs_size
  613. #define SPI_FLASH_SPI_CS_NUM_1_SPIFLASH (0 << 0)
  614. #define SPI_FLASH_SPI_CS_NUM_2_SPIFLASH (1 << 0)
  615. #define SPI_FLASH_SPI_SIZE(n) (((n)&0x3) << 1)
  616. #define SPI_FLASH_SPI_SIZE_32M (0 << 1)
  617. #define SPI_FLASH_SPI_SIZE_64M (1 << 1)
  618. #define SPI_FLASH_SPI_SIZE_16M (2 << 1)
  619. #define SPI_FLASH_SPI_SIZE_8M (3 << 1)
  620. #define SPI_FLASH_SPI_128M_OTHER_SPIFLASH (0 << 3)
  621. #define SPI_FLASH_SPI_128M_128M_SPIFLASH (1 << 3)
  622. #define SPI_FLASH_AHB_READ_DISABLE_ENABLE_AHB_READ (0 << 4)
  623. #define SPI_FLASH_AHB_READ_DISABLE_DISABLE_AHB_READ (1 << 4)
  624. #define SPI_FLASH_SEL_FLASH_1_SEL_FLASH_0 (0 << 5)
  625. #define SPI_FLASH_SEL_FLASH_1_SEL_FLASH_1 (1 << 5)
  626. #define SPI_FLASH_SEL1_FLASH_1 (1 << 6)
  627. #define SPI_FLASH_DIFF_128M_DIFF_CMD_EN (1 << 7)
  628. #define SPI_FLASH_SPI_256M (1 << 8)
  629. #define SPI_FLASH_SPI_512M (1 << 9)
  630. #define SPI_FLASH_SPI_CS1_SEL2 (1 << 10)
  631. #define SPI_FLASH_SPI_1G (1 << 11)
  632. #define SPI_FLASH_SPI_2G (1 << 12)
  633. #define SPI_FLASH_SPI_4G (1 << 13)
  634. #define SPI_FLASH_SPI_CS1_SEL3 (1 << 14)
  635. #define SPI_FLASH_SPI_CS1_SEL4 (1 << 15)
  636. #define SPI_FLASH_SPI_CS1_SEL5 (1 << 16)
  637. #define SPI_FLASH_SPI_CS_NUM_V_1_SPIFLASH (0)
  638. #define SPI_FLASH_SPI_CS_NUM_V_2_SPIFLASH (1)
  639. #define SPI_FLASH_SPI_SIZE_V_32M (0)
  640. #define SPI_FLASH_SPI_SIZE_V_64M (1)
  641. #define SPI_FLASH_SPI_SIZE_V_16M (2)
  642. #define SPI_FLASH_SPI_SIZE_V_8M (3)
  643. #define SPI_FLASH_SPI_128M_V_OTHER_SPIFLASH (0)
  644. #define SPI_FLASH_SPI_128M_V_128M_SPIFLASH (1)
  645. #define SPI_FLASH_AHB_READ_DISABLE_V_ENABLE_AHB_READ (0)
  646. #define SPI_FLASH_AHB_READ_DISABLE_V_DISABLE_AHB_READ (1)
  647. #define SPI_FLASH_SEL_FLASH_1_V_SEL_FLASH_0 (0)
  648. #define SPI_FLASH_SEL_FLASH_1_V_SEL_FLASH_1 (1)
  649. // spi_read_cmd
  650. #define SPI_FLASH_QREAD_CMD(n) (((n)&0xff) << 0)
  651. #define SPI_FLASH_FREAD_CMD(n) (((n)&0xff) << 8)
  652. #define SPI_FLASH_READ_CMD(n) (((n)&0xff) << 16)
  653. #define SPI_FLASH_PROTECT_BYTE(n) (((n)&0xff) << 24)
  654. // spi_nand_config
  655. #define SPI_FLASH_NAND_SEL (1 << 0)
  656. #define SPI_FLASH_NAND_ADDR(n) (((n)&0x3) << 1)
  657. #define SPI_FLASH_REUSE_NAND_RAM (1 << 3)
  658. #define SPI_FLASH_REUSE_READ (1 << 4)
  659. #define SPI_FLASH_WRITE_PAGE_HIT (1 << 5)
  660. #define SPI_FLASH_NAND_DATA_TRANS (1 << 6)
  661. #define SPI_FLASH_PAGE_SIZE_SEL (1 << 7)
  662. #define SPI_FLASH_PAGE_READ_CMD(n) (((n)&0xff) << 8)
  663. #define SPI_FLASH_GET_STS_CMD(n) (((n)&0xff) << 16)
  664. #define SPI_FLASH_RAM_READ_CMD(n) (((n)&0xff) << 24)
  665. // spi_nand_config2
  666. #define SPI_FLASH_GET_STS_ADDR(n) (((n)&0xff) << 0)
  667. #define SPI_FLASH_STS_QIP(n) (((n)&0xff) << 16)
  668. // spi_256_512_flash_config
  669. #define SPI_FLASH_FOUR_BYTE_ADDR (1 << 0)
  670. #define SPI_FLASH_DUMMY_CYCLE_EN (1 << 1)
  671. #define SPI_FLASH_DUMMY_CYCLE(n) (((n)&0xf) << 8)
  672. #define SPI_FLASH_WRAP_EN (1 << 12)
  673. #define SPI_FLASH_WRAP_CODE(n) (((n)&0xf) << 16)
  674. // spi_128_flash_config
  675. #define SPI_FLASH_FIRST_128M_CMD(n) (((n)&0xff) << 0)
  676. #define SPI_FLASH_SECOND_128M_CMD(n) (((n)&0xff) << 8)
  677. #define SPI_FLASH_THIRD_128M_CMD(n) (((n)&0xff) << 16)
  678. #define SPI_FLASH_FOURTH_128M_CMD(n) (((n)&0xff) << 24)
  679. // spi_cs4_sel
  680. #define SPI_FLASH_SPI_CS4_SEL(n) (((n)&0x7) << 0)
  681. // page0_addr
  682. #define SPI_FLASH_PAGE0_ADDR(n) (((n)&0xffffff) << 0)
  683. #define SPI_FLASH_PAGE0_VALID (1 << 31)
  684. // page1_addr
  685. #define SPI_FLASH_PAGE1_ADDR(n) (((n)&0xffffff) << 0)
  686. #define SPI_FLASH_PAGE1_VALID (1 << 31)
  687. // page2_addr
  688. #define SPI_FLASH_PAGE2_ADDR(n) (((n)&0xffffff) << 0)
  689. #define SPI_FLASH_PAGE2_VALID (1 << 31)
  690. // page3_addr
  691. #define SPI_FLASH_PAGE3_ADDR(n) (((n)&0xffffff) << 0)
  692. #define SPI_FLASH_PAGE3_VALID (1 << 31)
  693. // page4_addr
  694. #define SPI_FLASH_PAGE4_ADDR(n) (((n)&0xffffff) << 0)
  695. #define SPI_FLASH_PAGE4_VALID (1 << 31)
  696. // page5_addr
  697. #define SPI_FLASH_PAGE5_ADDR(n) (((n)&0xffffff) << 0)
  698. #define SPI_FLASH_PAGE5_VALID (1 << 31)
  699. // page6_addr
  700. #define SPI_FLASH_PAGE6_ADDR(n) (((n)&0xffffff) << 0)
  701. #define SPI_FLASH_PAGE6_VALID (1 << 31)
  702. // page7_addr
  703. #define SPI_FLASH_PAGE7_ADDR(n) (((n)&0xffffff) << 0)
  704. #define SPI_FLASH_PAGE7_VALID (1 << 31)
  705. // page8_addr
  706. #define SPI_FLASH_PAGE8_ADDR(n) (((n)&0xffffff) << 0)
  707. #define SPI_FLASH_PAGE8_VALID (1 << 31)
  708. // page9_addr
  709. #define SPI_FLASH_PAGE9_ADDR(n) (((n)&0xffffff) << 0)
  710. #define SPI_FLASH_PAGE9_VALID (1 << 31)
  711. // page10_addr
  712. #define SPI_FLASH_PAGE10_ADDR(n) (((n)&0xffffff) << 0)
  713. #define SPI_FLASH_PAGE10_VALID (1 << 31)
  714. // page11_addr
  715. #define SPI_FLASH_PAGE11_ADDR(n) (((n)&0xffffff) << 0)
  716. #define SPI_FLASH_PAGE11_VALID (1 << 31)
  717. // page12_addr
  718. #define SPI_FLASH_PAGE12_ADDR(n) (((n)&0xffffff) << 0)
  719. #define SPI_FLASH_PAGE12_VALID (1 << 31)
  720. // page13_addr
  721. #define SPI_FLASH_PAGE13_ADDR(n) (((n)&0xffffff) << 0)
  722. #define SPI_FLASH_PAGE13_VALID (1 << 31)
  723. // page14_addr
  724. #define SPI_FLASH_PAGE14_ADDR(n) (((n)&0xffffff) << 0)
  725. #define SPI_FLASH_PAGE14_VALID (1 << 31)
  726. // page15_addr
  727. #define SPI_FLASH_PAGE15_ADDR(n) (((n)&0xffffff) << 0)
  728. #define SPI_FLASH_PAGE15_VALID (1 << 31)
  729. // spi_page_config
  730. #define SPI_FLASH_MULTI_PAGE_ENABLE_MULTI_PAGE_START (1 << 0)
  731. #define SPI_FLASH_PAGE_NUM(n) (((n)&0x1f) << 8)
  732. // spi_cmd_reconfig
  733. #define SPI_FLASH_PROGRAM_EXE_CMD(n) (((n)&0xff) << 0)
  734. #define SPI_FLASH_PROGRAM_LOAD_CMD(n) (((n)&0xff) << 8)
  735. #define SPI_FLASH_WRITE_ENABLE_CMD(n) (((n)&0xff) << 16)
  736. // page0_col_addr
  737. #define SPI_FLASH_PAGE0_COL_ADDR(n) (((n)&0xffff) << 0)
  738. // page1_col_addr
  739. #define SPI_FLASH_PAGE1_COL_ADDR(n) (((n)&0xffff) << 0)
  740. // page2_col_addr
  741. #define SPI_FLASH_PAGE2_COL_ADDR(n) (((n)&0xffff) << 0)
  742. // page3_col_addr
  743. #define SPI_FLASH_PAGE3_COL_ADDR(n) (((n)&0xffff) << 0)
  744. // page4_col_addr
  745. #define SPI_FLASH_PAGE4_COL_ADDR(n) (((n)&0xffff) << 0)
  746. // page5_col_addr
  747. #define SPI_FLASH_PAGE5_COL_ADDR(n) (((n)&0xffff) << 0)
  748. // page6_col_addr
  749. #define SPI_FLASH_PAGE6_COL_ADDR(n) (((n)&0xffff) << 0)
  750. // page7_col_addr
  751. #define SPI_FLASH_PAGE7_COL_ADDR(n) (((n)&0xffff) << 0)
  752. // page8_col_addr
  753. #define SPI_FLASH_PAGE8_COL_ADDR(n) (((n)&0xffff) << 0)
  754. // page9_col_addr
  755. #define SPI_FLASH_PAGE9_COL_ADDR(n) (((n)&0xffff) << 0)
  756. // page10_col_addr
  757. #define SPI_FLASH_PAGE10_COL_ADDR(n) (((n)&0xffff) << 0)
  758. // page11_col_addr
  759. #define SPI_FLASH_PAGE11_COL_ADDR(n) (((n)&0xffff) << 0)
  760. // page12_col_addr
  761. #define SPI_FLASH_PAGE12_COL_ADDR(n) (((n)&0xffff) << 0)
  762. // page13_col_addr
  763. #define SPI_FLASH_PAGE13_COL_ADDR(n) (((n)&0xffff) << 0)
  764. // page14_col_addr
  765. #define SPI_FLASH_PAGE14_COL_ADDR(n) (((n)&0xffff) << 0)
  766. // page15_col_addr
  767. #define SPI_FLASH_PAGE15_COL_ADDR(n) (((n)&0xffff) << 0)
  768. // nand_int_mask
  769. #define SPI_FLASH_NAND_INT_MASK (1 << 0)
  770. #endif // _SPI_FLASH_H_