From: wdenk Date: Mon, 4 Feb 2002 19:42:06 +0000 (+0000) Subject: * Fix initialization of the Super I/O chip on Sandpoint board X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=db24625e07858f4657f0ea9611ec193afb2ef052;p=users%2Frw%2Fppcboot.git * 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 --- diff --git a/CHANGELOG b/CHANGELOG index 3712036..f21faf6 100644 --- 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 diff --git a/board/flagadm/flash.c b/board/flagadm/flash.c index d577173..5028165 100644 --- a/board/flagadm/flash.c +++ b/board/flagadm/flash.c @@ -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); diff --git a/board/pcippc2/cpc710_pci.c b/board/pcippc2/cpc710_pci.c index 64b5c32..4024489 100644 --- a/board/pcippc2/cpc710_pci.c +++ b/board/pcippc2/cpc710_pci.c @@ -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; } diff --git a/board/pcippc2/flash.c b/board/pcippc2/flash.c index e69df93..877f0e5 100644 --- a/board/pcippc2/flash.c +++ b/board/pcippc2/flash.c @@ -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; diff --git a/board/sandpoint/ns87308.h b/board/sandpoint/ns87308.h index 112c208..f007cbf 100644 --- a/board/sandpoint/ns87308.h +++ b/board/sandpoint/ns87308.h @@ -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 diff --git a/common/cmd_flash.c b/common/cmd_flash.c index 2b621f7..d22b7bf 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -269,7 +269,7 @@ int do_protect(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) for (i=0; isector_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; isector_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 diff --git a/common/flash.c b/common/flash.c index d64356f..0913d25 100644 --- a/common/flash.c +++ b/common/flash.c @@ -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 */