trdc.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright 2022-2023 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <errno.h>
  8. #include <stdbool.h>
  9. #include <common/bl_common.h>
  10. #include <common/debug.h>
  11. #include <lib/mmio.h>
  12. #include "trdc_config.h"
  13. struct trdc_mgr_info trdc_mgr_blks[] = {
  14. { TRDC_A_BASE, 0, 0, 39, 40 },
  15. { TRDC_W_BASE, 0, 0, 70, 71 },
  16. { TRDC_M_BASE, 1, 0, 1, 2 },
  17. { TRDC_N_BASE, 0, 1, 1, 2 },
  18. };
  19. unsigned int trdc_mgr_num = ARRAY_SIZE(trdc_mgr_blks);
  20. struct trdc_config_info trdc_cfg_info[] = {
  21. { TRDC_A_BASE,
  22. trdc_a_mbc_glbac, ARRAY_SIZE(trdc_a_mbc_glbac),
  23. trdc_a_mbc, ARRAY_SIZE(trdc_a_mbc),
  24. trdc_a_mrc_glbac, ARRAY_SIZE(trdc_a_mrc_glbac),
  25. trdc_a_mrc, ARRAY_SIZE(trdc_a_mrc)
  26. }, /* TRDC_A */
  27. { TRDC_W_BASE,
  28. trdc_w_mbc_glbac, ARRAY_SIZE(trdc_w_mbc_glbac),
  29. trdc_w_mbc, ARRAY_SIZE(trdc_w_mbc),
  30. trdc_w_mrc_glbac, ARRAY_SIZE(trdc_w_mrc_glbac),
  31. trdc_w_mrc, ARRAY_SIZE(trdc_w_mrc)
  32. }, /* TRDC_W */
  33. { TRDC_N_BASE,
  34. trdc_n_mbc_glbac, ARRAY_SIZE(trdc_n_mbc_glbac),
  35. trdc_n_mbc, ARRAY_SIZE(trdc_n_mbc),
  36. trdc_n_mrc_glbac, ARRAY_SIZE(trdc_n_mrc_glbac),
  37. trdc_n_mrc, ARRAY_SIZE(trdc_n_mrc)
  38. }, /* TRDC_N */
  39. };
  40. void trdc_config(void)
  41. {
  42. unsigned int i;
  43. /* Set MTR to DID1 */
  44. trdc_mda_set_noncpu(TRDC_A_BASE, 4, false, 0x2, 0x2, 0x1);
  45. /* Set M33 to DID2*/
  46. trdc_mda_set_cpu(TRDC_A_BASE, 1, 0, 0x2, 0x0, 0x2, 0x0, 0x0, 0x0);
  47. /* Configure the access permission for TRDC MGR and MC slots */
  48. for (i = 0U; i < ARRAY_SIZE(trdc_mgr_blks); i++) {
  49. trdc_mgr_mbc_setup(&trdc_mgr_blks[i]);
  50. }
  51. /* Configure TRDC user settings from config table */
  52. for (i = 0U; i < ARRAY_SIZE(trdc_cfg_info); i++) {
  53. trdc_setup(&trdc_cfg_info[i]);
  54. }
  55. NOTICE("TRDC init done\n");
  56. }