]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - board/logodl/flash.c
rename CFG_ macros to CONFIG_SYS
[people/ms/u-boot.git] / board / logodl / flash.c
index 3837401fd34de6452a1f7b2f60bb963b0a2e948f..593943ffda86dff47b7994bb9975789745aa7e70 100644 (file)
@@ -28,7 +28,7 @@
 #define FLASH_BANK_SIZE 0x1000000
 #define MAIN_SECT_SIZE  0x20000                /* 2x64k = 128k per sector */
 
-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   */
 
 /* NOTE - CONFIG_FLASH_16BIT means the CPU interface is 16-bit, it
  *        has nothing to do with the flash chip being 8-bit or 16-bit.
@@ -59,7 +59,7 @@ static int write_word_intel(flash_info_t *info, FPWV *dest, FPW data);
 static int write_word_amd(flash_info_t *info, FPWV *dest, FPW data);
 #define write_word(in, de, da)   write_word_amd(in, de, da)
 static void flash_get_offsets(ulong base, flash_info_t *info);
-#ifdef CFG_FLASH_PROTECTION
+#ifdef CONFIG_SYS_FLASH_PROTECTION
 static void flash_sync_real_protect(flash_info_t *info);
 #endif
 
@@ -73,27 +73,27 @@ ulong flash_init(void)
     int i, j;
     ulong size = 0;
 
-    for (i = 0; i < CFG_MAX_FLASH_BANKS; i++)
+    for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++)
     {
        ulong flashbase = 0;
        flash_info[i].flash_id =
          (FLASH_MAN_AMD & FLASH_VENDMASK) |
          (FLASH_AM640U & FLASH_TYPEMASK);
        flash_info[i].size = FLASH_BANK_SIZE;
-       flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
-       memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
-        switch (i)
-        {
-           case 0:
-               flashbase = PHYS_FLASH_1;
-                break;
-           case 1:
-               flashbase = PHYS_FLASH_2;
-                break;
-           default:
-               panic("configured to many flash banks!\n");
-                break;
-        }
+       flash_info[i].sector_count = CONFIG_SYS_MAX_FLASH_SECT;
+       memset(flash_info[i].protect, 0, CONFIG_SYS_MAX_FLASH_SECT);
+       switch (i)
+       {
+          case 0:
+               flashbase = PHYS_FLASH_1;
+               break;
+          case 1:
+               flashbase = PHYS_FLASH_2;
+               break;
+          default:
+               panic("configured too many flash banks!\n");
+               break;
+       }
        for (j = 0; j < flash_info[i].sector_count; j++)
        {
            flash_info[i].start[j] = flashbase + j*MAIN_SECT_SIZE;
@@ -104,13 +104,13 @@ ulong flash_init(void)
     /* Protect monitor and environment sectors
      */
     flash_protect(FLAG_PROTECT_SET,
-                 CFG_FLASH_BASE,
-                 CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
+                 CONFIG_SYS_FLASH_BASE,
+                 CONFIG_SYS_FLASH_BASE + _bss_start - _armboot_start,
                  &flash_info[0]);
 
     flash_protect(FLAG_PROTECT_SET,
-                 CFG_ENV_ADDR,
-                 CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
+                 CONFIG_ENV_ADDR,
+                 CONFIG_ENV_ADDR + CONFIG_ENV_SIZE - 1,
                  &flash_info[0]);
 
     return size;
@@ -208,32 +208,32 @@ void flash_print_info (flash_info_t *info)
        case FLASH_AM640U:
                fmt = "29LV641D (64 Mbit, uniform sectors)\n";
                break;
-        case FLASH_28F800C3B:
-        case FLASH_28F800C3T:
+       case FLASH_28F800C3B:
+       case FLASH_28F800C3T:
                fmt = "28F800C3%s (8 Mbit, %s)\n";
                break;
        case FLASH_INTEL800B:
        case FLASH_INTEL800T:
                fmt = "28F800B3%s (8 Mbit, %s)\n";
                break;
