1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef _DRV_HASH_V100_H_ 20 #define _DRV_HASH_V100_H_ 21 22 #include "drv_osal_lib.h" 23 24 /* Define the offset of reg */ 25 #define REG_TOTALLEN_LOW 0x00u 26 #define REG_TOTALLEN_HIGH 0x04 27 #define REG_STATUS 0x08 28 #define REG_CTRL 0x0C 29 #define REG_START 0x10 30 #define REG_DMA_START_ADDR 0x14 31 #define REG_DMA_LEN 0x18 32 #define REG_DATA_IN 0x1C 33 #define REG_REC_LEN1 0x20 34 #define REG_REC_LEN2 0x24 35 #define REG_SHA_OUT1 0x30 36 #define REG_SHA_OUT2 0x34 37 #define REG_SHA_OUT3 0x38 38 #define REG_SHA_OUT4 0x3C 39 #define REG_SHA_OUT5 0x40 40 #define REG_SHA_OUT6 0x44 41 #define REG_SHA_OUT7 0x48 42 #define REG_SHA_OUT8 0x4C 43 #define REG_MCU_KEY0 0x70 44 #define REG_MCU_KEY1 0x74 45 #define REG_MCU_KEY2 0x78 46 #define REG_MCU_KEY3 0x7C 47 #define REG_KL_KEY0 0x80 48 #define REG_KL_KEY1 0x84 49 #define REG_KL_KEY2 0x88 50 #define REG_KL_KEY3 0x8C 51 #define REG_INIT1_UPDATE 0x90 52 53 /* Define the union hash_status */ 54 typedef union { 55 /* Define the struct bits */ 56 struct { 57 hi_u32 hash_rdy : 1; /* [0] */ 58 hi_u32 dma_rdy : 1; /* [1] */ 59 hi_u32 msg_rdy : 1; /* [2] */ 60 hi_u32 rec_rdy : 1; /* [3] */ 61 hi_u32 error_state : 2; /* [5..4] */ 62 hi_u32 len_err : 1; /* [6] */ 63 hi_u32 reserved_1 : 2; /* [31..7] */ 64 } bits; 65 66 /* Define an unsigned member */ 67 hi_u32 u32; 68 } hash_status; 69 70 /* Define the union hash_ctrl */ 71 typedef union { 72 /* Define the struct bits */ 73 struct { 74 hi_u32 read_ctrl : 1; /* [0] */ 75 hi_u32 sha_sel : 2; /* [2..1] */ 76 hi_u32 hmac_flag : 1; /* [3] */ 77 hi_u32 hardkey_sel : 1; /* [4] */ 78 hi_u32 small_end_en : 1; /* [5] */ 79 hi_u32 sha_init_update_en : 1; /* [7] */ 80 hi_u32 reserved_1 : 25; /* [31..7] */ 81 } bits; 82 83 /* Define an unsigned member */ 84 hi_u32 u32; 85 } hash_ctrl; 86 87 /* Define the union sha_start */ 88 typedef union { 89 /* Define the struct bits */ 90 struct { 91 hi_u32 sha_start : 1; /* [0] */ 92 hi_u32 reserved_1 : 30; /* [31..1] */ 93 } bits; 94 95 /* Define an unsigned member */ 96 hi_u32 u32; 97 } sha_start; 98 #endif /* End of _DRV_HASH_V100_H_ */ 99