dma.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _DMA_H_
  14. #define _DMA_H_
  15. #include <linux/dmaengine.h>
  16. /* maximum data transfer block size between BAM and CE */
  17. #define QCE_BAM_BURST_SIZE 64
  18. #define QCE_AUTHIV_REGS_CNT 16
  19. #define QCE_AUTH_BYTECOUNT_REGS_CNT 4
  20. #define QCE_CNTRIV_REGS_CNT 4
  21. struct qce_result_dump {
  22. u32 auth_iv[QCE_AUTHIV_REGS_CNT];
  23. u32 auth_byte_count[QCE_AUTH_BYTECOUNT_REGS_CNT];
  24. u32 encr_cntr_iv[QCE_CNTRIV_REGS_CNT];
  25. u32 status;
  26. u32 status2;
  27. };
  28. #define QCE_IGNORE_BUF_SZ (2 * QCE_BAM_BURST_SIZE)
  29. #define QCE_RESULT_BUF_SZ \
  30. ALIGN(sizeof(struct qce_result_dump), QCE_BAM_BURST_SIZE)
  31. struct qce_dma_data {
  32. struct dma_chan *txchan;
  33. struct dma_chan *rxchan;
  34. struct qce_result_dump *result_buf;
  35. void *ignore_buf;
  36. };
  37. int qce_dma_request(struct device *dev, struct qce_dma_data *dma);
  38. void qce_dma_release(struct qce_dma_data *dma);
  39. int qce_dma_prep_sgs(struct qce_dma_data *dma, struct scatterlist *sg_in,
  40. int in_ents, struct scatterlist *sg_out, int out_ents,
  41. dma_async_tx_callback cb, void *cb_param);
  42. void qce_dma_issue_pending(struct qce_dma_data *dma);
  43. int qce_dma_terminate_all(struct qce_dma_data *dma);
  44. struct scatterlist *
  45. qce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add);
  46. #endif /* _DMA_H_ */