Path: blob/master/drivers/crypto/amcc/crypto4xx_reg_def.h
15112 views
/**1* AMCC SoC PPC4xx Crypto Driver2*3* Copyright (c) 2008 Applied Micro Circuits Corporation.4* All rights reserved. James Hsiao <[email protected]>5*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; either version 2 of the License, or9* (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* This filr defines the register set for Security Subsystem17*/1819#ifndef __CRYPTO4XX_REG_DEF_H__20#define __CRYPTO4XX_REG_DEF_H__2122/* CRYPTO4XX Register offset */23#define CRYPTO4XX_DESCRIPTOR 0x0000000024#define CRYPTO4XX_CTRL_STAT 0x0000000025#define CRYPTO4XX_SOURCE 0x0000000426#define CRYPTO4XX_DEST 0x0000000827#define CRYPTO4XX_SA 0x0000000C28#define CRYPTO4XX_SA_LENGTH 0x0000001029#define CRYPTO4XX_LENGTH 0x000000143031#define CRYPTO4XX_PE_DMA_CFG 0x0000004032#define CRYPTO4XX_PE_DMA_STAT 0x0000004433#define CRYPTO4XX_PDR_BASE 0x0000004834#define CRYPTO4XX_RDR_BASE 0x0000004c35#define CRYPTO4XX_RING_SIZE 0x0000005036#define CRYPTO4XX_RING_CTRL 0x0000005437#define CRYPTO4XX_INT_RING_STAT 0x0000005838#define CRYPTO4XX_EXT_RING_STAT 0x0000005c39#define CRYPTO4XX_IO_THRESHOLD 0x0000006040#define CRYPTO4XX_GATH_RING_BASE 0x0000006441#define CRYPTO4XX_SCAT_RING_BASE 0x0000006842#define CRYPTO4XX_PART_RING_SIZE 0x0000006c43#define CRYPTO4XX_PART_RING_CFG 0x000000704445#define CRYPTO4XX_PDR_BASE_UADDR 0x0000008046#define CRYPTO4XX_RDR_BASE_UADDR 0x0000008447#define CRYPTO4XX_PKT_SRC_UADDR 0x0000008848#define CRYPTO4XX_PKT_DEST_UADDR 0x0000008c49#define CRYPTO4XX_SA_UADDR 0x0000009050#define CRYPTO4XX_GATH_RING_BASE_UADDR 0x000000A051#define CRYPTO4XX_SCAT_RING_BASE_UADDR 0x000000A45253#define CRYPTO4XX_SEQ_RD 0x0000040854#define CRYPTO4XX_SEQ_MASK_RD 0x0000040C5556#define CRYPTO4XX_SA_CMD_0 0x0001060057#define CRYPTO4XX_SA_CMD_1 0x000106045859#define CRYPTO4XX_STATE_PTR 0x000106dc60#define CRYPTO4XX_STATE_IV 0x0001070061#define CRYPTO4XX_STATE_HASH_BYTE_CNT_0 0x0001071062#define CRYPTO4XX_STATE_HASH_BYTE_CNT_1 0x000107146364#define CRYPTO4XX_STATE_IDIGEST_0 0x0001071865#define CRYPTO4XX_STATE_IDIGEST_1 0x0001071c6667#define CRYPTO4XX_DATA_IN 0x0001800068#define CRYPTO4XX_DATA_OUT 0x0001c0006970#define CRYPTO4XX_INT_UNMASK_STAT 0x000500a071#define CRYPTO4XX_INT_MASK_STAT 0x000500a472#define CRYPTO4XX_INT_CLR 0x000500a473#define CRYPTO4XX_INT_EN 0x000500a87475#define CRYPTO4XX_INT_PKA 0x0000000276#define CRYPTO4XX_INT_PDR_DONE 0x0000800077#define CRYPTO4XX_INT_MA_WR_ERR 0x0002000078#define CRYPTO4XX_INT_MA_RD_ERR 0x0001000079#define CRYPTO4XX_INT_PE_ERR 0x0000020080#define CRYPTO4XX_INT_USER_DMA_ERR 0x0000004081#define CRYPTO4XX_INT_SLAVE_ERR 0x0000001082#define CRYPTO4XX_INT_MASTER_ERR 0x0000000883#define CRYPTO4XX_INT_ERROR 0x000302588485#define CRYPTO4XX_INT_CFG 0x000500ac86#define CRYPTO4XX_INT_DESCR_RD 0x000500b087#define CRYPTO4XX_INT_DESCR_CNT 0x000500b488#define CRYPTO4XX_INT_TIMEOUT_CNT 0x000500b88990#define CRYPTO4XX_DEVICE_CTRL 0x0006008091#define CRYPTO4XX_DEVICE_ID 0x0006008492#define CRYPTO4XX_DEVICE_INFO 0x0006008893#define CRYPTO4XX_DMA_USER_SRC 0x0006009494#define CRYPTO4XX_DMA_USER_DEST 0x0006009895#define CRYPTO4XX_DMA_USER_CMD 0x0006009C9697#define CRYPTO4XX_DMA_CFG 0x000600d498#define CRYPTO4XX_BYTE_ORDER_CFG 0x000600d899#define CRYPTO4XX_ENDIAN_CFG 0x000600d8100101#define CRYPTO4XX_PRNG_STAT 0x00070000102#define CRYPTO4XX_PRNG_CTRL 0x00070004103#define CRYPTO4XX_PRNG_SEED_L 0x00070008104#define CRYPTO4XX_PRNG_SEED_H 0x0007000c105106#define CRYPTO4XX_PRNG_RES_0 0x00070020107#define CRYPTO4XX_PRNG_RES_1 0x00070024108#define CRYPTO4XX_PRNG_RES_2 0x00070028109#define CRYPTO4XX_PRNG_RES_3 0x0007002C110111#define CRYPTO4XX_PRNG_LFSR_L 0x00070030112#define CRYPTO4XX_PRNG_LFSR_H 0x00070034113114/**115* Initialize CRYPTO ENGINE registers, and memory bases.116*/117#define PPC4XX_PDR_POLL 0x3ff118#define PPC4XX_OUTPUT_THRESHOLD 2119#define PPC4XX_INPUT_THRESHOLD 2120#define PPC4XX_PD_SIZE 6121#define PPC4XX_CTX_DONE_INT 0x2000122#define PPC4XX_PD_DONE_INT 0x8000123#define PPC4XX_BYTE_ORDER 0x22222124#define PPC4XX_INTERRUPT_CLR 0x3ffff125#define PPC4XX_PRNG_CTRL_AUTO_EN 0x3126#define PPC4XX_DC_3DES_EN 1127#define PPC4XX_INT_DESCR_CNT 4128#define PPC4XX_INT_TIMEOUT_CNT 0129#define PPC4XX_INT_CFG 1130/**131* all follow define are ad hoc132*/133#define PPC4XX_RING_RETRY 100134#define PPC4XX_RING_POLL 100135#define PPC4XX_SDR_SIZE PPC4XX_NUM_SD136#define PPC4XX_GDR_SIZE PPC4XX_NUM_GD137138/**139* Generic Security Association (SA) with all possible fields. These will140* never likely used except for reference purpose. These structure format141* can be not changed as the hardware expects them to be layout as defined.142* Field can be removed or reduced but ordering can not be changed.143*/144#define CRYPTO4XX_DMA_CFG_OFFSET 0x40145union ce_pe_dma_cfg {146struct {147u32 rsv:7;148u32 dir_host:1;149u32 rsv1:2;150u32 bo_td_en:1;151u32 dis_pdr_upd:1;152u32 bo_sgpd_en:1;153u32 bo_data_en:1;154u32 bo_sa_en:1;155u32 bo_pd_en:1;156u32 rsv2:4;157u32 dynamic_sa_en:1;158u32 pdr_mode:2;159u32 pe_mode:1;160u32 rsv3:5;161u32 reset_sg:1;162u32 reset_pdr:1;163u32 reset_pe:1;164} bf;165u32 w;166} __attribute__((packed));167168#define CRYPTO4XX_PDR_BASE_OFFSET 0x48169#define CRYPTO4XX_RDR_BASE_OFFSET 0x4c170#define CRYPTO4XX_RING_SIZE_OFFSET 0x50171union ce_ring_size {172struct {173u32 ring_offset:16;174u32 rsv:6;175u32 ring_size:10;176} bf;177u32 w;178} __attribute__((packed));179180#define CRYPTO4XX_RING_CONTROL_OFFSET 0x54181union ce_ring_contol {182struct {183u32 continuous:1;184u32 rsv:5;185u32 ring_retry_divisor:10;186u32 rsv1:4;187u32 ring_poll_divisor:10;188} bf;189u32 w;190} __attribute__((packed));191192#define CRYPTO4XX_IO_THRESHOLD_OFFSET 0x60193union ce_io_threshold {194struct {195u32 rsv:6;196u32 output_threshold:10;197u32 rsv1:6;198u32 input_threshold:10;199} bf;200u32 w;201} __attribute__((packed));202203#define CRYPTO4XX_GATHER_RING_BASE_OFFSET 0x64204#define CRYPTO4XX_SCATTER_RING_BASE_OFFSET 0x68205206union ce_part_ring_size {207struct {208u32 sdr_size:16;209u32 gdr_size:16;210} bf;211u32 w;212} __attribute__((packed));213214#define MAX_BURST_SIZE_32 0215#define MAX_BURST_SIZE_64 1216#define MAX_BURST_SIZE_128 2217#define MAX_BURST_SIZE_256 3218219/* gather descriptor control length */220struct gd_ctl_len {221u32 len:16;222u32 rsv:14;223u32 done:1;224u32 ready:1;225} __attribute__((packed));226227struct ce_gd {228u32 ptr;229struct gd_ctl_len ctl_len;230} __attribute__((packed));231232struct sd_ctl {233u32 ctl:30;234u32 done:1;235u32 rdy:1;236} __attribute__((packed));237238struct ce_sd {239u32 ptr;240struct sd_ctl ctl;241} __attribute__((packed));242243#define PD_PAD_CTL_32 0x10244#define PD_PAD_CTL_64 0x20245#define PD_PAD_CTL_128 0x40246#define PD_PAD_CTL_256 0x80247union ce_pd_ctl {248struct {249u32 pd_pad_ctl:8;250u32 status:8;251u32 next_hdr:8;252u32 rsv:2;253u32 cached_sa:1;254u32 hash_final:1;255u32 init_arc4:1;256u32 rsv1:1;257u32 pe_done:1;258u32 host_ready:1;259} bf;260u32 w;261} __attribute__((packed));262263union ce_pd_ctl_len {264struct {265u32 bypass:8;266u32 pe_done:1;267u32 host_ready:1;268u32 rsv:2;269u32 pkt_len:20;270} bf;271u32 w;272} __attribute__((packed));273274struct ce_pd {275union ce_pd_ctl pd_ctl;276u32 src;277u32 dest;278u32 sa; /* get from ctx->sa_dma_addr */279u32 sa_len; /* only if dynamic sa is used */280union ce_pd_ctl_len pd_ctl_len;281282} __attribute__((packed));283#endif284285286