* Patch by Jian Zhang, 3 Feb 2004:

- Changed the incorrect FAT12BUFSIZE
  - data_begin in fsdata can be negative. Changed it to be short.
* Code cleanup
This commit is contained in:
wdenk
2004-02-10 00:03:41 +00:00
parent ec4c544bed
commit cd37d9e6e5
9 changed files with 45 additions and 49 deletions

View File

@ -2,6 +2,10 @@
Changes since U-Boot 1.0.1: Changes since U-Boot 1.0.1:
====================================================================== ======================================================================
* Patch by Jian Zhang, 3 Feb 2004:
- Changed the incorrect FAT12BUFSIZE
- data_begin in fsdata can be negative. Changed it to be short.
* Patches by Stephan Linz, 30 Jan 2004: * Patches by Stephan Linz, 30 Jan 2004:
1: - board/altera/common/flash.c:flash_erase(): 1: - board/altera/common/flash.c:flash_erase():
o allow interrupts befor get_timer() call o allow interrupts befor get_timer() call

View File

@ -113,7 +113,7 @@ long int initdram (int board_type)
memctl->memc_mptpr = 0x0200; /* divide by 32 */ memctl->memc_mptpr = 0x0200; /* divide by 32 */
memctl->memc_mamr = 0x18003112; /*CFG_MAMR_8COL; *//* 0x18005112 TODO: explain here */ memctl->memc_mamr = 0x18003112; /*CFG_MAMR_8COL; */ /* 0x18005112 TODO: explain here */
upmconfig (UPMA, (uint *) sdram_table, upmconfig (UPMA, (uint *) sdram_table,
sizeof (sdram_table) / sizeof (uint)); sizeof (sdram_table) / sizeof (uint));

View File

