blob: 3918176a1e2d2bd476ad006126c6975b68eee59c [file] [log] [blame]
Jon Loeliger25d83d72007-04-11 16:51:02 -05001/*
2 * Copyright 2007 Freescale Semiconductor, Inc.
3 *
4 * See file CREDITS for list of people who contributed to this
5 * project.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23#include <ppc_asm.tmpl>
24#include <ppc_defs.h>
25#include <asm/cache.h>
26#include <asm/mmu.h>
27#include <config.h>
28#include <mpc85xx.h>
29
Jon Loeliger25d83d72007-04-11 16:51:02 -050030/*
31 * TLB0 and TLB1 Entries
32 *
33 * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR.
34 * However, CCSRBAR is then relocated to CFG_CCSRBAR right after
35 * these TLB entries are established.
36 *
37 * The TLB entries for DDR are dynamically setup in spd_sdram()
38 * and use TLB1 Entries 8 through 15 as needed according to the
39 * size of DDR memory.
40 *
41 * MAS0: tlbsel, esel, nv
42 * MAS1: valid, iprot, tid, ts, tsize
Kumar Gala2146cf52007-12-19 01:18:15 -060043 * MAS2: epn, x0, x1, w, i, m, g, e
Jon Loeliger25d83d72007-04-11 16:51:02 -050044 * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr
45 */
46
47#define entry_start \
Ed Swarthout837f1ba2007-07-27 01:50:51 -050048 mflr r1 ; \
49 bl 0f ;
Jon Loeliger25d83d72007-04-11 16:51:02 -050050
51#define entry_end \
520: mflr r0 ; \
53 mtlr r1 ; \
54 blr ;
55
56
57 .section .bootpg, "ax"
58 .globl tlb1_entry
59tlb1_entry:
60 entry_start
61
62 /*
63 * Number of TLB0 and TLB1 entries in the following table
64 */
65 .long (2f-1f)/16
661:
67 /*
68 * TLB0 4K Non-cacheable, guarded
69 * 0xff700000 4K Initial CCSRBAR mapping
70 *
71 * This ends up at a TLB0 Index==0 entry, and must not collide
72 * with other TLB0 Entries.
73 */
Kumar Gala2146cf52007-12-19 01:18:15 -060074 .long FSL_BOOKE_MAS0(0, 0, 0)
75 .long FSL_BOOKE_MAS1(1, 0, 0, 0, 0)
76 .long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G))
77 .long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -050078
79 /*
80 * TLB0 16K Cacheable, guarded
81 * Temporary Global data for initialization
82 *
83 * Use four 4K TLB0 entries. These entries must be cacheable
84 * as they provide the bootstrap memory before the memory
85 * controler and real memory have been configured.
86 *
87 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c,
88 * and must not collide with other TLB0 entries.
89 */
Kumar Gala2146cf52007-12-19 01:18:15 -060090 .long FSL_BOOKE_MAS0(0, 0, 0)
91 .long FSL_BOOKE_MAS1(1, 0, 0, 0, 0)
92 .long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, (MAS2_G))
93 .long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -050094
Kumar Gala2146cf52007-12-19 01:18:15 -060095 .long FSL_BOOKE_MAS0(0, 0, 0)
96 .long FSL_BOOKE_MAS1(1, 0, 0, 0, 0)
97 .long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, (MAS2_G))
98 .long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -050099
Kumar Gala2146cf52007-12-19 01:18:15 -0600100 .long FSL_BOOKE_MAS0(0, 0, 0)
101 .long FSL_BOOKE_MAS1(1, 0, 0, 0, 0)
102 .long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, (MAS2_G))
103 .long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -0500104
Kumar Gala2146cf52007-12-19 01:18:15 -0600105 .long FSL_BOOKE_MAS0(0, 0, 0)
106 .long FSL_BOOKE_MAS1(1, 0, 0, 0, 0)
107 .long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, (MAS2_G))
108 .long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -0500109
110
111 /*
112 * TLB 0: 64M Non-cacheable, guarded
113 * 0xfc000000 64M Covers FLASH at 0xFE800000 and 0xFF800000
114 * Out of reset this entry is only 4K.
115 */
Kumar Gala2146cf52007-12-19 01:18:15 -0600116 .long FSL_BOOKE_MAS0(1, 0, 0)
117 .long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M)
118 .long FSL_BOOKE_MAS2(CFG_BOOT_BLOCK, (MAS2_I|MAS2_G))
119 .long FSL_BOOKE_MAS3(CFG_BOOT_BLOCK, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -0500120
121 /*
122 * TLB 1: 1G Non-cacheable, guarded
123 * 0x80000000 1G PCIE 8,9,a,b
124 */
Kumar Gala2146cf52007-12-19 01:18:15 -0600125 .long FSL_BOOKE_MAS0(1, 1, 0)
126 .long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_1G)
127 .long FSL_BOOKE_MAS2(CFG_PCIE_PHYS, (MAS2_I|MAS2_G))
128 .long FSL_BOOKE_MAS3(CFG_PCIE_PHYS, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -0500129
130 /*
131 * TLB 2: 256M Non-cacheable, guarded
132 */
Kumar Gala2146cf52007-12-19 01:18:15 -0600133 .long FSL_BOOKE_MAS0(1, 2, 0)
134 .long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M)
135 .long FSL_BOOKE_MAS2(CFG_PCI_PHYS, (MAS2_I|MAS2_G))
136 .long FSL_BOOKE_MAS3(CFG_PCI_PHYS, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -0500137
138 /*
139 * TLB 3: 256M Non-cacheable, guarded
140 */
Kumar Gala2146cf52007-12-19 01:18:15 -0600141 .long FSL_BOOKE_MAS0(1, 3, 0)
142 .long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M)
143 .long FSL_BOOKE_MAS2(CFG_PCI_PHYS + 0x10000000, (MAS2_I|MAS2_G))
144 .long FSL_BOOKE_MAS3(CFG_PCI_PHYS + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -0500145
146 /*
147 * TLB 4: 64M Non-cacheable, guarded
148 * 0xe000_0000 1M CCSRBAR
149 * 0xe100_0000 255M PCI IO range
150 */
Kumar Gala2146cf52007-12-19 01:18:15 -0600151 .long FSL_BOOKE_MAS0(1, 4, 0)
152 .long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M)
153 .long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G))
154 .long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -0500155
156#ifdef CFG_LBC_CACHE_BASE
157 /*
158 * TLB 5: 64M Cacheable, non-guarded
159 */
Kumar Gala2146cf52007-12-19 01:18:15 -0600160 .long FSL_BOOKE_MAS0(1, 5, 0)
161 .long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M)
162 .long FSL_BOOKE_MAS2(CFG_LBC_CACHE_BASE, 0)
163 .long FSL_BOOKE_MAS3(CFG_LBC_CACHE_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -0500164#endif
165 /*
166 * TLB 6: 64M Non-cacheable, guarded
167 * 0xf8000000 64M PIXIS 0xF8000000 - 0xFBFFFFFF
168 */
Kumar Gala2146cf52007-12-19 01:18:15 -0600169 .long FSL_BOOKE_MAS0(1, 6, 0)
170 .long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M)
171 .long FSL_BOOKE_MAS2(CFG_LBC_NONCACHE_BASE, (MAS2_I|MAS2_G))
172 .long FSL_BOOKE_MAS3(CFG_LBC_NONCACHE_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR))
Jon Loeliger25d83d72007-04-11 16:51:02 -05001732:
174 entry_end