imx_caam.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef IMX_CAAM_H
  7. #define IMX_CAAM_H
  8. #include <cdefs.h>
  9. #include <stdint.h>
  10. #include <arch.h>
  11. #include <imx_regs.h>
  12. struct caam_job_ring {
  13. uint32_t jrmidr_ms;
  14. uint32_t jrmidr_ls;
  15. };
  16. struct caam_rtic_mid {
  17. uint32_t rticmidr_ms;
  18. uint32_t rticmidr_ls;
  19. };
  20. struct caam_deco {
  21. uint32_t deco_mid_ms;
  22. uint32_t deco_mid_ls;
  23. };
  24. #define JOB_RING_OFFSET 0x10
  25. #define DEBUGCTL_OFFSET 0x58
  26. #define RES2_SIZE (DEBUGCTL_OFFSET - JOB_RING_OFFSET - \
  27. (sizeof(struct caam_job_ring) * CAAM_NUM_JOB_RINGS))
  28. #define RTIC_MID_OFFSET 0x60
  29. #define DECORR_OFFSET 0x9C
  30. #define RES3_SIZE (DECORR_OFFSET - RTIC_MID_OFFSET - \
  31. (sizeof(struct caam_rtic_mid) * CAAM_NUM_RTIC))
  32. #define DECO_MID_OFFSET 0xA0
  33. #define DAR_OFFSET 0x120
  34. #define RES4_SIZE (DAR_OFFSET - DECO_MID_OFFSET - \
  35. (sizeof(struct caam_deco) * CAAM_NUM_DECO))
  36. struct caam_ctrl {
  37. uint32_t res0;
  38. uint32_t mcfgr;
  39. uint32_t res1;
  40. uint32_t scfgr;
  41. struct caam_job_ring jr[CAAM_NUM_JOB_RINGS];
  42. uint8_t res2[RES2_SIZE];
  43. uint32_t debuctl;
  44. uint32_t jrstartr;
  45. struct caam_rtic_mid mid[CAAM_NUM_RTIC];
  46. uint8_t res3[RES3_SIZE];
  47. uint32_t decorr;
  48. struct caam_deco deco[CAAM_NUM_DECO];
  49. uint8_t res4[RES4_SIZE];
  50. uint32_t dar;
  51. uint32_t drr;
  52. } __packed;
  53. /* Job ring control bits */
  54. #define JROWN_NS BIT(3)
  55. #define JROWN_MID 0x01
  56. /* Declare CAAM API */
  57. void imx_caam_init(void);
  58. #endif /* IMX_CAAM_H */