Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2008 |
| 4 | * Sergei Poselenov, Emcraft Systems, sposelenov@emcraft.com. |
| 5 | * |
| 6 | * Copyright 2008 Freescale Semiconductor, Inc. |
| 7 | * |
| 8 | * (C) Copyright 2000 |
| 9 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 10 | */ |
| 11 | |
Tom Rini | abb9a04 | 2024-05-18 20:20:43 -0600 | [diff] [blame] | 12 | #include <common.h> |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 13 | #include <asm/mmu.h> |
| 14 | |
| 15 | struct fsl_e_tlb_entry tlb_table[] = { |
| 16 | /* TLB 0 - for temp stack in cache */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 17 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR, CFG_SYS_INIT_RAM_ADDR, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 18 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 19 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 20 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 4 * 1024 , CFG_SYS_INIT_RAM_ADDR + 4 * 1024, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [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 + 8 * 1024 , CFG_SYS_INIT_RAM_ADDR + 8 * 1024, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 24 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 25 | 0, 0, BOOKE_PAGESZ_4K, 0), |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 26 | SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 12 * 1024 , CFG_SYS_INIT_RAM_ADDR + 12 * 1024, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 27 | MAS3_SX|MAS3_SW|MAS3_SR, 0, |
| 28 | 0, 0, BOOKE_PAGESZ_4K, 0), |
| 29 | |
| 30 | |
| 31 | /* |
Anatolij Gustschin | e6f5c91 | 2008-08-15 15:42:13 +0200 | [diff] [blame] | 32 | * TLB 1: 64M Non-cacheable, guarded |
Sergei Poselenov | 96dd16b | 2008-06-06 15:42:41 +0200 | [diff] [blame] | 33 | * 0xfc000000 64M FLASH |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 34 | * Out of reset this entry is only 4K. |
| 35 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 36 | SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 37 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 38 | 0, 1, BOOKE_PAGESZ_64M, 1), |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 39 | |
| 40 | /* |
| 41 | * TLB 2: 256M Non-cacheable, guarded |
| 42 | * 0x80000000 256M PCI1 MEM First half |
| 43 | */ |
Tom Rini | 56af659 | 2022-11-16 13:10:33 -0500 | [diff] [blame] | 44 | SET_TLB_ENTRY(1, CFG_SYS_PCI1_MEM_PHYS, CFG_SYS_PCI1_MEM_PHYS, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 45 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 46 | 0, 2, BOOKE_PAGESZ_256M, 1), |
| 47 | |
| 48 | /* |
| 49 | * TLB 3: 256M Non-cacheable, guarded |
| 50 | * 0x90000000 256M PCI1 MEM Second half |
| 51 | */ |
Tom Rini | 56af659 | 2022-11-16 13:10:33 -0500 | [diff] [blame] | 52 | SET_TLB_ENTRY(1, CFG_SYS_PCI1_MEM_PHYS + 0x10000000, CFG_SYS_PCI1_MEM_PHYS + 0x10000000, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 53 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 54 | 0, 3, BOOKE_PAGESZ_256M, 1), |
| 55 | |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 56 | #if defined(CFG_SYS_FPGA_BASE) |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 57 | /* |
Sergei Poselenov | 96dd16b | 2008-06-06 15:42:41 +0200 | [diff] [blame] | 58 | * TLB 4: 1M Non-cacheable, guarded |
| 59 | * 0xc0000000 1M FPGA and NAND |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 60 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 61 | SET_TLB_ENTRY(1, CFG_SYS_FPGA_BASE, CFG_SYS_FPGA_BASE, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 62 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
Sergei Poselenov | 96dd16b | 2008-06-06 15:42:41 +0200 | [diff] [blame] | 63 | 0, 4, BOOKE_PAGESZ_1M, 1), |
| 64 | #endif |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 65 | |
| 66 | /* |
Anatolij Gustschin | e6f5c91 | 2008-08-15 15:42:13 +0200 | [diff] [blame] | 67 | * TLB 5: 64M Non-cacheable, guarded |
| 68 | * 0xc8000000 16M LIME GDC framebuffer |
| 69 | * 0xc9fc0000 256K LIME GDC MMIO |
| 70 | * (0xcbfc0000 256K LIME GDC MMIO) |
| 71 | * MMIO is relocatable and could be at 0xcbfc0000 |
| 72 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 73 | SET_TLB_ENTRY(1, CFG_SYS_LIME_BASE, CFG_SYS_LIME_BASE, |
Anatolij Gustschin | e6f5c91 | 2008-08-15 15:42:13 +0200 | [diff] [blame] | 74 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 75 | 0, 5, BOOKE_PAGESZ_64M, 1), |
| 76 | |
| 77 | /* |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 78 | * TLB 6: 64M Non-cacheable, guarded |
| 79 | * 0xe000_0000 1M CCSRBAR |
| 80 | * 0xe200_0000 16M PCI1 IO |
| 81 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 82 | SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 83 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 84 | 0, 6, BOOKE_PAGESZ_64M, 1), |
| 85 | |
Anatolij Gustschin | a49dccd | 2008-11-13 18:08:57 +0100 | [diff] [blame] | 86 | #if !defined(CONFIG_SPD_EEPROM) |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 87 | /* |
| 88 | * TLB 7+8: 512M DDR, cache disabled (needed for memory test) |
| 89 | * 0x00000000 512M DDR System memory |
| 90 | * Without SPD EEPROM configured DDR, this must be setup manually. |
| 91 | * Make sure the TLB count at the top of this table is correct. |
| 92 | * Likely it needs to be increased by two for these entries. |
| 93 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 94 | SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE, CFG_SYS_DDR_SDRAM_BASE, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 95 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 96 | 0, 7, BOOKE_PAGESZ_256M, 1), |
| 97 | |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 98 | SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE + 0x10000000, CFG_SYS_DDR_SDRAM_BASE + 0x10000000, |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 99 | MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, |
| 100 | 0, 8, BOOKE_PAGESZ_256M, 1), |
Anatolij Gustschin | a49dccd | 2008-11-13 18:08:57 +0100 | [diff] [blame] | 101 | #endif |
Sergei Poselenov | f2bf96c | 2008-04-30 11:42:50 +0200 | [diff] [blame] | 102 | }; |
| 103 | |
| 104 | int num_tlb_entries = ARRAY_SIZE(tlb_table); |