Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Nicolas Royer | ebc82ef | 2012-07-01 19:19:46 +0200 | [diff] [blame] | 2 | #ifndef __ATMEL_SHA_REGS_H__ |
| 3 | #define __ATMEL_SHA_REGS_H__ |
| 4 | |
| 5 | #define SHA_REG_DIGEST(x) (0x80 + ((x) * 0x04)) |
| 6 | #define SHA_REG_DIN(x) (0x40 + ((x) * 0x04)) |
| 7 | |
| 8 | #define SHA_CR 0x00 |
| 9 | #define SHA_CR_START (1 << 0) |
| 10 | #define SHA_CR_FIRST (1 << 4) |
| 11 | #define SHA_CR_SWRST (1 << 8) |
Cyrille Pitchen | 7cee350 | 2016-01-15 15:49:34 +0100 | [diff] [blame] | 12 | #define SHA_CR_WUIHV (1 << 12) |
| 13 | #define SHA_CR_WUIEHV (1 << 13) |
Nicolas Royer | ebc82ef | 2012-07-01 19:19:46 +0200 | [diff] [blame] | 14 | |
| 15 | #define SHA_MR 0x04 |
| 16 | #define SHA_MR_MODE_MASK (0x3 << 0) |
| 17 | #define SHA_MR_MODE_MANUAL 0x0 |
| 18 | #define SHA_MR_MODE_AUTO 0x1 |
| 19 | #define SHA_MR_MODE_PDC 0x2 |
Cyrille Pitchen | 563c47d | 2017-01-26 17:07:51 +0100 | [diff] [blame] | 20 | #define SHA_MR_MODE_IDATAR0 0x2 |
Nicolas Royer | ebc82ef | 2012-07-01 19:19:46 +0200 | [diff] [blame] | 21 | #define SHA_MR_PROCDLY (1 << 4) |
Cyrille Pitchen | 7cee350 | 2016-01-15 15:49:34 +0100 | [diff] [blame] | 22 | #define SHA_MR_UIHV (1 << 5) |
| 23 | #define SHA_MR_UIEHV (1 << 6) |
Cyrille Pitchen | f07ceba | 2017-01-26 17:07:49 +0100 | [diff] [blame] | 24 | #define SHA_MR_ALGO_MASK GENMASK(10, 8) |
Nicolas Royer | ebc82ef | 2012-07-01 19:19:46 +0200 | [diff] [blame] | 25 | #define SHA_MR_ALGO_SHA1 (0 << 8) |
| 26 | #define SHA_MR_ALGO_SHA256 (1 << 8) |
Nicolas Royer | d4905b3 | 2013-02-20 17:10:26 +0100 | [diff] [blame] | 27 | #define SHA_MR_ALGO_SHA384 (2 << 8) |
| 28 | #define SHA_MR_ALGO_SHA512 (3 << 8) |
| 29 | #define SHA_MR_ALGO_SHA224 (4 << 8) |
Cyrille Pitchen | 81d8750 | 2017-01-26 17:07:54 +0100 | [diff] [blame] | 30 | #define SHA_MR_HMAC (1 << 11) |
Nicolas Royer | d4905b3 | 2013-02-20 17:10:26 +0100 | [diff] [blame] | 31 | #define SHA_MR_DUALBUFF (1 << 16) |
Nicolas Royer | ebc82ef | 2012-07-01 19:19:46 +0200 | [diff] [blame] | 32 | |
Cyrille Pitchen | 89a82ef | 2017-01-26 17:07:56 +0100 | [diff] [blame] | 33 | #define SHA_FLAGS_ALGO_MASK SHA_MR_ALGO_MASK |
| 34 | #define SHA_FLAGS_SHA1 SHA_MR_ALGO_SHA1 |
| 35 | #define SHA_FLAGS_SHA256 SHA_MR_ALGO_SHA256 |
| 36 | #define SHA_FLAGS_SHA384 SHA_MR_ALGO_SHA384 |
| 37 | #define SHA_FLAGS_SHA512 SHA_MR_ALGO_SHA512 |
| 38 | #define SHA_FLAGS_SHA224 SHA_MR_ALGO_SHA224 |
| 39 | #define SHA_FLAGS_HMAC SHA_MR_HMAC |
| 40 | #define SHA_FLAGS_HMAC_SHA1 (SHA_FLAGS_HMAC | SHA_FLAGS_SHA1) |
| 41 | #define SHA_FLAGS_HMAC_SHA256 (SHA_FLAGS_HMAC | SHA_FLAGS_SHA256) |
| 42 | #define SHA_FLAGS_HMAC_SHA384 (SHA_FLAGS_HMAC | SHA_FLAGS_SHA384) |
| 43 | #define SHA_FLAGS_HMAC_SHA512 (SHA_FLAGS_HMAC | SHA_FLAGS_SHA512) |
| 44 | #define SHA_FLAGS_HMAC_SHA224 (SHA_FLAGS_HMAC | SHA_FLAGS_SHA224) |
| 45 | #define SHA_FLAGS_MODE_MASK (SHA_FLAGS_HMAC | SHA_FLAGS_ALGO_MASK) |
| 46 | |
Nicolas Royer | ebc82ef | 2012-07-01 19:19:46 +0200 | [diff] [blame] | 47 | #define SHA_IER 0x10 |
| 48 | #define SHA_IDR 0x14 |
| 49 | #define SHA_IMR 0x18 |
| 50 | #define SHA_ISR 0x1C |
| 51 | #define SHA_INT_DATARDY (1 << 0) |
| 52 | #define SHA_INT_ENDTX (1 << 1) |
| 53 | #define SHA_INT_TXBUFE (1 << 2) |
| 54 | #define SHA_INT_URAD (1 << 8) |
| 55 | #define SHA_ISR_URAT_MASK (0x7 << 12) |
| 56 | #define SHA_ISR_URAT_IDR (0x0 << 12) |
| 57 | #define SHA_ISR_URAT_ODR (0x1 << 12) |
| 58 | #define SHA_ISR_URAT_MR (0x2 << 12) |
| 59 | #define SHA_ISR_URAT_WO (0x5 << 12) |
| 60 | |
Cyrille Pitchen | 81d8750 | 2017-01-26 17:07:54 +0100 | [diff] [blame] | 61 | #define SHA_MSR 0x20 |
| 62 | #define SHA_BCR 0x30 |
| 63 | |
Nicolas Royer | d4905b3 | 2013-02-20 17:10:26 +0100 | [diff] [blame] | 64 | #define SHA_HW_VERSION 0xFC |
| 65 | |
Nicolas Royer | ebc82ef | 2012-07-01 19:19:46 +0200 | [diff] [blame] | 66 | #define SHA_TPR 0x108 |
| 67 | #define SHA_TCR 0x10C |
| 68 | #define SHA_TNPR 0x118 |
| 69 | #define SHA_TNCR 0x11C |
| 70 | #define SHA_PTCR 0x120 |
| 71 | #define SHA_PTCR_TXTEN (1 << 8) |
| 72 | #define SHA_PTCR_TXTDIS (1 << 9) |
| 73 | #define SHA_PTSR 0x124 |
| 74 | #define SHA_PTSR_TXTEN (1 << 8) |
| 75 | |
| 76 | #endif /* __ATMEL_SHA_REGS_H__ */ |