tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 3 | * |
dp-arm | d91aaae | 2017-05-10 15:16:15 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 7 | #ifndef PLATFORM_DEF_H |
| 8 | #define PLATFORM_DEF_H |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 9 | |
| 10 | #include <arch.h> |
| 11 | #include <common_def.h> |
| 12 | #include <rk3328_def.h> |
| 13 | |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 14 | /******************************************************************************* |
| 15 | * Platform binary types for linking |
| 16 | ******************************************************************************/ |
| 17 | #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" |
| 18 | #define PLATFORM_LINKER_ARCH aarch64 |
| 19 | |
| 20 | /******************************************************************************* |
| 21 | * Generic platform constants |
| 22 | ******************************************************************************/ |
| 23 | |
| 24 | /* Size of cacheable stacks */ |
Antonio Nino Diaz | 5823090 | 2018-09-24 17:16:20 +0100 | [diff] [blame] | 25 | #if defined(IMAGE_BL1) |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 26 | #define PLATFORM_STACK_SIZE 0x440 |
Roberto Vargas | 8247796 | 2017-10-23 08:22:17 +0100 | [diff] [blame] | 27 | #elif defined(IMAGE_BL2) |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 28 | #define PLATFORM_STACK_SIZE 0x400 |
Roberto Vargas | 8247796 | 2017-10-23 08:22:17 +0100 | [diff] [blame] | 29 | #elif defined(IMAGE_BL31) |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 30 | #define PLATFORM_STACK_SIZE 0x800 |
Roberto Vargas | 8247796 | 2017-10-23 08:22:17 +0100 | [diff] [blame] | 31 | #elif defined(IMAGE_BL32) |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 32 | #define PLATFORM_STACK_SIZE 0x440 |
| 33 | #endif |
| 34 | |
| 35 | #define FIRMWARE_WELCOME_STR "Booting Trusted Firmware\n" |
| 36 | |
| 37 | #define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL2 |
| 38 | #define PLATFORM_SYSTEM_COUNT 1 |
| 39 | #define PLATFORM_CLUSTER_COUNT 1 |
| 40 | #define PLATFORM_CLUSTER0_CORE_COUNT 4 |
| 41 | #define PLATFORM_CLUSTER1_CORE_COUNT 0 |
| 42 | #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER1_CORE_COUNT + \ |
| 43 | PLATFORM_CLUSTER0_CORE_COUNT) |
| 44 | |
| 45 | #define PLATFORM_NUM_AFFS (PLATFORM_SYSTEM_COUNT + \ |
| 46 | PLATFORM_CLUSTER_COUNT + \ |
| 47 | PLATFORM_CORE_COUNT) |
| 48 | |
| 49 | #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL2 |
| 50 | |
| 51 | #define PLAT_RK_CLST_TO_CPUID_SHIFT 6 |
| 52 | |
| 53 | /* |
| 54 | * This macro defines the deepest retention state possible. A higher state |
| 55 | * id will represent an invalid or a power down state. |
| 56 | */ |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 57 | #define PLAT_MAX_RET_STATE U(1) |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 58 | |
| 59 | /* |
| 60 | * This macro defines the deepest power down states possible. Any state ID |
| 61 | * higher than this is invalid. |
| 62 | */ |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 63 | #define PLAT_MAX_OFF_STATE U(2) |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 64 | |
| 65 | /******************************************************************************* |
| 66 | * Platform memory map related constants |
| 67 | ******************************************************************************/ |
| 68 | /* TF txet, ro, rw, Size: 512KB */ |
| 69 | #define TZRAM_BASE (0x0) |
| 70 | #define TZRAM_SIZE (0x80000) |
| 71 | |
| 72 | /******************************************************************************* |
| 73 | * BL31 specific defines. |
| 74 | ******************************************************************************/ |
| 75 | /* |
| 76 | * Put BL3-1 at the top of the Trusted RAM |
| 77 | */ |
| 78 | #define BL31_BASE (TZRAM_BASE + 0x10000) |
| 79 | #define BL31_LIMIT (TZRAM_BASE + TZRAM_SIZE) |
| 80 | |
| 81 | /******************************************************************************* |
| 82 | * Platform specific page table and MMU setup constants |
| 83 | ******************************************************************************/ |
Antonio Nino Diaz | 5823090 | 2018-09-24 17:16:20 +0100 | [diff] [blame] | 84 | #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) |
| 85 | #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 86 | #define MAX_XLAT_TABLES 9 |
| 87 | #define MAX_MMAP_REGIONS 33 |
| 88 | |
| 89 | /******************************************************************************* |
| 90 | * Declarations and constants to access the mailboxes safely. Each mailbox is |
| 91 | * aligned on the biggest cache line size in the platform. This is known only |
| 92 | * to the platform as it might have a combination of integrated and external |
| 93 | * caches. Such alignment ensures that two maiboxes do not sit on the same cache |
| 94 | * line at any cache level. They could belong to different cpus/clusters & |
| 95 | * get written while being protected by different locks causing corruption of |
| 96 | * a valid mailbox address. |
| 97 | ******************************************************************************/ |
| 98 | #define CACHE_WRITEBACK_SHIFT 6 |
| 99 | #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) |
| 100 | |
| 101 | /* |
| 102 | * Define GICD and GICC and GICR base |
| 103 | */ |
| 104 | #define PLAT_RK_GICD_BASE RK3328_GICD_BASE |
| 105 | #define PLAT_RK_GICC_BASE RK3328_GICC_BASE |
| 106 | |
tony.xie | 54973e7 | 2017-04-24 16:18:10 +0800 | [diff] [blame] | 107 | #define PLAT_RK_UART_BASE RK3328_UART2_BASE |
| 108 | #define PLAT_RK_UART_CLOCK RK3328_UART_CLOCK |
| 109 | #define PLAT_RK_UART_BAUDRATE RK3328_BAUDRATE |
| 110 | |
| 111 | #define PLAT_RK_PRIMARY_CPU 0x0 |
| 112 | |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 113 | #define PSRAM_DO_DDR_RESUME 0 |
Lin Huang | 2a6df22 | 2017-05-12 10:26:32 +0800 | [diff] [blame] | 114 | #define PSRAM_CHECK_WAKEUP_CPU 0 |
Lin Huang | 30e4339 | 2017-05-04 16:02:45 +0800 | [diff] [blame] | 115 | |
Antonio Nino Diaz | 6f3ccc5 | 2018-07-20 09:17:26 +0100 | [diff] [blame] | 116 | #endif /* PLATFORM_DEF_H */ |