xref: /openbmc/u-boot/board/freescale/p1010rdb/tlb.c (revision 1a459660)
149249e13SPoonam Aggrwal /*
249249e13SPoonam Aggrwal  * Copyright 2010-2011 Freescale Semiconductor, Inc.
349249e13SPoonam Aggrwal  *
4*1a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
549249e13SPoonam Aggrwal  */
649249e13SPoonam Aggrwal 
749249e13SPoonam Aggrwal #include <common.h>
849249e13SPoonam Aggrwal #include <asm/mmu.h>
949249e13SPoonam Aggrwal 
1049249e13SPoonam Aggrwal struct fsl_e_tlb_entry tlb_table[] = {
1149249e13SPoonam Aggrwal 	/* TLB 0 - for temp stack in cache */
1249249e13SPoonam Aggrwal 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR, CONFIG_SYS_INIT_RAM_ADDR,
1349249e13SPoonam Aggrwal 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
1449249e13SPoonam Aggrwal 			0, 0, BOOKE_PAGESZ_4K, 0),
1549249e13SPoonam Aggrwal 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024 ,
1649249e13SPoonam Aggrwal 			CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024,
1749249e13SPoonam Aggrwal 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
1849249e13SPoonam Aggrwal 			0, 0, BOOKE_PAGESZ_4K, 0),
1949249e13SPoonam Aggrwal 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024 ,
2049249e13SPoonam Aggrwal 			CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024,
2149249e13SPoonam Aggrwal 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
2249249e13SPoonam Aggrwal 			0, 0, BOOKE_PAGESZ_4K, 0),
2349249e13SPoonam Aggrwal 	SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024 ,
2449249e13SPoonam Aggrwal 			CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
2549249e13SPoonam Aggrwal 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
2649249e13SPoonam Aggrwal 			0, 0, BOOKE_PAGESZ_4K, 0),
2749249e13SPoonam Aggrwal 
2849249e13SPoonam Aggrwal 	/* TLB 1 */
2949249e13SPoonam Aggrwal 	/* *I*** - Covers boot page */
30f64bd7c0SPrabhakar Kushwaha 	SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
31f64bd7c0SPrabhakar Kushwaha 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
32f64bd7c0SPrabhakar Kushwaha 		      0, 0, BOOKE_PAGESZ_4K, 1),
33f64bd7c0SPrabhakar Kushwaha #ifdef CONFIG_SPL_NAND_MINIMAL
340fa934d2SPrabhakar Kushwaha 	SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
3549249e13SPoonam Aggrwal 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
36f64bd7c0SPrabhakar Kushwaha 		      0, 10, BOOKE_PAGESZ_4K, 1),
37f64bd7c0SPrabhakar Kushwaha #endif
3849249e13SPoonam Aggrwal 
3949249e13SPoonam Aggrwal 	/* *I*G* - CCSRBAR */
4049249e13SPoonam Aggrwal 	SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
4149249e13SPoonam Aggrwal 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
4249249e13SPoonam Aggrwal 			0, 1, BOOKE_PAGESZ_1M, 1),
4349249e13SPoonam Aggrwal 
440fa934d2SPrabhakar Kushwaha #ifndef CONFIG_SPL_BUILD
4549249e13SPoonam Aggrwal #ifndef CONFIG_SDCARD
4649249e13SPoonam Aggrwal 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
4749249e13SPoonam Aggrwal 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
4849249e13SPoonam Aggrwal 			0, 2, BOOKE_PAGESZ_16M, 1),
4949249e13SPoonam Aggrwal 
5049249e13SPoonam Aggrwal 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE + 0x1000000,
5149249e13SPoonam Aggrwal 			CONFIG_SYS_FLASH_BASE_PHYS + 0x1000000,
5249249e13SPoonam Aggrwal 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
5349249e13SPoonam Aggrwal 			0, 3, BOOKE_PAGESZ_16M, 1),
5449249e13SPoonam Aggrwal #endif
5549249e13SPoonam Aggrwal 
56505c293fSPrabhakar Kushwaha #ifdef CONFIG_PCI
5749249e13SPoonam Aggrwal 	/* *I*G* - PCI */
5849249e13SPoonam Aggrwal 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS,
5949249e13SPoonam Aggrwal 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
6049249e13SPoonam Aggrwal 			0, 4, BOOKE_PAGESZ_1G, 1),
6149249e13SPoonam Aggrwal 
6249249e13SPoonam Aggrwal 	/* *I*G* - PCI I/O */
6349249e13SPoonam Aggrwal 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_IO_VIRT, CONFIG_SYS_PCIE1_IO_PHYS,
6449249e13SPoonam Aggrwal 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
6549249e13SPoonam Aggrwal 			0, 5, BOOKE_PAGESZ_256K, 1),
6649249e13SPoonam Aggrwal #endif
6749249e13SPoonam Aggrwal #endif
6849249e13SPoonam Aggrwal 
6949249e13SPoonam Aggrwal #ifndef CONFIG_SDCARD
7049249e13SPoonam Aggrwal 	/* *I*G - Board CPLD  */
7149249e13SPoonam Aggrwal 	SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
7249249e13SPoonam Aggrwal 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
7349249e13SPoonam Aggrwal 			0, 6, BOOKE_PAGESZ_256K, 1),
7449249e13SPoonam Aggrwal 
7549249e13SPoonam Aggrwal 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
7649249e13SPoonam Aggrwal 			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
7749249e13SPoonam Aggrwal 			0, 7, BOOKE_PAGESZ_1M, 1),
7849249e13SPoonam Aggrwal #endif
7949249e13SPoonam Aggrwal 
800fa934d2SPrabhakar Kushwaha #if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SPL)
8149249e13SPoonam Aggrwal 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
8249249e13SPoonam Aggrwal 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
8349249e13SPoonam Aggrwal 			0, 8, BOOKE_PAGESZ_1G, 1)
8449249e13SPoonam Aggrwal #endif
8549249e13SPoonam Aggrwal };
8649249e13SPoonam Aggrwal 
8749249e13SPoonam Aggrwal int num_tlb_entries = ARRAY_SIZE(tlb_table);
88