dma.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DMA_H_
  6. #define _DMA_H_
  7. #include <linux/dmaengine.h>
  8. /* maximum data transfer block size between BAM and CE */
  9. #define QCE_BAM_BURST_SIZE 64
  10. #define QCE_AUTHIV_REGS_CNT 16
  11. #define QCE_AUTH_BYTECOUNT_REGS_CNT 4
  12. #define QCE_CNTRIV_REGS_CNT 4
  13. struct qce_result_dump {
  14. u32 auth_iv[QCE_AUTHIV_REGS_CNT];
  15. u32 auth_byte_count[QCE_AUTH_BYTECOUNT_REGS_CNT];
  16. u32 encr_cntr_iv[QCE_CNTRIV_REGS_CNT];
  17. u32 status;
  18. u32 status2;
  19. };
  20. #define QCE_IGNORE_BUF_SZ (2 * QCE_BAM_BURST_SIZE)
  21. #define QCE_RESULT_BUF_SZ \
  22. ALIGN(sizeof(struct qce_result_dump), QCE_BAM_BURST_SIZE)
  23. struct qce_dma_data {
  24. struct dma_chan *txchan;
  25. struct dma_chan *rxchan;
  26. struct qce_result_dump *result_buf;
  27. void *ignore_buf;
  28. };
  29. int qce_dma_request(struct device *dev, struct qce_dma_data *dma);
  30. void qce_dma_release(struct qce_dma_data *dma);
  31. int qce_dma_prep_sgs(struct qce_dma_data *dma, struct scatterlist *sg_in,
  32. int in_ents, struct scatterlist *sg_out, int out_ents,
  33. dma_async_tx_callback cb, void *cb_param);
  34. void qce_dma_issue_pending(struct qce_dma_data *dma);
  35. int qce_dma_terminate_all(struct qce_dma_data *dma);
  36. struct scatterlist *
  37. qce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add,
  38. unsigned int max_len);
  39. #endif /* _DMA_H_ */