1*0db37dc2SKumar Gala /*
2*0db37dc2SKumar Gala  * Copyright 2008 Freescale Semiconductor, Inc.
3*0db37dc2SKumar Gala  *
4*0db37dc2SKumar Gala  * (C) Copyright 2000
5*0db37dc2SKumar Gala  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6*0db37dc2SKumar Gala  *
7*0db37dc2SKumar Gala  * See file CREDITS for list of people who contributed to this
8*0db37dc2SKumar Gala  * project.
9*0db37dc2SKumar Gala  *
10*0db37dc2SKumar Gala  * This program is free software; you can redistribute it and/or
11*0db37dc2SKumar Gala  * modify it under the terms of the GNU General Public License as
12*0db37dc2SKumar Gala  * published by the Free Software Foundation; either version 2 of
13*0db37dc2SKumar Gala  * the License, or (at your option) any later version.
14*0db37dc2SKumar Gala  *
15*0db37dc2SKumar Gala  * This program is distributed in the hope that it will be useful,
16*0db37dc2SKumar Gala  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*0db37dc2SKumar Gala  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*0db37dc2SKumar Gala  * GNU General Public License for more details.
19*0db37dc2SKumar Gala  *
20*0db37dc2SKumar Gala  * You should have received a copy of the GNU General Public License
21*0db37dc2SKumar Gala  * along with this program; if not, write to the Free Software
22*0db37dc2SKumar Gala  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23*0db37dc2SKumar Gala  * MA 02111-1307 USA
24*0db37dc2SKumar Gala  */
25*0db37dc2SKumar Gala 
26*0db37dc2SKumar Gala #include <common.h>
27*0db37dc2SKumar Gala #include <asm/mmu.h>
28*0db37dc2SKumar Gala 
29*0db37dc2SKumar Gala struct fsl_e_tlb_entry tlb_table[] = {
30*0db37dc2SKumar Gala 	/* TLB 0 - for temp stack in cache */
31*0db37dc2SKumar Gala 	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR,
32*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
33*0db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
34*0db37dc2SKumar Gala 	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024,
35*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
36*0db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
37*0db37dc2SKumar Gala 	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024,
38*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
39*0db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
40*0db37dc2SKumar Gala 	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024,
41*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
42*0db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_4K, 0),
43*0db37dc2SKumar Gala 
44*0db37dc2SKumar Gala 	/*
45*0db37dc2SKumar Gala 	 * TLB 0:	16M	Non-cacheable, guarded
46*0db37dc2SKumar Gala 	 * 0xff000000	16M	FLASH
47*0db37dc2SKumar Gala 	 * Out of reset this entry is only 4K.
48*0db37dc2SKumar Gala 	 */
49*0db37dc2SKumar Gala 	SET_TLB_ENTRY(1, CFG_BOOT_BLOCK, CFG_BOOT_BLOCK,
50*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
51*0db37dc2SKumar Gala 		      0, 0, BOOKE_PAGESZ_16M, 1),
52*0db37dc2SKumar Gala 
53*0db37dc2SKumar Gala 	/*
54*0db37dc2SKumar Gala 	 * TLB 1:	1G	Non-cacheable, guarded
55*0db37dc2SKumar Gala 	 * 0x80000000	1G	PCI1/PCIE  8,9,a,b
56*0db37dc2SKumar Gala 	 */
57*0db37dc2SKumar Gala 	SET_TLB_ENTRY(1, CFG_PCI_PHYS, CFG_PCI_PHYS,
58*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
59*0db37dc2SKumar Gala 		      0, 1, BOOKE_PAGESZ_1G, 1),
60*0db37dc2SKumar Gala 
61*0db37dc2SKumar Gala #ifdef CFG_RIO_MEM_PHYS
62*0db37dc2SKumar Gala 	/*
63*0db37dc2SKumar Gala 	 * TLB 2:	256M	Non-cacheable, guarded
64*0db37dc2SKumar Gala 	 */
65*0db37dc2SKumar Gala 	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE,
66*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
67*0db37dc2SKumar Gala 		      0, 2, BOOKE_PAGESZ_256M, 1),
68*0db37dc2SKumar Gala 
69*0db37dc2SKumar Gala 	/*
70*0db37dc2SKumar Gala 	 * TLB 3:	256M	Non-cacheable, guarded
71*0db37dc2SKumar Gala 	 */
72*0db37dc2SKumar Gala 	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000,
73*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
74*0db37dc2SKumar Gala 		      0, 3, BOOKE_PAGESZ_256M, 1),
75*0db37dc2SKumar Gala #endif
76*0db37dc2SKumar Gala 	/*
77*0db37dc2SKumar Gala 	 * TLB 5:	64M	Non-cacheable, guarded
78*0db37dc2SKumar Gala 	 * 0xe000_0000	1M	CCSRBAR
79*0db37dc2SKumar Gala 	 * 0xe200_0000	1M	PCI1 IO
80*0db37dc2SKumar Gala 	 * 0xe210_0000	1M	PCI2 IO
81*0db37dc2SKumar Gala 	 * 0xe300_0000	1M	PCIe IO
82*0db37dc2SKumar Gala 	 */
83*0db37dc2SKumar Gala 	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR,
84*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
85*0db37dc2SKumar Gala 		      0, 5, BOOKE_PAGESZ_64M, 1),
86*0db37dc2SKumar Gala 
87*0db37dc2SKumar Gala 	/*
88*0db37dc2SKumar Gala 	 * TLB 6:	64M	Cacheable, non-guarded
89*0db37dc2SKumar Gala 	 * 0xf000_0000	64M	LBC SDRAM
90*0db37dc2SKumar Gala 	 */
91*0db37dc2SKumar Gala 	SET_TLB_ENTRY(1, CFG_LBC_CACHE_BASE, CFG_LBC_CACHE_BASE,
92*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
93*0db37dc2SKumar Gala 		      0, 6, BOOKE_PAGESZ_64M, 1),
94*0db37dc2SKumar Gala 
95*0db37dc2SKumar Gala 	/*
96*0db37dc2SKumar Gala 	 * TLB 7:	64M	Non-cacheable, guarded
97*0db37dc2SKumar Gala 	 * 0xf8000000	64M	CADMUS registers, relocated L2SRAM
98*0db37dc2SKumar Gala 	 */
99*0db37dc2SKumar Gala 	SET_TLB_ENTRY(1, CFG_LBC_NONCACHE_BASE, CFG_LBC_NONCACHE_BASE,
100*0db37dc2SKumar Gala 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
101*0db37dc2SKumar Gala 		      0, 7, BOOKE_PAGESZ_64M, 1),
102*0db37dc2SKumar Gala };
103*0db37dc2SKumar Gala 
104*0db37dc2SKumar Gala int num_tlb_entries = ARRAY_SIZE(tlb_table);
105