Subbaraman Narayanamurthy | 9b7276c | 2011-01-25 17:25:30 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. |
| 2 | |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are |
| 5 | * met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above |
| 9 | * copyright notice, this list of conditions and the following |
| 10 | * disclaimer in the documentation and/or other materials provided |
| 11 | * with the distribution. |
| 12 | * * Neither the name of Code Aurora Forum, Inc. nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef __CRYPTO_ENG_H__ |
| 30 | #define __CRYPYO_ENG_H__ |
| 31 | |
| 32 | #define CRYPTO_ENG_REG(offset) (MSM_CRYPTO_BASE + offset) |
| 33 | |
| 34 | #define wr_ce(val,reg) writel(val,CRYPTO_ENG_REG(reg)) |
| 35 | #define rd_ce(reg) readl(CRYPTO_ENG_REG(reg)) |
| 36 | |
| 37 | #define IS_ALIGNED(ptr) (!(((unsigned int)ptr) & 0x03)) |
| 38 | |
| 39 | #define CRYPTO_ERR_NONE 0x01 |
| 40 | #define CRYPTO_ERR_FAIL 0x02 |
| 41 | |
| 42 | /* CRYPTO3 registers */ |
| 43 | #define CRYPTO3_DATA_IN 0x0000 |
| 44 | #define CRYPTO3_DATA_OUT 0x0010 |
| 45 | #define CRYPTO3_STATUS 0x0020 |
| 46 | #define CRYPTO3_CONFIG 0x0024 |
| 47 | #define CRYPTO3_DEBUG 0x0028 |
| 48 | #define CRYPTO3_REGISTER_LOCK 0x002C |
| 49 | #define CRYPTO3_SEG_CFG 0x0030 |
| 50 | #define CRYPTO3_ENCR_SEG_CFG 0x0034 |
| 51 | #define CRYPTO3_AUTH_SEG_CFG 0x0038 |
| 52 | #define CRYPTO3_SEG_SIZE 0x003C |
| 53 | #define CRYPTO3_GOPROC 0x0040 |
| 54 | #define CRYPTO3_ENGINES_AVAIL 0x0044 |
| 55 | |
| 56 | #define CRYPTO3_DES_KEYn(n) (0x0050 + 4*(n)) |
| 57 | #define CRYPTO3_CNTRn_KEYn(n) (0x0070 + 4*(n)) |
| 58 | #define CRYPTO3_CNTR_MASK 0x0080 |
| 59 | #define CRYPTO3_AUTH_BYTECNTn(n) (0x0090 + 4*(n)) |
| 60 | #define CRYPTO3_AUTH_IVn(n) (0x0100 + 4*(n)) |
| 61 | #define CRYPTO3_AES_RNDKEYn(n) (0x0200 + 4*(n)) |
| 62 | |
| 63 | #define CRYPTO3_DATA_SHADOW0 0x8000 |
| 64 | #define CRYPTO3_DATA_SHADOW8191 0xFFFC |
| 65 | |
| 66 | /* Register bit definitions */ |
| 67 | #define SW_ERR 0x00000001 |
| 68 | #define AUTH_DONE 0x00000002 |
| 69 | #define DIN_RDY 0x00000004 |
| 70 | #define DIN_SIZE_AVAIL 0x00380000 |
| 71 | |
| 72 | #define SW_RST 0x00000001 |
| 73 | #define AUTO_SHUTDOWN_EN 0x00000004 |
| 74 | #define MASK_ERR_INTR 0x00000008 |
| 75 | #define MASK_AUTH_DONE_INTR 0x00000010 |
| 76 | #define MASK_DIN_INTR 0x00000020 |
| 77 | #define MASK_DOUT_INTR 0x00000040 |
| 78 | #define HIGH_SPD_IN_EN_N 0x00002000 |
| 79 | #define HIGH_SPD_OUT_EN_N 0x00004000 |
| 80 | #define HIGH_SPD_HASH_EN_N 0x00008000 |
| 81 | |
| 82 | #define SEG_CFG_AUTH_ALG_SHA (1<<9) |
Subbaraman Narayanamurthy | 8fcccbd | 2011-01-28 13:26:00 -0800 | [diff] [blame] | 83 | #define SEG_CFG_AUTH_SIZE_SHA1 (0<<11) |
Subbaraman Narayanamurthy | 9b7276c | 2011-01-25 17:25:30 -0800 | [diff] [blame] | 84 | #define SEG_CFG_AUTH_SIZE_SHA256 (1<<11) |
| 85 | #define SEG_CFG_FIRST (1<<17) |
| 86 | #define SEG_CFG_LAST (1<<18) |
| 87 | |
| 88 | #define AUTH_SEG_CFG_AUTH_SIZE 16 |
| 89 | |
| 90 | #define GOPROC_GO 1 |
| 91 | |
| 92 | #endif |