-        case FLASH_28F160C3B:
-        case FLASH_28F160C3T:
+       case FLASH_28F160C3B:
+       case FLASH_28F160C3T:
                fmt = "28F160C3%s (16 Mbit, %s)\n";
                break;
        case FLASH_INTEL160B:
        case FLASH_INTEL160T:
                fmt = "28F160B3%s (16 Mbit, %s)\n";
                break;
-        case FLASH_28F320C3B:
-        case FLASH_28F320C3T:
+       case FLASH_28F320C3B:
+       case FLASH_28F320C3T:
                fmt = "28F320C3%s (32 Mbit, %s)\n";
                break;
        case FLASH_INTEL320B:
        case FLASH_INTEL320T:
                fmt = "28F320B3%s (32 Mbit, %s)\n";
                break;
-        case FLASH_28F640C3B:
-        case FLASH_28F640C3T:
+       case FLASH_28F640C3B:
+       case FLASH_28F640C3T:
                fmt = "28F640C3%s (64 Mbit, %s)\n";
                break;
        case FLASH_INTEL640B:
@@ -373,7 +373,7 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info)
        return (info->size);
 }
 
-#ifdef CFG_FLASH_PROTECTION
+#ifdef CONFIG_SYS_FLASH_PROTECTION
 /*-----------------------------------------------------------------------
  */
 
@@ -510,7 +510,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
                udelay (1000);
 
                while ((*addr & (FPW)0x00800080) != (FPW)0x00800080) {
-                       if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
+                       if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
                                printf ("Timeout\n");
 
                                if (intel) {
@@ -554,15 +554,15 @@ int bad_write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
         left > 0 && res == 0;
         addr += sizeof(data), left -= sizeof(data) - bytes) {
 
-        bytes = addr & (sizeof(data) - 1);
-        addr &= ~(sizeof(data) - 1);
+       bytes = addr & (sizeof(data) - 1);
+       addr &= ~(sizeof(data) - 1);
 
        /* combine source and destination data so can program
         * an entire word of 16 or 32 bits
         */
-        for (i = 0; i < sizeof(data); i++) {
-            data <<= 8;
-            if (i < bytes || i - bytes >= left )
+       for (i = 0; i < sizeof(data); i++) {
+           data <<= 8;
+           if (i < bytes || i - bytes >= left )
                data += *((uchar *)addr + i);
            else
                data += *src++;
@@ -593,7 +593,7 @@ int bad_write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
  * @param info:
  * @param src: source of copy transaction
  * @param addr:        where to copy to
- * @param cnt:         number of bytes to copy
+ * @param cnt: number of bytes to copy
  *
  * @return     error code
  */
@@ -662,7 +662,6 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 }
 
 
-
 /*-----------------------------------------------------------------------
  * Write a word to Flash for AMD FLASH
  * A word is 16 or 32 bits, whichever the bus width of the flash bank
@@ -704,7 +703,7 @@ static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data)
 
     /* data polling for D7 */
     while (res == 0 && (*dest & (FPW)0x00800080) != (data & (FPW)0x00800080)) {
-       if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+       if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
            *dest = (FPW)0x00F000F0;    /* reset bank */
            res = 1;
        }
@@ -750,7 +749,7 @@ static int write_word_intel (flash_info_t *info, FPWV *dest, FPW data)
     start = get_timer (0);
 
     while (res == 0 && (*dest & (FPW)0x00800080) != (FPW)0x00800080) {
-       if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
+       if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
            *dest = (FPW)0x00B000B0;    /* Suspend program      */
            res = 1;
        }
@@ -765,7 +764,7 @@ static int write_word_intel (flash_info_t *info, FPWV *dest, FPW data)
     return (res);
 }
 
-#ifdef CFG_FLASH_PROTECTION
+#ifdef CONFIG_SYS_FLASH_PROTECTION
 /*-----------------------------------------------------------------------
  */
 int flash_real_protect (flash_info_t * info, long sector, int prot)