Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
[pandora-u-boot.git] / board / svm_sc8xx / svm_sc8xx.c
index b900e6b..771bb4a 100644 (file)
@@ -75,42 +75,41 @@ const uint sdram_table[] =
  * Return 1 for "SC8xx" type, 0 else.
  */
 
-int checkboard (void)
+int checkboard(void)
 {
-    char *s = getenv("serial#");
-    int board_type;
+       char buf[64];
+       int i;
+       int l = getenv_f("serial#", buf, sizeof(buf));
 
-    if (!s || strncmp(s, "SVM8", 4)) {
-       printf ("### No HW ID - assuming SVM SC8xx\n");
-       return (0);
-    }
+       if (l < 0 || strncmp(buf, "SVM8", 4)) {
+               printf("### No HW ID - assuming SVM SC8xx\n");
+               return (0);
+       }
 
-    board_type = 1;
+       for (i = 0; i < l; ++i) {
+               if (buf[i] == ' ')
+                       break;
+               putc(buf[i]);
+       }
 
-    for (; *s; ++s) {
-       if (*s == ' ')
-           break;
-       putc (*s);
-    }
+       putc('\n');
 
-    putc ('\n');
-
-    return (0);
+       return 0;
 }
 
 /* ------------------------------------------------------------------------- */
 
-long int initdram (int board_type)
+phys_size_t initdram (int board_type)
 {
-       volatile immap_t     *immap  = (immap_t *)CFG_IMMR;
+       volatile immap_t     *immap  = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
        long int size_b0 = 0;
 
        upmconfig(UPMA, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint));
 
-       memctl->memc_mptpr = CFG_MPTPR;
+       memctl->memc_mptpr = CONFIG_SYS_MPTPR;
 #if defined (CONFIG_SDRAM_16M)
-       memctl->memc_mamr = 0x00802114 | CFG_MxMR_PTx;
+       memctl->memc_mamr = 0x00802114 | CONFIG_SYS_MxMR_PTx;
        memctl->memc_mcr  = 0x80002105;     /* SDRAM bank 0 */
        udelay(1);
        memctl->memc_mcr  = 0x80002830;
@@ -122,7 +121,7 @@ long int initdram (int board_type)
        memctl->memc_or1 =  0xff000a00;
        size_b0 = 0x01000000;
 #elif defined (CONFIG_SDRAM_32M)
-       memctl->memc_mamr = 0x00904114 | CFG_MxMR_PTx;
+       memctl->memc_mamr = 0x00904114 | CONFIG_SYS_MxMR_PTx;
        memctl->memc_mcr  = 0x80002105;     /* SDRAM bank 0 */
        udelay(1);
        memctl->memc_mcr  = 0x80002830;
@@ -134,7 +133,7 @@ long int initdram (int board_type)
        memctl->memc_or1 =  0xfe000a00;
        size_b0 = 0x02000000;
 #elif defined (CONFIG_SDRAM_64M)
-       memctl->memc_mamr = 0x00a04114 | CFG_MxMR_PTx;
+       memctl->memc_mamr = 0x00a04114 | CONFIG_SYS_MxMR_PTx;
        memctl->memc_mcr  = 0x80002105;     /* SDRAM bank 0 */
        udelay(1);
        memctl->memc_mcr  = 0x80002830;
@@ -154,9 +153,8 @@ long int initdram (int board_type)
 }
 
 #if defined(CONFIG_CMD_DOC)
-extern void doc_probe (ulong physadr);
 void doc_init (void)
 {
-               doc_probe (CFG_DOC_BASE);
+               doc_probe (CONFIG_SYS_DOC_BASE);
 }
 #endif