core.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2010-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 _CORE_H_
  14. #define _CORE_H_
  15. #include "dma.h"
  16. /**
  17. * struct qce_device - crypto engine device structure
  18. * @queue: crypto request queue
  19. * @lock: the lock protects queue and req
  20. * @done_tasklet: done tasklet object
  21. * @req: current active request
  22. * @result: result of current transform
  23. * @base: virtual IO base
  24. * @dev: pointer to device structure
  25. * @core: core device clock
  26. * @iface: interface clock
  27. * @bus: bus clock
  28. * @dma: pointer to dma data
  29. * @burst_size: the crypto burst size
  30. * @pipe_pair_id: which pipe pair id the device using
  31. * @async_req_enqueue: invoked by every algorithm to enqueue a request
  32. * @async_req_done: invoked by every algorithm to finish its request
  33. */
  34. struct qce_device {
  35. struct crypto_queue queue;
  36. spinlock_t lock;
  37. struct tasklet_struct done_tasklet;
  38. struct crypto_async_request *req;
  39. int result;
  40. void __iomem *base;
  41. struct device *dev;
  42. struct clk *core, *iface, *bus;
  43. struct qce_dma_data dma;
  44. int burst_size;
  45. unsigned int pipe_pair_id;
  46. int (*async_req_enqueue)(struct qce_device *qce,
  47. struct crypto_async_request *req);
  48. void (*async_req_done)(struct qce_device *qce, int ret);
  49. };
  50. /**
  51. * struct qce_algo_ops - algorithm operations per crypto type
  52. * @type: should be CRYPTO_ALG_TYPE_XXX
  53. * @register_algs: invoked by core to register the algorithms
  54. * @unregister_algs: invoked by core to unregister the algorithms
  55. * @async_req_handle: invoked by core to handle enqueued request
  56. */
  57. struct qce_algo_ops {
  58. u32 type;
  59. int (*register_algs)(struct qce_device *qce);
  60. void (*unregister_algs)(struct qce_device *qce);
  61. int (*async_req_handle)(struct crypto_async_request *async_req);
  62. };
  63. #endif /* _CORE_H_ */