blob: 008bd6e72b7b73d129db8a3684104ea105a2d798 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Shengzhou Liu49912402014-11-24 17:11:56 +08002/*
3 * Copyright 2014 Freescale Semiconductor, Inc.
Shengzhou Liu49912402014-11-24 17:11:56 +08004 */
5
Tom Riniaf026762024-04-30 20:41:48 -06006#include <config.h>
Shengzhou Liu49912402014-11-24 17:11:56 +08007#include <asm/mmu.h>
Tom Riniaf026762024-04-30 20:41:48 -06008#include <asm/ppc.h>
Shengzhou Liu49912402014-11-24 17:11:56 +08009
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,
Shengzhou Liu49912402014-11-24 17:11:56 +080014 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,
Shengzhou Liu49912402014-11-24 17:11:56 +080018 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,
Shengzhou Liu49912402014-11-24 17:11:56 +080022 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,
Shengzhou Liu49912402014-11-24 17:11:56 +080026 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)
Shengzhou Liu49912402014-11-24 17:11:56 +080032 /*
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,
Shengzhou Liu49912402014-11-24 17:11:56 +080037 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
38 0, 0, BOOKE_PAGESZ_256K, 1),
39#else
40 SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
41 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
42 0, 0, BOOKE_PAGESZ_4K, 1),
43#endif
44
45 /* *I*G* - CCSRBAR */
Tom Rini6a5dccc2022-11-16 13:10:41 -050046 SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080047 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
48 0, 1, BOOKE_PAGESZ_16M, 1),
49
50 /* *I*G* - Flash, localbus */
51 /* This will be changed to *I*G* after relocation to RAM. */
Tom Rini6a5dccc2022-11-16 13:10:41 -050052 SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080053 MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
54 0, 2, BOOKE_PAGESZ_256M, 1),
55
56#ifndef CONFIG_SPL_BUILD
57 /* *I*G* - PCI */
Tom Rini56af6592022-11-16 13:10:33 -050058 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT, CFG_SYS_PCIE1_MEM_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080059 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
60 0, 3, BOOKE_PAGESZ_1G, 1),
61
62 /* *I*G* - PCI I/O */
Tom Rini56af6592022-11-16 13:10:33 -050063 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080064 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
65 0, 4, BOOKE_PAGESZ_256K, 1),
66
67 /* Bman/Qman */
Tom Rini6a5dccc2022-11-16 13:10:41 -050068#ifdef CFG_SYS_BMAN_MEM_PHYS
69 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE, CFG_SYS_BMAN_MEM_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080070 MAS3_SX|MAS3_SW|MAS3_SR, 0,
71 0, 5, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050072 SET_TLB_ENTRY(1, CFG_SYS_BMAN_MEM_BASE + 0x01000000,
73 CFG_SYS_BMAN_MEM_PHYS + 0x01000000,
Shengzhou Liu49912402014-11-24 17:11:56 +080074 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
75 0, 6, BOOKE_PAGESZ_16M, 1),
76#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050077#ifdef CFG_SYS_QMAN_MEM_PHYS
78 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE, CFG_SYS_QMAN_MEM_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080079 MAS3_SX|MAS3_SW|MAS3_SR, 0,
80 0, 7, BOOKE_PAGESZ_16M, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -050081 SET_TLB_ENTRY(1, CFG_SYS_QMAN_MEM_BASE + 0x01000000,
82 CFG_SYS_QMAN_MEM_PHYS + 0x01000000,
Shengzhou Liu49912402014-11-24 17:11:56 +080083 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
84 0, 8, BOOKE_PAGESZ_16M, 1),
85#endif
86#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050087#ifdef CFG_SYS_DCSRBAR_PHYS
88 SET_TLB_ENTRY(1, CFG_SYS_DCSRBAR, CFG_SYS_DCSRBAR_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080089 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
90 0, 9, BOOKE_PAGESZ_4M, 1),
91#endif
Tom Rinib4213492022-11-12 17:36:51 -050092#ifdef CFG_SYS_NAND_BASE
93 SET_TLB_ENTRY(1, CFG_SYS_NAND_BASE, CFG_SYS_NAND_BASE_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080094 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
95 0, 10, BOOKE_PAGESZ_64K, 1),
96#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050097#ifdef CFG_SYS_CPLD_BASE
98 SET_TLB_ENTRY(1, CFG_SYS_CPLD_BASE, CFG_SYS_CPLD_BASE_PHYS,
Shengzhou Liu49912402014-11-24 17:11:56 +080099 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
100 0, 11, BOOKE_PAGESZ_256K, 1),
101#endif
102
103#if defined(CONFIG_RAMBOOT_PBL) && !defined(CONFIG_SPL_BUILD)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500104 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE, CFG_SYS_DDR_SDRAM_BASE,
York Sun05204d02017-12-05 10:57:54 -0800105 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Shengzhou Liu49912402014-11-24 17:11:56 +0800106 0, 12, BOOKE_PAGESZ_1G, 1),
Tom Rini6a5dccc2022-11-16 13:10:41 -0500107 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE + 0x40000000,
108 CFG_SYS_DDR_SDRAM_BASE + 0x40000000,
York Sun05204d02017-12-05 10:57:54 -0800109 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Shengzhou Liu49912402014-11-24 17:11:56 +0800110 0, 13, BOOKE_PAGESZ_1G, 1)
111#endif
112 /* entry 14 and 15 has been used hard coded, they will be disabled
113 * in cpu_init_f, so if needed more, will use entry 16 later.
114 */
115};
116
117int num_tlb_entries = ARRAY_SIZE(tlb_table);