Pritesh Raithatha | 537bce4 | 2017-01-02 19:43:45 +0530 | [diff] [blame] | 1 | /* |
Pritesh Raithatha | 66f9ff6 | 2018-04-19 13:11:43 +0530 | [diff] [blame] | 2 | * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. |
Pritesh Raithatha | 537bce4 | 2017-01-02 19:43:45 +0530 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Varun Wadekar | 0075990 | 2017-05-31 11:41:00 -0700 | [diff] [blame] | 7 | #include <common/bl_common.h> |
| 8 | #include <common/debug.h> |
Pritesh Raithatha | 537bce4 | 2017-01-02 19:43:45 +0530 | [diff] [blame] | 9 | #include <smmu.h> |
Varun Wadekar | 0075990 | 2017-05-31 11:41:00 -0700 | [diff] [blame] | 10 | #include <tegra_def.h> |
Pritesh Raithatha | 537bce4 | 2017-01-02 19:43:45 +0530 | [diff] [blame] | 11 | |
Steven Kao | 7dfbca7 | 2017-07-25 12:44:32 +0800 | [diff] [blame] | 12 | #define BOARD_SYSTEM_FPGA_BASE U(1) |
| 13 | #define BASE_CONFIG_SMMU_DEVICES U(2) |
| 14 | #define MAX_NUM_SMMU_DEVICES U(3) |
| 15 | |
| 16 | static uint32_t tegra_misc_read_32(uint32_t off) |
| 17 | { |
Anthony Zhou | 8bf6d4e | 2017-09-20 17:44:43 +0800 | [diff] [blame] | 18 | return mmio_read_32((uintptr_t)TEGRA_MISC_BASE + off); |
Steven Kao | 7dfbca7 | 2017-07-25 12:44:32 +0800 | [diff] [blame] | 19 | } |
| 20 | |
Varun Wadekar | 0075990 | 2017-05-31 11:41:00 -0700 | [diff] [blame] | 21 | /******************************************************************************* |
Steven Kao | 7dfbca7 | 2017-07-25 12:44:32 +0800 | [diff] [blame] | 22 | * Handler to return the support SMMU devices number |
| 23 | ******************************************************************************/ |
| 24 | uint32_t plat_get_num_smmu_devices(void) |
| 25 | { |
| 26 | uint32_t ret_num = MAX_NUM_SMMU_DEVICES; |
Elyes Haouas | 183638f | 2023-02-13 10:05:41 +0100 | [diff] [blame] | 27 | uint32_t board_revid = ((tegra_misc_read_32(MISCREG_EMU_REVID) >> |
Pritesh Raithatha | fe9635b | 2017-08-03 19:12:14 +0530 | [diff] [blame] | 28 | BOARD_SHIFT_BITS) & BOARD_MASK_BITS); |
Steven Kao | 7dfbca7 | 2017-07-25 12:44:32 +0800 | [diff] [blame] | 29 | |
| 30 | if (board_revid == BOARD_SYSTEM_FPGA_BASE) { |
| 31 | ret_num = BASE_CONFIG_SMMU_DEVICES; |
| 32 | } |
| 33 | |
| 34 | return ret_num; |
Varun Wadekar | 362a6b2 | 2017-11-10 11:04:42 -0800 | [diff] [blame] | 35 | } |