Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 1 | /* |
Prabhakar Kushwaha | b707090 | 2011-01-19 10:52:04 +0530 | [diff] [blame] | 2 | * Copyright 2011 Freescale Semiconductor, Inc. |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 3 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <asm/mmu.h> |
| 9 | |
| 10 | struct fsl_e_tlb_entry tlb_table[] = { |
| 11 | /* TLB 0 - for temp stack in cache */ |
Poonam Aggrwal | e0082f7 | 2011-02-09 20:05:29 +0000 | [diff] [blame] | 12 | SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, |
| 13 | CONFIG_SYS_INIT_RAM_ADDR_PHYS, |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 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 , |
Poonam Aggrwal | e0082f7 | 2011-02-09 20:05:29 +0000 | [diff] [blame] | 17 | CONFIG_SYS_INIT_RAM_ADDR_PHYS + 4 * 1024, |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 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 , |
Poonam Aggrwal | e0082f7 | 2011-02-09 20:05:29 +0000 | [diff] [blame] | 21 | CONFIG_SYS_INIT_RAM_ADDR_PHYS + 8 * 1024, |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 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 , |
Poonam Aggrwal | e0082f7 | 2011-02-09 20:05:29 +0000 | [diff] [blame] | 25 | CONFIG_SYS_INIT_RAM_ADDR_PHYS + 12 * 1024, |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 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, |
Kumar Gala | abc76eb | 2009-11-17 20:21:20 -0600 | [diff] [blame] | 32 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 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 | |
Prabhakar Kushwaha | bc2d40c | 2014-05-15 16:43:12 +0530 | [diff] [blame] | 40 | #ifndef CONFIG_SPL_BUILD |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [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_16M, 1), |
| 46 | |
Prabhakar Kushwaha | b707090 | 2011-01-19 10:52:04 +0530 | [diff] [blame] | 47 | #if defined(CONFIG_PCI) |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 48 | /* *I*G* - PCI */ |
Prabhakar Kushwaha | b0c5ceb | 2011-03-23 04:21:13 -0500 | [diff] [blame] | 49 | SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS, |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 50 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 51 | 0, 3, BOOKE_PAGESZ_1G, 1), |
| 52 | |
| 53 | /* *I*G* - PCI I/O */ |
Prabhakar Kushwaha | b0c5ceb | 2011-03-23 04:21:13 -0500 | [diff] [blame] | 54 | SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_IO_VIRT, CONFIG_SYS_PCIE1_IO_PHYS, |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 55 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 56 | 0, 4, BOOKE_PAGESZ_256K, 1), |
| 57 | |
Prabhakar Kushwaha | b707090 | 2011-01-19 10:52:04 +0530 | [diff] [blame] | 58 | #endif /* #if defined(CONFIG_PCI) */ |
Prabhakar Kushwaha | bc2d40c | 2014-05-15 16:43:12 +0530 | [diff] [blame] | 59 | #endif |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 60 | /* *I*G - NAND */ |
| 61 | SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS, |
| 62 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 63 | 0, 5, BOOKE_PAGESZ_1M, 1), |
| 64 | |
| 65 | /* *I*G - VSC7385 Switch */ |
| 66 | SET_TLB_ENTRY(1, CONFIG_SYS_VSC7385_BASE, CONFIG_SYS_VSC7385_BASE_PHYS, |
| 67 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 68 | 0, 6, BOOKE_PAGESZ_1M, 1), |
| 69 | |
Prabhakar Kushwaha | bc2d40c | 2014-05-15 16:43:12 +0530 | [diff] [blame] | 70 | #ifdef CONFIG_SYS_INIT_L2_ADDR |
| 71 | /* *I*G - L2SRAM */ |
| 72 | SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS, |
| 73 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G, |
| 74 | 0, 11, BOOKE_PAGESZ_256K, 1), |
| 75 | #if CONFIG_SYS_L2_SIZE >= (256 << 10) |
| 76 | SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR + 0x40000, |
| 77 | CONFIG_SYS_INIT_L2_ADDR_PHYS + 0x40000, |
| 78 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 79 | 0, 12, BOOKE_PAGESZ_256K, 1), |
| 80 | #endif |
| 81 | #endif |
| 82 | |
| 83 | #if defined(CONFIG_SYS_RAMBOOT) || \ |
| 84 | (defined(CONFIG_SPL) && !defined(CONFIG_SPL_COMMON_INIT_DDR)) |
Priyanka Jain | 0c871e95 | 2011-02-08 13:13:15 +0530 | [diff] [blame] | 85 | SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE, |
| 86 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 87 | 0, 7, BOOKE_PAGESZ_1G, 1) |
Dipen Dudhat | f7780ec | 2009-10-08 13:33:18 +0530 | [diff] [blame] | 88 | #endif |
Poonam Aggrwal | 728ece3 | 2009-08-05 13:29:24 +0530 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | int num_tlb_entries = ARRAY_SIZE(tlb_table); |