Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Timur Tabi | 9b45b5a | 2010-06-14 15:28:24 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2010 Freescale Semiconductor, Inc. |
| 4 | * Authors: Srikanth Srinivasan <srikanth.srinivasan@freescale.com> |
| 5 | * Timur Tabi <timur@freescale.com> |
Timur Tabi | 9b45b5a | 2010-06-14 15:28:24 -0500 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/mmu.h> |
| 10 | |
| 11 | struct fsl_e_tlb_entry tlb_table[] = { |
| 12 | /* TLB 0 - for temp stack in cache */ |
| 13 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, CONFIG_SYS_INIT_RAM_ADDR, |
| 14 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 15 | 0, 0, BOOKE_PAGESZ_4K, 0), |
| 16 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024, |
| 17 | CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024, |
| 18 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 19 | 0, 0, BOOKE_PAGESZ_4K, 0), |
| 20 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024, |
| 21 | CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024, |
| 22 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 23 | 0, 0, BOOKE_PAGESZ_4K, 0), |
| 24 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024, |
| 25 | CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024, |
| 26 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 27 | 0, 0, BOOKE_PAGESZ_4K, 0), |
| 28 | |
| 29 | /* TLB 1 */ |
| 30 | /* *I*** - Covers boot page */ |
| 31 | SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000, |
| 32 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I, |
| 33 | 0, 0, BOOKE_PAGESZ_4K, 1), |
| 34 | |
| 35 | /* *I*G* - CCSRBAR */ |
| 36 | SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS, |
| 37 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 38 | 0, 1, BOOKE_PAGESZ_1M, 1), |
| 39 | |
Matthew McClintock | cd99caa | 2013-02-18 10:02:19 +0000 | [diff] [blame] | 40 | #ifndef CONFIG_SPL_BUILD |
Timur Tabi | 9b45b5a | 2010-06-14 15:28:24 -0500 | [diff] [blame] | 41 | /* W**G* - Flash/promjet, localbus */ |
| 42 | /* This will be changed to *I*G* after relocation to RAM. */ |
| 43 | SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS, |
| 44 | MAS3_SX|MAS3_SR, MAS2_W|MAS2_G, |
| 45 | 0, 2, BOOKE_PAGESZ_256M, 1), |
| 46 | |
| 47 | /* *I*G* - PCI */ |
| 48 | SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT, CONFIG_SYS_PCIE3_MEM_PHYS, |
| 49 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 50 | 0, 3, BOOKE_PAGESZ_1G, 1), |
| 51 | |
| 52 | /* *I*G* - PCI */ |
| 53 | SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT + 0x40000000, |
| 54 | CONFIG_SYS_PCIE3_MEM_PHYS + 0x40000000, |
| 55 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 56 | 0, 4, BOOKE_PAGESZ_256M, 1), |
| 57 | |
| 58 | SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT + 0x50000000, |
| 59 | CONFIG_SYS_PCIE3_MEM_PHYS + 0x50000000, |
| 60 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 61 | 0, 5, BOOKE_PAGESZ_256M, 1), |
| 62 | |
| 63 | /* *I*G* - PCI I/O */ |
| 64 | SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_IO_VIRT, CONFIG_SYS_PCIE3_IO_PHYS, |
| 65 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 66 | 0, 6, BOOKE_PAGESZ_256K, 1), |
Matthew McClintock | cd99caa | 2013-02-18 10:02:19 +0000 | [diff] [blame] | 67 | #endif |
Timur Tabi | 9b45b5a | 2010-06-14 15:28:24 -0500 | [diff] [blame] | 68 | |
| 69 | SET_TLB_ENTRY(1, PIXIS_BASE, PIXIS_BASE_PHYS, |
| 70 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 71 | 0, 7, BOOKE_PAGESZ_4K, 1), |
Matthew McClintock | c4253e9 | 2012-05-18 06:04:17 +0000 | [diff] [blame] | 72 | |
Ying Zhang | dfb2b15 | 2013-08-16 15:16:12 +0800 | [diff] [blame] | 73 | #if defined(CONFIG_SYS_RAMBOOT) || \ |
| 74 | (defined(CONFIG_SPL) && !defined(CONFIG_SPL_COMMON_INIT_DDR)) |
Matthew McClintock | cd99caa | 2013-02-18 10:02:19 +0000 | [diff] [blame] | 75 | /* **** - eSDHC/eSPI/NAND boot */ |
Matthew McClintock | c4253e9 | 2012-05-18 06:04:17 +0000 | [diff] [blame] | 76 | SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE, |
York Sun | 05204d0 | 2017-12-05 10:57:54 -0800 | [diff] [blame] | 77 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M, |
Ying Zhang | dfb2b15 | 2013-08-16 15:16:12 +0800 | [diff] [blame] | 78 | 0, 8, BOOKE_PAGESZ_1G, 1), |
Matthew McClintock | cd99caa | 2013-02-18 10:02:19 +0000 | [diff] [blame] | 79 | /* **** - eSDHC/eSPI/NAND boot - second 1GB of memory */ |
Matthew McClintock | c4253e9 | 2012-05-18 06:04:17 +0000 | [diff] [blame] | 80 | SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000, |
Ying Zhang | dfb2b15 | 2013-08-16 15:16:12 +0800 | [diff] [blame] | 81 | CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000, |
York Sun | 05204d0 | 2017-12-05 10:57:54 -0800 | [diff] [blame] | 82 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M, |
Ying Zhang | dfb2b15 | 2013-08-16 15:16:12 +0800 | [diff] [blame] | 83 | 0, 9, BOOKE_PAGESZ_1G, 1), |
Matthew McClintock | c4253e9 | 2012-05-18 06:04:17 +0000 | [diff] [blame] | 84 | #endif |
Matthew McClintock | cd99caa | 2013-02-18 10:02:19 +0000 | [diff] [blame] | 85 | |
| 86 | #ifdef CONFIG_SYS_NAND_BASE |
| 87 | /* *I*G - NAND */ |
| 88 | SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS, |
Ying Zhang | dfb2b15 | 2013-08-16 15:16:12 +0800 | [diff] [blame] | 89 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 90 | 0, 10, BOOKE_PAGESZ_16K, 1), |
Matthew McClintock | cd99caa | 2013-02-18 10:02:19 +0000 | [diff] [blame] | 91 | #endif |
| 92 | |
Ying Zhang | dfb2b15 | 2013-08-16 15:16:12 +0800 | [diff] [blame] | 93 | #ifdef CONFIG_SYS_INIT_L2_ADDR |
| 94 | /* *I*G - L2SRAM */ |
| 95 | SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS, |
| 96 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G, |
| 97 | 0, 11, BOOKE_PAGESZ_256K, 1) |
| 98 | #endif |
Timur Tabi | 9b45b5a | 2010-06-14 15:28:24 -0500 | [diff] [blame] | 99 | }; |
| 100 | |
| 101 | int num_tlb_entries = ARRAY_SIZE(tlb_table); |