core.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _CORE_H_
  6. #define _CORE_H_
  7. #include "dma.h"
  8. /**
  9. * struct qce_device - crypto engine device structure
  10. * @queue: crypto request queue
  11. * @lock: the lock protects queue and req
  12. * @done_tasklet: done tasklet object
  13. * @req: current active request
  14. * @result: result of current transform
  15. * @base: virtual IO base
  16. * @dev: pointer to device structure
  17. * @core: core device clock
  18. * @iface: interface clock
  19. * @bus: bus clock
  20. * @dma: pointer to dma data
  21. * @burst_size: the crypto burst size
  22. * @pipe_pair_id: which pipe pair id the device using
  23. * @async_req_enqueue: invoked by every algorithm to enqueue a request
  24. * @async_req_done: invoked by every algorithm to finish its request
  25. */
  26. struct qce_device {
  27. struct crypto_queue queue;
  28. spinlock_t lock;
  29. struct tasklet_struct done_tasklet;
  30. struct crypto_async_request *req;
  31. int result;
  32. void __iomem *base;
  33. struct device *dev;
  34. struct clk *core, *iface, *bus;
  35. struct icc_path *mem_path;
  36. struct qce_dma_data dma;
  37. int burst_size;
  38. unsigned int pipe_pair_id;
  39. int (*async_req_enqueue)(struct qce_device *qce,
  40. struct crypto_async_request *req);
  41. void (*async_req_done)(struct qce_device *qce, int ret);
  42. };
  43. /**
  44. * struct qce_algo_ops - algorithm operations per crypto type
  45. * @type: should be CRYPTO_ALG_TYPE_XXX
  46. * @register_algs: invoked by core to register the algorithms
  47. * @unregister_algs: invoked by core to unregister the algorithms
  48. * @async_req_handle: invoked by core to handle enqueued request
  49. */
  50. struct qce_algo_ops {
  51. u32 type;
  52. int (*register_algs)(struct qce_device *qce);
  53. void (*unregister_algs)(struct qce_device *qce);
  54. int (*async_req_handle)(struct crypto_async_request *async_req);
  55. };
  56. #endif /* _CORE_H_ */