blob: a9a03908dfbdeec6530c3e609f7b92747233d37b [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Shengzhou Liuf13321d2014-03-05 15:04:48 +08002/*
3 * Copyright 2008-2014 Freescale Semiconductor, Inc.
4 *
5 * (C) Copyright 2000
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Shengzhou Liuf13321d2014-03-05 15:04:48 +08007 */
8
Tom Rinidec7ea02024-05-20 13:35:03 -06009#include <config.h>
Shengzhou Liuf13321d2014-03-05 15:04:48 +080010#include <asm/mmu.h>
Tom Rinidec7ea02024-05-20 13:35:03 -060011#include <asm/ppc.h>
Shengzhou Liuf13321d2014-03-05 15:04:48 +080012
13struct fsl_e_tlb_entry tlb_table[] = {
14 /* TLB 0 - for temp stack in cache */
Tom Rini6a5dccc2022-11-16 13:10:41 -050015 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR,
16 CFG_SYS_INIT_RAM_ADDR_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080017 MAS3_SX|MAS3_SW|MAS3_SR, 0,
18 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050019 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 4 * 1024,
20 CFG_SYS_INIT_RAM_ADDR_PHYS + 4 * 1024,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080021 MAS3_SX|MAS3_SW|MAS3_SR, 0,
22 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050023 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 8 * 1024,
24 CFG_SYS_INIT_RAM_ADDR_PHYS + 8 * 1024,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080025 MAS3_SX|MAS3_SW|MAS3_SR, 0,
26 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050027 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 12 * 1024,
28 CFG_SYS_INIT_RAM_ADDR_PHYS + 12 * 1024,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080029 MAS3_SX|MAS3_SW|MAS3_SR, 0,
30 0, 0, BOOKE_PAGESZ_4K, 0),
31
32 /* TLB 1 */
33 /* *I*** - Covers boot page */
Tom Rini6a5dccc2022-11-16 13:10:41 -050034#if defined(CONFIG_SYS_RAMBOOT) && defined(CFG_SYS_INIT_L3_ADDR)
Shengzhou Liuf13321d2014-03-05 15:04:48 +080035 /*
36 * *I*G - L3SRAM. When L3 is used as 1M SRAM, the address of the
37 * SRAM is at 0xfff00000, it covered the 0xfffff000.
38 */
Tom Rini6a5dccc2022-11-16 13:10:41 -050039 SET_TLB_ENTRY(1, CFG_SYS_INIT_L3_ADDR, CFG_SYS_INIT_L3_ADDR,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080040 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
41 0, 0, BOOKE_PAGESZ_1M, 1),
42#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE)
43 /*
44 * SRIO_PCIE_BOOT-SLAVE. When slave boot, the address of the
45 * space is at 0xfff00000, it covered the 0xfffff000.
46 */
Tom Rini40eb5562022-11-16 13:10:40 -050047 SET_TLB_ENTRY(1, CFG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR,
48 CFG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080049 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_W|MAS2_G,
50 0, 0, BOOKE_PAGESZ_1M, 1),
51#else
52 SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
53 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
54 0, 0, BOOKE_PAGESZ_4K, 1),
55#endif
56
57 /* *I*G* - CCSRBAR */
Tom Rini6a5dccc2022-11-16 13:10:41 -050058 SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080059 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
60 0, 1, BOOKE_PAGESZ_16M, 1),
61
62 /* *I*G* - Flash, localbus */
63 /* This will be changed to *I*G* after relocation to RAM. */
Tom Rini6a5dccc2022-11-16 13:10:41 -050064 SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080065 MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
66 0, 2, BOOKE_PAGESZ_256M, 1),
67
Shengzhou Liu11ff48a2014-04-18 16:43:40 +080068#ifndef CONFIG_SPL_BUILD
Shengzhou Liuf13321d2014-03-05 15:04:48 +080069 /* *I*G* - PCIe 1, 0x80000000 */
Tom Rini56af6592022-11-16 13:10:33 -050070 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT, CFG_SYS_PCIE1_MEM_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080071 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
72 0, 3, BOOKE_PAGESZ_512M, 1),
73
74 /* *I*G* - PCIe 2, 0xa0000000 */
Tom Rini56af6592022-11-16 13:10:33 -050075 SET_TLB_ENTRY(1, CFG_SYS_PCIE2_MEM_VIRT, CFG_SYS_PCIE2_MEM_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080076 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
77 0, 4, BOOKE_PAGESZ_256M, 1),
78
79 /* *I*G* - PCIe 3, 0xb0000000 */
Tom Rini56af6592022-11-16 13:10:33 -050080 SET_TLB_ENTRY(1, CFG_SYS_PCIE3_MEM_VIRT, CFG_SYS_PCIE3_MEM_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080081 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
82 0, 5, BOOKE_PAGESZ_256M, 1),
83
Shengzhou Liuf13321d2014-03-05 15:04:48 +080084 /* *I*G* - PCIe 4, 0xc0000000 */
Tom Rini56af6592022-11-16 13:10:33 -050085 SET_TLB_ENTRY(1, CFG_SYS_PCIE4_MEM_VIRT, CFG_SYS_PCIE4_MEM_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080086 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
87 0, 6, BOOKE_PAGESZ_256M, 1),
88
89 /* *I*G* - PCI I/O */
Tom Rini56af6592022-11-16 13:10:33 -050090 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080091 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
92 0, 7, BOOKE_PAGESZ_256K, 1),
93
94 /* Bman/Qman */
Tom Rini6a5dccc2022-11-16 13:10:41 -050095#ifdef CFG_SYS_BMAN_MEM_PHYS
96 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE, CFG_SYS_BMAN_MEM_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +080097 MAS3_SX|MAS3_SW|MAS3_SR, 0,
98 0, 9, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050099 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE + 0x01000000,
100 CFG_SYS_BMAN_MEM_PHYS + 0x01000000,
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800101 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
102 0, 10, BOOKE_PAGESZ_16M, 1),
103#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500104#ifdef CFG_SYS_QMAN_MEM_PHYS
105 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE, CFG_SYS_QMAN_MEM_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800106 MAS3_SX|MAS3_SW|MAS3_SR, 0,
107 0, 11, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -0500108 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE + 0x01000000,
109 CFG_SYS_QMAN_MEM_PHYS + 0x01000000,
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800110 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
111 0, 12, BOOKE_PAGESZ_16M, 1),
112#endif
Shengzhou Liu11ff48a2014-04-18 16:43:40 +0800113#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500114#ifdef CFG_SYS_DCSRBAR_PHYS
115 SET_TLB_ENTRY(1, CFG_SYS_DCSRBAR, CFG_SYS_DCSRBAR_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800116 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
117 0, 13, BOOKE_PAGESZ_32M, 1),
118#endif
Tom Rinib4213492022-11-12 17:36:51 -0500119#ifdef CFG_SYS_NAND_BASE
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800120 /*
121 * *I*G - NAND
122 * entry 14 and 15 has been used hard coded, they will be disabled
123 * in cpu_init_f, so we use entry 16 for nand.
124 */
Tom Rinib4213492022-11-12 17:36:51 -0500125 SET_TLB_ENTRY(1, CFG_SYS_NAND_BASE, CFG_SYS_NAND_BASE_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800126 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
127 0, 16, BOOKE_PAGESZ_64K, 1),
128#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500129#ifdef CFG_SYS_CPLD_BASE
130 SET_TLB_ENTRY(1, CFG_SYS_CPLD_BASE, CFG_SYS_CPLD_BASE_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800131 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
132 0, 17, BOOKE_PAGESZ_4K, 1),
133#endif
134#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
135 /*
136 * SRIO_PCIE_BOOT-SLAVE. 1M space from 0xffe00000 for
137 * fetching ucode and ENV from master
138 */
Tom Rini40eb5562022-11-16 13:10:40 -0500139 SET_TLB_ENTRY(1, CFG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR,
140 CFG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS,
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800141 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
142 0, 18, BOOKE_PAGESZ_1M, 1),
143#endif
Shengzhou Liu11ff48a2014-04-18 16:43:40 +0800144#if defined(CONFIG_RAMBOOT_PBL) && !defined(CONFIG_SPL_BUILD)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500145 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE, CFG_SYS_DDR_SDRAM_BASE,
York Sun05204d02017-12-05 10:57:54 -0800146 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Shengzhou Liuf13321d2014-03-05 15:04:48 +0800147 0, 19, BOOKE_PAGESZ_2G, 1)
148#endif
149
150};
151
152int num_tlb_entries = ARRAY_SIZE(tlb_table);