]> git.sur5r.net Git - u-boot/blobdiff - board/freescale/mpc8266ads/flash.c
ls1021aqds: add hwconfig setting to do pin mux
[u-boot] / board / freescale / mpc8266ads / flash.c
index aa533e4b90564c69a7c5b8e6f4f8815766d37812..ef281944a1f50f0fbf8e402a28c3c62cc92e0eba 100644 (file)
@@ -7,39 +7,23 @@
  * I started with board/ip860/flash.c and made changes I found in
  * the MTD project by David Schleef.
  *
- * 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>
 
 
-flash_info_t   flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips        */
+flash_info_t   flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
 
 #if defined(CONFIG_ENV_IS_IN_FLASH)
-# ifndef  CFG_ENV_ADDR
-#  define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
+# ifndef  CONFIG_ENV_ADDR
+#  define CONFIG_ENV_ADDR      (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)
 # endif
-# ifndef  CFG_ENV_SIZE
-#  define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
+# ifndef  CONFIG_ENV_SIZE
+#  define CONFIG_ENV_SIZE      CONFIG_ENV_SECT_SIZE
 # endif
-# ifndef  CFG_ENV_SECT_SIZE
-#  define CFG_ENV_SECT_SIZE  CFG_ENV_SIZE
+# ifndef  CONFIG_ENV_SECT_SIZE
+#  define CONFIG_ENV_SECT_SIZE  CONFIG_ENV_SIZE
 # endif
 #endif
 
@@ -56,7 +40,7 @@ static int clear_block_lock_bit(vu_long * addr);
 unsigned long flash_init (void)
 {
 #ifndef CONFIG_MPC8266ADS
-       volatile immap_t        *immap  = (immap_t *)CFG_IMMR;
+       volatile immap_t        *immap  = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8xx_t    *memctl = &immap->im_memctl;
        volatile ip860_bcsr_t   *bcsr   = (ip860_bcsr_t *)BCSR_BASE;
 #endif
@@ -71,7 +55,7 @@ unsigned long flash_init (void)
 #endif
 
 
-       for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
+       for (i=0; i<CONFIG_SYS_MAX_FLASH_BANKS; ++i) {
                flash_info[i].flash_id = FLASH_UNKNOWN;
 
                /* set the default sector offset */
@@ -88,28 +72,28 @@ unsigned long flash_init (void)
 
 #ifndef CONFIG_MPC8266ADS
        /* Remap FLASH according to real size */
-       memctl->memc_or1 = CFG_OR_TIMING_FLASH | (-size & 0xFFFF8000);
-       memctl->memc_br1 = (CFG_FLASH_BASE & BR_BA_MSK) |
+       memctl->memc_or1 = CONFIG_SYS_OR_TIMING_FLASH | (-size & 0xFFFF8000);
+       memctl->memc_br1 = (CONFIG_SYS_FLASH_BASE & BR_BA_MSK) |
                                (memctl->memc_br1 & ~(BR_BA_MSK));
 #endif
        /* Re-do sizing to get full correct info */
-       size = flash_get_size((vu_long *)CFG_FLASH_BASE, &flash_info[0]);
+       size = flash_get_size((vu_long *)CONFIG_SYS_FLASH_BASE, &flash_info[0]);
 
        flash_info[0].size = size;
 
-#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
+#if CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE
        /* monitor protection ON by default */
        flash_protect(FLAG_PROTECT_SET,
-                     CFG_MONITOR_BASE,
-                     CFG_MONITOR_BASE+monitor_flash_len-1,
+                     CONFIG_SYS_MONITOR_BASE,
+                     CONFIG_SYS_MONITOR_BASE+monitor_flash_len-1,
                      &flash_info[0]);
 #endif
 
 #ifdef CONFIG_ENV_IS_IN_FLASH
        /* ENV protection ON by default */
        flash_protect(FLAG_PROTECT_SET,
-                     CFG_ENV_ADDR,
-                     CFG_ENV_ADDR+CFG_ENV_SECT_SIZE-1,
+                     CONFIG_ENV_ADDR,
+                     CONFIG_ENV_ADDR+CONFIG_ENV_SECT_SIZE-1,
                      &flash_info[0]);
 #endif
        return (size);
@@ -336,7 +320,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
                                        *addr = 0xFFFFFFFF;     /* reset bank */
                                        return 1;
                                }
-                               if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
+                               if ((now=get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
                                        printf ("Timeout\n");
                                        *addr = 0xFFFFFFFF;     /* reset bank */
                                        return 1;
@@ -461,7 +445,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
        start = get_timer (0);
        flag  = 0;
        while (((csr = *addr) & 0x80808080) != 0x80808080) {
-               if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+               if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
                        flag = 1;
                        break;
                }
@@ -499,7 +483,7 @@ static int clear_block_lock_bit(vu_long  * addr)
 
        start = get_timer (0);
        while(*addr != 0x80808080){
-               if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
+               if ((now=get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
                        printf ("Timeout on clearing Block Lock Bit\n");
                        *addr = 0xFFFFFFFF;     /* reset bank */
                        return 1;