]> www.infradead.org Git - users/rw/ppcboot.git/commitdiff
* Fix initialization of the Super I/O chip on Sandpoint board
authorwdenk <wdenk>
Mon, 4 Feb 2002 19:42:06 +0000 (19:42 +0000)
committerwdenk <wdenk>
Mon, 4 Feb 2002 19:42:06 +0000 (19:42 +0000)
* Fix flash driver for PCIPPC2: size for AMD_ID_F040B, comments.

* Patch by Chen Yaoming, 1 Feb 2002
  Fix flash_real_protect() parameter passing

CHANGELOG
board/flagadm/flash.c
board/pcippc2/cpc710_pci.c
board/pcippc2/flash.c
board/sandpoint/ns87308.h
common/cmd_flash.c
common/flash.c

index 3712036078d937b309d06dea3fabf15d69c213b0..f21faf666c120ed1e0572f2ef66b6905450e59ce 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,13 @@
 Modifications for 1.1.5:
 ======================================================================
 
+* Fix initialization of the Super I/O chip on Sandpoint board
+
+* Fix flash driver for PCIPPC2: size for AMD_ID_F040B, comments.
+
+* Patch by Chen Yaoming, 1 Feb 2002
+  Fix flash_real_protect() parameter passing
+
 * Fix names for 3 Volt Intel StrataFlash (it's ...J3A)
 
 * Make "md" command interruptable by ^C
index d57717365c02958e857b2f5c4407c7a1f7d5f4bd..50281650cd1a9d2217badea0b3b495a825562237 100644 (file)
@@ -34,7 +34,7 @@ static ulong flash_recognize (vu_long *base);
 static int write_word (flash_info_t *info, ulong dest, ulong data);
 static void flash_get_geometry (vu_long *base, flash_info_t *info);
 static void flash_unprotect(flash_info_t *info);
-static int _flash_real_protect(flash_info_t *info, long idx, int prot);
+static int _flash_real_protect(flash_info_t *info, long sector, int prot);
 
 /*-----------------------------------------------------------------------
  */
@@ -90,7 +90,7 @@ unsigned long flash_init (void)
 }
 
 
-int flash_get_protect_status(flash_info_t * info, long idx)
+int flash_get_protect_status(flash_info_t * info, long sector)
 {
        vu_short * base;
        ushort res;
@@ -101,7 +101,7 @@ int flash_get_protect_status(flash_info_t * info, long idx)
 #endif
 
 
-       base = (vu_short*)info->start[idx];
+       base = (vu_short*)info->start[sector];
 
        *(base) = 0xffff;
 
@@ -577,7 +577,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong da)
        return (flag);
 }
 
-int flash_real_protect(flash_info_t *info, long idx, int prot)
+int flash_real_protect(flash_info_t *info, long sector, int prot)
 {
        int i;
 
@@ -586,7 +586,7 @@ int flash_real_protect(flash_info_t *info, long idx, int prot)
                 * and reprotect the other protected sectors.
                 */
                _flash_real_protect(info, 0, 0); /* Unprotects the whole flash*/
-               info->protect[idx] = 0;
+               info->protect[sector] = 0;
 
                for(i = 0; i < info->sector_count; i++) {
                        if(info->protect[i])
@@ -594,7 +594,7 @@ int flash_real_protect(flash_info_t *info, long idx, int prot)
                }
        } else {
                /* We can protect individual sectors */
-               _flash_real_protect(info, idx, 1);
+               _flash_real_protect(info, sector, 1);
        }
 
        for( i = 0; i < info->sector_count; i++)
@@ -603,7 +603,7 @@ int flash_real_protect(flash_info_t *info, long idx, int prot)
        return 0;
 }
 
-static int _flash_real_protect(flash_info_t *info, long idx, int prot)
+static int _flash_real_protect(flash_info_t *info, long sector, int prot)
 {
        vu_short *addr;
        int flag;
@@ -625,7 +625,7 @@ static int _flash_real_protect(flash_info_t *info, long idx, int prot)
                cmd = 0x0001;
        }
 
-       addr = (vu_short *)(info->start[idx]);
+       addr = (vu_short *)(info->start[sector]);
 
        /* If chip is busy, wait for it */
        start = get_timer(0);