@ -19,7 +19,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
@ -32,7 +32,7 @@
#include <linux/byteorder/swab.h> #include <linux/byteorder/swab.h>
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */ #define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
/* Board support for 1 or 2 flash devices */ /* Board support for 1 or 2 flash devices */
#undef FLASH_PORT_WIDTH32 #undef FLASH_PORT_WIDTH32
@ -120,13 +120,13 @@ unsigned long flash_init (void)
*/ */
flash_unlock(flash_info_t * info) flash_unlock(flash_info_t * info)
{ {
int j; int j;
for (j=2;j<CFG_MAX_FLASH_SECT;j++){ for (j=2;j<CFG_MAX_FLASH_SECT;j++){
FPWV *addr = (FPWV *) (info->start[j]); FPWV *addr = (FPWV *) (info->start[j]);
flash_unprotect_sectors (addr); flash_unprotect_sectors (addr);
*addr = (FPW) 0x00500050;/* clear status register */ *addr = (FPW) 0x00500050;/* clear status register */
*addr = (FPW) 0x00FF00FF;/* resest to read mode */ *addr = (FPW) 0x00FF00FF;/* resest to read mode */
} }
} }
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
@ -192,7 +192,7 @@ void flash_print_info (flash_info_t * info)
if ((i % 5) == 0) if ((i % 5) == 0)
printf ("\n "); printf ("\n ");
printf (" %08lX%s", printf (" %08lX%s",
info->start[i], info->protect[i] ? " (RO)" : " "); info->start[i], info->protect[i] ? " (RO)" : " ");
} }
printf ("\n"); printf ("\n");
return; return;
@ -224,18 +224,18 @@ static ulong flash_get_size (FPW * addr, flash_info_t * info)
info->sector_count = 0; info->sector_count = 0;
info->size = 0; info->size = 0;
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */ addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
return (0); /* no or unknown flash */ return (0); /* no or unknown flash */
} }
mb (); mb ();
value = addr[1]; /* device ID */ value = addr[1]; /* device ID */
switch (value) { switch (value) {
case (FPW) (INTEL_ID_28F256L18T): case (FPW) (INTEL_ID_28F256L18T):
info->flash_id += FLASH_28F256L18T; info->flash_id += FLASH_28F256L18T;
info->sector_count = 259; info->sector_count = 259;
info->size = 0x02000000; info->size = 0x02000000;
break; /* => 32 MB */ break; /* => 32 MB */
default: default:
info->flash_id = FLASH_UNKNOWN; info->flash_id = FLASH_UNKNOWN;
@ -318,7 +318,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
/* Start erase on unprotected sectors */ /* Start erase on unprotected sectors */
for (sect = s_first; sect <= s_last; sect++) { for (sect = s_first; sect <= s_last; sect++) {
if (info->protect[sect] == 0) { /* not protected */ if (info->protect[sect] == 0) { /* not protected */
FPWV *addr = (FPWV *) (info->start[sect]); FPWV *addr = (FPWV *) (info->start[sect]);
FPW status; FPW status;
@ -348,7 +348,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
} }
} }
/* clear status register cmd. */ /* clear status register cmd. */
*addr = (FPW) 0x00500050; *addr = (FPW) 0x00500050;
*addr = (FPW) 0x00FF00FF;/* resest to read mode */ *addr = (FPW) 0x00FF00FF;/* resest to read mode */
printf (" done\n"); printf (" done\n");

View File

@ -860,7 +860,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
} }
for (info = info_first; info <= info_last; ++info) { for (info = info_first; info <= info_last; ++info) {
ulong b_end = info->start[0] + info->size;*//* bank end addr */ ulong b_end = info->start[0] + info->size;*/ /* bank end addr */
/* short s_end = info->sector_count - 1; /* short s_end = info->sector_count - 1;
for (i=0; i<info->sector_count; ++i) { for (i=0; i<info->sector_count; ++i) {
ulong e_addr = (i == s_end) ? b_end : info->start[i + 1]; ulong e_addr = (i == s_end) ? b_end : info->start[i + 1];
@ -872,7 +872,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
} }
} }
*//* finally write data to flash */ */ /* finally write data to flash */
/* for (info = info_first; info <= info_last && cnt>0; ++info) { /* for (info = info_first; info <= info_last && cnt>0; ++info) {
ulong len; ulong len;

View File

@ -84,7 +84,7 @@
"cp.b 80400000 BFC60000 $(filesize)\0" \ "cp.b 80400000 BFC60000 $(filesize)\0" \
"initenv=erase bfc40000 bfc5ffff\0" \ "initenv=erase bfc40000 bfc5ffff\0" \
"" ""
//#define CONFIG_BOOTCOMMAND "run flash_local" /*#define CONFIG_BOOTCOMMAND "run flash_local" */
#define CONFIG_BOOTCOMMAND "run netboot" #define CONFIG_BOOTCOMMAND "run netboot"
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \ #define CONFIG_COMMANDS (CONFIG_CMD_DFL | \

View File

@ -43,7 +43,7 @@
#define FATBUFBLOCKS 6 #define FATBUFBLOCKS 6
#define FATBUFSIZE (FS_BLOCK_SIZE*FATBUFBLOCKS) #define FATBUFSIZE (FS_BLOCK_SIZE*FATBUFBLOCKS)
#define FAT12BUFSIZE ((FATBUFSIZE*3)/2) #define FAT12BUFSIZE ((FATBUFSIZE*2)/3)
#define FAT16BUFSIZE (FATBUFSIZE/2) #define FAT16BUFSIZE (FATBUFSIZE/2)
#define FAT32BUFSIZE (FATBUFSIZE/4) #define FAT32BUFSIZE (FATBUFSIZE/4)
@ -176,7 +176,7 @@ typedef struct {
__u16 fat_sect; /* Starting sector of the FAT */ __u16 fat_sect; /* Starting sector of the FAT */
__u16 rootdir_sect; /* Start sector of root directory */ __u16 rootdir_sect; /* Start sector of root directory */
__u16 clust_size; /* Size of clusters in sectors */ __u16 clust_size; /* Size of clusters in sectors */
__u16 data_begin; /* The sector of the first cluster */ short data_begin; /* The sector of the first cluster, can be negative */
__u8 fatbuf[FATBUFSIZE]; /* Current FAT buffer */ __u8 fatbuf[FATBUFSIZE]; /* Current FAT buffer */
int fatbufnum; /* Used by get_fatent, init to -1 */ int fatbufnum; /* Used by get_fatent, init to -1 */
} fsdata; } fsdata;

View File

@ -74,10 +74,6 @@ static unsigned char bcd2bin (unsigned char c);
static unsigned char rtc_read (unsigned char reg); static unsigned char rtc_read (unsigned char reg);
static void rtc_write (unsigned char reg, unsigned char val); static void rtc_write (unsigned char reg, unsigned char val);
/* ************************************************************************* */ /* ************************************************************************* */
#ifdef CONFIG_SXNI855T /* !!! SHOULD BE CHANGED TO NEW CODE !!! */ #ifdef CONFIG_SXNI855T /* !!! SHOULD BE CHANGED TO NEW CODE !!! */
@ -306,10 +302,6 @@ void rtc_reset (void)
#else /* not CONFIG_SXNI855T */ #else /* not CONFIG_SXNI855T */
/* ************************************************************************* */ /* ************************************************************************* */
/* read clock time from DS1306 and return it in *tmp */ /* read clock time from DS1306 and return it in *tmp */
void rtc_get (struct rtc_time *tmp) void rtc_get (struct rtc_time *tmp)
{ {