blob: ae0b7adbe544474f8ae752af10b1105b3621e5a6 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Li Yang5f999732011-07-26 09:50:46 -05002/*
3 * Copyright 2010-2011 Freescale Semiconductor, Inc.
Li Yang5f999732011-07-26 09:50:46 -05004 */
5
Tom Rinidec7ea02024-05-20 13:35:03 -06006#include <config.h>
Li Yang5f999732011-07-26 09:50:46 -05007#include <asm/mmu.h>
Tom Rinidec7ea02024-05-20 13:35:03 -06008#include <asm/ppc.h>
Li Yang5f999732011-07-26 09:50:46 -05009
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,
Li Yang5f999732011-07-26 09:50:46 -050014 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,
Li Yang5f999732011-07-26 09:50:46 -050018 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,
Li Yang5f999732011-07-26 09:50:46 -050022 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,
Li Yang5f999732011-07-26 09:50:46 -050026 MAS3_SX|MAS3_SW|MAS3_SR, 0,
27 0, 0, BOOKE_PAGESZ_4K, 0),
28
29 /* TLB 1 */
30 /* *I*** - Covers boot page */
31 SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
32 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I,
33 0, 0, BOOKE_PAGESZ_4K, 1),
34
35 /* *I*G* - CCSRBAR */
Tom Rini6a5dccc2022-11-16 13:10:41 -050036 SET_TLB_ENTRY(1, CFG_SYS_CCSRBAR, CFG_SYS_CCSRBAR_PHYS,
Li Yang5f999732011-07-26 09:50:46 -050037 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
38 0, 1, BOOKE_PAGESZ_1M, 1),
39
Scott Woodc4f0d002012-09-20 19:05:12 -050040#ifndef CONFIG_SPL_BUILD
Li Yang5f999732011-07-26 09:50:46 -050041 /* W**G* - Flash/promjet, localbus */
42 /* This will be changed to *I*G* after relocation to RAM. */
Tom Rini6a5dccc2022-11-16 13:10:41 -050043 SET_TLB_ENTRY(1, CFG_SYS_FLASH_BASE, CFG_SYS_FLASH_BASE_PHYS,
Li Yang5f999732011-07-26 09:50:46 -050044 MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
45 0, 2, BOOKE_PAGESZ_64M, 1),
46
47#ifdef CONFIG_PCI
48 /* *I*G* - PCI memory 1.5G */
Tom Rini56af6592022-11-16 13:10:33 -050049 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_MEM_VIRT, CFG_SYS_PCIE1_MEM_PHYS,
Li Yang5f999732011-07-26 09:50:46 -050050 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
51 0, 3, BOOKE_PAGESZ_1G, 1),
52
53 /* *I*G* - PCI I/O effective: 192K */
Tom Rini56af6592022-11-16 13:10:33 -050054 SET_TLB_ENTRY(1, CFG_SYS_PCIE1_IO_VIRT, CFG_SYS_PCIE1_IO_PHYS,
Li Yang5f999732011-07-26 09:50:46 -050055 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
56 0, 4, BOOKE_PAGESZ_256K, 1),
57#endif
58
59#ifdef CONFIG_VSC7385_ENET
60 /* *I*G - VSC7385 Switch */
Tom Rini6a5dccc2022-11-16 13:10:41 -050061 SET_TLB_ENTRY(1, CFG_SYS_VSC7385_BASE, CFG_SYS_VSC7385_BASE_PHYS,
Li Yang5f999732011-07-26 09:50:46 -050062 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
63 0, 5, BOOKE_PAGESZ_1M, 1),
64#endif
Pali Rohárfecba2e2022-08-01 15:31:43 +020065#endif /* not SPL */
Li Yang5f999732011-07-26 09:50:46 -050066
Tom Rini6a5dccc2022-11-16 13:10:41 -050067 SET_TLB_ENTRY(1, CFG_SYS_CPLD_BASE, CFG_SYS_CPLD_BASE_PHYS,
Li Yang5f999732011-07-26 09:50:46 -050068 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
69 0, 6, BOOKE_PAGESZ_1M, 1),
Li Yang5f999732011-07-26 09:50:46 -050070
Tom Rinib4213492022-11-12 17:36:51 -050071#ifdef CFG_SYS_NAND_BASE
Li Yang5f999732011-07-26 09:50:46 -050072 /* *I*G - NAND */
Tom Rinib4213492022-11-12 17:36:51 -050073 SET_TLB_ENTRY(1, CFG_SYS_NAND_BASE, CFG_SYS_NAND_BASE_PHYS,
Li Yang5f999732011-07-26 09:50:46 -050074 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
75 0, 7, BOOKE_PAGESZ_1M, 1),
76#endif
77
Tom Rinif8f6b322022-05-21 14:44:28 -040078#if defined(CONFIG_SYS_RAMBOOT) || !CONFIG_IS_ENABLED(COMMON_INIT_DDR)
Pali Rohárcca58282022-04-07 12:16:18 +020079 /* **M** - 1G DDR for eSDHC/eSPI/NAND boot */
Tom Rini6a5dccc2022-11-16 13:10:41 -050080 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE, CFG_SYS_DDR_SDRAM_BASE,
York Sun05204d02017-12-05 10:57:54 -080081 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Li Yang5f999732011-07-26 09:50:46 -050082 0, 8, BOOKE_PAGESZ_1G, 1),
83
Priyanka Jainb1d24412020-09-21 11:56:39 +053084#if defined(CONFIG_TARGET_P1020RDB_PD)
Pali Rohárcca58282022-04-07 12:16:18 +020085 /* **M** - 2G DDR on P1020MBG, map the second 1G */
Tom Rini6a5dccc2022-11-16 13:10:41 -050086 SET_TLB_ENTRY(1, CFG_SYS_DDR_SDRAM_BASE + 0x40000000,
87 CFG_SYS_DDR_SDRAM_BASE + 0x40000000,
Pali Rohárcca58282022-04-07 12:16:18 +020088 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Li Yang5f999732011-07-26 09:50:46 -050089 0, 9, BOOKE_PAGESZ_1G, 1),
Priyanka Jainb1d24412020-09-21 11:56:39 +053090#endif
Scott Wood03fedda2012-10-12 18:02:24 -050091#endif /* RAMBOOT/SPL */
Ying Zhang28027d72013-09-06 17:30:56 +080092
Tom Rini6a5dccc2022-11-16 13:10:41 -050093#ifdef CFG_SYS_INIT_L2_ADDR
Pali Rohárc2b77f82022-07-27 17:21:28 +020094 /* ***G - L2SRAM */
Tom Rini6a5dccc2022-11-16 13:10:41 -050095 SET_TLB_ENTRY(1, CFG_SYS_INIT_L2_ADDR, CFG_SYS_INIT_L2_ADDR_PHYS,
Ying Zhang28027d72013-09-06 17:30:56 +080096 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
Ying Zhangb8b404d2013-09-06 17:30:58 +080097 0, 11, BOOKE_PAGESZ_256K, 1),
98#if CONFIG_SYS_L2_SIZE >= (256 << 10)
Tom Rini6a5dccc2022-11-16 13:10:41 -050099 SET_TLB_ENTRY(1, CFG_SYS_INIT_L2_ADDR + 0x40000,
100 CFG_SYS_INIT_L2_ADDR_PHYS + 0x40000,
Pali Rohárc2b77f82022-07-27 17:21:28 +0200101 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
Ying Zhangb8b404d2013-09-06 17:30:58 +0800102 0, 12, BOOKE_PAGESZ_256K, 1)
103#endif
Ying Zhang28027d72013-09-06 17:30:56 +0800104#endif
Li Yang5f999732011-07-26 09:50:46 -0500105};
106
107int num_tlb_entries = ARRAY_SIZE(tlb_table);