blob: 17871d2a1bf57474d06427fd53e4bb32e7ab3bca [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
2 * (C) Copyright 2001
3 * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
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.
12 *
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.
17 *
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,
21 * MA 02111-1307 USA
22 *
23 */
24
25#include <common.h>
26#include <command.h>
27#include <video_fb.h>
28#include "common_util.h"
29#include <asm/processor.h>
wdenk1fe2c702003-03-06 21:55:29 +000030#include <asm/byteorder.h>
wdenkc6097192002-11-03 00:24:07 +000031#include <i2c.h>
32#include <devices.h>
33#include <pci.h>
wdenk4ea537d2003-12-07 18:32:37 +000034#include <malloc.h>
35#include <bzlib.h>
wdenkc6097192002-11-03 00:24:07 +000036
wdenk7d076412003-05-23 11:38:58 +000037#ifdef CONFIG_PIP405
38#include "../pip405/pip405.h"
39#include <405gp_pci.h>
40#endif
41#ifdef CONFIG_MIP405
42#include "../mip405/mip405.h"
43#include <405gp_pci.h>
44#endif
45
wdenk4ea537d2003-12-07 18:32:37 +000046extern int gunzip(void *, int, uchar *, int *);
47extern int mem_test(ulong start, ulong ramsize, int quiet);
wdenkc6097192002-11-03 00:24:07 +000048
wdenk4ea537d2003-12-07 18:32:37 +000049#define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */
50#define IMAGE_SIZE CFG_MONITOR_LEN /* ugly, but it works for now */
wdenkc6097192002-11-03 00:24:07 +000051
52extern flash_info_t flash_info[]; /* info for FLASH chips */
53
wdenk1fe2c702003-03-06 21:55:29 +000054static image_header_t header;
wdenkc6097192002-11-03 00:24:07 +000055
56
wdenk4ea537d2003-12-07 18:32:37 +000057static int
58mpl_prg(uchar *src, ulong size)
wdenkc6097192002-11-03 00:24:07 +000059{
wdenk4ea537d2003-12-07 18:32:37 +000060 ulong start;
wdenkc6097192002-11-03 00:24:07 +000061 flash_info_t *info;
wdenk4ea537d2003-12-07 18:32:37 +000062 int i, rc;
wdenk6b58f332003-03-14 20:47:52 +000063#if defined(CONFIG_PIP405) || defined(CONFIG_MIP405)
wdenke39c2842003-06-04 15:05:30 +000064 char *copystr = (char *)src;
wdenk4ea537d2003-12-07 18:32:37 +000065 ulong *magic = (ulong *)src;
wdenk6b58f332003-03-14 20:47:52 +000066#endif
wdenkc6097192002-11-03 00:24:07 +000067
68 info = &flash_info[0];
wdenk1fe2c702003-03-06 21:55:29 +000069
70#if defined(CONFIG_PIP405) || defined(CONFIG_MIP405)
wdenk4ea537d2003-12-07 18:32:37 +000071 if (ntohl(magic[0]) != IH_MAGIC) {
72 puts("Bad Magic number\n");
wdenk1fe2c702003-03-06 21:55:29 +000073 return -1;
74 }
wdenke39c2842003-06-04 15:05:30 +000075 /* some more checks before we delete the Flash... */
76 /* Checking the ISO_STRING prevents to program a
77 * wrong Firmware Image into the flash.
78 */
wdenk4ea537d2003-12-07 18:32:37 +000079 i = 4; /* skip Magic number */
80 while (1) {
81 if (strncmp(&copystr[i], "MEV-", 4) == 0)
wdenke39c2842003-06-04 15:05:30 +000082 break;
wdenk4ea537d2003-12-07 18:32:37 +000083 if (i++ >= 0x100) {
84 puts("Firmware Image for unknown Target\n");
wdenke39c2842003-06-04 15:05:30 +000085 return -1;
86 }
87 }
88 /* we have the ISO STRING, check */
wdenk4ea537d2003-12-07 18:32:37 +000089 if (strncmp(&copystr[i], CONFIG_ISO_STRING, sizeof(CONFIG_ISO_STRING)-1) != 0) {
90 printf("Wrong Firmware Image: %s\n", &copystr[i]);
wdenke39c2842003-06-04 15:05:30 +000091 return -1;
92 }
93 start = 0 - size;
wdenk4ea537d2003-12-07 18:32:37 +000094 for (i = info->sector_count-1; i > 0; i--) {
wdenkc6097192002-11-03 00:24:07 +000095 info->protect[i] = 0; /* unprotect this sector */
wdenk4ea537d2003-12-07 18:32:37 +000096 if (start >= info->start[i])
97 break;
wdenkc6097192002-11-03 00:24:07 +000098 }
99 /* set-up flash location */
100 /* now erase flash */
wdenkc6097192002-11-03 00:24:07 +0000101 printf("Erasing at %lx (sector %d) (start %lx)\n",
102 start,i,info->start[i]);
wdenk4ea537d2003-12-07 18:32:37 +0000103 if ((rc = flash_erase (info, i, info->sector_count-1)) != 0) {
104 puts("ERROR ");
105 flash_perror(rc);
106 return (1);
107 }
108
wdenk1fe2c702003-03-06 21:55:29 +0000109
110#elif defined(CONFIG_VCMA9)
111 start = 0;
wdenk4ea537d2003-12-07 18:32:37 +0000112 for (i = 0; i <info->sector_count; i++) {
wdenk1fe2c702003-03-06 21:55:29 +0000113 info->protect[i] = 0; /* unprotect this sector */
114 if (size < info->start[i])
115 break;
116 }
117 /* set-up flash location */
118 /* now erase flash */
119 printf("Erasing at %lx (sector %d) (start %lx)\n",
120 start,0,info->start[0]);
wdenk4ea537d2003-12-07 18:32:37 +0000121 if ((rc = flash_erase (info, 0, i)) != 0) {
122 puts("ERROR ");
123 flash_perror(rc);
124 return (1);
125 }
wdenk1fe2c702003-03-06 21:55:29 +0000126
127#endif
wdenkc6097192002-11-03 00:24:07 +0000128 printf("flash erased, programming from 0x%lx 0x%lx Bytes\n",src,size);
wdenk4ea537d2003-12-07 18:32:37 +0000129 if ((rc = flash_write (src, start, size)) != 0) {
130 puts("ERROR ");
131 flash_perror(rc);
wdenkc6097192002-11-03 00:24:07 +0000132 return (1);
133 }
wdenk4ea537d2003-12-07 18:32:37 +0000134 puts("OK programming done\n");
wdenkc6097192002-11-03 00:24:07 +0000135 return 0;
136}
137
138
wdenk4ea537d2003-12-07 18:32:37 +0000139static int
140mpl_prg_image(uchar *ld_addr)
wdenkc6097192002-11-03 00:24:07 +0000141{
wdenk4ea537d2003-12-07 18:32:37 +0000142 unsigned long len, checksum;
143 uchar *data;
144 image_header_t *hdr = &header;
145 int rc;
146
wdenkc6097192002-11-03 00:24:07 +0000147 /* Copy header so we can blank CRC field for re-calculation */
148 memcpy (&header, (char *)ld_addr, sizeof(image_header_t));
wdenk1fe2c702003-03-06 21:55:29 +0000149 if (ntohl(hdr->ih_magic) != IH_MAGIC) {
wdenk4ea537d2003-12-07 18:32:37 +0000150 puts("Bad Magic Number\n");
wdenkc6097192002-11-03 00:24:07 +0000151 return 1;
152 }
153 print_image_hdr(hdr);
154 if (hdr->ih_os != IH_OS_U_BOOT) {
wdenk4ea537d2003-12-07 18:32:37 +0000155 puts("No U-Boot Image\n");
wdenkc6097192002-11-03 00:24:07 +0000156 return 1;
157 }
158 if (hdr->ih_type != IH_TYPE_FIRMWARE) {
wdenk4ea537d2003-12-07 18:32:37 +0000159 puts("No Firmware Image\n");
wdenkc6097192002-11-03 00:24:07 +0000160 return 1;
161 }
wdenk4ea537d2003-12-07 18:32:37 +0000162 data = (uchar *)&header;
wdenkc6097192002-11-03 00:24:07 +0000163 len = sizeof(image_header_t);
wdenk1fe2c702003-03-06 21:55:29 +0000164 checksum = ntohl(hdr->ih_hcrc);
wdenkc6097192002-11-03 00:24:07 +0000165 hdr->ih_hcrc = 0;
166 if (crc32 (0, (char *)data, len) != checksum) {
wdenk4ea537d2003-12-07 18:32:37 +0000167 puts("Bad Header Checksum\n");
wdenkc6097192002-11-03 00:24:07 +0000168 return 1;
169 }
170 data = ld_addr + sizeof(image_header_t);
wdenk1fe2c702003-03-06 21:55:29 +0000171 len = ntohl(hdr->ih_size);
wdenk4ea537d2003-12-07 18:32:37 +0000172 puts("Verifying Checksum ... ");
wdenk1fe2c702003-03-06 21:55:29 +0000173 if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
wdenk4ea537d2003-12-07 18:32:37 +0000174 puts("Bad Data CRC\n");
wdenkc6097192002-11-03 00:24:07 +0000175 return 1;
176 }
wdenk4ea537d2003-12-07 18:32:37 +0000177 puts("OK\n");
178
179 if (hdr->ih_comp != IH_COMP_NONE) {
180 uchar *buf;
181 /* reserve space for uncompressed image */
182 if ((buf = malloc(IMAGE_SIZE)) == NULL) {
183 puts("Insufficient space for decompression\n");
wdenkc6097192002-11-03 00:24:07 +0000184 return 1;
185 }
wdenk4ea537d2003-12-07 18:32:37 +0000186
187 switch (hdr->ih_comp) {
188 case IH_COMP_GZIP:
189 puts("Uncompressing (GZIP) ... ");
190 rc = gunzip ((void *)(buf), IMAGE_SIZE, data, (int *)&len);
191 if (rc != 0) {
192 puts("GUNZIP ERROR\n");
193 free(buf);
194 return 1;
195 }
196 puts("OK\n");
197 break;
198#if CONFIG_BZIP2
199 case IH_COMP_BZIP2:
200 puts("Uncompressing (BZIP2) ... ");
201 {
202 uint retlen = IMAGE_SIZE;
203 rc = BZ2_bzBuffToBuffDecompress ((char *)(buf), &retlen,
204 (char *)data, len, 0, 0);
205 len = retlen;
206 }
207 if (rc != BZ_OK) {
208 printf ("BUNZIP2 ERROR: %d\n", rc);
209 free(buf);
210 return 1;
211 }
212 puts("OK\n");
213 break;
214#endif
215 default:
216 printf ("Unimplemented compression type %d\n", hdr->ih_comp);
217 free(buf);
218 return 1;
219 }
220
221 rc = mpl_prg(buf, len);
222 free(buf);
223 } else {
224 rc = mpl_prg(data, len);
wdenkc6097192002-11-03 00:24:07 +0000225 }
wdenk4ea537d2003-12-07 18:32:37 +0000226
227 return(rc);
wdenkc6097192002-11-03 00:24:07 +0000228}
229
230
231void get_backup_values(backup_t *buf)
232{
233 i2c_read(CFG_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,2,(void *)buf,sizeof(backup_t));
234}
235
236void set_backup_values(int overwrite)
237{
238 backup_t back;
239 int i;
240
241 get_backup_values(&back);
242 if(!overwrite) {
243 if(strncmp(back.signature,"MPL\0",4)==0) {
wdenk4ea537d2003-12-07 18:32:37 +0000244 puts("Not possible to write Backup\n");
wdenkc6097192002-11-03 00:24:07 +0000245 return;
246 }
247 }
248 memcpy(back.signature,"MPL\0",4);
wdenk1fe2c702003-03-06 21:55:29 +0000249 i = getenv_r("serial#",back.serial_name,16);
250 if(i < 0) {
wdenk4ea537d2003-12-07 18:32:37 +0000251 puts("Not possible to write Backup\n");
wdenkc6097192002-11-03 00:24:07 +0000252 return;
253 }
254 back.serial_name[16]=0;
wdenk1fe2c702003-03-06 21:55:29 +0000255 i = getenv_r("ethaddr",back.eth_addr,20);
256 if(i < 0) {
wdenk4ea537d2003-12-07 18:32:37 +0000257 puts("Not possible to write Backup\n");
wdenkc6097192002-11-03 00:24:07 +0000258 return;
259 }
260 back.eth_addr[20]=0;
261 i2c_write(CFG_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,2,(void *)&back,sizeof(backup_t));
262}
263
264void clear_env_values(void)
265{
266 backup_t back;
267 unsigned char env_crc[4];
268
269 memset(&back,0xff,sizeof(backup_t));
270 memset(env_crc,0x00,4);
271 i2c_write(CFG_DEF_EEPROM_ADDR,I2C_BACKUP_ADDR,2,(void *)&back,sizeof(backup_t));
272 i2c_write(CFG_DEF_EEPROM_ADDR,CFG_ENV_OFFSET,2,(void *)env_crc,4);
273}
274
275/*
276 * check crc of "older" environment
277 */
278int check_env_old_size(ulong oldsize)
279{
280 ulong crc, len, new;
281 unsigned off;
282 uchar buf[64];
283
284 /* read old CRC */
285 eeprom_read (CFG_DEF_EEPROM_ADDR,
286 CFG_ENV_OFFSET,
287 (uchar *)&crc, sizeof(ulong));
288
289 new = 0;
290 len = oldsize;
291 off = sizeof(long);
292 len = oldsize-off;
293 while (len > 0) {
294 int n = (len > sizeof(buf)) ? sizeof(buf) : len;
295
296 eeprom_read (CFG_DEF_EEPROM_ADDR, CFG_ENV_OFFSET+off, buf, n);
297 new = crc32 (new, buf, n);
298 len -= n;
299 off += n;
300 }
301
302 return (crc == new);
303}
304
305static ulong oldsizes[] = {
306 0x200,
307 0x800,
308 0
309};
310
311void copy_old_env(ulong size)
312{
313 uchar name_buf[64];
314 uchar value_buf[0x800];
315 uchar c;
316 ulong len;
317 unsigned off;
318 uchar *name, *value;
319
320 name=&name_buf[0];
321 value=&value_buf[0];
322 len=size;
323 off = sizeof(long);
324 while (len > off) {
325 eeprom_read (CFG_DEF_EEPROM_ADDR, CFG_ENV_OFFSET+off, &c, 1);
326 if(c != '=') {
327 *name++=c;
328 off++;
329 }
330 else {
331 *name++='\0';
332 off++;
333 do {
334 eeprom_read (CFG_DEF_EEPROM_ADDR, CFG_ENV_OFFSET+off, &c, 1);
335 *value++=c;
336 off++;
337 if(c == '\0')
338 break;
339 } while(len > off);
340 name=&name_buf[0];
341 value=&value_buf[0];
342 if(strncmp(name,"baudrate",8)!=0) {
343 setenv(name,value);
344 }
345
346 }
347 }
348}
349
350
351void check_env(void)
352{
353 unsigned char *s;
354 int i=0;
355 char buf[32];
356 backup_t back;
357
358 s=getenv("serial#");
359 if(!s) {
360 while(oldsizes[i]) {
361 if(check_env_old_size(oldsizes[i]))
362 break;
363 i++;
364 }
365 if(!oldsizes[i]) {
366 /* no old environment has been found */
367 get_backup_values (&back);
368 if (strncmp (back.signature, "MPL\0", 4) == 0) {
369 sprintf (buf, "%s", back.serial_name);
370 setenv ("serial#", buf);
371 sprintf (buf, "%s", back.eth_addr);
372 setenv ("ethaddr", buf);
373 printf ("INFO: serial# and ethaddr recovered, use saveenv\n");
374 return;
375 }
376 }
377 else {
378 copy_old_env(oldsizes[i]);
wdenk4ea537d2003-12-07 18:32:37 +0000379 puts("INFO: old environment ajusted, use saveenv\n");
wdenkc6097192002-11-03 00:24:07 +0000380 }
381 }
382 else {
383 /* check if back up is set */
384 get_backup_values(&back);
385 if(strncmp(back.signature,"MPL\0",4)!=0) {
386 set_backup_values(0);
387 }
388 }
389}
390
391
wdenkc6097192002-11-03 00:24:07 +0000392extern device_t *stdio_devices[];
393extern char *stdio_names[];
394
395void show_stdio_dev(void)
396{
wdenkcc1e2562003-03-06 13:39:27 +0000397 /* Print information */
wdenk4ea537d2003-12-07 18:32:37 +0000398 puts("In: ");
wdenkc6097192002-11-03 00:24:07 +0000399 if (stdio_devices[stdin] == NULL) {
wdenk4ea537d2003-12-07 18:32:37 +0000400 puts("No input devices available!\n");
wdenkc6097192002-11-03 00:24:07 +0000401 } else {
402 printf ("%s\n", stdio_devices[stdin]->name);
403 }
404
wdenk4ea537d2003-12-07 18:32:37 +0000405 puts("Out: ");
wdenkc6097192002-11-03 00:24:07 +0000406 if (stdio_devices[stdout] == NULL) {
wdenk4ea537d2003-12-07 18:32:37 +0000407 puts("No output devices available!\n");
wdenkc6097192002-11-03 00:24:07 +0000408 } else {
409 printf ("%s\n", stdio_devices[stdout]->name);
410 }
411
wdenk4ea537d2003-12-07 18:32:37 +0000412 puts("Err: ");
wdenkc6097192002-11-03 00:24:07 +0000413 if (stdio_devices[stderr] == NULL) {
wdenk4ea537d2003-12-07 18:32:37 +0000414 puts("No error devices available!\n");
wdenkc6097192002-11-03 00:24:07 +0000415 } else {
416 printf ("%s\n", stdio_devices[stderr]->name);
417 }
418}
419
wdenkc6097192002-11-03 00:24:07 +0000420
421int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
422{
423 ulong size,src,ld_addr;
424 int result;
425 backup_t back;
wdenkc6097192002-11-03 00:24:07 +0000426 src = MULTI_PURPOSE_SOCKET_ADDR;
427 size = IMAGE_SIZE;
428
429 if (strcmp(argv[1], "flash") == 0)
430 {
wdenkc6097192002-11-03 00:24:07 +0000431#if (CONFIG_COMMANDS & CFG_CMD_FDC)
432 if (strcmp(argv[2], "floppy") == 0) {
433 char *local_args[3];
434 extern int do_fdcboot (cmd_tbl_t *, int, int, char *[]);
wdenk4ea537d2003-12-07 18:32:37 +0000435 puts("\nupdating bootloader image from floppy\n");
wdenkc6097192002-11-03 00:24:07 +0000436 local_args[0] = argv[0];
437 if(argc==4) {
438 local_args[1] = argv[3];
439 local_args[2] = NULL;
440 ld_addr=simple_strtoul(argv[3], NULL, 16);
441 result=do_fdcboot(cmdtp, 0, 2, local_args);
442 }
443 else {
444 local_args[1] = NULL;
445 ld_addr=CFG_LOAD_ADDR;
446 result=do_fdcboot(cmdtp, 0, 1, local_args);
447 }
448 result=mpl_prg_image(ld_addr);
wdenkc6097192002-11-03 00:24:07 +0000449 return result;
450 }
451#endif /* (CONFIG_COMMANDS & CFG_CMD_FDC) */
452 if (strcmp(argv[2], "mem") == 0) {
453 if(argc==4) {
454 ld_addr=simple_strtoul(argv[3], NULL, 16);
455 }
456 else {
457 ld_addr=load_addr;
458 }
459 printf ("\nupdating bootloader image from memory at %lX\n",ld_addr);
wdenk4ea537d2003-12-07 18:32:37 +0000460 result=mpl_prg_image((uchar *)ld_addr);
wdenkc6097192002-11-03 00:24:07 +0000461 return result;
462 }
463 if (strcmp(argv[2], "mps") == 0) {
wdenk4ea537d2003-12-07 18:32:37 +0000464 puts("\nupdating bootloader image from MPS\n");
465 result=mpl_prg((uchar *)src,size);
wdenkc6097192002-11-03 00:24:07 +0000466 return result;
467 }
wdenkc6097192002-11-03 00:24:07 +0000468 }
469 if (strcmp(argv[1], "mem") == 0)
470 {
471 result=0;
472 if(argc==3)
473 {
474 result = (int)simple_strtol(argv[2], NULL, 16);
475 }
476 src=(unsigned long)&result;
477 src-=CFG_MEMTEST_START;
478 src-=(100*1024); /* - 100k */
479 src&=0xfff00000;
480 size=0;
481 do {
482 size++;
483 printf("\n\nPass %ld\n",size);
484 mem_test(CFG_MEMTEST_START,src,1);
485 if(ctrlc())
486 break;
487 if(result>0)
488 result--;
489
490 }while(result);
491 return 0;
492 }
493 if (strcmp(argv[1], "clearenvvalues") == 0)
494 {
495 if (strcmp(argv[2], "yes") == 0)
496 {
497 clear_env_values();
498 return 0;
499 }
500 }
501 if (strcmp(argv[1], "getback") == 0) {
502 get_backup_values(&back);
503 back.signature[3]=0;
504 back.serial_name[16]=0;
505 back.eth_addr[20]=0;
506 printf("GetBackUp: signature: %s\n",back.signature);
507 printf(" serial#: %s\n",back.serial_name);
508 printf(" ethaddr: %s\n",back.eth_addr);
509 return 0;
510 }
511 if (strcmp(argv[1], "setback") == 0) {
512 set_backup_values(1);
513 return 0;
514 }
515 printf("Usage:\n%s\n", cmdtp->usage);
516 return 1;
517}
518
519
520#if (CONFIG_COMMANDS & CFG_CMD_DOC)
521extern void doc_probe(ulong physadr);
522void doc_init (void)
523{
524 doc_probe(MULTI_PURPOSE_SOCKET_ADDR);
525}
526#endif
527
528
529#ifdef CONFIG_VIDEO
530/******************************************************
531 * Routines to display the Board information
532 * to the screen (since the VGA will be initialized as last,
533 * we must resend the infos)
534 */
535
536#ifdef CONFIG_CONSOLE_EXTRA_INFO
537extern GraphicDevice ctfb;
wdenk2c9b05d2003-09-10 22:30:53 +0000538extern int get_boot_mode(void);
wdenkc6097192002-11-03 00:24:07 +0000539
540void video_get_info_str (int line_number, char *info)
541{
542 /* init video info strings for graphic console */
543 DECLARE_GLOBAL_DATA_PTR;
544 PPC405_SYS_INFO sys_info;
545 char rev;
wdenk7d076412003-05-23 11:38:58 +0000546 int i,boot;
wdenkc6097192002-11-03 00:24:07 +0000547 unsigned long pvr;
548 char buf[64];
549 char tmp[16];
wdenk7d076412003-05-23 11:38:58 +0000550 char cpustr[16];
551 unsigned char *s, *e, bc;
wdenkc6097192002-11-03 00:24:07 +0000552 switch (line_number)
553 {
554 case 2:
555 /* CPU and board infos */
556 pvr=get_pvr();
557 get_sys_info (&sys_info);
558 switch (pvr) {
559 case PVR_405GP_RB: rev='B'; break;
560 case PVR_405GP_RC: rev='C'; break;
561 case PVR_405GP_RD: rev='D'; break;
562 case PVR_405GP_RE: rev='E'; break;
wdenk7d076412003-05-23 11:38:58 +0000563 case PVR_405GPR_RB: rev='B'; break;
wdenkc6097192002-11-03 00:24:07 +0000564 default: rev='?'; break;
565 }
wdenk7d076412003-05-23 11:38:58 +0000566 if(pvr==PVR_405GPR_RB)
567 sprintf(cpustr,"PPC405GPr %c",rev);
568 else
569 sprintf(cpustr,"PPC405GP %c",rev);
wdenkc6097192002-11-03 00:24:07 +0000570 /* Board info */
571 i=0;
572 s=getenv ("serial#");
573#ifdef CONFIG_PIP405
574 if (!s || strncmp (s, "PIP405", 6)) {
575 sprintf(buf,"### No HW ID - assuming PIP405");
576 }
577#endif
578#ifdef CONFIG_MIP405
579 if (!s || strncmp (s, "MIP405", 6)) {
580 sprintf(buf,"### No HW ID - assuming MIP405");
581 }
582#endif
583 else {
584 for (e = s; *e; ++e) {
585 if (*e == ' ')
586 break;
587 }
588 for (; s < e; ++s) {
589 if (*s == '_') {
590 ++s;
591 break;
592 }
593 buf[i++]=*s;
594 }
595 sprintf(&buf[i]," SN ");
596 i+=4;
597 for (; s < e; ++s) {
598 buf[i++]=*s;
599 }
600 buf[i++]=0;
601 }
wdenk7d076412003-05-23 11:38:58 +0000602 sprintf (info," %s %s %s MHz (%lu/%lu/%lu MHz)",
603 buf, cpustr,
wdenkc6097192002-11-03 00:24:07 +0000604 strmhz (tmp, gd->cpu_clk), sys_info.freqPLB / 1000000,
605 sys_info.freqPLB / sys_info.pllOpbDiv / 1000000,
606 sys_info.freqPLB / sys_info.pllExtBusDiv / 1000000);
607 return;
608 case 3:
609 /* Memory Info */
wdenk7d076412003-05-23 11:38:58 +0000610 boot = get_boot_mode();
wdenkc6097192002-11-03 00:24:07 +0000611 bc = in8 (CONFIG_PORT_ADDR);
612 sprintf(info, " %luMB RAM, %luMB Flash Cfg 0x%02X %s %s",
613 gd->bd->bi_memsize / 0x100000,
614 gd->bd->bi_flashsize / 0x100000,
615 bc,
wdenk7d076412003-05-23 11:38:58 +0000616 (boot & BOOT_MPS) ? "MPS boot" : "Flash boot",
wdenkc6097192002-11-03 00:24:07 +0000617 ctfb.modeIdent);
618 return;
619 case 1:
620 sprintf (buf, "%s",CONFIG_IDENT_STRING);
621 sprintf (info, " %s", &buf[1]);
622 return;
623 }
624 /* no more info lines */
625 *info = 0;
626 return;
627}
628#endif /* CONFIG_CONSOLE_EXTRA_INFO */
629
630#endif /* CONFIG_VIDEO */