Path: blob/master/drivers/crypto/amcc/crypto4xx_reg_def.h
29268 views
/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* AMCC SoC PPC4xx Crypto Driver3*4* Copyright (c) 2008 Applied Micro Circuits Corporation.5* All rights reserved. James Hsiao <[email protected]>6*7* This filr defines the register set for Security Subsystem8*/910#ifndef __CRYPTO4XX_REG_DEF_H__11#define __CRYPTO4XX_REG_DEF_H__1213/* CRYPTO4XX Register offset */14#define CRYPTO4XX_DESCRIPTOR 0x0000000015#define CRYPTO4XX_CTRL_STAT 0x0000000016#define CRYPTO4XX_SOURCE 0x0000000417#define CRYPTO4XX_DEST 0x0000000818#define CRYPTO4XX_SA 0x0000000C19#define CRYPTO4XX_SA_LENGTH 0x0000001020#define CRYPTO4XX_LENGTH 0x000000142122#define CRYPTO4XX_PE_DMA_CFG 0x0000004023#define CRYPTO4XX_PE_DMA_STAT 0x0000004424#define CRYPTO4XX_PDR_BASE 0x0000004825#define CRYPTO4XX_RDR_BASE 0x0000004c26#define CRYPTO4XX_RING_SIZE 0x0000005027#define CRYPTO4XX_RING_CTRL 0x0000005428#define CRYPTO4XX_INT_RING_STAT 0x0000005829#define CRYPTO4XX_EXT_RING_STAT 0x0000005c30#define CRYPTO4XX_IO_THRESHOLD 0x0000006031#define CRYPTO4XX_GATH_RING_BASE 0x0000006432#define CRYPTO4XX_SCAT_RING_BASE 0x0000006833#define CRYPTO4XX_PART_RING_SIZE 0x0000006c34#define CRYPTO4XX_PART_RING_CFG 0x000000703536#define CRYPTO4XX_PDR_BASE_UADDR 0x0000008037#define CRYPTO4XX_RDR_BASE_UADDR 0x0000008438#define CRYPTO4XX_PKT_SRC_UADDR 0x0000008839#define CRYPTO4XX_PKT_DEST_UADDR 0x0000008c40#define CRYPTO4XX_SA_UADDR 0x0000009041#define CRYPTO4XX_GATH_RING_BASE_UADDR 0x000000A042#define CRYPTO4XX_SCAT_RING_BASE_UADDR 0x000000A44344#define CRYPTO4XX_SEQ_RD 0x0000040845#define CRYPTO4XX_SEQ_MASK_RD 0x0000040C4647#define CRYPTO4XX_SA_CMD_0 0x0001060048#define CRYPTO4XX_SA_CMD_1 0x000106044950#define CRYPTO4XX_STATE_PTR 0x000106dc51#define CRYPTO4XX_STATE_IV 0x0001070052#define CRYPTO4XX_STATE_HASH_BYTE_CNT_0 0x0001071053#define CRYPTO4XX_STATE_HASH_BYTE_CNT_1 0x000107145455#define CRYPTO4XX_STATE_IDIGEST_0 0x0001071856#define CRYPTO4XX_STATE_IDIGEST_1 0x0001071c5758#define CRYPTO4XX_DATA_IN 0x0001800059#define CRYPTO4XX_DATA_OUT 0x0001c0006061#define CRYPTO4XX_INT_UNMASK_STAT 0x000500a062#define CRYPTO4XX_INT_MASK_STAT 0x000500a463#define CRYPTO4XX_INT_CLR 0x000500a464#define CRYPTO4XX_INT_EN 0x000500a86566#define CRYPTO4XX_INT_PKA 0x0000000267#define CRYPTO4XX_INT_PDR_DONE 0x0000800068#define CRYPTO4XX_INT_MA_WR_ERR 0x0002000069#define CRYPTO4XX_INT_MA_RD_ERR 0x0001000070#define CRYPTO4XX_INT_PE_ERR 0x0000020071#define CRYPTO4XX_INT_USER_DMA_ERR 0x0000004072#define CRYPTO4XX_INT_SLAVE_ERR 0x0000001073#define CRYPTO4XX_INT_MASTER_ERR 0x0000000874#define CRYPTO4XX_INT_ERROR 0x000302587576#define CRYPTO4XX_INT_CFG 0x000500ac77#define CRYPTO4XX_INT_DESCR_RD 0x000500b078#define CRYPTO4XX_INT_DESCR_CNT 0x000500b479#define CRYPTO4XX_INT_TIMEOUT_CNT 0x000500b88081#define CRYPTO4XX_DEVICE_CTRL 0x0006008082#define CRYPTO4XX_DEVICE_ID 0x0006008483#define CRYPTO4XX_DEVICE_INFO 0x0006008884#define CRYPTO4XX_DMA_USER_SRC 0x0006009485#define CRYPTO4XX_DMA_USER_DEST 0x0006009886#define CRYPTO4XX_DMA_USER_CMD 0x0006009C8788#define CRYPTO4XX_DMA_CFG 0x000600d489#define CRYPTO4XX_BYTE_ORDER_CFG 0x000600d890#define CRYPTO4XX_ENDIAN_CFG 0x000600d89192#define CRYPTO4XX_PRNG_STAT 0x0007000093#define CRYPTO4XX_PRNG_STAT_BUSY 0x194#define CRYPTO4XX_PRNG_CTRL 0x0007000495#define CRYPTO4XX_PRNG_SEED_L 0x0007000896#define CRYPTO4XX_PRNG_SEED_H 0x0007000c9798#define CRYPTO4XX_PRNG_RES_0 0x0007002099#define CRYPTO4XX_PRNG_RES_1 0x00070024100#define CRYPTO4XX_PRNG_RES_2 0x00070028101#define CRYPTO4XX_PRNG_RES_3 0x0007002C102103#define CRYPTO4XX_PRNG_LFSR_L 0x00070030104#define CRYPTO4XX_PRNG_LFSR_H 0x00070034105106/*107* Initialize CRYPTO ENGINE registers, and memory bases.108*/109#define PPC4XX_PDR_POLL 0x3ff110#define PPC4XX_OUTPUT_THRESHOLD 2111#define PPC4XX_INPUT_THRESHOLD 2112#define PPC4XX_PD_SIZE 6113#define PPC4XX_CTX_DONE_INT 0x2000114#define PPC4XX_PD_DONE_INT 0x8000115#define PPC4XX_TMO_ERR_INT 0x40000116#define PPC4XX_BYTE_ORDER 0x22222117#define PPC4XX_INTERRUPT_CLR 0x3ffff118#define PPC4XX_PRNG_CTRL_AUTO_EN 0x3119#define PPC4XX_DC_3DES_EN 1120#define PPC4XX_TRNG_EN 0x00020000121#define PPC4XX_INT_DESCR_CNT 7122#define PPC4XX_INT_TIMEOUT_CNT 0123#define PPC4XX_INT_TIMEOUT_CNT_REVB 0x3FF124#define PPC4XX_INT_CFG 1125/*126* all follow define are ad hoc127*/128#define PPC4XX_RING_RETRY 100129#define PPC4XX_RING_POLL 100130#define PPC4XX_SDR_SIZE PPC4XX_NUM_SD131#define PPC4XX_GDR_SIZE PPC4XX_NUM_GD132133/*134* Generic Security Association (SA) with all possible fields. These will135* never likely used except for reference purpose. These structure format136* can be not changed as the hardware expects them to be layout as defined.137* Field can be removed or reduced but ordering can not be changed.138*/139#define CRYPTO4XX_DMA_CFG_OFFSET 0x40140union ce_pe_dma_cfg {141struct {142u32 rsv:7;143u32 dir_host:1;144u32 rsv1:2;145u32 bo_td_en:1;146u32 dis_pdr_upd:1;147u32 bo_sgpd_en:1;148u32 bo_data_en:1;149u32 bo_sa_en:1;150u32 bo_pd_en:1;151u32 rsv2:4;152u32 dynamic_sa_en:1;153u32 pdr_mode:2;154u32 pe_mode:1;155u32 rsv3:5;156u32 reset_sg:1;157u32 reset_pdr:1;158u32 reset_pe:1;159} bf;160u32 w;161} __attribute__((packed));162163#define CRYPTO4XX_PDR_BASE_OFFSET 0x48164#define CRYPTO4XX_RDR_BASE_OFFSET 0x4c165#define CRYPTO4XX_RING_SIZE_OFFSET 0x50166union ce_ring_size {167struct {168u32 ring_offset:16;169u32 rsv:6;170u32 ring_size:10;171} bf;172u32 w;173} __attribute__((packed));174175#define CRYPTO4XX_RING_CONTROL_OFFSET 0x54176union ce_ring_control {177struct {178u32 continuous:1;179u32 rsv:5;180u32 ring_retry_divisor:10;181u32 rsv1:4;182u32 ring_poll_divisor:10;183} bf;184u32 w;185} __attribute__((packed));186187#define CRYPTO4XX_IO_THRESHOLD_OFFSET 0x60188union ce_io_threshold {189struct {190u32 rsv:6;191u32 output_threshold:10;192u32 rsv1:6;193u32 input_threshold:10;194} bf;195u32 w;196} __attribute__((packed));197198#define CRYPTO4XX_GATHER_RING_BASE_OFFSET 0x64199#define CRYPTO4XX_SCATTER_RING_BASE_OFFSET 0x68200201union ce_part_ring_size {202struct {203u32 sdr_size:16;204u32 gdr_size:16;205} bf;206u32 w;207} __attribute__((packed));208209#define MAX_BURST_SIZE_32 0210#define MAX_BURST_SIZE_64 1211#define MAX_BURST_SIZE_128 2212#define MAX_BURST_SIZE_256 3213214/* gather descriptor control length */215struct gd_ctl_len {216u32 len:16;217u32 rsv:14;218u32 done:1;219u32 ready:1;220} __attribute__((packed));221222struct ce_gd {223u32 ptr;224struct gd_ctl_len ctl_len;225} __attribute__((packed));226227struct sd_ctl {228u32 ctl:30;229u32 done:1;230u32 rdy:1;231} __attribute__((packed));232233struct ce_sd {234u32 ptr;235struct sd_ctl ctl;236} __attribute__((packed));237238#define PD_PAD_CTL_32 0x10239#define PD_PAD_CTL_64 0x20240#define PD_PAD_CTL_128 0x40241#define PD_PAD_CTL_256 0x80242union ce_pd_ctl {243struct {244u32 pd_pad_ctl:8;245u32 status:8;246u32 next_hdr:8;247u32 rsv:2;248u32 cached_sa:1;249u32 hash_final:1;250u32 init_arc4:1;251u32 rsv1:1;252u32 pe_done:1;253u32 host_ready:1;254} bf;255u32 w;256} __attribute__((packed));257#define PD_CTL_HASH_FINAL BIT(4)258#define PD_CTL_PE_DONE BIT(1)259#define PD_CTL_HOST_READY BIT(0)260261union ce_pd_ctl_len {262struct {263u32 bypass:8;264u32 pe_done:1;265u32 host_ready:1;266u32 rsv:2;267u32 pkt_len:20;268} bf;269u32 w;270} __attribute__((packed));271272struct ce_pd {273union ce_pd_ctl pd_ctl;274u32 src;275u32 dest;276u32 sa; /* get from ctx->sa_dma_addr */277u32 sa_len; /* only if dynamic sa is used */278union ce_pd_ctl_len pd_ctl_len;279280} __attribute__((packed));281#endif282283284