1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#include <common.h>
26#include <watchdog.h>
27#include <command.h>
28#include <asm/cache.h>
29#include <asm/mmu.h>
30#include <mpc86xx.h>
31#include <asm/fsl_law.h>
32
33DECLARE_GLOBAL_DATA_PTR;
34
35
36
37
38static void
39__board_reset(void)
40{
41
42}
43void board_reset(void) __attribute__((weak, alias("__board_reset")));
44
45
46int
47checkcpu(void)
48{
49 sys_info_t sysinfo;
50 uint pvr, svr;
51 uint major, minor;
52 char buf1[32], buf2[32];
53 volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
54 volatile ccsr_gur_t *gur = &immap->im_gur;
55 struct cpu_type *cpu;
56 uint msscr0 = mfspr(MSSCR0);
57
58 svr = get_svr();
59 major = SVR_MAJ(svr);
60 minor = SVR_MIN(svr);
61
62 if (cpu_numcores() > 1) {
63#ifndef CONFIG_MP
64 puts("Unicore software on multiprocessor system!!\n"
65 "To enable mutlticore build define CONFIG_MP\n");
66#endif
67 }
68 puts("CPU: ");
69
70 cpu = gd->arch.cpu;
71
72 puts(cpu->name);
73
74 printf(", Version: %d.%d, (0x%08x)\n", major, minor, svr);
75 puts("Core: ");
76
77 pvr = get_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);
87
88 get_sys_info(&sysinfo);
89
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));
96
97 if (sysinfo.freqLocalBus > LCRR_CLKDIV) {
98 printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
99 } else {
100 printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
101 sysinfo.freqLocalBus);
102 }
103
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 {
116 puts("Disabled\n");
117 }
118
119 return 0;
120}
121
122
123int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
124{
125 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
126 volatile ccsr_gur_t *gur = &immap->im_gur;
127
128
129 board_reset();
130
131
132 out_be32(&gur->rstcr, MPC86xx_RSTCR_HRST_REQ);
133
134 while (1)
135 ;
136
137 return 1;
138}
139
140
141
142
143
144unsigned long
145get_tbclk(void)
146{
147 sys_info_t sys_info;
148
149 get_sys_info(&sys_info);
150 return (sys_info.freqSystemBus + 3L) / 4L;
151}
152
153
154#if defined(CONFIG_WATCHDOG)
155void
156watchdog_reset(void)
157{
158#if defined(CONFIG_MPC8610)
159
160
161
162 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
163 volatile ccsr_wdt_t *wdt = &immap->im_wdt;
164 volatile ccsr_gur_t *gur = &immap->im_gur;
165 u32 tmp = gur->pordevsr;
166
167 if (tmp & 0x4000) {
168 wdt->swsrr = 0x556c;
169 wdt->swsrr = 0xaa39;
170 }
171#endif
172}
173#endif
174
175
176
177
178
179void mpc86xx_reginfo(void)
180{
181 print_bats();
182 print_laws();
183 print_lbc_regs();
184}
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204void setup_ddr_bat(phys_addr_t dram_size)
205{
206 unsigned long batu, bl;
207
208 bl = TO_BATU_BL(min(dram_size, CONFIG_MAX_MEM_MAPPED));
209
210 if (BATU_SIZE(bl) != dram_size) {
211 u64 sz = (u64)dram_size - BATU_SIZE(bl);
212 print_size(sz, " left unmapped\n");
213 }
214
215 batu = bl | BATU_VS | BATU_VP;
216 write_bat(DBAT0, batu, CONFIG_SYS_DBAT0L);
217 write_bat(IBAT0, batu, CONFIG_SYS_IBAT0L);
218}
219