2019-05-29 22:17:58 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2014-06-26 00:28:57 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DMA_H_
|
|
|
|
#define _DMA_H_
|
|
|
|
|
2014-10-08 17:23:02 +08:00
|
|
|
#include <linux/dmaengine.h>
|
|
|
|
|
2014-06-26 00:28:57 +08:00
|
|
|
/* maximum data transfer block size between BAM and CE */
|
|
|
|
#define QCE_BAM_BURST_SIZE 64
|
|
|
|
|
|
|
|
#define QCE_AUTHIV_REGS_CNT 16
|
|
|
|
#define QCE_AUTH_BYTECOUNT_REGS_CNT 4
|
|
|
|
#define QCE_CNTRIV_REGS_CNT 4
|
|
|
|
|
|
|
|
struct qce_result_dump {
|
|
|
|
u32 auth_iv[QCE_AUTHIV_REGS_CNT];
|
|
|
|
u32 auth_byte_count[QCE_AUTH_BYTECOUNT_REGS_CNT];
|
|
|
|
u32 encr_cntr_iv[QCE_CNTRIV_REGS_CNT];
|
|
|
|
u32 status;
|
|
|
|
u32 status2;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define QCE_IGNORE_BUF_SZ (2 * QCE_BAM_BURST_SIZE)
|
|
|
|
#define QCE_RESULT_BUF_SZ \
|
|
|
|
ALIGN(sizeof(struct qce_result_dump), QCE_BAM_BURST_SIZE)
|
|
|
|
|
|
|
|
struct qce_dma_data {
|
|
|
|
struct dma_chan *txchan;
|
|
|
|
struct dma_chan *rxchan;
|
|
|
|
struct qce_result_dump *result_buf;
|
|
|
|
void *ignore_buf;
|
|
|
|
};
|
|
|
|
|
|
|
|
int qce_dma_request(struct device *dev, struct qce_dma_data *dma);
|
|
|
|
void qce_dma_release(struct qce_dma_data *dma);
|
|
|
|
int qce_dma_prep_sgs(struct qce_dma_data *dma, struct scatterlist *sg_in,
|
|
|
|
int in_ents, struct scatterlist *sg_out, int out_ents,
|
|
|
|
dma_async_tx_callback cb, void *cb_param);
|
|
|
|
void qce_dma_issue_pending(struct qce_dma_data *dma);
|
|
|
|
int qce_dma_terminate_all(struct qce_dma_data *dma);
|
|
|
|
struct scatterlist *
|
2019-12-21 03:02:15 +08:00
|
|
|
qce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add,
|
2020-02-07 23:02:25 +08:00
|
|
|
unsigned int max_len);
|
2014-06-26 00:28:57 +08:00
|
|
|
|
|
|
|
#endif /* _DMA_H_ */
|