blob: 194fbd5afc74f25298eb1095102fe18fd5b45a93 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Timur Tabi9b45b5a2010-06-14 15:28:24 -05002/*
3 * Copyright 2010 Freescale Semiconductor, Inc.
4 * Authors: Srikanth Srinivasan <srikanth.srinivasan@freescale.com>
5 * Timur Tabi <timur@freescale.com>
Timur Tabi9b45b5a2010-06-14 15:28:24 -05006 */
7
8#include <common.h>
9#include <asm/mmu.h>
10
11struct fsl_e_tlb_entry tlb_table[] = {
12 /* TLB 0 - for temp stack in cache */
13 SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, CONFIG_SYS_INIT_RAM_ADDR,
14 MAS3_SX|MAS3_SW|MAS3_SR, 0,
15 0, 0, BOOKE_PAGESZ_4K, 0),
16 SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024,
17 CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024,
18 MAS3_SX|MAS3_SW|MAS3_SR, 0,
19 0, 0, BOOKE_PAGESZ_4K, 0),
20 SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024,
21 CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024,
22 MAS3_SX|MAS3_SW|MAS3_SR, 0,
23 0, 0, BOOKE_PAGESZ_4K, 0),
24 SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
25 CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
26 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 */
36 SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
37 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
38 0, 1, BOOKE_PAGESZ_1M, 1),
39
Matthew McClintockcd99caa2013-02-18 10:02:19 +000040#ifndef CONFIG_SPL_BUILD
Timur Tabi9b45b5a2010-06-14 15:28:24 -050041 /* W**G* - Flash/promjet, localbus */
42 /* This will be changed to *I*G* after relocation to RAM. */
43 SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
44 MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
45 0, 2, BOOKE_PAGESZ_256M, 1),
46
47 /* *I*G* - PCI */
48 SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT, CONFIG_SYS_PCIE3_MEM_PHYS,
49 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
50 0, 3, BOOKE_PAGESZ_1G, 1),
51
52 /* *I*G* - PCI */
53 SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT + 0x40000000,
54 CONFIG_SYS_PCIE3_MEM_PHYS + 0x40000000,
55 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
56 0, 4, BOOKE_PAGESZ_256M, 1),
57
58 SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT + 0x50000000,
59 CONFIG_SYS_PCIE3_MEM_PHYS + 0x50000000,
60 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
61 0, 5, BOOKE_PAGESZ_256M, 1),
62
63 /* *I*G* - PCI I/O */
64 SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_IO_VIRT, CONFIG_SYS_PCIE3_IO_PHYS,
65 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
66 0, 6, BOOKE_PAGESZ_256K, 1),
Matthew McClintockcd99caa2013-02-18 10:02:19 +000067#endif
Timur Tabi9b45b5a2010-06-14 15:28:24 -050068
69 SET_TLB_ENTRY(1, PIXIS_BASE, PIXIS_BASE_PHYS,
70 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
71 0, 7, BOOKE_PAGESZ_4K, 1),
Matthew McClintockc4253e92012-05-18 06:04:17 +000072
Ying Zhangdfb2b152013-08-16 15:16:12 +080073#if defined(CONFIG_SYS_RAMBOOT) || \
74 (defined(CONFIG_SPL) && !defined(CONFIG_SPL_COMMON_INIT_DDR))
Matthew McClintockcd99caa2013-02-18 10:02:19 +000075 /* **** - eSDHC/eSPI/NAND boot */
Matthew McClintockc4253e92012-05-18 06:04:17 +000076 SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
York Sun05204d02017-12-05 10:57:54 -080077 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Ying Zhangdfb2b152013-08-16 15:16:12 +080078 0, 8, BOOKE_PAGESZ_1G, 1),
Matthew McClintockcd99caa2013-02-18 10:02:19 +000079 /* **** - eSDHC/eSPI/NAND boot - second 1GB of memory */
Matthew McClintockc4253e92012-05-18 06:04:17 +000080 SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
Ying Zhangdfb2b152013-08-16 15:16:12 +080081 CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
York Sun05204d02017-12-05 10:57:54 -080082 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M,
Ying Zhangdfb2b152013-08-16 15:16:12 +080083 0, 9, BOOKE_PAGESZ_1G, 1),
Matthew McClintockc4253e92012-05-18 06:04:17 +000084#endif
Matthew McClintockcd99caa2013-02-18 10:02:19 +000085
86#ifdef CONFIG_SYS_NAND_BASE
87 /* *I*G - NAND */
88 SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
Ying Zhangdfb2b152013-08-16 15:16:12 +080089 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
90 0, 10, BOOKE_PAGESZ_16K, 1),
Matthew McClintockcd99caa2013-02-18 10:02:19 +000091#endif
92
Ying Zhangdfb2b152013-08-16 15:16:12 +080093#ifdef CONFIG_SYS_INIT_L2_ADDR
94 /* *I*G - L2SRAM */
95 SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
96 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
97 0, 11, BOOKE_PAGESZ_256K, 1)
98#endif
Timur Tabi9b45b5a2010-06-14 15:28:24 -050099};
100
101int num_tlb_entries = ARRAY_SIZE(tlb_table);