1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __STARFIVE_STR_H__
3 #define __STARFIVE_STR_H__
5 #include <linux/delay.h>
6 #include <linux/dma-mapping.h>
7 #include <linux/dmaengine.h>
9 #include <crypto/engine.h>
11 #define STARFIVE_ALG_CR_OFFSET 0x0
12 #define STARFIVE_ALG_FIFO_OFFSET 0x4
13 #define STARFIVE_IE_MASK_OFFSET 0x8
14 #define STARFIVE_IE_FLAG_OFFSET 0xc
15 #define STARFIVE_DMA_IN_LEN_OFFSET 0x10
16 #define STARFIVE_DMA_OUT_LEN_OFFSET 0x14
18 #define STARFIVE_MSG_BUFFER_SIZE SZ_16K
20 union starfive_alg_cr {
34 struct starfive_cryp_ctx {
35 struct crypto_engine_ctx enginectx;
36 struct starfive_cryp_dev *cryp;
41 struct starfive_cryp_dev {
42 struct list_head list;
47 struct reset_control *rst;
50 phys_addr_t phys_base;
55 struct dma_slave_config cfg_in;
56 struct dma_slave_config cfg_out;
57 struct completion tx_comp;
58 struct completion rx_comp;
60 struct crypto_engine *engine;
62 union starfive_alg_cr alg_cr;
65 struct starfive_cryp_dev *starfive_cryp_find_dev(struct starfive_cryp_ctx *ctx);