xref: /rk3399_rockchip-uboot/board/freescale/mpc8572ds/tlb.c (revision 326ea986ac150acdc7656d57fca647db80b50158)
1129ba616SKumar Gala /*
2cb14e93bSKumar Gala  * Copyright 2008-2010 Freescale Semiconductor, Inc.
3129ba616SKumar Gala  *
4129ba616SKumar Gala  * (C) Copyright 2000
5129ba616SKumar Gala  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6129ba616SKumar Gala  *
7*1a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
8129ba616SKumar Gala  */
9129ba616SKumar Gala 
10129ba616SKumar Gala #include <common.h>
11129ba616SKumar Gala #include <asm/mmu.h>
12129ba616SKumar Gala 
13129ba616SKumar Gala struct fsl_e_tlb_entry tlb_table[] = {
14129ba616SKumar Gala 	/* TLB 0 - for temp stack in cache */
156d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, CONFIG_SYS_INIT_RAM_ADDR,
16129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
17129ba616SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
186d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024,
19129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
20129ba616SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
216d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024,
22129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
23129ba616SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
246d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024 , CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
25129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
26129ba616SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
27129ba616SKumar Gala 
28129ba616SKumar Gala 	/* TLB 1 */
29129ba616SKumar Gala 	/* *I*** - Covers boot page */
30129ba616SKumar Gala 	SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
31abc76eb6SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
32129ba616SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 1),
33129ba616SKumar Gala 
34129ba616SKumar Gala 	/* *I*G* - CCSRBAR */
356d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
36129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
37129ba616SKumar Gala 		      0, 1, BOOKE_PAGESZ_1M, 1),
38129ba616SKumar Gala 
39129ba616SKumar Gala 	/* W**G* - Flash/promjet, localbus */
40129ba616SKumar Gala 	/* This will be changed to *I*G* after relocation to RAM. */
41c953ddfdSKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
427c0d4a75SKumar Gala 		      MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
43129ba616SKumar Gala 		      0, 2, BOOKE_PAGESZ_256M, 1),
44129ba616SKumar Gala 
45e4382acbSKumar Gala #ifndef CONFIG_NAND_SPL
46129ba616SKumar Gala 	/* *I*G* - PCI */
475af0fdd8SKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT, CONFIG_SYS_PCIE3_MEM_PHYS,
48129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
49129ba616SKumar Gala 		      0, 3, BOOKE_PAGESZ_1G, 1),
50129ba616SKumar Gala 
51129ba616SKumar Gala 	/* *I*G* - PCI */
525af0fdd8SKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT + 0x40000000, CONFIG_SYS_PCIE3_MEM_PHYS + 0x40000000,
53129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
54129ba616SKumar Gala 		      0, 4, BOOKE_PAGESZ_256M, 1),
55129ba616SKumar Gala 
565af0fdd8SKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_MEM_VIRT + 0x50000000, CONFIG_SYS_PCIE3_MEM_PHYS + 0x50000000,
57129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
58129ba616SKumar Gala 		      0, 5, BOOKE_PAGESZ_256M, 1),
59129ba616SKumar Gala 
60129ba616SKumar Gala 	/* *I*G* - PCI I/O */
61aca5f018SKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE3_IO_VIRT, CONFIG_SYS_PCIE3_IO_PHYS,
62129ba616SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
63129ba616SKumar Gala 		      0, 6, BOOKE_PAGESZ_256K, 1),
64e4382acbSKumar Gala #endif
65c013b749SHaiying Wang 
66c013b749SHaiying Wang 	/* *I*G - NAND */
67c013b749SHaiying Wang 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
68c013b749SHaiying Wang 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
69c013b749SHaiying Wang 		      0, 7, BOOKE_PAGESZ_1M, 1),
70c013b749SHaiying Wang 
7152b565f5SKumar Gala 	SET_TLB_ENTRY(1, PIXIS_BASE, PIXIS_BASE_PHYS,
72b5f65dfaSHaiying Wang 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
73b5f65dfaSHaiying Wang 		      0, 8, BOOKE_PAGESZ_4K, 1),
74cb14e93bSKumar Gala 
75cb14e93bSKumar Gala #if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR)
76cb14e93bSKumar Gala 	/* *I*G - L2SRAM */
77cb14e93bSKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR,
78cb14e93bSKumar Gala 			CONFIG_SYS_INIT_L2_ADDR_PHYS,
79cb14e93bSKumar Gala 			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
80cb14e93bSKumar Gala 			0, 9, BOOKE_PAGESZ_256K, 1),
81cb14e93bSKumar Gala 	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR + 0x40000,
82cb14e93bSKumar Gala 			CONFIG_SYS_INIT_L2_ADDR_PHYS + 0x40000,
83cb14e93bSKumar Gala 			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
84cb14e93bSKumar Gala 			0, 10, BOOKE_PAGESZ_256K, 1),
85cb14e93bSKumar Gala #endif
86129ba616SKumar Gala };
87129ba616SKumar Gala 
88129ba616SKumar Gala int num_tlb_entries = ARRAY_SIZE(tlb_table);
89