Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2010-2011 Freescale Semiconductor, Inc. |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 6 | #include <config.h> |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 7 | #include <asm/mmu.h> |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 8 | #include <asm/ppc.h> |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 9 | |
| 10 | struct fsl_e_tlb_entry tlb_table[] = { |
| 11 | /* TLB 0 - for temp stack in cache */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 12 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR, CFG_SYS_INIT_RAM_ADDR, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 13 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 14 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 15 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 4 * 1024 , |
| 16 | CFG_SYS_INIT_RAM_ADDR + 4 * 1024, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 17 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 18 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 19 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 8 * 1024 , |
| 20 | CFG_SYS_INIT_RAM_ADDR + 8 * 1024, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 21 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 22 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 23 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 12 * 1024 , |
| 24 | CFG_SYS_INIT_RAM_ADDR + 12 * 1024, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 25 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 26 | 0, 0, BOOKE_PAGESZ_4K, 0), |
| 27 | |
| 28 | /* TLB 1 */ |
| 29 | /* *I*** - Covers boot page */ |
Prabhakar Kushwaha | d6a7aba | 2013-05-07 11:19:55 +0530 | [diff] [blame] | 30 | SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000, |
| 31 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 32 | 0, 0, BOOKE_PAGESZ_4K, 1), |
Prabhakar Kushwaha | afffcb0 | 2013-12-11 12:42:11 +0530 | [diff] [blame] | 33 | #ifdef CONFIG_SPL_NAND_BOOT |
Prabhakar Kushwaha | 66d6aa8 | 2013-04-16 13:28:12 +0530 | [diff] [blame] | 34 | SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000, |
| 35 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
Prabhakar Kushwaha | d6a7aba | 2013-05-07 11:19:55 +0530 | [diff] [blame] | 36 | 0, 10, BOOKE_PAGESZ_4K, 1), |
| 37 | #endif |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 38 | |
| 39 | /* *I*G* - CCSRBAR */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 40 | SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 41 | MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 42 | 0, 1, BOOKE_PAGESZ_1M, 1), |
| 43 | |
Prabhakar Kushwaha | 66d6aa8 | 2013-04-16 13:28:12 +0530 | [diff] [blame] | 44 | #ifndef CONFIG_SPL_BUILD |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 45 | SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE_PHYS, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 46 | MAS3_SX|MAS3_SR, MAS2_W|MAS2_G, |
| 47 | 0, 2, BOOKE_PAGESZ_16M, 1), |
| 48 | |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 49 | SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE + 0x1000000, |
| 50 | CFG_SYS_FLASH_BASE_PHYS + 0x1000000, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 51 | MAS3_SX|MAS3_SR, MAS2_W|MAS2_G, |
| 52 | 0, 3, BOOKE_PAGESZ_16M, 1), |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 53 | |
Prabhakar Kushwaha | 5b029e9 | 2013-05-17 14:22:34 +0530 | [diff] [blame] | 54 | #ifdef CONFIG_PCI |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 55 | /* *I*G* - PCI */ |
Tom Rini | 56af659 | 2022-11-16 13:10:33 -0500 | [diff] [blame] | 56 | SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT, CFG_SYS_PCIE1_MEM_PHYS, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 57 | MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 58 | 0, 4, BOOKE_PAGESZ_1G, 1), |
| 59 | |
| 60 | /* *I*G* - PCI I/O */ |
Tom Rini | 56af659 | 2022-11-16 13:10:33 -0500 | [diff] [blame] | 61 | SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 62 | MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 63 | 0, 5, BOOKE_PAGESZ_256K, 1), |
| 64 | #endif |
| 65 | #endif |
| 66 | |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 67 | /* *I*G - Board CPLD */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 68 | SET_TLB_ENTRY(1, CFG_SYS_CPLD_BASE, CFG_SYS_CPLD_BASE_PHYS, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 69 | MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 70 | 0, 6, BOOKE_PAGESZ_256K, 1), |
| 71 | |
Tom Rini | b421349 | 2022-11-12 17:36:51 -0500 | [diff] [blame] | 72 | SET_TLB_ENTRY(1, CFG_SYS_NAND_BASE, CFG_SYS_NAND_BASE_PHYS, |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 73 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 74 | 0, 7, BOOKE_PAGESZ_1M, 1), |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 75 | |
Tom Rini | f8f6b32 | 2022-05-21 14:44:28 -0400 | [diff] [blame] | 76 | #if defined(CONFIG_SYS_RAMBOOT) || !CONFIG_IS_ENABLED(COMMON_INIT_DDR) |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 77 | SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE, CFG_SYS_DDR_SDRAM_BASE, |
York Sun | 05204d0 | 2017-12-05 10:57:54 -0800 | [diff] [blame] | 78 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M, |
Ying Zhang | 1233cbc | 2014-01-24 15:50:09 +0800 | [diff] [blame] | 79 | 0, 8, BOOKE_PAGESZ_1G, 1), |
| 80 | #endif |
| 81 | |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 82 | #ifdef CFG_SYS_INIT_L2_ADDR |
Ying Zhang | 1233cbc | 2014-01-24 15:50:09 +0800 | [diff] [blame] | 83 | /* *I*G - L2SRAM */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 84 | SET_TLB_ENTRY(1, CFG_SYS_INIT_L2_ADDR, CFG_SYS_INIT_L2_ADDR_PHYS, |
Ying Zhang | 1233cbc | 2014-01-24 15:50:09 +0800 | [diff] [blame] | 85 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G, |
| 86 | 0, 11, BOOKE_PAGESZ_256K, 1) |
Poonam Aggrwal | a2ec135 | 2011-02-09 19:17:53 +0000 | [diff] [blame] | 87 | #endif |
| 88 | }; |
| 89 | |
| 90 | int num_tlb_entries = ARRAY_SIZE(tlb_table); |