imx_rdc.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2019-2022 NXP. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef IMX_RDC_H
  7. #define IMX_RDC_H
  8. #include <lib/utils_def.h>
  9. #include <imx_sec_def.h>
  10. #include <platform_def.h>
  11. #define MDAn(x) (IMX_RDC_BASE + 0x200 + (x) * 4)
  12. #define PDAPn(x) (IMX_RDC_BASE + 0x400 + (x) * 4)
  13. #define MRSAn(x) (IMX_RDC_BASE + 0x800 + (x) * 0x10)
  14. #define MREAn(x) (IMX_RDC_BASE + 0x804 + (x) * 0x10)
  15. #define MRCn(x) (IMX_RDC_BASE + 0x808 + (x) * 0x10)
  16. #define LCK BIT(31)
  17. #define SREQ BIT(30)
  18. #define ENA BIT(30)
  19. #define DID0 U(0x0)
  20. #define DID1 U(0x1)
  21. #define DID2 U(0x2)
  22. #define DID3 U(0x3)
  23. #define D3R BIT(7)
  24. #define D3W BIT(6)
  25. #define D2R BIT(5)
  26. #define D2W BIT(4)
  27. #define D1R BIT(3)
  28. #define D1W BIT(2)
  29. #define D0R BIT(1)
  30. #define D0W BIT(0)
  31. union rdc_setting {
  32. uint32_t rdc_mda; /* Master Domain Assignment */
  33. uint32_t rdc_pdap; /* Peripheral Domain Access Permissions */
  34. uint32_t rdc_mem_region[3]; /* Memory Region Access Control */
  35. };
  36. enum rdc_type {
  37. RDC_INVALID,
  38. RDC_MDA,
  39. RDC_PDAP,
  40. RDC_MEM_REGION,
  41. };
  42. struct imx_rdc_cfg {
  43. enum rdc_type type; /* config type Master, Peripheral or Memory region */
  44. int index;
  45. union rdc_setting setting;
  46. };
  47. #define RDC_MDAn(i, mda) \
  48. {RDC_MDA, (i), .setting.rdc_mda = (mda), }
  49. #define RDC_PDAPn(i, pdap) \
  50. {RDC_PDAP, (i), .setting.rdc_pdap = (pdap), }
  51. #define RDC_MEM_REGIONn(i, msa, mea, mrc) \
  52. { RDC_MEM_REGION, (i), \
  53. .setting.rdc_mem_region[0] = (msa), \
  54. .setting.rdc_mem_region[1] = (mea), \
  55. .setting.rdc_mem_region[2] = (mrc), \
  56. }
  57. void imx_rdc_init(struct imx_rdc_cfg *cfg, unsigned int console_base);
  58. #endif /* IMX_RDC_H */