Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flash
[platform/kernel/u-boot.git] / board / snmc / qs850 / qs850.c
index 637f125..dc4a476 100644 (file)
@@ -8,23 +8,7 @@
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -86,6 +70,13 @@ const uint sdram_table[] =
  *
  * Always return 1
  */
+#if defined(CONFIG_QS850)
+#define BOARD_IDENTITY "QS850"
+#elif defined(CONFIG_QS823)
+#define BOARD_IDENTITY "QS823"
+#else
+#define        BOARD_IDENTITY  "QS???"
+#endif
 
 int checkboard (void)
 {
@@ -93,17 +84,11 @@ int checkboard (void)
        char buf[64];
        int i;
 
-       i = getenv_r("serial#", buf, sizeof(buf));
+       i = getenv_f("serial#", buf, sizeof(buf));
        s = (i>0) ? buf : NULL;
 
-#ifdef CONFIG_QS850
-       if (!s || strncmp(s, "QS850", 5)) {
-               puts ("### No HW ID - assuming QS850");
-#endif
-#ifdef CONFIG_QS823
-       if (!s || strncmp(s, "QS823", 5)) {
-               puts ("### No HW ID - assuming QS823");
-#endif
+       if (!s || strncmp(s, BOARD_IDENTITY, 5)) {
+               puts ("### No HW ID - assuming " BOARD_IDENTITY);
        } else {
                for (e=s; *e; ++e) {
                if (*e == ' ')
@@ -143,9 +128,9 @@ int checkboard (void)
 #define REFRESH_INIT_LOOPS (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;
 
@@ -154,17 +139,17 @@ long int initdram (int board_type)
        /*
        * Prescaler for refresh
        */
-       memctl->memc_mptpr = CFG_MPTPR;
+       memctl->memc_mptpr = CONFIG_SYS_MPTPR;
 
        /*
        * Map controller bank 1 to the SDRAM address
        */
-       memctl->memc_or1 = CFG_OR1;
-       memctl->memc_br1 = CFG_BR1;
+       memctl->memc_or1 = CONFIG_SYS_OR1;
+       memctl->memc_br1 = CONFIG_SYS_BR1;
        udelay(1000);
 
        /* perform SDRAM initialization sequence */
-       memctl->memc_mamr = CFG_16M_MAMR;
+       memctl->memc_mamr = CONFIG_SYS_16M_MAMR;
        udelay(100);
 
        /* Program the SDRAM's Mode Register */
@@ -191,7 +176,7 @@ long int initdram (int board_type)
        /*
        * Check for 32M SDRAM Memory Size
        */
-       size = dram_size(CFG_32M_MAMR|MAMR_PTAE,
+       size = dram_size(CONFIG_SYS_32M_MAMR|MAMR_PTAE,
        (long *)SDRAM_BASE, SDRAM_32M_MAX_SIZE);
        udelay (1000);
 
@@ -199,7 +184,7 @@ long int initdram (int board_type)
        * Check for 16M SDRAM Memory Size
        */
        if (size != SDRAM_32M_MAX_SIZE) {
-       size = dram_size(CFG_16M_MAMR|MAMR_PTAE,
+       size = dram_size(CONFIG_SYS_16M_MAMR|MAMR_PTAE,
        (long *)SDRAM_BASE, SDRAM_16M_MAX_SIZE);
        udelay (1000);
        }
@@ -220,7 +205,7 @@ long int initdram (int board_type)
 
 static long int dram_size (long int mamr_value, long int *base, long int maxsize)
 {
-       volatile immap_t *immap = (immap_t *)CFG_IMMR;
+       volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
 
        memctl->memc_mamr = mamr_value;