Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 2 | /* |
Kumar Gala | ad4e9d4 | 2011-01-04 17:57:59 -0600 | [diff] [blame] | 3 | * Copyright 2008, 2011 Freescale Semiconductor, Inc. |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 4 | * |
| 5 | * (C) Copyright 2000 |
| 6 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 7 | */ |
| 8 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 9 | #include <config.h> |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 10 | #include <asm/mmu.h> |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 11 | #include <asm/ppc.h> |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 12 | |
| 13 | struct fsl_e_tlb_entry tlb_table[] = { |
| 14 | /* TLB 0 - for temp stack in cache */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 15 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR, CFG_SYS_INIT_RAM_ADDR, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 16 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 17 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 18 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 4 * 1024 , CFG_SYS_INIT_RAM_ADDR + 4 * 1024, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 19 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 20 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 21 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 8 * 1024 , CFG_SYS_INIT_RAM_ADDR + 8 * 1024, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 22 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 23 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 24 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 12 * 1024 , CFG_SYS_INIT_RAM_ADDR + 12 * 1024, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 25 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 26 | 0, 0, BOOKE_PAGESZ_4K, 0), |
| 27 | |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 28 | /* TLB 1 */ |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 29 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 30 | * Entry 0: |
| 31 | * FLASH(cover boot page) 16M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 32 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 33 | SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE_PHYS, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 34 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 35 | 0, 0, BOOKE_PAGESZ_16M, 1), |
| 36 | |
| 37 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 38 | * Entry 1: |
| 39 | * CCSRBAR 1M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 40 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 41 | SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 42 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 43 | 0, 1, BOOKE_PAGESZ_1M, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 44 | |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 45 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 46 | * Entry 2: |
| 47 | * LBC SDRAM 64M Cacheable, non-guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 48 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 49 | SET_TLB_ENTRY(1, CFG_SYS_LBC_SDRAM_BASE, |
| 50 | CFG_SYS_LBC_SDRAM_BASE_PHYS, |
York Sun | 05204d0 | 2017-12-05 10:57:54 -0800 | [diff] [blame] | 51 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 52 | 0, 2, BOOKE_PAGESZ_64M, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 53 | |
| 54 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 55 | * Entry 3: |
| 56 | * CADMUS registers 1M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 57 | */ |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 58 | SET_TLB_ENTRY(1, CADMUS_BASE_ADDR, CADMUS_BASE_ADDR_PHYS, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 59 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 60 | 0, 3, BOOKE_PAGESZ_1M, 1), |
Kumar Gala | ad4e9d4 | 2011-01-04 17:57:59 -0600 | [diff] [blame] | 61 | |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 62 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 63 | * Entry 4: |
| 64 | * PCI and PCIe MEM 1G Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 65 | */ |
Tom Rini | 56af659 | 2022-11-16 13:10:33 -0500 | [diff] [blame] | 66 | SET_TLB_ENTRY(1, CFG_SYS_PCI1_MEM_VIRT, CFG_SYS_PCI1_MEM_PHYS, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 67 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 68 | 0, 4, BOOKE_PAGESZ_1G, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 69 | |
| 70 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 71 | * Entry 5: |
| 72 | * PCI1 IO 1M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 73 | */ |
Tom Rini | 56af659 | 2022-11-16 13:10:33 -0500 | [diff] [blame] | 74 | SET_TLB_ENTRY(1, CFG_SYS_PCI1_IO_VIRT, CFG_SYS_PCI1_IO_PHYS, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 75 | MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 76 | 0, 5, BOOKE_PAGESZ_1M, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 77 | |
| 78 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 79 | * Entry 6: |
| 80 | * PCIe IO 1M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 81 | */ |
Tom Rini | 56af659 | 2022-11-16 13:10:33 -0500 | [diff] [blame] | 82 | SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 83 | MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 84 | 0, 6, BOOKE_PAGESZ_1M, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | int num_tlb_entries = ARRAY_SIZE(tlb_table); |