1 /* 2 * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved. 3 * Copyright (c) 2019-2023, Intel Corporation. All rights reserved. 4 * Copyright (c) 2024, Altera Corporation. All rights reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef PLAT_SOCFPGA_DEF_H 10 #define PLAT_SOCFPGA_DEF_H 11 12 #include "agilex5_memory_controller.h" 13 #include "agilex5_system_manager.h" 14 15 #include <platform_def.h> 16 17 /* Platform Setting */ 18 #define PLATFORM_MODEL PLAT_SOCFPGA_AGILEX5 19 /* 1 = Flush cache, 0 = No cache flush. 20 * Default for Agilex5 is Cache flush. 21 */ 22 #define CACHE_FLUSH 1 23 #define MMC_DEVICE_TYPE 1 /* MMC = 0, SD = 1 */ 24 #define XLAT_TABLES_V2 U(1) 25 #define PLAT_PRIMARY_CPU_A55 0x000 26 #define PLAT_PRIMARY_CPU_A76 0x200 27 #define PLAT_CLUSTER_ID_MPIDR_AFF_SHIFT MPIDR_AFF2_SHIFT 28 #define PLAT_CPU_ID_MPIDR_AFF_SHIFT MPIDR_AFF1_SHIFT 29 #define PLAT_L2_RESET_REQ 0xB007C0DE 30 #define PLAT_HANDOFF_OFFSET 0x0007F000 31 #define PLAT_TIMER_BASE_ADDR 0x10D01000 32 33 /* System Counter */ 34 /* TODO: Update back to 400MHz. 35 * This shall be updated to read from L4 clock instead of hardcoded. 36 */ 37 #define PLAT_SYS_COUNTER_FREQ_IN_TICKS U(400000000) 38 #define PLAT_SYS_COUNTER_FREQ_IN_MHZ U(400) 39 40 /* FPGA config helpers */ 41 #define INTEL_SIP_SMC_FPGA_CONFIG_ADDR 0x80400000 42 #define INTEL_SIP_SMC_FPGA_CONFIG_SIZE 0x82000000 43 44 /* QSPI Setting */ 45 #define CAD_QSPIDATA_OFST 0x10900000 46 #define CAD_QSPI_OFFSET 0x108d2000 47 48 /* FIP Setting */ 49 #define PLAT_FIP_BASE (0) 50 #if ARM_LINUX_KERNEL_AS_BL33 51 #define PLAT_FIP_MAX_SIZE (0x8000000) 52 #else 53 #define PLAT_FIP_MAX_SIZE (0x1000000) 54 #endif 55 56 /* SDMMC Setting */ 57 #if ARM_LINUX_KERNEL_AS_BL33 58 #define PLAT_MMC_DATA_BASE (0x90000000) 59 #define PLAT_MMC_DATA_SIZE (0x100000) 60 #define SOCFPGA_MMC_BLOCK_SIZE U(32768) 61 #else 62 #define PLAT_MMC_DATA_BASE (0x0007D000) 63 #define PLAT_MMC_DATA_SIZE (0x2000) 64 #define SOCFPGA_MMC_BLOCK_SIZE U(8192) 65 #endif 66 67 /* Register Mapping */ 68 #define SOCFPGA_CCU_NOC_REG_BASE 0x1c000000 69 #define SOCFPGA_F2SDRAMMGR_REG_BASE 0x18001000 70 71 #define SOCFPGA_MMC_REG_BASE 0x10808000 72 #define SOCFPGA_MEMCTRL_REG_BASE 0x108CC000 73 #define SOCFPGA_RSTMGR_REG_BASE 0x10d11000 74 #define SOCFPGA_SYSMGR_REG_BASE 0x10d12000 75 #define SOCFPGA_PINMUX_REG_BASE 0x10d13000 76 #define SOCFPGA_NAND_REG_BASE 0x10B80000 77 #define SOCFPGA_ECC_QSPI_REG_BASE 0x10A22000 78 79 #define SOCFPGA_L4_PER_SCR_REG_BASE 0x10d21000 80 #define SOCFPGA_L4_SYS_SCR_REG_BASE 0x10d21100 81 #define SOCFPGA_SOC2FPGA_SCR_REG_BASE 0x10d21200 82 #define SOCFPGA_LWSOC2FPGA_SCR_REG_BASE 0x10d21300 83 #define SOCFPGA_SDMMC_SECU_BIT 0x40 84 #define SOCFPGA_LWSOC2FPGA_ENABLE 0xffe0301 85 #define SOCFPGA_SDMMC_SECU_BIT_ENABLE 0x1010001 86 87 88 /* Define maximum page size for NAND flash devices */ 89 #define PLATFORM_MTD_MAX_PAGE_SIZE U(0x2000) 90 91 /* OCRAM Register*/ 92 93 #define OCRAM_REG_BASE 0x108CC400 94 #define OCRAM_REGION_0_OFFSET 0x18 95 #define OCRAM_REGION_0_REG_BASE (OCRAM_REG_BASE + \ 96 OCRAM_REGION_0_OFFSET) 97 #define OCRAM_NON_SECURE_ENABLE 0x0 98 99 100 /* 101 * Magic key bits: 4 bits[5:2] from boot scratch register COLD3 are used to 102 * indicate the below requests/status 103 * 0x0 : Default value on reset, not used 104 * 0x1 : L2/warm reset is completed 105 * 0x2 : SMP secondary core boot requests 106 * 0x3 - 0xF : Reserved for future use 107 */ 108 #define BS_REG_MAGIC_KEYS_MASK 0x3C 109 #define BS_REG_MAGIC_KEYS_POS 0x02 110 #define L2_RESET_DONE_STATUS (0x01 << BS_REG_MAGIC_KEYS_POS) 111 #define SMP_SEC_CORE_BOOT_REQ (0x02 << BS_REG_MAGIC_KEYS_POS) 112 #define ALIGN_CHECK_64BIT_MASK 0x07 113 114 /******************************************************************************* 115 * Platform memory map related constants 116 ******************************************************************************/ 117 #define DRAM_BASE (0x80000000) 118 #define DRAM_SIZE (0x80000000) 119 120 #define OCRAM_BASE (0x00000000) 121 #define OCRAM_SIZE (0x00080000) 122 123 #define MEM64_BASE (0x0080000000) 124 #define MEM64_SIZE (0x0080000000) 125 126 //128MB PSS 127 #define PSS_BASE (0x10000000) 128 #define PSS_SIZE (0x08000000) 129 130 //64MB MPFE 131 #define MPFE_BASE (0x18000000) 132 #define MPFE_SIZE (0x04000000) 133 134 //16MB CCU 135 #define CCU_BASE (0x1C000000) 136 #define CCU_SIZE (0x01000000) 137 138 //1MB GIC 139 #define GIC_BASE (0x1D000000) 140 #define GIC_SIZE (0x00100000) 141 142 #define BL2_BASE (0x00000000) 143 #define BL2_LIMIT (0x0007E000) 144 145 #define BL31_BASE (0x80000000) 146 #define BL31_LIMIT (0x82000000) 147 /******************************************************************************* 148 * UART related constants 149 ******************************************************************************/ 150 #define PLAT_UART0_BASE (0x10C02000) 151 #define PLAT_UART1_BASE (0x10C02100) 152 153 /******************************************************************************* 154 * WDT related constants 155 ******************************************************************************/ 156 #define WDT_BASE (0x10D00200) 157 158 /******************************************************************************* 159 * GIC related constants 160 ******************************************************************************/ 161 #define PLAT_GIC_BASE (0x1D000000) 162 #define PLAT_GICC_BASE (PLAT_GIC_BASE + 0x20000) 163 #define PLAT_GICD_BASE (PLAT_GIC_BASE + 0x00000) 164 #define PLAT_GICR_BASE (PLAT_GIC_BASE + 0x60000) 165 166 #define PLAT_INTEL_SOCFPGA_GICR_BASE PLAT_GICR_BASE 167 168 /******************************************************************************* 169 * SDMMC related pointer function 170 ******************************************************************************/ 171 #define SDMMC_READ_BLOCKS sdmmc_read_blocks 172 #define SDMMC_WRITE_BLOCKS sdmmc_write_blocks 173 174 /******************************************************************************* 175 * sysmgr.boot_scratch_cold3 bits[5:2] are used to indicate L2 reset 176 * is done, or SMP secondary cores boot request status. 177 ******************************************************************************/ 178 #define L2_RESET_DONE_REG SOCFPGA_SYSMGR(BOOT_SCRATCH_COLD_3) 179 180 #endif /* PLAT_SOCFPGA_DEF_H */ 181