qcryptohw_50.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _DRIVERS_CRYPTO_MSM_QCRYPTOHW_50_H_
  13. #define _DRIVERS_CRYPTO_MSM_QCRYPTOHW_50_H_
  14. #define CRYPTO_BAM_CNFG_BITS_REG 0x0007C
  15. #define CRYPTO_BAM_CD_ENABLE 27
  16. #define CRYPTO_BAM_CD_ENABLE_MASK (1 << CRYPTO_BAM_CD_ENABLE)
  17. #define QCE_AUTH_REG_BYTE_COUNT 4
  18. #define CRYPTO_VERSION_REG 0x1A000
  19. #define CRYPTO_DATA_IN0_REG 0x1A010
  20. #define CRYPTO_DATA_IN1_REG 0x1A014
  21. #define CRYPTO_DATA_IN2_REG 0x1A018
  22. #define CRYPTO_DATA_IN3_REG 0x1A01C
  23. #define CRYPTO_DATA_OUT0_REG 0x1A020
  24. #define CRYPTO_DATA_OUT1_REG 0x1A024
  25. #define CRYPTO_DATA_OUT2_REG 0x1A028
  26. #define CRYPTO_DATA_OUT3_REG 0x1A02C
  27. #define CRYPTO_STATUS_REG 0x1A100
  28. #define CRYPTO_STATUS2_REG 0x1A104
  29. #define CRYPTO_ENGINES_AVAIL 0x1A108
  30. #define CRYPTO_FIFO_SIZES_REG 0x1A10C
  31. #define CRYPTO_SEG_SIZE_REG 0x1A110
  32. #define CRYPTO_GOPROC_REG 0x1A120
  33. #define CRYPTO_GOPROC_QC_KEY_REG 0x1B000
  34. #define CRYPTO_GOPROC_OEM_KEY_REG 0x1C000
  35. #define CRYPTO_ENCR_SEG_CFG_REG 0x1A200
  36. #define CRYPTO_ENCR_SEG_SIZE_REG 0x1A204
  37. #define CRYPTO_ENCR_SEG_START_REG 0x1A208
  38. #define CRYPTO_ENCR_KEY0_REG 0x1D000
  39. #define CRYPTO_ENCR_KEY1_REG 0x1D004
  40. #define CRYPTO_ENCR_KEY2_REG 0x1D008
  41. #define CRYPTO_ENCR_KEY3_REG 0x1D00C
  42. #define CRYPTO_ENCR_KEY4_REG 0x1D010
  43. #define CRYPTO_ENCR_KEY5_REG 0x1D014
  44. #define CRYPTO_ENCR_KEY6_REG 0x1D018
  45. #define CRYPTO_ENCR_KEY7_REG 0x1D01C
  46. #define CRYPTO_ENCR_XTS_KEY0_REG 0x1D020
  47. #define CRYPTO_ENCR_XTS_KEY1_REG 0x1D024
  48. #define CRYPTO_ENCR_XTS_KEY2_REG 0x1D028
  49. #define CRYPTO_ENCR_XTS_KEY3_REG 0x1D02C
  50. #define CRYPTO_ENCR_XTS_KEY4_REG 0x1D030
  51. #define CRYPTO_ENCR_XTS_KEY5_REG 0x1D034
  52. #define CRYPTO_ENCR_XTS_KEY6_REG 0x1D038
  53. #define CRYPTO_ENCR_XTS_KEY7_REG 0x1D03C
  54. #define CRYPTO_ENCR_PIPE0_KEY0_REG 0x1E000
  55. #define CRYPTO_ENCR_PIPE0_KEY1_REG 0x1E004
  56. #define CRYPTO_ENCR_PIPE0_KEY2_REG 0x1E008
  57. #define CRYPTO_ENCR_PIPE0_KEY3_REG 0x1E00C
  58. #define CRYPTO_ENCR_PIPE0_KEY4_REG 0x1E010
  59. #define CRYPTO_ENCR_PIPE0_KEY5_REG 0x1E014
  60. #define CRYPTO_ENCR_PIPE0_KEY6_REG 0x1E018
  61. #define CRYPTO_ENCR_PIPE0_KEY7_REG 0x1E01C
  62. #define CRYPTO_ENCR_PIPE1_KEY0_REG 0x1E020
  63. #define CRYPTO_ENCR_PIPE1_KEY1_REG 0x1E024
  64. #define CRYPTO_ENCR_PIPE1_KEY2_REG 0x1E028
  65. #define CRYPTO_ENCR_PIPE1_KEY3_REG 0x1E02C
  66. #define CRYPTO_ENCR_PIPE1_KEY4_REG 0x1E030
  67. #define CRYPTO_ENCR_PIPE1_KEY5_REG 0x1E034
  68. #define CRYPTO_ENCR_PIPE1_KEY6_REG 0x1E038
  69. #define CRYPTO_ENCR_PIPE1_KEY7_REG 0x1E03C
  70. #define CRYPTO_ENCR_PIPE2_KEY0_REG 0x1E040
  71. #define CRYPTO_ENCR_PIPE2_KEY1_REG 0x1E044
  72. #define CRYPTO_ENCR_PIPE2_KEY2_REG 0x1E048
  73. #define CRYPTO_ENCR_PIPE2_KEY3_REG 0x1E04C
  74. #define CRYPTO_ENCR_PIPE2_KEY4_REG 0x1E050
  75. #define CRYPTO_ENCR_PIPE2_KEY5_REG 0x1E054
  76. #define CRYPTO_ENCR_PIPE2_KEY6_REG 0x1E058
  77. #define CRYPTO_ENCR_PIPE2_KEY7_REG 0x1E05C
  78. #define CRYPTO_ENCR_PIPE3_KEY0_REG 0x1E060
  79. #define CRYPTO_ENCR_PIPE3_KEY1_REG 0x1E064
  80. #define CRYPTO_ENCR_PIPE3_KEY2_REG 0x1E068
  81. #define CRYPTO_ENCR_PIPE3_KEY3_REG 0x1E06C
  82. #define CRYPTO_ENCR_PIPE3_KEY4_REG 0x1E070
  83. #define CRYPTO_ENCR_PIPE3_KEY5_REG 0x1E074
  84. #define CRYPTO_ENCR_PIPE3_KEY6_REG 0x1E078
  85. #define CRYPTO_ENCR_PIPE3_KEY7_REG 0x1E07C
  86. #define CRYPTO_ENCR_PIPE0_XTS_KEY0_REG 0x1E200
  87. #define CRYPTO_ENCR_PIPE0_XTS_KEY1_REG 0x1E204
  88. #define CRYPTO_ENCR_PIPE0_XTS_KEY2_REG 0x1E208
  89. #define CRYPTO_ENCR_PIPE0_XTS_KEY3_REG 0x1E20C
  90. #define CRYPTO_ENCR_PIPE0_XTS_KEY4_REG 0x1E210
  91. #define CRYPTO_ENCR_PIPE0_XTS_KEY5_REG 0x1E214
  92. #define CRYPTO_ENCR_PIPE0_XTS_KEY6_REG 0x1E218
  93. #define CRYPTO_ENCR_PIPE0_XTS_KEY7_REG 0x1E21C
  94. #define CRYPTO_ENCR_PIPE1_XTS_KEY0_REG 0x1E220
  95. #define CRYPTO_ENCR_PIPE1_XTS_KEY1_REG 0x1E224
  96. #define CRYPTO_ENCR_PIPE1_XTS_KEY2_REG 0x1E228
  97. #define CRYPTO_ENCR_PIPE1_XTS_KEY3_REG 0x1E22C
  98. #define CRYPTO_ENCR_PIPE1_XTS_KEY4_REG 0x1E230
  99. #define CRYPTO_ENCR_PIPE1_XTS_KEY5_REG 0x1E234
  100. #define CRYPTO_ENCR_PIPE1_XTS_KEY6_REG 0x1E238
  101. #define CRYPTO_ENCR_PIPE1_XTS_KEY7_REG 0x1E23C
  102. #define CRYPTO_ENCR_PIPE2_XTS_KEY0_REG 0x1E240
  103. #define CRYPTO_ENCR_PIPE2_XTS_KEY1_REG 0x1E244
  104. #define CRYPTO_ENCR_PIPE2_XTS_KEY2_REG 0x1E248
  105. #define CRYPTO_ENCR_PIPE2_XTS_KEY3_REG 0x1E24C
  106. #define CRYPTO_ENCR_PIPE2_XTS_KEY4_REG 0x1E250
  107. #define CRYPTO_ENCR_PIPE2_XTS_KEY5_REG 0x1E254
  108. #define CRYPTO_ENCR_PIPE2_XTS_KEY6_REG 0x1E258
  109. #define CRYPTO_ENCR_PIPE2_XTS_KEY7_REG 0x1E25C
  110. #define CRYPTO_ENCR_PIPE3_XTS_KEY0_REG 0x1E260
  111. #define CRYPTO_ENCR_PIPE3_XTS_KEY1_REG 0x1E264
  112. #define CRYPTO_ENCR_PIPE3_XTS_KEY2_REG 0x1E268
  113. #define CRYPTO_ENCR_PIPE3_XTS_KEY3_REG 0x1E26C
  114. #define CRYPTO_ENCR_PIPE3_XTS_KEY4_REG 0x1E270
  115. #define CRYPTO_ENCR_PIPE3_XTS_KEY5_REG 0x1E274
  116. #define CRYPTO_ENCR_PIPE3_XTS_KEY6_REG 0x1E278
  117. #define CRYPTO_ENCR_PIPE3_XTS_KEY7_REG 0x1E27C
  118. #define CRYPTO_CNTR0_IV0_REG 0x1A20C
  119. #define CRYPTO_CNTR1_IV1_REG 0x1A210
  120. #define CRYPTO_CNTR2_IV2_REG 0x1A214
  121. #define CRYPTO_CNTR3_IV3_REG 0x1A218
  122. #define CRYPTO_CNTR_MASK_REG0 0x1A23C
  123. #define CRYPTO_CNTR_MASK_REG1 0x1A238
  124. #define CRYPTO_CNTR_MASK_REG2 0x1A234
  125. #define CRYPTO_CNTR_MASK_REG 0x1A21C
  126. #define CRYPTO_ENCR_CCM_INT_CNTR0_REG 0x1A220
  127. #define CRYPTO_ENCR_CCM_INT_CNTR1_REG 0x1A224
  128. #define CRYPTO_ENCR_CCM_INT_CNTR2_REG 0x1A228
  129. #define CRYPTO_ENCR_CCM_INT_CNTR3_REG 0x1A22C
  130. #define CRYPTO_ENCR_XTS_DU_SIZE_REG 0x1A230
  131. #define CRYPTO_AUTH_SEG_CFG_REG 0x1A300
  132. #define CRYPTO_AUTH_SEG_SIZE_REG 0x1A304
  133. #define CRYPTO_AUTH_SEG_START_REG 0x1A308
  134. #define CRYPTO_AUTH_KEY0_REG 0x1D040
  135. #define CRYPTO_AUTH_KEY1_REG 0x1D044
  136. #define CRYPTO_AUTH_KEY2_REG 0x1D048
  137. #define CRYPTO_AUTH_KEY3_REG 0x1D04C
  138. #define CRYPTO_AUTH_KEY4_REG 0x1D050
  139. #define CRYPTO_AUTH_KEY5_REG 0x1D054
  140. #define CRYPTO_AUTH_KEY6_REG 0x1D058
  141. #define CRYPTO_AUTH_KEY7_REG 0x1D05C
  142. #define CRYPTO_AUTH_KEY8_REG 0x1D060
  143. #define CRYPTO_AUTH_KEY9_REG 0x1D064
  144. #define CRYPTO_AUTH_KEY10_REG 0x1D068
  145. #define CRYPTO_AUTH_KEY11_REG 0x1D06C
  146. #define CRYPTO_AUTH_KEY12_REG 0x1D070
  147. #define CRYPTO_AUTH_KEY13_REG 0x1D074
  148. #define CRYPTO_AUTH_KEY14_REG 0x1D078
  149. #define CRYPTO_AUTH_KEY15_REG 0x1D07C
  150. #define CRYPTO_AUTH_PIPE0_KEY0_REG 0x1E800
  151. #define CRYPTO_AUTH_PIPE0_KEY1_REG 0x1E804
  152. #define CRYPTO_AUTH_PIPE0_KEY2_REG 0x1E808
  153. #define CRYPTO_AUTH_PIPE0_KEY3_REG 0x1E80C
  154. #define CRYPTO_AUTH_PIPE0_KEY4_REG 0x1E810
  155. #define CRYPTO_AUTH_PIPE0_KEY5_REG 0x1E814
  156. #define CRYPTO_AUTH_PIPE0_KEY6_REG 0x1E818
  157. #define CRYPTO_AUTH_PIPE0_KEY7_REG 0x1E81C
  158. #define CRYPTO_AUTH_PIPE0_KEY8_REG 0x1E820
  159. #define CRYPTO_AUTH_PIPE0_KEY9_REG 0x1E824
  160. #define CRYPTO_AUTH_PIPE0_KEY10_REG 0x1E828
  161. #define CRYPTO_AUTH_PIPE0_KEY11_REG 0x1E82C
  162. #define CRYPTO_AUTH_PIPE0_KEY12_REG 0x1E830
  163. #define CRYPTO_AUTH_PIPE0_KEY13_REG 0x1E834
  164. #define CRYPTO_AUTH_PIPE0_KEY14_REG 0x1E838
  165. #define CRYPTO_AUTH_PIPE0_KEY15_REG 0x1E83C
  166. #define CRYPTO_AUTH_PIPE1_KEY0_REG 0x1E880
  167. #define CRYPTO_AUTH_PIPE1_KEY1_REG 0x1E884
  168. #define CRYPTO_AUTH_PIPE1_KEY2_REG 0x1E888
  169. #define CRYPTO_AUTH_PIPE1_KEY3_REG 0x1E88C
  170. #define CRYPTO_AUTH_PIPE1_KEY4_REG 0x1E890
  171. #define CRYPTO_AUTH_PIPE1_KEY5_REG 0x1E894
  172. #define CRYPTO_AUTH_PIPE1_KEY6_REG 0x1E898
  173. #define CRYPTO_AUTH_PIPE1_KEY7_REG 0x1E89C
  174. #define CRYPTO_AUTH_PIPE1_KEY8_REG 0x1E8A0
  175. #define CRYPTO_AUTH_PIPE1_KEY9_REG 0x1E8A4
  176. #define CRYPTO_AUTH_PIPE1_KEY10_REG 0x1E8A8
  177. #define CRYPTO_AUTH_PIPE1_KEY11_REG 0x1E8AC
  178. #define CRYPTO_AUTH_PIPE1_KEY12_REG 0x1E8B0
  179. #define CRYPTO_AUTH_PIPE1_KEY13_REG 0x1E8B4
  180. #define CRYPTO_AUTH_PIPE1_KEY14_REG 0x1E8B8
  181. #define CRYPTO_AUTH_PIPE1_KEY15_REG 0x1E8BC
  182. #define CRYPTO_AUTH_PIPE2_KEY0_REG 0x1E900
  183. #define CRYPTO_AUTH_PIPE2_KEY1_REG 0x1E904
  184. #define CRYPTO_AUTH_PIPE2_KEY2_REG 0x1E908
  185. #define CRYPTO_AUTH_PIPE2_KEY3_REG 0x1E90C
  186. #define CRYPTO_AUTH_PIPE2_KEY4_REG 0x1E910
  187. #define CRYPTO_AUTH_PIPE2_KEY5_REG 0x1E914
  188. #define CRYPTO_AUTH_PIPE2_KEY6_REG 0x1E918
  189. #define CRYPTO_AUTH_PIPE2_KEY7_REG 0x1E91C
  190. #define CRYPTO_AUTH_PIPE2_KEY8_REG 0x1E920
  191. #define CRYPTO_AUTH_PIPE2_KEY9_REG 0x1E924
  192. #define CRYPTO_AUTH_PIPE2_KEY10_REG 0x1E928
  193. #define CRYPTO_AUTH_PIPE2_KEY11_REG 0x1E92C
  194. #define CRYPTO_AUTH_PIPE2_KEY12_REG 0x1E930
  195. #define CRYPTO_AUTH_PIPE2_KEY13_REG 0x1E934
  196. #define CRYPTO_AUTH_PIPE2_KEY14_REG 0x1E938
  197. #define CRYPTO_AUTH_PIPE2_KEY15_REG 0x1E93C
  198. #define CRYPTO_AUTH_PIPE3_KEY0_REG 0x1E980
  199. #define CRYPTO_AUTH_PIPE3_KEY1_REG 0x1E984
  200. #define CRYPTO_AUTH_PIPE3_KEY2_REG 0x1E988
  201. #define CRYPTO_AUTH_PIPE3_KEY3_REG 0x1E98C
  202. #define CRYPTO_AUTH_PIPE3_KEY4_REG 0x1E990
  203. #define CRYPTO_AUTH_PIPE3_KEY5_REG 0x1E994
  204. #define CRYPTO_AUTH_PIPE3_KEY6_REG 0x1E998
  205. #define CRYPTO_AUTH_PIPE3_KEY7_REG 0x1E99C
  206. #define CRYPTO_AUTH_PIPE3_KEY8_REG 0x1E9A0
  207. #define CRYPTO_AUTH_PIPE3_KEY9_REG 0x1E9A4
  208. #define CRYPTO_AUTH_PIPE3_KEY10_REG 0x1E9A8
  209. #define CRYPTO_AUTH_PIPE3_KEY11_REG 0x1E9AC
  210. #define CRYPTO_AUTH_PIPE3_KEY12_REG 0x1E9B0
  211. #define CRYPTO_AUTH_PIPE3_KEY13_REG 0x1E9B4
  212. #define CRYPTO_AUTH_PIPE3_KEY14_REG 0x1E9B8
  213. #define CRYPTO_AUTH_PIPE3_KEY15_REG 0x1E9BC
  214. #define CRYPTO_AUTH_IV0_REG 0x1A310
  215. #define CRYPTO_AUTH_IV1_REG 0x1A314
  216. #define CRYPTO_AUTH_IV2_REG 0x1A318
  217. #define CRYPTO_AUTH_IV3_REG 0x1A31C
  218. #define CRYPTO_AUTH_IV4_REG 0x1A320
  219. #define CRYPTO_AUTH_IV5_REG 0x1A324
  220. #define CRYPTO_AUTH_IV6_REG 0x1A328
  221. #define CRYPTO_AUTH_IV7_REG 0x1A32C
  222. #define CRYPTO_AUTH_IV8_REG 0x1A330
  223. #define CRYPTO_AUTH_IV9_REG 0x1A334
  224. #define CRYPTO_AUTH_IV10_REG 0x1A338
  225. #define CRYPTO_AUTH_IV11_REG 0x1A33C
  226. #define CRYPTO_AUTH_IV12_REG 0x1A340
  227. #define CRYPTO_AUTH_IV13_REG 0x1A344
  228. #define CRYPTO_AUTH_IV14_REG 0x1A348
  229. #define CRYPTO_AUTH_IV15_REG 0x1A34C
  230. #define CRYPTO_AUTH_INFO_NONCE0_REG 0x1A350
  231. #define CRYPTO_AUTH_INFO_NONCE1_REG 0x1A354
  232. #define CRYPTO_AUTH_INFO_NONCE2_REG 0x1A358
  233. #define CRYPTO_AUTH_INFO_NONCE3_REG 0x1A35C
  234. #define CRYPTO_AUTH_BYTECNT0_REG 0x1A390
  235. #define CRYPTO_AUTH_BYTECNT1_REG 0x1A394
  236. #define CRYPTO_AUTH_BYTECNT2_REG 0x1A398
  237. #define CRYPTO_AUTH_BYTECNT3_REG 0x1A39C
  238. #define CRYPTO_AUTH_EXP_MAC0_REG 0x1A3A0
  239. #define CRYPTO_AUTH_EXP_MAC1_REG 0x1A3A4
  240. #define CRYPTO_AUTH_EXP_MAC2_REG 0x1A3A8
  241. #define CRYPTO_AUTH_EXP_MAC3_REG 0x1A3AC
  242. #define CRYPTO_AUTH_EXP_MAC4_REG 0x1A3B0
  243. #define CRYPTO_AUTH_EXP_MAC5_REG 0x1A3B4
  244. #define CRYPTO_AUTH_EXP_MAC6_REG 0x1A3B8
  245. #define CRYPTO_AUTH_EXP_MAC7_REG 0x1A3BC
  246. #define CRYPTO_CONFIG_REG 0x1A400
  247. #define CRYPTO_DEBUG_ENABLE_REG 0x1AF00
  248. #define CRYPTO_DEBUG_REG 0x1AF04
  249. /* Register bits */
  250. #define CRYPTO_CORE_STEP_REV_MASK 0xFFFF
  251. #define CRYPTO_CORE_STEP_REV 0 /* bit 15-0 */
  252. #define CRYPTO_CORE_MAJOR_REV_MASK 0xFF000000
  253. #define CRYPTO_CORE_MAJOR_REV 24 /* bit 31-24 */
  254. #define CRYPTO_CORE_MINOR_REV_MASK 0xFF0000
  255. #define CRYPTO_CORE_MINOR_REV 16 /* bit 23-16 */
  256. /* status reg */
  257. #define CRYPTO_MAC_FAILED 31
  258. #define CRYPTO_DOUT_SIZE_AVAIL 26 /* bit 30-26 */
  259. #define CRYPTO_DOUT_SIZE_AVAIL_MASK (0x1F << CRYPTO_DOUT_SIZE_AVAIL)
  260. #define CRYPTO_DIN_SIZE_AVAIL 21 /* bit 21-25 */
  261. #define CRYPTO_DIN_SIZE_AVAIL_MASK (0x1F << CRYPTO_DIN_SIZE_AVAIL)
  262. #define CRYPTO_HSD_ERR 20
  263. #define CRYPTO_ACCESS_VIOL 19
  264. #define CRYPTO_PIPE_ACTIVE_ERR 18
  265. #define CRYPTO_CFG_CHNG_ERR 17
  266. #define CRYPTO_DOUT_ERR 16
  267. #define CRYPTO_DIN_ERR 15
  268. #define CRYPTO_AXI_ERR 14
  269. #define CRYPTO_CRYPTO_STATE 10 /* bit 13-10 */
  270. #define CRYPTO_CRYPTO_STATE_MASK (0xF << CRYPTO_CRYPTO_STATE)
  271. #define CRYPTO_ENCR_BUSY 9
  272. #define CRYPTO_AUTH_BUSY 8
  273. #define CRYPTO_DOUT_INTR 7
  274. #define CRYPTO_DIN_INTR 6
  275. #define CRYPTO_OP_DONE_INTR 5
  276. #define CRYPTO_ERR_INTR 4
  277. #define CRYPTO_DOUT_RDY 3
  278. #define CRYPTO_DIN_RDY 2
  279. #define CRYPTO_OPERATION_DONE 1
  280. #define CRYPTO_SW_ERR 0
  281. /* status2 reg */
  282. #define CRYPTO_AXI_EXTRA 1
  283. #define CRYPTO_LOCKED 2
  284. /* config reg */
  285. #define CRYPTO_REQ_SIZE 17 /* bit 20-17 */
  286. #define CRYPTO_REQ_SIZE_MASK (0xF << CRYPTO_REQ_SIZE)
  287. #define CRYPTO_REQ_SIZE_ENUM_1_BEAT 0
  288. #define CRYPTO_REQ_SIZE_ENUM_2_BEAT 1
  289. #define CRYPTO_REQ_SIZE_ENUM_3_BEAT 2
  290. #define CRYPTO_REQ_SIZE_ENUM_4_BEAT 3
  291. #define CRYPTO_REQ_SIZE_ENUM_5_BEAT 4
  292. #define CRYPTO_REQ_SIZE_ENUM_6_BEAT 5
  293. #define CRYPTO_REQ_SIZE_ENUM_7_BEAT 6
  294. #define CRYPTO_REQ_SIZE_ENUM_8_BEAT 7
  295. #define CRYPTO_REQ_SIZE_ENUM_9_BEAT 8
  296. #define CRYPTO_REQ_SIZE_ENUM_10_BEAT 9
  297. #define CRYPTO_REQ_SIZE_ENUM_11_BEAT 10
  298. #define CRYPTO_REQ_SIZE_ENUM_12_BEAT 11
  299. #define CRYPTO_REQ_SIZE_ENUM_13_BEAT 12
  300. #define CRYPTO_REQ_SIZE_ENUM_14_BEAT 13
  301. #define CRYPTO_REQ_SIZE_ENUM_15_BEAT 14
  302. #define CRYPTO_REQ_SIZE_ENUM_16_BEAT 15
  303. #define CRYPTO_MAX_QUEUED_REQ 14 /* bit 16-14 */
  304. #define CRYPTO_MAX_QUEUED_REQ_MASK (0x7 << CRYPTO_MAX_QUEUED_REQ)
  305. #define CRYPTO_ENUM_1_QUEUED_REQS 0
  306. #define CRYPTO_ENUM_2_QUEUED_REQS 1
  307. #define CRYPTO_ENUM_3_QUEUED_REQS 2
  308. #define CRYPTO_IRQ_ENABLES 10 /* bit 13-10 */
  309. #define CRYPTO_IRQ_ENABLES_MASK (0xF << CRYPTO_IRQ_ENABLES)
  310. #define CRYPTO_LITTLE_ENDIAN_MODE 9
  311. #define CRYPTO_LITTLE_ENDIAN_MASK (1 << CRYPTO_LITTLE_ENDIAN_MODE)
  312. #define CRYPTO_PIPE_SET_SELECT 5 /* bit 8-5 */
  313. #define CRYPTO_PIPE_SET_SELECT_MASK (0xF << CRYPTO_PIPE_SET_SELECT)
  314. #define CRYPTO_HIGH_SPD_EN_N 4
  315. #define CRYPTO_MASK_DOUT_INTR 3
  316. #define CRYPTO_MASK_DIN_INTR 2
  317. #define CRYPTO_MASK_OP_DONE_INTR 1
  318. #define CRYPTO_MASK_ERR_INTR 0
  319. /* auth_seg_cfg reg */
  320. #define CRYPTO_COMP_EXP_MAC 24
  321. #define CRYPTO_COMP_EXP_MAC_DISABLED 0
  322. #define CRYPTO_COMP_EXP_MAC_ENABLED 1
  323. #define CRYPTO_F9_DIRECTION 23
  324. #define CRYPTO_F9_DIRECTION_UPLINK 0
  325. #define CRYPTO_F9_DIRECTION_DOWNLINK 1
  326. #define CRYPTO_AUTH_NONCE_NUM_WORDS 20 /* bit 22-20 */
  327. #define CRYPTO_AUTH_NONCE_NUM_WORDS_MASK \
  328. (0x7 << CRYPTO_AUTH_NONCE_NUM_WORDS)
  329. #define CRYPTO_USE_PIPE_KEY_AUTH 19
  330. #define CRYPTO_USE_HW_KEY_AUTH 18
  331. #define CRYPTO_FIRST 17
  332. #define CRYPTO_LAST 16
  333. #define CRYPTO_AUTH_POS 14 /* bit 15 .. 14*/
  334. #define CRYPTO_AUTH_POS_MASK (0x3 << CRYPTO_AUTH_POS)
  335. #define CRYPTO_AUTH_POS_BEFORE 0
  336. #define CRYPTO_AUTH_POS_AFTER 1
  337. #define CRYPTO_AUTH_SIZE 9 /* bits 13 .. 9*/
  338. #define CRYPTO_AUTH_SIZE_MASK (0x1F << CRYPTO_AUTH_SIZE)
  339. #define CRYPTO_AUTH_SIZE_SHA1 0
  340. #define CRYPTO_AUTH_SIZE_SHA256 1
  341. #define CRYPTO_AUTH_SIZE_ENUM_1_BYTES 0
  342. #define CRYPTO_AUTH_SIZE_ENUM_2_BYTES 1
  343. #define CRYPTO_AUTH_SIZE_ENUM_3_BYTES 2
  344. #define CRYPTO_AUTH_SIZE_ENUM_4_BYTES 3
  345. #define CRYPTO_AUTH_SIZE_ENUM_5_BYTES 4
  346. #define CRYPTO_AUTH_SIZE_ENUM_6_BYTES 5
  347. #define CRYPTO_AUTH_SIZE_ENUM_7_BYTES 6
  348. #define CRYPTO_AUTH_SIZE_ENUM_8_BYTES 7
  349. #define CRYPTO_AUTH_SIZE_ENUM_9_BYTES 8
  350. #define CRYPTO_AUTH_SIZE_ENUM_10_BYTES 9
  351. #define CRYPTO_AUTH_SIZE_ENUM_11_BYTES 10
  352. #define CRYPTO_AUTH_SIZE_ENUM_12_BYTES 11
  353. #define CRYPTO_AUTH_SIZE_ENUM_13_BYTES 12
  354. #define CRYPTO_AUTH_SIZE_ENUM_14_BYTES 13
  355. #define CRYPTO_AUTH_SIZE_ENUM_15_BYTES 14
  356. #define CRYPTO_AUTH_SIZE_ENUM_16_BYTES 15
  357. #define CRYPTO_AUTH_MODE 6 /* bit 8 .. 6*/
  358. #define CRYPTO_AUTH_MODE_MASK (0x7 << CRYPTO_AUTH_MODE)
  359. #define CRYPTO_AUTH_MODE_HASH 0
  360. #define CRYPTO_AUTH_MODE_HMAC 1
  361. #define CRYPTO_AUTH_MODE_CCM 0
  362. #define CRYPTO_AUTH_MODE_CMAC 1
  363. #define CRYPTO_AUTH_KEY_SIZE 3 /* bit 5 .. 3*/
  364. #define CRYPTO_AUTH_KEY_SIZE_MASK (0x7 << CRYPTO_AUTH_KEY_SIZE)
  365. #define CRYPTO_AUTH_KEY_SZ_AES128 0
  366. #define CRYPTO_AUTH_KEY_SZ_AES256 2
  367. #define CRYPTO_AUTH_ALG 0 /* bit 2 .. 0*/
  368. #define CRYPTO_AUTH_ALG_MASK 7
  369. #define CRYPTO_AUTH_ALG_NONE 0
  370. #define CRYPTO_AUTH_ALG_SHA 1
  371. #define CRYPTO_AUTH_ALG_AES 2
  372. #define CRYPTO_AUTH_ALG_KASUMI 3
  373. #define CRYPTO_AUTH_ALG_SNOW3G 4
  374. #define CRYPTO_AUTH_ALG_ZUC 5
  375. /* encr_xts_du_size reg */
  376. #define CRYPTO_ENCR_XTS_DU_SIZE 0 /* bit 19-0 */
  377. #define CRYPTO_ENCR_XTS_DU_SIZE_MASK 0xfffff
  378. /* encr_seg_cfg reg */
  379. #define CRYPTO_F8_KEYSTREAM_ENABLE 17/* bit */
  380. #define CRYPTO_F8_KEYSTREAM_DISABLED 0
  381. #define CRYPTO_F8_KEYSTREAM_ENABLED 1
  382. #define CRYPTO_F8_DIRECTION 16 /* bit */
  383. #define CRYPTO_F8_DIRECTION_UPLINK 0
  384. #define CRYPTO_F8_DIRECTION_DOWNLINK 1
  385. #define CRYPTO_USE_PIPE_KEY_ENCR 15 /* bit */
  386. #define CRYPTO_USE_PIPE_KEY_ENCR_ENABLED 1
  387. #define CRYPTO_USE_KEY_REGISTERS 0
  388. #define CRYPTO_USE_HW_KEY_ENCR 14
  389. #define CRYPTO_USE_KEY_REG 0
  390. #define CRYPTO_USE_HW_KEY 1
  391. #define CRYPTO_LAST_CCM 13
  392. #define CRYPTO_LAST_CCM_XFR 1
  393. #define CRYPTO_INTERM_CCM_XFR 0
  394. #define CRYPTO_CNTR_ALG 11 /* bit 12-11 */
  395. #define CRYPTO_CNTR_ALG_MASK (3 << CRYPTO_CNTR_ALG)
  396. #define CRYPTO_CNTR_ALG_NIST 0
  397. #define CRYPTO_ENCODE 10
  398. #define CRYPTO_ENCR_MODE 6 /* bit 9-6 */
  399. #define CRYPTO_ENCR_MODE_MASK (0xF << CRYPTO_ENCR_MODE)
  400. /* only valid when AES */
  401. #define CRYPTO_ENCR_MODE_ECB 0
  402. #define CRYPTO_ENCR_MODE_CBC 1
  403. #define CRYPTO_ENCR_MODE_CTR 2
  404. #define CRYPTO_ENCR_MODE_XTS 3
  405. #define CRYPTO_ENCR_MODE_CCM 4
  406. #define CRYPTO_ENCR_KEY_SZ 3 /* bit 5-3 */
  407. #define CRYPTO_ENCR_KEY_SZ_MASK (7 << CRYPTO_ENCR_KEY_SZ)
  408. #define CRYPTO_ENCR_KEY_SZ_DES 0
  409. #define CRYPTO_ENCR_KEY_SZ_3DES 1
  410. #define CRYPTO_ENCR_KEY_SZ_AES128 0
  411. #define CRYPTO_ENCR_KEY_SZ_AES256 2
  412. #define CRYPTO_ENCR_ALG 0 /* bit 2-0 */
  413. #define CRYPTO_ENCR_ALG_MASK (7 << CRYPTO_ENCR_ALG)
  414. #define CRYPTO_ENCR_ALG_NONE 0
  415. #define CRYPTO_ENCR_ALG_DES 1
  416. #define CRYPTO_ENCR_ALG_AES 2
  417. #define CRYPTO_ENCR_ALG_KASUMI 4
  418. #define CRYPTO_ENCR_ALG_SNOW_3G 5
  419. #define CRYPTO_ENCR_ALG_ZUC 6
  420. /* goproc reg */
  421. #define CRYPTO_GO 0
  422. #define CRYPTO_CLR_CNTXT 1
  423. #define CRYPTO_RESULTS_DUMP 2
  424. /* F8 definition of CRYPTO_ENCR_CNTR1_IV1 REG */
  425. #define CRYPTO_CNTR1_IV1_REG_F8_PKT_CNT 16 /* bit 31 - 16 */
  426. #define CRYPTO_CNTR1_IV1_REG_F8_PKT_CNT_MASK \
  427. (0xffff << CRYPTO_CNTR1_IV1_REG_F8_PKT_CNT)
  428. #define CRYPTO_CNTR1_IV1_REG_F8_BEARER 0 /* bit 4 - 0 */
  429. #define CRYPTO_CNTR1_IV1_REG_F8_BEARER_MASK \
  430. (0x1f << CRYPTO_CNTR1_IV1_REG_F8_BEARER)
  431. /* F9 definition of CRYPTO_AUTH_IV4 REG */
  432. #define CRYPTO_AUTH_IV4_REG_F9_VALID_BIS 0 /* bit 2 - 0 */
  433. #define CRYPTO_AUTH_IV4_REG_F9_VALID_BIS_MASK \
  434. (0x7 << CRYPTO_AUTH_IV4_REG_F9_VALID_BIS)
  435. /* engines_avail */
  436. #define CRYPTO_ENCR_AES_SEL 0
  437. #define CRYPTO_DES_SEL 1
  438. #define CRYPTO_ENCR_SNOW3G_SEL 2
  439. #define CRYPTO_ENCR_KASUMI_SEL 3
  440. #define CRYPTO_SHA_SEL 4
  441. #define CRYPTO_SHA512_SEL 5
  442. #define CRYPTO_AUTH_AES_SEL 6
  443. #define CRYPTO_AUTH_SNOW3G_SEL 7
  444. #define CRYPTO_AUTH_KASUMI_SEL 8
  445. #define CRYPTO_BAM_PIPE_SETS 9 /* bit 12 - 9 */
  446. #define CRYPTO_AXI_WR_BEATS 13 /* bit 18 - 13 */
  447. #define CRYPTO_AXI_RD_BEATS 19 /* bit 24 - 19 */
  448. #define CRYPTO_ENCR_ZUC_SEL 26
  449. #define CRYPTO_AUTH_ZUC_SEL 27
  450. #define CRYPTO_ZUC_ENABLE 28
  451. #endif /* _DRIVERS_CRYPTO_MSM_QCRYPTOHW_50_H_ */