Merge branch 'master' of /home/wd/git/u-boot/custodians
[oweals/u-boot.git] / board / mp2usb / flash.c
index 070dbf62c49f7ac503afc35f0feafe858fefe8bb..527e74ef13cef97d5a2bf14cea76d09992624399 100644 (file)
@@ -98,8 +98,8 @@ unsigned long flash_init (void)
                        &flash_info[0] );
 
        flash_protect ( FLAG_PROTECT_SET,
-                       CFG_ENV_ADDR,
-                       CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0] );
+                       CONFIG_ENV_ADDR,
+                       CONFIG_ENV_ADDR + CONFIG_ENV_SIZE - 1, &flash_info[0] );
 
        return size;
 }
@@ -237,7 +237,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
-       int flag, prot, sect;
+       int prot, sect;
        ulong type, start, last;
        int rcode = 0;
        int cflag, iflag;
@@ -284,10 +284,8 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
         */
        cflag = icache_status ();
        icache_disable ();
-       iflag = disable_interrupts ();
-
        /* Disable interrupts which might cause a timeout here */
-/*     flag = disable_interrupts (); */
+       iflag = disable_interrupts ();
 
        /* Start erase on unprotected sectors */
        for (sect = s_first; sect <= s_last; sect++) {
@@ -314,8 +312,8 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
                                }
                        }
 
-                       *addr = INTEL_CLEAR;    /* clear status register cmd.   */
-                       *addr = INTEL_RESET;    /* resest to read mode          */
+                       *addr = (FPWV)INTEL_CLEAR;      /* clear status register cmd.   */
+                       *addr = (FPWV)INTEL_RESET;      /* resest to read mode          */
 
                        printf (" done\n");
                }
@@ -425,11 +423,10 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
        FPWV *addr = (FPWV *) dest;
        ulong status;
        int cflag, iflag;
-       int flag;
 
        /* Check if Flash is (sufficiently) erased */
        if ((*addr & data) != data) {
-               printf ("not erased at %08lx (%lx)\n", (ulong) addr, *addr);
+               printf ("not erased at %08lx (%lx)\n", (ulong) addr, (ulong) *addr);
                return (2);
        }
        /*
@@ -441,10 +438,8 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
         */
        cflag = icache_status ();
        icache_disable ();
-       iflag = disable_interrupts ();
-
        /* Disable interrupts which might cause a timeout here */
-       /*flag = disable_interrupts (); */
+       iflag = disable_interrupts ();
 
        *addr = (FPW) INTEL_PROG;       /* write setup */
        *addr = data;