]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/mpl/common/common_util.c
a6edb6dbca08089c23ef3b157044c083c59d0ad5
[people/ms/u-boot.git] / board / mpl / common / common_util.c
1 /*
2 * (C) Copyright 2001
3 * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8 #include <common.h>
9 #include <command.h>
10 #include <video_fb.h>
11 #include "common_util.h"
12 #include <asm/processor.h>
13 #include <asm/byteorder.h>
14 #include <i2c.h>
15 #include <pci.h>
16 #include <malloc.h>
17 #include <bzlib.h>
18 #include <video.h>
19
20 #ifdef CONFIG_PIP405
21 #include "../pip405/pip405.h"
22 #include <asm/4xx_pci.h>
23 #endif
24 #if defined(CONFIG_TARGET_MIP405) || defined(CONFIG_TARGET_MIP405T)
25 #include "../mip405/mip405.h"
26 #include <asm/4xx_pci.h>
27 #endif
28
29 DECLARE_GLOBAL_DATA_PTR;
30
31 #if defined(CONFIG_PATI)
32 #define FIRM_START 0xFFF00000
33 #endif
34
35 extern int mem_test(ulong start, ulong ramsize, int quiet);
36
37 #define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */
38 #define IMAGE_SIZE CONFIG_SYS_MONITOR_LEN /* ugly, but it works for now */
39
40 #if defined(CONFIG_PIP405) || defined(CONFIG_TARGET_MIP405) \
41 || defined(CONFIG_TARGET_MIP405T)
42 /*-----------------------------------------------------------------------
43 * On PIP/MIP405 we have 3 (4) possible boot mode
44 *
45 * - Boot from Flash (Flash CS = CS0, MPS CS = CS1)
46 * - Boot from MPS (Flash CS = CS1, MPS CS = CS0)
47 * - Boot from PCI with Flash map (Flash CS = CS0, MPS CS = CS1)
48 * - Boot from PCI with MPS map (Flash CS = CS1, MPS CS = CS0)
49 * The flash init is the first board specific routine which is called
50 * after code relocation (running from SDRAM)
51 * The first thing we do is to map the Flash CS to the Flash area and
52 * the MPS CS to the MPS area. Since the flash size is unknown at this
53 * point, we use the max flash size and the lowest flash address as base.
54 *
55 * After flash detection we adjust the size of the CS area accordingly.
56 * update_flash_size() will fix in wrong values in the flash_info structure,
57 * misc_init_r() will fix the values in the board info structure
58 */
59 int get_boot_mode(void)
60 {
61 unsigned long pbcr;
62 int res = 0;
63 pbcr = mfdcr(CPC0_PSR);
64 if ((pbcr & PSR_ROM_WIDTH_MASK) == 0)
65 /* boot via MPS or MPS mapping */
66 res = BOOT_MPS;
67 if (pbcr & PSR_ROM_LOC)
68 /* boot via PCI.. */
69 res |= BOOT_PCI;
70 return res;
71 }
72
73 /* Map the flash high (in boot area)
74 This code can only be executed from SDRAM (after relocation).
75 */
76 void setup_cs_reloc(void)
77 {
78 int mode;
79 /*
80 * since we are relocated, we can set-up the CS finaly
81 * but first of all, switch off PCI mapping (in case it
82 * was a PCI boot)
83 */
84 out32r(PMM0MA, 0L);
85 /* get boot mode */
86 mode = get_boot_mode();
87 /*
88 * we map the flash high in every case
89 * first find out to which CS the flash is attached to
90 */
91 if (mode & BOOT_MPS) {
92 /* map flash high on CS1 and MPS on CS0 */
93 mtdcr(EBC0_CFGADDR, PB0AP);
94 mtdcr(EBC0_CFGDATA, MPS_AP);
95 mtdcr(EBC0_CFGADDR, PB0CR);
96 mtdcr(EBC0_CFGDATA, MPS_CR);
97 /*
98 * we use the default values (max values) for the flash
99 * because its real size is not yet known
100 */
101 mtdcr(EBC0_CFGADDR, PB1AP);
102 mtdcr(EBC0_CFGDATA, FLASH_AP);
103 mtdcr(EBC0_CFGADDR, PB1CR);
104 mtdcr(EBC0_CFGDATA, FLASH_CR_B);
105 } else {
106 /* map flash high on CS0 and MPS on CS1 */
107 mtdcr(EBC0_CFGADDR, PB1AP);
108 mtdcr(EBC0_CFGDATA, MPS_AP);
109 mtdcr(EBC0_CFGADDR, PB1CR);
110 mtdcr(EBC0_CFGDATA, MPS_CR);
111 /*
112 * we use the default values (max values) for the flash
113 * because its real size is not yet known
114 */
115 mtdcr(EBC0_CFGADDR, PB0AP);
116 mtdcr(EBC0_CFGDATA, FLASH_AP);
117 mtdcr(EBC0_CFGADDR, PB0CR);
118 mtdcr(EBC0_CFGDATA, FLASH_CR_B);
119 }
120 }
121 #endif /* #if defined(CONFIG_PIP405) || defined(CONFIG_TARGET_MIP405) */
122
123 #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
124 /* adjust flash start and protection info */
125 int update_flash_size(int flash_size)
126 {
127 int i = 0, mode;
128 flash_info_t *info = &flash_info[0];
129 unsigned long flashcr;
130 unsigned long flash_base = (0 - flash_size) & 0xFFF00000;
131
132 if (flash_size > 128*1024*1024) {
133 printf("\n ### ERROR, wrong flash size: %X, reset board ###\n",
134 flash_size);
135 hang();
136 }
137
138 if ((flash_size >> 20) != 0)
139 i = __ilog2(flash_size >> 20);
140
141 /* set up flash CS according to the size */
142 mode = get_boot_mode();
143 if (mode & BOOT_MPS) {
144 /* flash is on CS1 */
145 mtdcr(EBC0_CFGADDR, PB1CR);
146 flashcr = mfdcr(EBC0_CFGDATA);
147 /* we map the flash high in every case */
148 flashcr &= 0x0001FFFF; /* mask out address bits */
149 flashcr |= flash_base; /* start addr */
150 flashcr |= (i << 17); /* size addr */
151 mtdcr(EBC0_CFGADDR, PB1CR);
152 mtdcr(EBC0_CFGDATA, flashcr);
153 } else {
154 /* flash is on CS0 */
155 mtdcr(EBC0_CFGADDR, PB0CR);
156 flashcr = mfdcr(EBC0_CFGDATA);
157 /* we map the flash high in every case */
158 flashcr &= 0x0001FFFF; /* mask out address bits */
159 flashcr |= flash_base; /* start addr */
160 flashcr |= (i << 17); /* size addr */
161 mtdcr(EBC0_CFGADDR, PB0CR);
162 mtdcr(EBC0_CFGDATA, flashcr);
163 }
164
165 for (i = 0; i < info->sector_count; i++)
166 /* adjust sector start address */
167 info->start[i] = flash_base +
168 (info->start[i] - CONFIG_SYS_FLASH_BASE);
169
170 /* unprotect all sectors */
171 flash_protect(FLAG_PROTECT_CLEAR,
172 info->start[0],
173 0xFFFFFFFF,
174 info);
175 flash_protect_default();
176 /* protect reset vector too*/
177 flash_protect(FLAG_PROTECT_SET,
178 info->start[info->sector_count-1],
179 0xFFFFFFFF,
180 info);
181
182 return 0;
183 }
184 #endif
185
186 static int
187 mpl_prg(uchar *src, ulong size)
188 {
189 ulong start;
190 flash_info_t *info = &flash_info[0];
191 int i, rc;
192 #if defined(CONFIG_PATI)
193 int start_sect;
194 #endif
195 #if defined(CONFIG_PIP405) || defined(CONFIG_TARGET_MIP405) \
196 || defined(CONFIG_TARGET_MIP405T) || defined(CONFIG_PATI)
197 char *copystr = (char *)src;
198 ulong *magic = (ulong *)src;
199
200 if (uimage_to_cpu (magic[0]) != IH_MAGIC) {
201 puts("Bad Magic number\n");
202 return -1;
203 }
204 /* some more checks before we delete the Flash... */
205 /* Checking the ISO_STRING prevents to program a
206 * wrong Firmware Image into the flash.
207 */
208 i = 4; /* skip Magic number */
209 while (1) {
210 if (strncmp(&copystr[i], "MEV-", 4) == 0)
211 break;
212 if (i++ >= 0x100) {
213 puts("Firmware Image for unknown Target\n");
214 return -1;
215 }
216 }
217 /* we have the ISO STRING, check */
218 if (strncmp(&copystr[i], CONFIG_ISO_STRING, sizeof(CONFIG_ISO_STRING)-1) != 0) {
219 printf("Wrong Firmware Image: %s\n", &copystr[i]);
220 return -1;
221 }
222 #if !defined(CONFIG_PATI)
223 start = 0 - size;
224
225 /* unprotect sectors used by u-boot */
226 flash_protect(FLAG_PROTECT_CLEAR,
227 start,
228 0xFFFFFFFF,
229 info);
230
231 /* search start sector */
232 for (i = info->sector_count-1; i > 0; i--)
233 if (start >= info->start[i])
234 break;
235
236 /* now erase flash */
237 printf("Erasing at %lx (sector %d) (start %lx)\n",
238 start,i,info->start[i]);
239 if ((rc = flash_erase (info, i, info->sector_count-1)) != 0) {
240 puts("ERROR ");
241 flash_perror(rc);
242 return (1);
243 }
244
245 #else /* #if !defined(CONFIG_PATI) */
246 start = FIRM_START;
247 start_sect = -1;
248
249 /* search start sector */
250 for (i = info->sector_count-1; i > 0; i--)
251 if (start >= info->start[i])
252 break;
253
254 start_sect = i;
255
256 for (i = info->sector_count-1; i > 0; i--)
257 if ((start + size) >= info->start[i])
258 break;
259
260 /* unprotect sectors used by u-boot */
261 flash_protect(FLAG_PROTECT_CLEAR,
262 start,
263 start + size,
264 info);
265
266 /* now erase flash */
267 printf ("Erasing at %lx to %lx (sector %d to %d) (%lx to %lx)\n",
268 start, start + size, start_sect, i,
269 info->start[start_sect], info->start[i]);
270 if ((rc = flash_erase (info, start_sect, i)) != 0) {
271 puts ("ERROR ");
272 flash_perror (rc);
273 return (1);
274 }
275 #endif /* defined(CONFIG_PATI) */
276
277 #elif defined(CONFIG_VCMA9)
278 start = 0;
279
280 /* search end sector */
281 for (i = 0; i < info->sector_count; i++)
282 if (size < info->start[i])
283 break;
284
285 flash_protect(FLAG_PROTECT_CLEAR,
286 start,
287 size,
288 info);
289
290 /* now erase flash */
291 printf("Erasing at %lx (sector %d) (start %lx)\n",
292 start,0,info->start[0]);
293 if ((rc = flash_erase (info, 0, i)) != 0) {
294 puts("ERROR ");
295 flash_perror(rc);
296 return (1);
297 }
298
299 #endif
300 printf("flash erased, programming from 0x%lx 0x%lx Bytes\n",
301 (ulong)src, size);
302 if ((rc = flash_write ((char *)src, start, size)) != 0) {
303 puts("ERROR ");
304 flash_perror(rc);
305 return (1);
306 }
307 puts("OK programming done\n");
308 return 0;
309 }
310
311
312 static int
313 mpl_prg_image(uchar *ld_addr)
314 {
315 unsigned long len;
316 uchar *data;
317 image_header_t *hdr = (image_header_t *)ld_addr;
318 int rc;
319
320 #if defined(CONFIG_FIT)
321 if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
322 puts ("Non legacy image format not supported\n");
323 return -1;
324 }
325 #endif
326
327 if (!image_check_magic (hdr)) {
328 puts("Bad Magic Number\n");
329 return 1;
330 }
331 image_print_contents (hdr);
332 if (!image_check_os (hdr, IH_OS_U_BOOT)) {
333 puts("No U-Boot Image\n");
334 return 1;
335 }
336 if (!image_check_type (hdr, IH_TYPE_FIRMWARE)) {
337 puts("No Firmware Image\n");
338 return 1;
339 }
340 if (!image_check_hcrc (hdr)) {
341 puts("Bad Header Checksum\n");
342 return 1;
343 }
344 puts("Verifying Checksum ... ");
345 if (!image_check_dcrc (hdr)) {
346 puts("Bad Data CRC\n");
347 return 1;
348 }
349 puts("OK\n");
350
351 data = (uchar *)image_get_data (hdr);
352 len = image_get_data_size (hdr);
353
354 if (image_get_comp (hdr) != IH_COMP_NONE) {
355 uchar *buf;
356 /* reserve space for uncompressed image */
357 if ((buf = malloc(IMAGE_SIZE)) == NULL) {
358 puts("Insufficient space for decompression\n");
359 return 1;
360 }
361
362 switch (image_get_comp (hdr)) {
363 case IH_COMP_GZIP:
364 puts("Uncompressing (GZIP) ... ");
365 rc = gunzip ((void *)(buf), IMAGE_SIZE, data, &len);
366 if (rc != 0) {
367 puts("GUNZIP ERROR\n");
368 free(buf);
369 return 1;
370 }
371 puts("OK\n");
372 break;
373 #ifdef CONFIG_BZIP2
374 case IH_COMP_BZIP2:
375 puts("Uncompressing (BZIP2) ... ");
376 {
377 uint retlen = IMAGE_SIZE;
378 rc = BZ2_bzBuffToBuffDecompress ((char *)(buf), &retlen,
379 (char *)data, len, 0, 0);
380 len = retlen;
381 }
382 if (rc != BZ_OK) {
383 printf ("BUNZIP2 ERROR: %d\n", rc);
384 free(buf);
385 return 1;
386 }
387 puts("OK\n");
388 break;
389 #endif
390 default:
391 printf ("Unimplemented compression type %d\n",
392 image_get_comp (hdr));
393 free(buf);
394 return 1;
395 }
396
397 rc = mpl_prg(buf, len);
398 free(buf);
399 } else {
400 rc = mpl_prg(data, len);
401 }
402
403 return(rc);
404 }
405
406 #if !defined(CONFIG_PATI)
407 void get_backup_values(backup_t *buf)
408 {
409 i2c_read(CONFIG_SYS_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,2,(void *)buf,sizeof(backup_t));
410 }
411
412 void set_backup_values(int overwrite)
413 {
414 backup_t back;
415 int i;
416
417 get_backup_values(&back);
418 if(!overwrite) {
419 if(strncmp(back.signature,"MPL\0",4)==0) {
420 puts("Not possible to write Backup\n");
421 return;
422 }
423 }
424 memcpy(back.signature,"MPL\0",4);
425 i = getenv_f("serial#",back.serial_name,16);
426 if(i < 0) {
427 puts("Not possible to write Backup\n");
428 return;
429 }
430 back.serial_name[16]=0;
431 i = getenv_f("ethaddr",back.eth_addr,20);
432 if(i < 0) {
433 puts("Not possible to write Backup\n");
434 return;
435 }
436 back.eth_addr[20]=0;
437 i2c_write(CONFIG_SYS_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,2,(void *)&back,sizeof(backup_t));
438 }
439
440 void clear_env_values(void)
441 {
442 backup_t back;
443 unsigned char env_crc[4];
444
445 memset(&back,0xff,sizeof(backup_t));
446 memset(env_crc,0x00,4);
447 i2c_write(CONFIG_SYS_DEF_EEPROM_ADDR,I2C_BACKUP_ADDR,2,(void *)&back,sizeof(backup_t));
448 i2c_write(CONFIG_SYS_DEF_EEPROM_ADDR,CONFIG_ENV_OFFSET,2,(void *)env_crc,4);
449 }
450
451 /*
452 * check crc of "older" environment
453 */
454 int check_env_old_size(ulong oldsize)
455 {
456 ulong crc, len, new;
457 unsigned off;
458 uchar buf[64];
459
460 /* read old CRC */
461 eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR,
462 CONFIG_ENV_OFFSET,
463 (uchar *)&crc, sizeof(ulong));
464
465 new = 0;
466 len = oldsize;
467 off = sizeof(long);
468 len = oldsize-off;
469 while (len > 0) {
470 int n = (len > sizeof(buf)) ? sizeof(buf) : len;
471
472 eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, buf, n);
473 new = crc32 (new, buf, n);
474 len -= n;
475 off += n;
476 }
477
478 return (crc == new);
479 }
480
481 static ulong oldsizes[] = {
482 0x200,
483 0x800,
484 0
485 };
486
487 void copy_old_env(ulong size)
488 {
489 uchar name_buf[64];
490 uchar value_buf[0x800];
491 uchar c;
492 ulong len;
493 unsigned off;
494 uchar *name, *value;
495
496 name = &name_buf[0];
497 value = &value_buf[0];
498 len=size;
499 off = sizeof(long);
500 while (len > off) {
501 eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, &c, 1);
502 if(c != '=') {
503 *name++=c;
504 off++;
505 }
506 else {
507 *name++='\0';
508 off++;
509 do {
510 eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, &c, 1);
511 *value++=c;
512 off++;
513 if(c == '\0')
514 break;
515 } while(len > off);
516 name = &name_buf[0];
517 value = &value_buf[0];
518 if(strncmp((char *)name,"baudrate",8)!=0) {
519 setenv((char *)name,(char *)value);
520 }
521
522 }
523 }
524 }
525
526
527 void check_env(void)
528 {
529 char *s;
530 int i=0;
531 char buf[32];
532 backup_t back;
533
534 s=getenv("serial#");
535 if(!s) {
536 while(oldsizes[i]) {
537 if(check_env_old_size(oldsizes[i]))
538 break;
539 i++;
540 }
541 if(!oldsizes[i]) {
542 /* no old environment has been found */
543 get_backup_values (&back);
544 if (strncmp (back.signature, "MPL\0", 4) == 0) {
545 sprintf (buf, "%s", back.serial_name);
546 setenv ("serial#", buf);
547 sprintf (buf, "%s", back.eth_addr);
548 setenv ("ethaddr", buf);
549 printf ("INFO: serial# and ethaddr recovered, use saveenv\n");
550 return;
551 }
552 }
553 else {
554 copy_old_env(oldsizes[i]);
555 puts("INFO: old environment ajusted, use saveenv\n");
556 }
557 }
558 else {
559 /* check if back up is set */
560 get_backup_values(&back);
561 if(strncmp(back.signature,"MPL\0",4)!=0) {
562 set_backup_values(0);
563 }
564 }
565 }
566
567 #endif /* #if !defined(CONFIG_PATI) */
568
569 int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
570 {
571 ulong ld_addr;
572 int result;
573 #if !defined(CONFIG_PATI)
574 ulong size = IMAGE_SIZE;
575 ulong src = MULTI_PURPOSE_SOCKET_ADDR;
576 backup_t back;
577 #endif
578
579 if (strcmp(argv[1], "flash") == 0)
580 {
581 #if defined(CONFIG_CMD_FDC)
582 if (strcmp(argv[2], "floppy") == 0) {
583 char *local_args[3];
584 extern int do_fdcboot (cmd_tbl_t *, int, int, char *[]);
585 puts("\nupdating bootloader image from floppy\n");
586 local_args[0] = argv[0];
587 if(argc==4) {
588 local_args[1] = argv[3];
589 local_args[2] = NULL;
590 ld_addr=simple_strtoul(argv[3], NULL, 16);
591 result=do_fdcboot(cmdtp, 0, 2, local_args);
592 }
593 else {
594 local_args[1] = NULL;
595 ld_addr=CONFIG_SYS_LOAD_ADDR;
596 result=do_fdcboot(cmdtp, 0, 1, local_args);
597 }
598 result=mpl_prg_image((uchar *)ld_addr);
599 return result;
600 }
601 #endif
602 if (strcmp(argv[2], "mem") == 0) {
603 if(argc==4) {
604 ld_addr=simple_strtoul(argv[3], NULL, 16);
605 }
606 else {
607 ld_addr=load_addr;
608 }
609 printf ("\nupdating bootloader image from memory at %lX\n",ld_addr);
610 result=mpl_prg_image((uchar *)ld_addr);
611 return result;
612 }
613 #if !defined(CONFIG_PATI)
614 if (strcmp(argv[2], "mps") == 0) {
615 puts("\nupdating bootloader image from MPS\n");
616 result=mpl_prg((uchar *)src,size);
617 return result;
618 }
619 #endif /* #if !defined(CONFIG_PATI) */
620 }
621 #if !defined(CONFIG_PATI)
622 if (strcmp(argv[1], "clearenvvalues") == 0)
623 {
624 if (strcmp(argv[2], "yes") == 0)
625 {
626 clear_env_values();
627 return 0;
628 }
629 }
630 if (strcmp(argv[1], "getback") == 0) {
631 get_backup_values(&back);
632 back.signature[3]=0;
633 back.serial_name[16]=0;
634 back.eth_addr[20]=0;
635 printf("GetBackUp: signature: %s\n",back.signature);
636 printf(" serial#: %s\n",back.serial_name);
637 printf(" ethaddr: %s\n",back.eth_addr);
638 return 0;
639 }
640 if (strcmp(argv[1], "setback") == 0) {
641 set_backup_values(1);
642 return 0;
643 }
644 #endif
645 return cmd_usage(cmdtp);
646 }
647
648
649 #if defined(CONFIG_CMD_DOC)
650 void doc_init (void)
651 {
652 doc_probe(MULTI_PURPOSE_SOCKET_ADDR);
653 }
654 #endif
655
656
657 #ifdef CONFIG_VIDEO
658 /******************************************************
659 * Routines to display the Board information
660 * to the screen (since the VGA will be initialized as last,
661 * we must resend the infos)
662 */
663
664 #ifdef CONFIG_CONSOLE_EXTRA_INFO
665 extern GraphicDevice ctfb;
666 extern int get_boot_mode(void);
667
668 void video_get_info_str (int line_number, char *info)
669 {
670 /* init video info strings for graphic console */
671 PPC4xx_SYS_INFO sys_info;
672 char rev;
673 int i,boot;
674 unsigned long pvr;
675 char buf[64];
676 char buf1[32], buf2[32], buf3[32], buf4[32];
677 char cpustr[16];
678 char *s, *e, bc;
679 switch (line_number)
680 {
681 case 2:
682 /* CPU and board infos */
683 pvr=get_pvr();
684 get_sys_info (&sys_info);
685 switch (pvr) {
686 case PVR_405GP_RB: rev='B'; break;
687 case PVR_405GP_RC: rev='C'; break;
688 case PVR_405GP_RD: rev='D'; break;
689 case PVR_405GP_RE: rev='E'; break;
690 case PVR_405GPR_RB: rev='B'; break;
691 default: rev='?'; break;
692 }
693 if(pvr==PVR_405GPR_RB)
694 sprintf(cpustr,"PPC405GPr %c",rev);
695 else
696 sprintf(cpustr,"PPC405GP %c",rev);
697 /* Board info */
698 i=0;
699 s=getenv ("serial#");
700 #ifdef CONFIG_PIP405
701 if (!s || strncmp (s, "PIP405", 6)) {
702 strcpy(buf,"### No HW ID - assuming PIP405");
703 }
704 #endif
705 #if defined(CONFIG_TARGET_MIP405) || defined(CONFIG_TARGET_MIP405T)
706 if (!s || strncmp (s, "MIP405", 6)) {
707 strcpy(buf,"### No HW ID - assuming MIP405");
708 }
709 #endif
710 else {
711 for (e = s; *e; ++e) {
712 if (*e == ' ')
713 break;
714 }
715 for (; s < e; ++s) {
716 if (*s == '_') {
717 ++s;
718 break;
719 }
720 buf[i++] = *s;
721 }
722 strcpy(&buf[i]," SN ");
723 i+=4;
724 for (; s < e; ++s) {
725 buf[i++] = *s;
726 }
727 buf[i++]=0;
728 }
729 sprintf (info," %s %s %s MHz (%s/%s/%s MHz)",
730 buf, cpustr,
731 strmhz (buf1, gd->cpu_clk),
732 strmhz (buf2, sys_info.freqPLB),
733 strmhz (buf3, sys_info.freqPLB / sys_info.pllOpbDiv),
734 strmhz (buf4, sys_info.freqPLB / sys_info.pllExtBusDiv));
735 return;
736 case 3:
737 /* Memory Info */
738 boot = get_boot_mode();
739 bc = in8 (CONFIG_PORT_ADDR);
740 sprintf(info, " %luMB RAM, %luMB Flash Cfg 0x%02X %s %s",
741 gd->bd->bi_memsize / 0x100000,
742 gd->bd->bi_flashsize / 0x100000,
743 bc,
744 (boot & BOOT_MPS) ? "MPS boot" : "Flash boot",
745 ctfb.modeIdent);
746 return;
747 case 1:
748 strcpy(buf, CONFIG_IDENT_STRING);
749 sprintf (info, " %s", &buf[1]);
750 return;
751 }
752 /* no more info lines */
753 *info = 0;
754 return;
755 }
756 #endif /* CONFIG_CONSOLE_EXTRA_INFO */
757
758 #endif /* CONFIG_VIDEO */