blob: f5af893c2d9d4315063211fac93d1bd2d58ec798 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +08002/*
3 * Copyright 2014 Freescale Semiconductor, Inc.
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +08004 */
5
6#include <common.h>
7#include <asm/mmu.h>
8
9struct fsl_e_tlb_entry tlb_table[] = {
10 /* TLB 0 - for temp stack in cache */
Tom Rini6a5dccc2022-11-16 13:10:41 -050011 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR,
12 CFG_SYS_INIT_RAM_ADDR_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080013 MAS3_SX|MAS3_SW|MAS3_SR, 0,
14 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050015 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 4 * 1024,
16 CFG_SYS_INIT_RAM_ADDR_PHYS + 4 * 1024,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +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 + 8 * 1024,
20 CFG_SYS_INIT_RAM_ADDR_PHYS + 8 * 1024,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +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 + 12 * 1024,
24 CFG_SYS_INIT_RAM_ADDR_PHYS + 12 * 1024,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080025 MAS3_SX|MAS3_SW|MAS3_SR, 0,
26 0, 0, BOOKE_PAGESZ_4K, 0),
27
28 /* TLB 1 */
29 /* *I*** - Covers boot page */
Tom Rini6a5dccc2022-11-16 13:10:41 -050030#if defined(CONFIG_SYS_RAMBOOT) && defined(CFG_SYS_INIT_L3_ADDR)
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080031 /*
32 * *I*G - L3SRAM. When L3 is used as 512K SRAM */
Tom Rini6a5dccc2022-11-16 13:10:41 -050033 SET_TLB_ENTRY(1, CFG_SYS_INIT_L3_ADDR, CFG_SYS_INIT_L3_ADDR,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080034 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
35 0, 0, BOOKE_PAGESZ_512K, 1),
36#else
37 SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
38 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
39 0, 0, BOOKE_PAGESZ_4K, 1),
40#endif
41
42 /* *I*G* - CCSRBAR */
Tom Rini6a5dccc2022-11-16 13:10:41 -050043 SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080044 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
45 0, 1, BOOKE_PAGESZ_16M, 1),
46
47 /* *I*G* - Flash, localbus */
48 /* This will be changed to *I*G* after relocation to RAM. */
Tom Rini6a5dccc2022-11-16 13:10:41 -050049 SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080050 MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
51 0, 2, BOOKE_PAGESZ_256M, 1),
52
Chunhe Lan66cba6b2015-03-20 17:08:54 +080053#ifndef CONFIG_SPL_BUILD
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080054 /* *I*G* - PCI */
Tom Rini56af6592022-11-16 13:10:33 -050055 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT, CFG_SYS_PCIE1_MEM_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080056 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
57 0, 3, BOOKE_PAGESZ_1G, 1),
58
59 /* *I*G* - PCI */
Tom Rini56af6592022-11-16 13:10:33 -050060 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT + 0x40000000,
61 CFG_SYS_PCIE1_MEM_PHYS + 0x40000000,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080062 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
63 0, 4, BOOKE_PAGESZ_256M, 1),
64
Tom Rini56af6592022-11-16 13:10:33 -050065 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT + 0x50000000,
66 CFG_SYS_PCIE1_MEM_PHYS + 0x50000000,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080067 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
68 0, 5, BOOKE_PAGESZ_256M, 1),
69
70 /* *I*G* - PCI I/O */
Tom Rini56af6592022-11-16 13:10:33 -050071 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080072 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
73 0, 6, BOOKE_PAGESZ_256K, 1),
74
75 /* Bman/Qman */
Tom Rini6a5dccc2022-11-16 13:10:41 -050076#ifdef CFG_SYS_BMAN_MEM_PHYS
77 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE, CFG_SYS_BMAN_MEM_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080078 MAS3_SX|MAS3_SW|MAS3_SR, 0,
79 0, 9, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050080 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE + 0x01000000,
81 CFG_SYS_BMAN_MEM_PHYS + 0x01000000,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080082 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
83 0, 10, BOOKE_PAGESZ_16M, 1),
84#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050085#ifdef CFG_SYS_QMAN_MEM_PHYS
86 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE, CFG_SYS_QMAN_MEM_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080087 MAS3_SX|MAS3_SW|MAS3_SR, 0,
88 0, 11, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050089 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE + 0x01000000,
90 CFG_SYS_QMAN_MEM_PHYS + 0x01000000,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080091 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
92 0, 12, BOOKE_PAGESZ_16M, 1),
93#endif
Chunhe Lan66cba6b2015-03-20 17:08:54 +080094#endif
95
Tom Rini6a5dccc2022-11-16 13:10:41 -050096#ifdef CFG_SYS_DCSRBAR_PHYS
97 SET_TLB_ENTRY(1, CFG_SYS_DCSRBAR, CFG_SYS_DCSRBAR_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +080098 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
99 0, 13, BOOKE_PAGESZ_32M, 1),
100#endif
Tom Rinib4213492022-11-12 17:36:51 -0500101#ifdef CFG_SYS_NAND_BASE
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +0800102 /*
103 * *I*G - NAND
104 * entry 14 and 15 has been used hard coded, they will be disabled
105 * in cpu_init_f, so we use entry 16 for nand.
106 */
Tom Rinib4213492022-11-12 17:36:51 -0500107 SET_TLB_ENTRY(1, CFG_SYS_NAND_BASE, CFG_SYS_NAND_BASE_PHYS,
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +0800108 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
109 0, 16, BOOKE_PAGESZ_64K, 1),
110#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500111#ifdef CFG_SYS_CPLD_BASE
112 SET_TLB_ENTRY(1, CFG_SYS_CPLD_BASE, CFG_SYS_CPLD_BASE_PHYS,
Chunhe Lanc3eb88d2014-09-12 14:47:09 +0800113 MAS3_SW|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
114 0, 17, BOOKE_PAGESZ_4K, 1),
115#endif
Chunhe Lan66cba6b2015-03-20 17:08:54 +0800116#if defined(CONFIG_RAMBOOT_PBL) && !defined(CONFIG_SPL_BUILD)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500117 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE, CFG_SYS_DDR_SDRAM_BASE,
York Sun05204d02017-12-05 10:57:54 -0800118 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Chunhe Lan66cba6b2015-03-20 17:08:54 +0800119 0, 18, BOOKE_PAGESZ_2G, 1)
120#endif
Chunhe Lan8e4f3ff2014-04-14 18:42:06 +0800121};
122
123int num_tlb_entries = ARRAY_SIZE(tlb_table);