]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/funkwerk/vovpn-gw/flash.c
Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flash
[karo-tx-uboot.git] / board / funkwerk / vovpn-gw / flash.c
index 935adfa1a0d5311cd4f9677cef78c43ca789a5a7..829514c179a7a0b91614154f8c58c14f40cfb4b7 100644 (file)
@@ -9,25 +9,12 @@
  *
  * Most of this code is taken from existing u-boot source code.
  *
- * 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];
+flash_info_t                           flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
 
 #define FLASH_CMD_READ_ID              0x90
 #define FLASH_CMD_READ_STATUS          0x70
@@ -46,7 +33,7 @@ flash_info_t                          flash_info[CFG_MAX_FLASH_BANKS];
 
 #define FLASH_WRITE_BUFFER_SIZE                32
 
-#ifdef CFG_FLASH_16BIT
+#ifdef CONFIG_SYS_FLASH_16BIT
 #define FLASH_WORD_SIZE                        unsigned short
 #define FLASH_ID_MASK                  0xffff
 #define FLASH_CMD_ADDR_SHIFT           0
@@ -130,10 +117,10 @@ flash_init(void)
        unsigned long   size;
        int             i;
 
-       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;
        }
-       size = flash_get((volatile FLASH_WORD_SIZE *)CFG_FLASH_BASE, &flash_info[0]);
+       size = flash_get((volatile FLASH_WORD_SIZE *)CONFIG_SYS_FLASH_BASE, &flash_info[0]);
        if (flash_info[0].flash_id == FLASH_UNKNOWN) {
                printf ("## Unknown FLASH Size=0x%08lx\n", size);
                return (0);
@@ -145,16 +132,16 @@ flash_init(void)
                      flash_info[0].start[1] - 1,
                      &flash_info[0]);
 
-#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
+#if CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE
        flash_protect(FLAG_PROTECT_SET,
-                     CFG_MONITOR_FLASH,
-                     CFG_MONITOR_FLASH+CFG_MONITOR_LEN-1,
+                     CONFIG_SYS_MONITOR_FLASH,
+                     CONFIG_SYS_MONITOR_FLASH+CONFIG_SYS_MONITOR_LEN-1,
                      &flash_info[0]);
 #endif
 #ifdef CONFIG_ENV_IS_IN_FLASH
        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);
@@ -265,7 +252,7 @@ flash_erase(flash_info_t *info, int s_first, int s_last)
                udelay (1000);
 
                while (((status = *addr) & FLASH_STATUS_DONE) != FLASH_STATUS_DONE) {
-                       if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
+                       if ((now=get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
                                printf("Flash erase timeout at address %lx\n", info->start[sect]);
                                *addr = FLASH_CMD_SUSPEND_ERASE;
                                *addr = FLASH_CMD_RESET;
@@ -307,7 +294,7 @@ write_buff2( volatile FLASH_WORD_SIZE *dst,
                        enable_interrupts();
                }
 
-               if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+               if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
                        return (-1);
                }
        }
@@ -337,7 +324,7 @@ poll_status( volatile FLASH_WORD_SIZE *addr )
                                break;
                        }
                }
-               if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+               if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
                        *addr = FLASH_CMD_RESET;
                        return (-1);
                }
@@ -367,7 +354,7 @@ write_buff(flash_info_t *info, uchar *src, ulong udst, ulong cnt)
        addr = (volatile FLASH_WORD_SIZE *)(info->start[0]);
        dst = (volatile FLASH_WORD_SIZE *) udst;
 
-#ifdef CFG_FLASH_16BIT
+#ifdef CONFIG_SYS_FLASH_16BIT
 #error NYI
 #else
        while (cnt > 0) {
@@ -435,7 +422,7 @@ flash_real_protect(flash_info_t *info, long sector, int prot)
        /* wait for error or finish */
        start = get_timer (0);
        while(!(addr[0] & FLASH_STATUS_DONE)){
-               if (get_timer(start) > CFG_FLASH_ERASE_TOUT) {
+               if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
                        printf("Flash protect timeout at address %lx\n",  info->start[sector]);
                        addr[0] = FLASH_CMD_RESET;
                        return (1);