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 | |
| 9 | #include <common.h> |
| 10 | #include <asm/mmu.h> |
| 11 | |
| 12 | struct fsl_e_tlb_entry tlb_table[] = { |
| 13 | /* TLB 0 - for temp stack in cache */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 14 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, CONFIG_SYS_INIT_RAM_ADDR, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 15 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 16 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 17 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 18 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 19 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 20 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 21 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 22 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 23 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 24 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 25 | 0, 0, BOOKE_PAGESZ_4K, 0), |
| 26 | |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 27 | /* TLB 1 */ |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 28 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 29 | * Entry 0: |
| 30 | * FLASH(cover boot page) 16M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 31 | */ |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 32 | SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 33 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 34 | 0, 0, BOOKE_PAGESZ_16M, 1), |
| 35 | |
| 36 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 37 | * Entry 1: |
| 38 | * CCSRBAR 1M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 39 | */ |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 40 | SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 41 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 42 | 0, 1, BOOKE_PAGESZ_1M, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 43 | |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 44 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 45 | * Entry 2: |
| 46 | * LBC SDRAM 64M Cacheable, non-guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 47 | */ |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 48 | SET_TLB_ENTRY(1, CONFIG_SYS_LBC_SDRAM_BASE, |
| 49 | CONFIG_SYS_LBC_SDRAM_BASE_PHYS, |
York Sun | 05204d0 | 2017-12-05 10:57:54 -0800 | [diff] [blame] | 50 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 51 | 0, 2, BOOKE_PAGESZ_64M, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 52 | |
| 53 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 54 | * Entry 3: |
| 55 | * CADMUS registers 1M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 56 | */ |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 57 | SET_TLB_ENTRY(1, CADMUS_BASE_ADDR, CADMUS_BASE_ADDR_PHYS, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 58 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 59 | 0, 3, BOOKE_PAGESZ_1M, 1), |
Kumar Gala | ad4e9d4 | 2011-01-04 17:57:59 -0600 | [diff] [blame] | 60 | |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 61 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 62 | * Entry 4: |
| 63 | * PCI and PCIe MEM 1G Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 64 | */ |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 65 | SET_TLB_ENTRY(1, CONFIG_SYS_PCI1_MEM_VIRT, CONFIG_SYS_PCI1_MEM_PHYS, |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 66 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 67 | 0, 4, BOOKE_PAGESZ_1G, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 68 | |
| 69 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 70 | * Entry 5: |
| 71 | * PCI1 IO 1M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 72 | */ |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 73 | SET_TLB_ENTRY(1, CONFIG_SYS_PCI1_IO_VIRT, CONFIG_SYS_PCI1_IO_PHYS, |
| 74 | MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 75 | 0, 5, BOOKE_PAGESZ_1M, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 76 | |
| 77 | /* |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 78 | * Entry 6: |
| 79 | * PCIe IO 1M Non-cacheable, guarded |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 80 | */ |
chenhui zhao | e97171e | 2011-10-13 13:40:59 +0800 | [diff] [blame] | 81 | SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_IO_VIRT, CONFIG_SYS_PCIE1_IO_PHYS, |
| 82 | MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 83 | 0, 6, BOOKE_PAGESZ_1M, 1), |
Kumar Gala | 1242b88 | 2008-01-17 01:01:09 -0600 | [diff] [blame] | 84 | }; |
| 85 | |
| 86 | int num_tlb_entries = ARRAY_SIZE(tlb_table); |