]>
git.ipfire.org Git - people/ms/u-boot.git/blob - cpu/mpc85xx/cpu_init.c
2 * (C) Copyright 2003 Motorola Inc.
3 * Modified by Xianghua Xiao, X.Xiao@motorola.com
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <asm/processor.h>
33 DECLARE_GLOBAL_DATA_PTR
;
36 static void config_8560_ioports (volatile immap_t
* immr
)
40 for (portnum
= 0; portnum
< 4; portnum
++) {
47 iop_conf_t
*iopc
= (iop_conf_t
*) & iop_conf_tab
[portnum
][0];
48 iop_conf_t
*eiopc
= iopc
+ 32;
53 * index 0 refers to pin 31,
54 * index 31 refers to pin 0
56 while (iopc
< eiopc
) {
76 volatile ioport_t
*iop
= ioport_addr (immr
, portnum
);
80 * the (somewhat confused) paragraph at the
81 * bottom of page 35-5 warns that there might
82 * be "unknown behaviour" when programming
83 * PSORx and PDIRx, if PPARx = 1, so I
84 * decided this meant I had to disable the
85 * dedicated function first, and enable it
89 iop
->psor
= (iop
->psor
& tpmsk
) | psor
;
90 iop
->podr
= (iop
->podr
& tpmsk
) | podr
;
91 iop
->pdat
= (iop
->pdat
& tpmsk
) | pdat
;
92 iop
->pdir
= (iop
->pdir
& tpmsk
) | pdir
;
100 * Breathe some life into the CPU...
102 * Set up the memory map
103 * initialize a bunch of registers
106 void cpu_init_f (void)
108 volatile immap_t
*immap
= (immap_t
*)CFG_IMMR
;
109 volatile ccsr_lbc_t
*memctl
= &immap
->im_lbc
;
110 extern void m8560_cpm_reset (void);
112 /* Pointer is writable since we allocated a register for it */
113 gd
= (gd_t
*) (CFG_INIT_RAM_ADDR
+ CFG_GBL_DATA_OFFSET
);
115 /* Clear initial global data */
116 memset ((void *) gd
, 0, sizeof (gd_t
));
120 config_8560_ioports(immap
);
123 /* Map banks 0 and 1 to the FLASH banks 0 and 1 at preliminary
124 * addresses - these have to be modified later when FLASH size
125 * has been determined
127 #if defined(CFG_OR0_REMAP)
128 memctl
->or0
= CFG_OR0_REMAP
;
130 #if defined(CFG_OR1_REMAP)
131 memctl
->or1
= CFG_OR1_REMAP
;
134 /* now restrict to preliminary range */
135 #if defined(CFG_BR0_PRELIM) && defined(CFG_OR0_PRELIM)
136 memctl
->br0
= CFG_BR0_PRELIM
;
137 memctl
->or0
= CFG_OR0_PRELIM
;
140 #if defined(CFG_BR1_PRELIM) && defined(CFG_OR1_PRELIM)
141 memctl
->or1
= CFG_OR1_PRELIM
;
142 memctl
->br1
= CFG_BR1_PRELIM
;
145 #if !defined(CONFIG_MPC85xx)
146 #if defined(CFG_BR2_PRELIM) && defined(CFG_OR2_PRELIM)
147 memctl
->or2
= CFG_OR2_PRELIM
;
148 memctl
->br2
= CFG_BR2_PRELIM
;
152 #if defined(CFG_BR3_PRELIM) && defined(CFG_OR3_PRELIM)
153 memctl
->or3
= CFG_OR3_PRELIM
;
154 memctl
->br3
= CFG_BR3_PRELIM
;
157 #if defined(CFG_BR4_PRELIM) && defined(CFG_OR4_PRELIM)
158 memctl
->or4
= CFG_OR4_PRELIM
;
159 memctl
->br4
= CFG_BR4_PRELIM
;
162 #if defined(CFG_BR5_PRELIM) && defined(CFG_OR5_PRELIM)
163 memctl
->or5
= CFG_OR5_PRELIM
;
164 memctl
->br5
= CFG_BR5_PRELIM
;
167 #if defined(CFG_BR6_PRELIM) && defined(CFG_OR6_PRELIM)
168 memctl
->or6
= CFG_OR6_PRELIM
;
169 memctl
->br6
= CFG_BR6_PRELIM
;
172 #if defined(CFG_BR7_PRELIM) && defined(CFG_OR7_PRELIM)
173 memctl
->or7
= CFG_OR7_PRELIM
;
174 memctl
->br7
= CFG_BR7_PRELIM
;
177 #if defined(CONFIG_CPM2)
184 * Initialize L2 as cache.
186 * The newer 8548, etc, parts have twice as much cache, but
187 * use the same bit-encoding as the older 8555, etc, parts.
189 * FIXME: Use PVR_VER(pvr) == 1 test here instead of SVR_VER()?
194 #if defined(CONFIG_L2_CACHE)
195 volatile immap_t
*immap
= (immap_t
*)CFG_IMMR
;
196 volatile ccsr_l2cache_t
*l2cache
= &immap
->im_l2cache
;
197 volatile uint cache_ctl
;
204 cache_ctl
= l2cache
->l2ctl
;
206 switch (cache_ctl
& 0x30000000) {
208 if (ver
== SVR_8548
|| ver
== SVR_8548_E
) {
209 printf ("L2 cache 512KB:");
211 printf ("L2 cache 256KB:");
218 printf ("L2 cache unknown size (0x%08x)\n", cache_ctl
);
223 l2cache
->l2ctl
= 0x68000000; /* invalidate */
224 cache_ctl
= l2cache
->l2ctl
;
227 l2cache
->l2ctl
= 0xa8000000; /* enable 256KB L2 cache */
228 cache_ctl
= l2cache
->l2ctl
;
231 printf(" enabled\n");
233 printf("L2 cache: disabled\n");