18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef _DMA_H_ 78c2ecf20Sopenharmony_ci#define _DMA_H_ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/dmaengine.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* maximum data transfer block size between BAM and CE */ 128c2ecf20Sopenharmony_ci#define QCE_BAM_BURST_SIZE 64 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define QCE_AUTHIV_REGS_CNT 16 158c2ecf20Sopenharmony_ci#define QCE_AUTH_BYTECOUNT_REGS_CNT 4 168c2ecf20Sopenharmony_ci#define QCE_CNTRIV_REGS_CNT 4 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistruct qce_result_dump { 198c2ecf20Sopenharmony_ci u32 auth_iv[QCE_AUTHIV_REGS_CNT]; 208c2ecf20Sopenharmony_ci u32 auth_byte_count[QCE_AUTH_BYTECOUNT_REGS_CNT]; 218c2ecf20Sopenharmony_ci u32 encr_cntr_iv[QCE_CNTRIV_REGS_CNT]; 228c2ecf20Sopenharmony_ci u32 status; 238c2ecf20Sopenharmony_ci u32 status2; 248c2ecf20Sopenharmony_ci}; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define QCE_IGNORE_BUF_SZ (2 * QCE_BAM_BURST_SIZE) 278c2ecf20Sopenharmony_ci#define QCE_RESULT_BUF_SZ \ 288c2ecf20Sopenharmony_ci ALIGN(sizeof(struct qce_result_dump), QCE_BAM_BURST_SIZE) 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistruct qce_dma_data { 318c2ecf20Sopenharmony_ci struct dma_chan *txchan; 328c2ecf20Sopenharmony_ci struct dma_chan *rxchan; 338c2ecf20Sopenharmony_ci struct qce_result_dump *result_buf; 348c2ecf20Sopenharmony_ci void *ignore_buf; 358c2ecf20Sopenharmony_ci}; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciint qce_dma_request(struct device *dev, struct qce_dma_data *dma); 388c2ecf20Sopenharmony_civoid qce_dma_release(struct qce_dma_data *dma); 398c2ecf20Sopenharmony_ciint qce_dma_prep_sgs(struct qce_dma_data *dma, struct scatterlist *sg_in, 408c2ecf20Sopenharmony_ci int in_ents, struct scatterlist *sg_out, int out_ents, 418c2ecf20Sopenharmony_ci dma_async_tx_callback cb, void *cb_param); 428c2ecf20Sopenharmony_civoid qce_dma_issue_pending(struct qce_dma_data *dma); 438c2ecf20Sopenharmony_ciint qce_dma_terminate_all(struct qce_dma_data *dma); 448c2ecf20Sopenharmony_cistruct scatterlist * 458c2ecf20Sopenharmony_ciqce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add, 468c2ecf20Sopenharmony_ci unsigned int max_len); 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#endif /* _DMA_H_ */ 49