blob: 10be580b81363ae1e74352a7e6048357bd6ff1ba [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Priyanka Jain8b1a60e2013-10-18 17:19:06 +05302/*
3 * Copyright 2013 Freescale Semiconductor, Inc.
Priyanka Jain8b1a60e2013-10-18 17:19:06 +05304 */
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,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053013 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,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053017 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,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053021 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,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053025 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) && \
Udit Agarwald2dd2f72019-11-07 16:11:39 +000031 !defined(CONFIG_NXP_ESBC)
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053032 /*
33 * *I*G - L3SRAM. When L3 is used as 256K SRAM, the address of the
34 * SRAM is at 0xfffc0000, it covered the 0xfffff000.
35 */
Tom Rini6a5dccc2022-11-16 13:10:41 -050036 SET_TLB_ENTRY(1, CFG_SYS_INIT_L3_ADDR, CFG_SYS_INIT_L3_ADDR,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053037 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
38 0, 0, BOOKE_PAGESZ_256K, 1),
Sumit Gargafaca2a2016-07-14 12:27:52 -040039
Udit Agarwald2dd2f72019-11-07 16:11:39 +000040#elif defined(CONFIG_NXP_ESBC) && defined(CONFIG_SPL_BUILD)
Sumit Gargafaca2a2016-07-14 12:27:52 -040041 /*
42 * *I*G - L3SRAM. When L3 is used as 256K SRAM, in case of Secure Boot
43 * the physical address of the SRAM is at 0xbffc0000,
44 * and virtual address is 0xfffc0000
45 */
46
Tom Rini6a5dccc2022-11-16 13:10:41 -050047 SET_TLB_ENTRY(1, CFG_SYS_INIT_L3_VADDR,
48 CFG_SYS_INIT_L3_ADDR,
Sumit Gargafaca2a2016-07-14 12:27:52 -040049 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
50 0, 0, BOOKE_PAGESZ_256K, 1),
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053051#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,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053059 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,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053065 MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
66 0, 2, BOOKE_PAGESZ_256M, 1),
67
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +053068#ifndef CONFIG_SPL_BUILD
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053069 /* *I*G* - PCI */
Tom Rini56af6592022-11-16 13:10:33 -050070 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT, CFG_SYS_PCIE1_MEM_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053071 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
72 0, 3, BOOKE_PAGESZ_1G, 1),
73
74 /* *I*G* - PCI I/O */
Tom Rini56af6592022-11-16 13:10:33 -050075 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053076 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
77 0, 4, BOOKE_PAGESZ_256K, 1),
78
79 /* Bman/Qman */
Tom Rini6a5dccc2022-11-16 13:10:41 -050080#ifdef CFG_SYS_BMAN_MEM_PHYS
81 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE, CFG_SYS_BMAN_MEM_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053082 MAS3_SX|MAS3_SW|MAS3_SR, 0,
83 0, 5, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050084 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE + 0x01000000,
85 CFG_SYS_BMAN_MEM_PHYS + 0x01000000,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053086 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
87 0, 6, BOOKE_PAGESZ_16M, 1),
88#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050089#ifdef CFG_SYS_QMAN_MEM_PHYS
90 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE, CFG_SYS_QMAN_MEM_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053091 MAS3_SX|MAS3_SW|MAS3_SR, 0,
92 0, 7, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050093 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE + 0x01000000,
94 CFG_SYS_QMAN_MEM_PHYS + 0x01000000,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053095 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
96 0, 8, BOOKE_PAGESZ_16M, 1),
97#endif
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +053098#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050099#ifdef CFG_SYS_DCSRBAR_PHYS
100 SET_TLB_ENTRY(1, CFG_SYS_DCSRBAR, CFG_SYS_DCSRBAR_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530101 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
102 0, 9, BOOKE_PAGESZ_4M, 1),
103#endif
Tom Rinib4213492022-11-12 17:36:51 -0500104#ifdef CFG_SYS_NAND_BASE
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530105 /*
106 * *I*G - NAND
107 * entry 14 and 15 has been used hard coded, they will be disabled
108 * in cpu_init_f, so we use entry 16 for nand.
109 */
Tom Rinib4213492022-11-12 17:36:51 -0500110 SET_TLB_ENTRY(1, CFG_SYS_NAND_BASE, CFG_SYS_NAND_BASE_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530111 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
112 0, 10, BOOKE_PAGESZ_64K, 1),
113#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500114#ifdef CFG_SYS_CPLD_BASE
115 SET_TLB_ENTRY(1, CFG_SYS_CPLD_BASE, CFG_SYS_CPLD_BASE_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530116 MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
117 0, 11, BOOKE_PAGESZ_256K, 1),
118#endif
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +0530119
120#if defined(CONFIG_RAMBOOT_PBL) && !defined(CONFIG_SPL_BUILD)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500121 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE, CFG_SYS_DDR_SDRAM_BASE,
York Sun05204d02017-12-05 10:57:54 -0800122 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +0530123 0, 12, BOOKE_PAGESZ_1G, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -0500124 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE + 0x40000000,
125 CFG_SYS_DDR_SDRAM_BASE + 0x40000000,
York Sun05204d02017-12-05 10:57:54 -0800126 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +0530127 0, 13, BOOKE_PAGESZ_1G, 1)
128#endif
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530129};
130
131int num_tlb_entries = ARRAY_SIZE(tlb_table);