Varun Wadekar | 91535cd | 2020-03-12 14:32:44 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2020, NVIDIA Corporation. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <debug.h> |
| 8 | #include <drivers/console.h> |
| 9 | #include <drivers/arm/gic_common.h> |
| 10 | #include <drivers/arm/gic_v2.h> |
| 11 | #include <platform.h> |
| 12 | #include <platform_def.h> |
| 13 | |
| 14 | #include <xlat_tables_v2.h> |
| 15 | |
| 16 | /* |
| 17 | * The memory map currently provides the following apertures |
| 18 | * |
| 19 | * GIC Distributor : 4KB |
| 20 | * GIC CPU Interface : 4KB |
| 21 | * UARTC for the console : 128KB |
| 22 | * RTC : 4KB |
| 23 | * us Timer : 4KB |
| 24 | * DRAM aperture for NVM : 256MB |
| 25 | */ |
| 26 | static const mmap_region_t tegra194_mmap[] = { |
| 27 | MAP_REGION_FLAT(TEGRA194_GICD_BASE, 0x1000, /* 4KB */ |
| 28 | MT_DEVICE | MT_RW | MT_NS), |
| 29 | MAP_REGION_FLAT(TEGRA194_GICC_BASE, 0x1000, /* 4KB */ |
| 30 | MT_DEVICE | MT_RW | MT_NS), |
| 31 | MAP_REGION_FLAT(TEGRA194_UARTC_BASE, 0x20000U, /* 128KB */ |
| 32 | MT_DEVICE | MT_RW | MT_NS), |
| 33 | MAP_REGION_FLAT(TEGRA194_RTC_BASE, 0x1000, /* 4KB */ |
| 34 | MT_DEVICE | MT_RW | MT_NS), |
| 35 | MAP_REGION_FLAT(TEGRA194_TMRUS_BASE, 0x1000, /* 4KB */ |
| 36 | MT_DEVICE | MT_RW | MT_NS), |
| 37 | MAP_REGION_FLAT(DRAM_BASE + TFTF_NVM_OFFSET, TFTF_NVM_SIZE, |
| 38 | MT_MEMORY | MT_RW | MT_NS), |
| 39 | {0} |
| 40 | }; |
| 41 | |
| 42 | const mmap_region_t *tftf_platform_get_mmap(void) |
| 43 | { |
| 44 | return tegra194_mmap; |
| 45 | } |
| 46 | |
| 47 | void tftf_plat_arch_setup(void) |
| 48 | { |
| 49 | tftf_plat_configure_mmu(); |
| 50 | } |
| 51 | |
| 52 | void tftf_early_platform_setup(void) |
| 53 | { |
| 54 | /* Tegra194 platforms use UARTC as the console */ |
| 55 | console_init(TEGRA194_UARTC_BASE, TEGRA194_CONSOLE_CLKRATE, |
| 56 | TEGRA194_CONSOLE_BAUDRATE); |
| 57 | } |
| 58 | |
| 59 | void tftf_platform_setup(void) |
| 60 | { |
| 61 | gicv2_init(TEGRA194_GICC_BASE, TEGRA194_GICD_BASE); |
| 62 | gicv2_setup_distif(); |
| 63 | gicv2_probe_gic_cpu_id(); |
| 64 | gicv2_setup_cpuif(); |
| 65 | } |