blob: 24bc83f756bd745a9b385ad35d99f1fb3216fe10 [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
Tom Rinidec7ea02024-05-20 13:35:03 -06006#include <config.h>
Priyanka Jain8b1a60e2013-10-18 17:19:06 +05307#include <asm/mmu.h>
Tom Rinidec7ea02024-05-20 13:35:03 -06008#include <asm/ppc.h>
Priyanka Jain8b1a60e2013-10-18 17:19:06 +05309
10struct fsl_e_tlb_entry tlb_table[] = {
11 /* TLB 0 - for temp stack in cache */
Tom Rini6a5dccc2022-11-16 13:10:41 -050012 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR,
13 CFG_SYS_INIT_RAM_ADDR_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053014 MAS3_SX|MAS3_SW|MAS3_SR, 0,
15 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050016 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 4 * 1024,
17 CFG_SYS_INIT_RAM_ADDR_PHYS + 4 * 1024,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053018 MAS3_SX|MAS3_SW|MAS3_SR, 0,
19 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050020 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 8 * 1024,
21 CFG_SYS_INIT_RAM_ADDR_PHYS + 8 * 1024,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053022 MAS3_SX|MAS3_SW|MAS3_SR, 0,
23 0, 0, BOOKE_PAGESZ_4K, 0),
Tom Rini6a5dccc2022-11-16 13:10:41 -050024 SET_TLB_ENTRY(0, CFG_SYS_INIT_RAM_ADDR + 12 * 1024,
25 CFG_SYS_INIT_RAM_ADDR_PHYS + 12 * 1024,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053026 MAS3_SX|MAS3_SW|MAS3_SR, 0,
27 0, 0, BOOKE_PAGESZ_4K, 0),
28
29 /* TLB 1 */
30 /* *I*** - Covers boot page */
Tom Rini6a5dccc2022-11-16 13:10:41 -050031#if defined(CONFIG_SYS_RAMBOOT) && defined(CFG_SYS_INIT_L3_ADDR) && \
Udit Agarwald2dd2f72019-11-07 16:11:39 +000032 !defined(CONFIG_NXP_ESBC)
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053033 /*
34 * *I*G - L3SRAM. When L3 is used as 256K SRAM, the address of the
35 * SRAM is at 0xfffc0000, it covered the 0xfffff000.
36 */
Tom Rini6a5dccc2022-11-16 13:10:41 -050037 SET_TLB_ENTRY(1, CFG_SYS_INIT_L3_ADDR, CFG_SYS_INIT_L3_ADDR,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053038 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
39 0, 0, BOOKE_PAGESZ_256K, 1),
Sumit Gargafaca2a2016-07-14 12:27:52 -040040
Udit Agarwald2dd2f72019-11-07 16:11:39 +000041#elif defined(CONFIG_NXP_ESBC) && defined(CONFIG_SPL_BUILD)
Sumit Gargafaca2a2016-07-14 12:27:52 -040042 /*
43 * *I*G - L3SRAM. When L3 is used as 256K SRAM, in case of Secure Boot
44 * the physical address of the SRAM is at 0xbffc0000,
45 * and virtual address is 0xfffc0000
46 */
47
Tom Rini6a5dccc2022-11-16 13:10:41 -050048 SET_TLB_ENTRY(1, CFG_SYS_INIT_L3_VADDR,
49 CFG_SYS_INIT_L3_ADDR,
Sumit Gargafaca2a2016-07-14 12:27:52 -040050 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
51 0, 0, BOOKE_PAGESZ_256K, 1),
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053052#else
53 SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
54 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
55 0, 0, BOOKE_PAGESZ_4K, 1),
56#endif
57
58 /* *I*G* - CCSRBAR */
Tom Rini6a5dccc2022-11-16 13:10:41 -050059 SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053060 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
61 0, 1, BOOKE_PAGESZ_16M, 1),
62
63 /* *I*G* - Flash, localbus */
64 /* This will be changed to *I*G* after relocation to RAM. */
Tom Rini6a5dccc2022-11-16 13:10:41 -050065 SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053066 MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
67 0, 2, BOOKE_PAGESZ_256M, 1),
68
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +053069#ifndef CONFIG_SPL_BUILD
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053070 /* *I*G* - PCI */
Tom Rini56af6592022-11-16 13:10:33 -050071 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT, CFG_SYS_PCIE1_MEM_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053072 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
73 0, 3, BOOKE_PAGESZ_1G, 1),
74
75 /* *I*G* - PCI I/O */
Tom Rini56af6592022-11-16 13:10:33 -050076 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053077 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
78 0, 4, BOOKE_PAGESZ_256K, 1),
79
80 /* Bman/Qman */
Tom Rini6a5dccc2022-11-16 13:10:41 -050081#ifdef CFG_SYS_BMAN_MEM_PHYS
82 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE, CFG_SYS_BMAN_MEM_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053083 MAS3_SX|MAS3_SW|MAS3_SR, 0,
84 0, 5, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050085 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE + 0x01000000,
86 CFG_SYS_BMAN_MEM_PHYS + 0x01000000,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053087 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
88 0, 6, BOOKE_PAGESZ_16M, 1),
89#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050090#ifdef CFG_SYS_QMAN_MEM_PHYS
91 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE, CFG_SYS_QMAN_MEM_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053092 MAS3_SX|MAS3_SW|MAS3_SR, 0,
93 0, 7, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050094 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE + 0x01000000,
95 CFG_SYS_QMAN_MEM_PHYS + 0x01000000,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +053096 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
97 0, 8, BOOKE_PAGESZ_16M, 1),
98#endif
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +053099#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500100#ifdef CFG_SYS_DCSRBAR_PHYS
101 SET_TLB_ENTRY(1, CFG_SYS_DCSRBAR, CFG_SYS_DCSRBAR_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530102 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
103 0, 9, BOOKE_PAGESZ_4M, 1),
104#endif
Tom Rinib4213492022-11-12 17:36:51 -0500105#ifdef CFG_SYS_NAND_BASE
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530106 /*
107 * *I*G - NAND
108 * entry 14 and 15 has been used hard coded, they will be disabled
109 * in cpu_init_f, so we use entry 16 for nand.
110 */
Tom Rinib4213492022-11-12 17:36:51 -0500111 SET_TLB_ENTRY(1, CFG_SYS_NAND_BASE, CFG_SYS_NAND_BASE_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530112 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
113 0, 10, BOOKE_PAGESZ_64K, 1),
114#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500115#ifdef CFG_SYS_CPLD_BASE
116 SET_TLB_ENTRY(1, CFG_SYS_CPLD_BASE, CFG_SYS_CPLD_BASE_PHYS,
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530117 MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
118 0, 11, BOOKE_PAGESZ_256K, 1),
119#endif
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +0530120
121#if defined(CONFIG_RAMBOOT_PBL) && !defined(CONFIG_SPL_BUILD)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500122 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE, CFG_SYS_DDR_SDRAM_BASE,
York Sun05204d02017-12-05 10:57:54 -0800123 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +0530124 0, 12, BOOKE_PAGESZ_1G, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -0500125 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE + 0x40000000,
126 CFG_SYS_DDR_SDRAM_BASE + 0x40000000,
York Sun05204d02017-12-05 10:57:54 -0800127 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Prabhakar Kushwahac8d8e1a2014-04-08 19:13:56 +0530128 0, 13, BOOKE_PAGESZ_1G, 1)
129#endif
Priyanka Jain8b1a60e2013-10-18 17:19:06 +0530130};
131
132int num_tlb_entries = ARRAY_SIZE(tlb_table);