Patrice Chotard | d29531c | 2023-10-27 16:43:04 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause |
| 2 | /* |
| 3 | * Copyright (C) 2023, STMicroelectronics - All Rights Reserved |
| 4 | */ |
| 5 | |
Patrice Chotard | d29531c | 2023-10-27 16:43:04 +0200 | [diff] [blame] | 6 | #include <asm/system.h> |
| 7 | #include <asm/armv8/mmu.h> |
Tom Rini | 34d4a82 | 2023-11-13 09:07:23 -0500 | [diff] [blame] | 8 | #include <mach/stm32.h> |
Patrice Chotard | d29531c | 2023-10-27 16:43:04 +0200 | [diff] [blame] | 9 | |
| 10 | #define MP2_MEM_MAP_MAX 10 |
| 11 | |
| 12 | #if (CONFIG_TEXT_BASE < STM32_DDR_BASE) || \ |
| 13 | (CONFIG_TEXT_BASE > (STM32_DDR_BASE + STM32_DDR_SIZE)) |
| 14 | #error "invalid CONFIG_TEXT_BASE value" |
| 15 | #endif |
| 16 | |
| 17 | struct mm_region stm32mp2_mem_map[MP2_MEM_MAP_MAX] = { |
| 18 | { |
| 19 | /* PCIe */ |
| 20 | .virt = 0x10000000UL, |
| 21 | .phys = 0x10000000UL, |
| 22 | .size = 0x10000000UL, |
| 23 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 24 | PTE_BLOCK_NON_SHARE | |
| 25 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 26 | }, { |
| 27 | /* LPSRAMs, VDERAM, RETRAM, SRAMs, SYSRAM: alias1 */ |
| 28 | .virt = 0x20000000UL, |
| 29 | .phys = 0x20000000UL, |
| 30 | .size = 0x00200000UL, |
| 31 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 32 | PTE_BLOCK_NON_SHARE | |
| 33 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 34 | }, { |
| 35 | /* Peripherals: alias1 */ |
| 36 | .virt = 0x40000000UL, |
| 37 | .phys = 0x40000000UL, |
| 38 | .size = 0x10000000UL, |
| 39 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 40 | PTE_BLOCK_NON_SHARE | |
| 41 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 42 | }, { |
| 43 | /* OSPI and FMC: memory-map area */ |
| 44 | .virt = 0x60000000UL, |
| 45 | .phys = 0x60000000UL, |
| 46 | .size = 0x20000000UL, |
| 47 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 48 | PTE_BLOCK_NON_SHARE | |
| 49 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 50 | }, { |
| 51 | /* |
| 52 | * DDR = STM32_DDR_BASE / STM32_DDR_SIZE |
| 53 | * the beginning of DDR (before CONFIG_TEXT_BASE) is not |
| 54 | * mapped, protected by RIF and reserved for other firmware |
| 55 | * (OP-TEE / TF-M / Cube M33) |
| 56 | */ |
| 57 | .virt = CONFIG_TEXT_BASE, |
| 58 | .phys = CONFIG_TEXT_BASE, |
| 59 | .size = STM32_DDR_SIZE - (CONFIG_TEXT_BASE - STM32_DDR_BASE), |
| 60 | .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | |
| 61 | PTE_BLOCK_INNER_SHARE |
| 62 | }, { |
| 63 | /* List terminator */ |
| 64 | 0, |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | struct mm_region *mem_map = stm32mp2_mem_map; |