index 64b5c32e6f8f57640d17d00047088a476ceabc9f..402448982fa6fb4a757e7f5c572f295f438bf164 100644 (file)
@@ -245,7 +245,7 @@ unsigned int PCI_Read_CFG_Reg (
 
     /* Drop out-of-range device numbers
      */
-  if (bus < 2 && (dev == 0 || dev > 21))
+  if (bus >= 2 || dev == 0 || dev > 21)
   {
     return (1 << (8 * width)) - 1;
   }
@@ -289,7 +289,7 @@ int PCI_Write_CFG_Reg (
 
     /* Drop out-of-range device numbers
      */
-  if (bus < 2 && (dev == 0 || dev > 21))
+  if (bus >= 2 || dev == 0 || dev > 21)
   {
     return 0;
   }
index e69df933d45e87071a8e3792f414628ad8ab5882..877f0e5ff751d040393bb04fae4460ee15d50bd4 100644 (file)
@@ -124,14 +124,14 @@ static ulong flash_get_size (u32 addr, flash_info_t *info)
                case AMD_ID_F040B:
                        info->flash_id += FLASH_AM040;
                        info->sector_count = 8;
-                       info->size = 0x00200000;
-                       break;                  /* => 2 MB              */
+                       info->size = 0x00080000;
+                       break;                  /* => 512 kB            */
 
                case AMD_ID_LV040B:
                        info->flash_id += FLASH_AM040;
                        info->sector_count = 8;
-                       info->size = 0x80000;
-                       break;
+                       info->size = 0x00080000;
+                       break;                  /* => 512 kB            */
 
                case AMD_ID_LV400T:
                        info->flash_id += FLASH_AM400T;
index 112c20858f515d3cde6a664e52094f9447afe2bf..f007cbf830b3112b1e069049f3df7a91135e096c 100644 (file)
@@ -69,9 +69,9 @@
 /*vendor defined values */
 #define SID_REG             0x20
 #define SUPOERIO_CONF1      0x21
-#define SUPOERIO_CONF2      0x21
-#define PGCS_INDEX          0x22
-#define PGCS_DATA           0x22
+#define SUPOERIO_CONF2      0x22
+#define PGCS_INDEX          0x23
+#define PGCS_DATA           0x24
 
 /* values above 30 are different for each logical device
    but I can't be arsed to enter them all. the ones here
index 2b621f7023a819c05067ed1d6418c4993472fe00..d22b7bfab056421cf96942ecc25baaac522b1ac5 100644 (file)
@@ -269,7 +269,7 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 
                        for (i=0; i<info->sector_count; ++i) {
 #if defined(CFG_FLASH_PROTECTION)
-                               if (flash_real_protect(info, info->start[i], p))
+                               if (flash_real_protect(info, i, p))
                                        rcode = 1;
                                putc ('.');
 #else
@@ -295,7 +295,7 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                        (info-flash_info)+1);
                for (i = sect_first; i <= sect_last; i++) {
 #if defined(CFG_FLASH_PROTECTION)
-                       if (flash_real_protect(info, info->start[i], p))
+                       if (flash_real_protect(info, i, p))
                                rcode =  1;
                        putc ('.');
 #else
@@ -332,7 +332,7 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                }
                for (i=0; i<info->sector_count; ++i) {
 #if defined(CFG_FLASH_PROTECTION)
-                       if (flash_real_protect(info, info->start[i], p))
+                       if (flash_real_protect(info, i, p))
                                rcode =  1;
                        putc ('.');
 #else
@@ -404,7 +404,7 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
                        protected += s_last - s_first + 1;
                        for (i=s_first; i<=s_last; ++i) {
 #if defined(CFG_FLASH_PROTECTION)
-                               if (flash_real_protect(info, info->start[i], p))
+                               if (flash_real_protect(info, i, p))
                                        rcode = 1;
                                putc ('.');
 #else
index d64356f6a6285b5cba39a48bdcb92eb418757c91..0913d2573aa967d5cd90ca62e58b147bc7406e91 100644 (file)
@@ -67,14 +67,14 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
                if (from <= end && to >= info->start[i]) {
                        if (flag & FLAG_PROTECT_CLEAR) {
 #if defined(CFG_FLASH_PROTECTION)
-                               flash_real_protect(info, info->start[i], 0);
+                               flash_real_protect(info, i, 0);
 #else
                                info->protect[i] = 0;
 #endif /* CFG_FLASH_PROTECTION */
                        }
                        else if (flag & FLAG_PROTECT_SET) {
 #if defined(CFG_FLASH_PROTECTION)
-                               flash_real_protect(info, info->start[i], 1);
+                               flash_real_protect(info, i, 1);
 #else
                                info->protect[i] = 1;
 #endif /* CFG_FLASH_PROTECTION */