Neeti Desai | 992ed6c | 2012-09-20 11:59:12 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Shashank Mittal | 1fcde7a | 2011-07-25 13:41:50 -0700 | [diff] [blame] | 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. |
Neeti Desai | 992ed6c | 2012-09-20 11:59:12 -0700 | [diff] [blame] | 12 | * * Neither the name of The Linux Foundation nor the names of its |
Shashank Mittal | 1fcde7a | 2011-07-25 13:41:50 -0700 | [diff] [blame] | 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 __CRYPTO4_ENG_H__ |
| 30 | #define __CRYPYO4_ENG_H__ |
| 31 | |
Neeti Desai | 992ed6c | 2012-09-20 11:59:12 -0700 | [diff] [blame] | 32 | #define CRYPTO_ENG_REG(base, offset) ((base) + offset) |
Shashank Mittal | 1fcde7a | 2011-07-25 13:41:50 -0700 | [diff] [blame] | 33 | |
| 34 | #define IS_ALIGNED(ptr) (!(((unsigned int)ptr) & 0x03)) |
| 35 | |
| 36 | /* CRYPTO4 registers */ |
| 37 | #define CRYPTO_DATA_IN 0x0008 |
| 38 | #define CRYPTO_DATA_OUT 0x0010 |
| 39 | #define CRYPTO_STATUS 0x0100 |
| 40 | #define CRYPTO_CONFIG 0x0500 |
| 41 | #define CRYPTO_DEBUG 0x0508 |
| 42 | #define CRYPTO_ENCR_SEG_CFG 0x0300 |
| 43 | #define CRYPTO_SEG_SIZE 0x0200 |
| 44 | #define CRYPTO_GOPROC 0x0204 |
| 45 | #define CRYPTO_ENGINES_AVAIL 0x0104 |
| 46 | #define CRYPTO_AUTH_SEG_CFG 0x0400 |
| 47 | #define CRYPTO_AUTH_SEG_SIZE 0x0404 |
| 48 | #define CRYPTO_AUTH_SEG_START 0x0408 |
| 49 | |
| 50 | #define CRYPTO_AUTH_BYTECNTn(n) (0x04A0 + 4*(n)) |
| 51 | #define CRYPTO_AUTH_IVn(n) (0x0450 + 4*(n)) |
| 52 | |
Shashank Mittal | 1fcde7a | 2011-07-25 13:41:50 -0700 | [diff] [blame] | 53 | /* Register bit definitions */ |
| 54 | #define SW_ERR BIT(0) |
| 55 | #define OPERATION_DONE BIT(1) |
| 56 | #define DIN_RDY BIT(2) |
| 57 | #define DIN_SIZE_AVAIL 0x00380000 |
| 58 | |
| 59 | /* CRYPTO_CONFIG register bit definitions */ |
| 60 | #define AUTO_SHUTDOWN_EN BIT(2) |
| 61 | #define MASK_ERR_INTR BIT(3) |
| 62 | #define MASK_OP_DONE_INTR BIT(4) |
| 63 | #define MASK_DIN_INTR BIT(5) |
| 64 | #define MASK_DOUT_INTR BIT(6) |
| 65 | #define HIGH_SPD_IN_EN_N BIT(13) |
| 66 | #define HIGH_SPD_OUT_EN_N BIT(14) |
| 67 | |
| 68 | /* CRYPTO_AUTH_SEG_CFG register bit definitions */ |
| 69 | #define SEG_CFG_AUTH_ALG_SHA (1<<0) |
| 70 | #define SEG_CFG_AUTH_SIZE_SHA1 (0<<9) |
| 71 | #define SEG_CFG_AUTH_SIZE_SHA256 (1<<9) |
| 72 | #define SEG_CFG_LAST (1<<14) |
| 73 | |
| 74 | #define GOPROC_GO 1 |
| 75 | |
vijay kumar | 4f4405f | 2014-08-08 11:49:53 +0530 | [diff] [blame] | 76 | void crypto_eng_cleanup(void); |
Shashank Mittal | 1fcde7a | 2011-07-25 13:41:50 -0700 | [diff] [blame] | 77 | #endif |