]>
git.ipfire.org Git - people/ms/u-boot.git/blob - cpu/mpc8260/cpu.c
2 * (C) Copyright 2000-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * CPU specific code for the MPC825x / MPC826x / MPC827x / MPC828x
27 * written or collected and sometimes rewritten by
28 * Magnus Damm <damm@bitsmart.com>
31 * Wolfgang Denk <wd@denx.de>
33 * modified for 8260 by
34 * Murray Jensen <Murray.Jensen@cmst.csiro.au>
37 * Marius Groeger <mag@sysgo.de>
39 * added HiP7 (8270/8275/8280) processors support by
40 * Yuli Barcohen <yuli@arabellasw.com>
47 #include <asm/processor.h>
48 #include <asm/cpm_8260.h>
52 DECLARE_GLOBAL_DATA_PTR
;
54 volatile immap_t
*immap
= (immap_t
*) CFG_IMMR
;
55 ulong clock
= gd
->cpu_clk
;
56 uint pvr
= get_pvr ();
75 return -1; /* whoops! not an MPC8260 */
79 immr
= immap
->im_memctl
.memc_immr
;
80 if ((immr
& IMMR_ISB_MSK
) != CFG_IMMR
)
81 return -1; /* whoops! someone moved the IMMR */
83 printf (CPU_ID_STR
" (HiP%d Rev %02x, Mask ", k
, rev
);
86 * the bottom 16 bits of the immr are the Part Number and Mask Number
87 * (4-34); the 16 bits at PROFF_REVNUM (0x8af0) in dual port ram is the
88 * RISC Microcode Revision Number (13-10).
89 * For the 8260, Motorola doesn't include the Microcode Revision
92 m
= immr
& (IMMR_PARTNUM_MSK
| IMMR_MASKNUM_MSK
);
93 k
= *((ushort
*) & immap
->im_dprambase
[PROFF_REVNUM
]);
103 puts ("A.1 1K22A-XC");
109 puts ("B.2 2K23A-XC");
118 puts ("A.0(A) 2K25A");
133 printf ("unknown [immr=0x%04x,k=0x%04x]", m
, k
);
137 printf (") at %s MHz\n", strmhz (buf
, clock
));
142 /* ------------------------------------------------------------------------- */
143 /* configures a UPM by writing into the UPM RAM array */
144 /* uses bank 11 and a dummy physical address (=BRx_BA_MSK) */
145 /* NOTE: the physical address chosen must not overlap into any other area */
146 /* mapped by the memory controller because bank 11 has the lowest priority */
148 void upmconfig (uint upm
, uint
* table
, uint size
)
150 volatile immap_t
*immap
= (immap_t
*) CFG_IMMR
;
151 volatile memctl8260_t
*memctl
= &immap
->im_memctl
;
152 volatile uchar
*dummy
= (uchar
*) BRx_BA_MSK
; /* set all BA bits */
155 /* first set up bank 11 to reference the correct UPM at a dummy address */
157 memctl
->memc_or11
= ORxU_AM_MSK
; /* set all AM bits */
163 ((uint
)dummy
& BRx_BA_MSK
) | BRx_PS_32
| BRx_MS_UPMA
|
165 memctl
->memc_mamr
= MxMR_OP_WARR
;
170 ((uint
)dummy
& BRx_BA_MSK
) | BRx_PS_32
| BRx_MS_UPMB
|
172 memctl
->memc_mbmr
= MxMR_OP_WARR
;
177 ((uint
)dummy
& BRx_BA_MSK
) | BRx_PS_32
| BRx_MS_UPMC
|
179 memctl
->memc_mcmr
= MxMR_OP_WARR
;
183 panic ("upmconfig passed invalid UPM number (%u)\n", upm
);
189 * at this point, the dummy address is set up to access the selected UPM,
190 * the MAD pointer is zero, and the MxMR OP is set for writing to RAM
192 * now we simply load the mdr with each word and poke the dummy address.
193 * the MAD is incremented on each access.
196 for (i
= 0; i
< size
; i
++) {
197 memctl
->memc_mdr
= table
[i
];
201 /* now kill bank 11 */
202 memctl
->memc_br11
= 0;
205 /* ------------------------------------------------------------------------- */
208 do_reset (cmd_tbl_t
* cmdtp
, int flag
, int argc
, char *argv
[])
212 volatile immap_t
*immap
= (immap_t
*) CFG_IMMR
;
214 immap
->im_clkrst
.car_rmr
= RMR_CSRE
; /* Checkstop Reset enable */
216 /* Interrupts and MMU off */
217 __asm__
__volatile__ ("mfmsr %0":"=r" (msr
):);
219 msr
&= ~(MSR_ME
| MSR_EE
| MSR_IR
| MSR_DR
);
220 __asm__
__volatile__ ("mtmsr %0"::"r" (msr
));
223 * Trying to execute the next instruction at a non-existing address
224 * should cause a machine check, resulting in reset
226 #ifdef CFG_RESET_ADDRESS
227 addr
= CFG_RESET_ADDRESS
;
230 * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE
231 * - sizeof (ulong) is usually a valid address. Better pick an address
232 * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
234 addr
= CFG_MONITOR_BASE
- sizeof (ulong
);
236 ((void (*)(void)) addr
) ();
241 /* ------------------------------------------------------------------------- */
244 * Get timebase clock frequency (like cpu_clk in Hz)
247 unsigned long get_tbclk (void)
249 DECLARE_GLOBAL_DATA_PTR
;
253 tbclk
= (gd
->bus_clk
+ 3L) / 4L;
258 /* ------------------------------------------------------------------------- */
260 #if defined(CONFIG_WATCHDOG)
261 void watchdog_reset (void)
263 int re_enable
= disable_interrupts ();
265 reset_8260_watchdog ((immap_t
*) CFG_IMMR
);
267 enable_interrupts ();
269 #endif /* CONFIG_WATCHDOG */
271 /* ------------------------------------------------------------------------- */