]> git.ipfire.org Git - people/ms/u-boot.git/blame - cpu/mpc86xx/cpu.c
8xxx: Removed CONFIG_NUM_CPUS from 85xx/86xx
[people/ms/u-boot.git] / cpu / mpc86xx / cpu.c
CommitLineData
debb7354 1/*
18bacc20 2 * Copyright 2006,2009 Freescale Semiconductor, Inc.
cb5965fb 3 * Jeff Brown
debb7354
JL
4 * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
5 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 * MA 02111-1307 USA
23 */
24
25#include <common.h>
26#include <watchdog.h>
27#include <command.h>
28#include <asm/cache.h>
e34a0e91 29#include <asm/mmu.h>
debb7354 30#include <mpc86xx.h>
4f93f8b1 31#include <asm/fsl_law.h>
debb7354 32
0e870980
PA
33DECLARE_GLOBAL_DATA_PTR;
34
4ef630df
PT
35/*
36 * Default board reset function
37 */
38static void
39__board_reset(void)
40{
41 /* Do nothing */
42}
f9a109b3 43void board_reset(void) __attribute__((weak, alias("__board_reset")));
4ef630df
PT
44
45
ffff3ae5
JL
46int
47checkcpu(void)
debb7354
JL
48{
49 sys_info_t sysinfo;
50 uint pvr, svr;
51 uint ver;
52 uint major, minor;
a1c8a719 53 char buf1[32], buf2[32];
6d0f6bcf 54 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
9553df86 55 volatile ccsr_gur_t *gur = &immap->im_gur;
480f6179 56 struct cpu_type *cpu;
a1c8a719 57 uint msscr0 = mfspr(MSSCR0);
debb7354
JL
58
59 svr = get_svr();
1ced1216 60 ver = SVR_SOC_VER(svr);
debb7354
JL
61 major = SVR_MAJ(svr);
62 minor = SVR_MIN(svr);
63
a1c8a719
PT
64 puts("CPU: ");
65
0e870980
PA
66 cpu = gd->cpu;
67
68 if (cpu->name)
480f6179 69 puts(cpu->name);
0e870980 70 else
debb7354 71 puts("Unknown");
480f6179 72
debb7354 73 printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
a1c8a719
PT
74 puts("Core: ");
75
76 pvr = get_pvr();
77 ver = PVR_E600_VER(pvr);
78 major = PVR_E600_MAJ(pvr);
79 minor = PVR_E600_MIN(pvr);
80
81 printf("E600 Core %d", (msscr0 & 0x20) ? 1 : 0 );
82 if (gur->pordevsr & MPC86xx_PORDEVSR_CORE1TE)
83 puts("\n Core1Translation Enabled");
84 debug(" (MSSCR0=%x, PORDEVSR=%x)", msscr0, gur->pordevsr);
85
86 printf(", Version: %d.%d, (0x%08x)\n", major, minor, pvr);
debb7354
JL
87
88 get_sys_info(&sysinfo);
89
a1c8a719
PT
90 puts("Clock Configuration:\n");
91 printf(" CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freqProcessor));
92 printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freqSystemBus));
93 printf(" DDR:%-4s MHz (%s MT/s data rate), ",
94 strmhz(buf1, sysinfo.freqSystemBus / 2),
95 strmhz(buf2, sysinfo.freqSystemBus));
5c9efb36 96
ada591d2 97 if (sysinfo.freqLocalBus > LCRR_CLKDIV) {
a1c8a719 98 printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
debb7354 99 } else {
a9f3acbc 100 printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
ada591d2 101 sysinfo.freqLocalBus);
debb7354
JL
102 }
103
a1c8a719
PT
104 puts("L1: D-cache 32 KB enabled\n");
105 puts(" I-cache 32 KB enabled\n");
106
107 puts("L2: ");
108 if (get_l2cr() & 0x80000000) {
109#if defined(CONFIG_MPC8610)
110 puts("256");
111#elif defined(CONFIG_MPC8641)
112 puts("512");
113#endif
114 puts(" KB enabled\n");
115 } else {
cb5965fb 116 puts("Disabled\n");
a1c8a719 117 }
5c9efb36
JL
118
119 return 0;
debb7354
JL
120}
121
122
debb7354 123void
126aa70f 124do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
debb7354 125{
4ef630df
PT
126 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
127 volatile ccsr_gur_t *gur = &immap->im_gur;
5c9efb36 128
4ef630df
PT
129 /* Attempt board-specific reset */
130 board_reset();
5c9efb36 131
4ef630df
PT
132 /* Next try asserting HRESET_REQ */
133 out_be32(&gur->rstcr, MPC86xx_RSTCR_HRST_REQ);
5c9efb36 134
4ef630df
PT
135 while (1)
136 ;
debb7354
JL
137}
138
139
debb7354
JL
140/*
141 * Get timebase clock frequency
142 */
ffff3ae5
JL
143unsigned long
144get_tbclk(void)
debb7354 145{
ffff3ae5 146 sys_info_t sys_info;
debb7354
JL
147
148 get_sys_info(&sys_info);
5c9efb36 149 return (sys_info.freqSystemBus + 3L) / 4L;
debb7354
JL
150}
151
debb7354
JL
152
153#if defined(CONFIG_WATCHDOG)
154void
155watchdog_reset(void)
156{
3473ab73
JJ
157#if defined(CONFIG_MPC8610)
158 /*
159 * This actually feed the hard enabled watchdog.
160 */
6d0f6bcf 161 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
3473ab73
JJ
162 volatile ccsr_wdt_t *wdt = &immap->im_wdt;
163 volatile ccsr_gur_t *gur = &immap->im_gur;
164 u32 tmp = gur->pordevsr;
165
166 if (tmp & 0x4000) {
167 wdt->swsrr = 0x556c;
168 wdt->swsrr = 0xaa39;
169 }
170#endif
debb7354
JL
171}
172#endif /* CONFIG_WATCHDOG */
173
4f93f8b1
BB
174/*
175 * Print out the state of various machine registers.
e34a0e91 176 * Currently prints out LAWs, BR0/OR0, and BATs
4f93f8b1
BB
177 */
178void mpc86xx_reginfo(void)
179{
6d0f6bcf 180 immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
4f93f8b1
BB
181 ccsr_lbc_t *lbc = &immap->im_lbc;
182
e34a0e91 183 print_bats();
4f93f8b1
BB
184 print_laws();
185
186 printf ("Local Bus Controller Registers\n"
187 "\tBR0\t0x%08X\tOR0\t0x%08X \n", in_be32(&lbc->br0), in_be32(&lbc->or0));
188 printf("\tBR1\t0x%08X\tOR1\t0x%08X \n", in_be32(&lbc->br1), in_be32(&lbc->or1));
189 printf("\tBR2\t0x%08X\tOR2\t0x%08X \n", in_be32(&lbc->br2), in_be32(&lbc->or2));
190 printf("\tBR3\t0x%08X\tOR3\t0x%08X \n", in_be32(&lbc->br3), in_be32(&lbc->or3));
191 printf("\tBR4\t0x%08X\tOR4\t0x%08X \n", in_be32(&lbc->br4), in_be32(&lbc->or4));
192 printf("\tBR5\t0x%08X\tOR5\t0x%08X \n", in_be32(&lbc->br5), in_be32(&lbc->or5));
193 printf("\tBR6\t0x%08X\tOR6\t0x%08X \n", in_be32(&lbc->br6), in_be32(&lbc->or6));
194 printf("\tBR7\t0x%08X\tOR7\t0x%08X \n", in_be32(&lbc->br7), in_be32(&lbc->or7));
debb7354
JL
195
196}