* Fix flash driver for PCIPPC2: size for AMD_ID_F040B, comments.
* Patch by Chen Yaoming, 1 Feb 2002
Fix flash_real_protect() parameter passing
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
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);
/*-----------------------------------------------------------------------
*/
}
-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;
#endif
- base = (vu_short*)info->start[idx];
+ base = (vu_short*)info->start[sector];
*(base) = 0xffff;
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;
* 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])
}
} 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++)
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;
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);
/* 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;
}
/* Drop out-of-range device numbers
*/
- if (bus < 2 && (dev == 0 || dev > 21))
+ if (bus >= 2 || dev == 0 || dev > 21)
{
return 0;
}
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;
/*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
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
(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
}
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
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
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 */