plat_smmu.c 960 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <common/bl_common.h>
  7. #include <common/debug.h>
  8. #include <smmu.h>
  9. #include <tegra_def.h>
  10. #define BOARD_SYSTEM_FPGA_BASE U(1)
  11. #define BASE_CONFIG_SMMU_DEVICES U(2)
  12. #define MAX_NUM_SMMU_DEVICES U(3)
  13. static uint32_t tegra_misc_read_32(uint32_t off)
  14. {
  15. return mmio_read_32((uintptr_t)TEGRA_MISC_BASE + off);
  16. }
  17. /*******************************************************************************
  18. * Handler to return the support SMMU devices number
  19. ******************************************************************************/
  20. uint32_t plat_get_num_smmu_devices(void)
  21. {
  22. uint32_t ret_num = MAX_NUM_SMMU_DEVICES;
  23. uint32_t board_revid = ((tegra_misc_read_32(MISCREG_EMU_REVID) >>
  24. BOARD_SHIFT_BITS) & BOARD_MASK_BITS);
  25. if (board_revid == BOARD_SYSTEM_FPGA_BASE) {
  26. ret_num = BASE_CONFIG_SMMU_DEVICES;
  27. }
  28. return ret_num;
  29. }