From efe2a4d5cf96dd37bc4782ba1880cee4ed1117c5 Mon Sep 17 00:00:00 2001 From: wdenk Date: Thu, 16 Dec 2004 21:44:03 +0000 Subject: Code cleanup. --- board/g2000/g2000.c | 34 +++++++++++++++------------------- board/g2000/strataflash.c | 47 ++++++++++++++++++++--------------------------- 2 files changed, 35 insertions(+), 46 deletions(-) (limited to 'board/g2000') diff --git a/board/g2000/g2000.c b/board/g2000/g2000.c index c0b36762b2..5967e90e1e 100644 --- a/board/g2000/g2000.c +++ b/board/g2000/g2000.c @@ -25,7 +25,6 @@ #include #include - #define MEM_MCOPT1_INIT_VAL 0x00800000 #define MEM_RTR_INIT_VAL 0x04070000 #define MEM_PMIT_INIT_VAL 0x07c00000 @@ -34,11 +33,8 @@ #define MEM_SDTR1_INIT_VAL 0x00854005 #define SDRAM0_CFG_ENABLE 0x80000000 - - #define CFG_SDRAM_SIZE 0x04000000 /* 64 MB */ - int board_early_init_f (void) { #if 0 /* test-only */ @@ -119,19 +115,19 @@ int checkboard (void) long int init_sdram_static_settings(void) { #define mtsdram0(reg, data) mtdcr(memcfga,reg);mtdcr(memcfgd,data) - /* disable memcontroller so updates work */ - mtsdram0( mem_mcopt1, MEM_MCOPT1_INIT_VAL ); - mtsdram0( mem_rtr , MEM_RTR_INIT_VAL ); - mtsdram0( mem_pmit , MEM_PMIT_INIT_VAL ); - mtsdram0( mem_mb0cf , MEM_MB0CF_INIT_VAL ); - mtsdram0( mem_mb1cf , MEM_MB1CF_INIT_VAL ); - mtsdram0( mem_sdtr1 , MEM_SDTR1_INIT_VAL ); - - /* SDRAM have a power on delay, 500 micro should do */ - udelay(500); - mtsdram0( mem_mcopt1, MEM_MCOPT1_INIT_VAL|SDRAM0_CFG_ENABLE ); - - return (CFG_SDRAM_SIZE); /* CFG_SDRAM_SIZE is in G2000.h */ + /* disable memcontroller so updates work */ + mtsdram0( mem_mcopt1, MEM_MCOPT1_INIT_VAL ); + mtsdram0( mem_rtr , MEM_RTR_INIT_VAL ); + mtsdram0( mem_pmit , MEM_PMIT_INIT_VAL ); + mtsdram0( mem_mb0cf , MEM_MB0CF_INIT_VAL ); + mtsdram0( mem_mb1cf , MEM_MB1CF_INIT_VAL ); + mtsdram0( mem_sdtr1 , MEM_SDTR1_INIT_VAL ); + + /* SDRAM have a power on delay, 500 micro should do */ + udelay(500); + mtsdram0( mem_mcopt1, MEM_MCOPT1_INIT_VAL|SDRAM0_CFG_ENABLE ); + + return (CFG_SDRAM_SIZE); /* CFG_SDRAM_SIZE is in G2000.h */ } @@ -141,9 +137,9 @@ long int initdram (int board_type) /* flzt, we can still turn this on in the future */ /* #ifdef CONFIG_SPD_EEPROM - ret = spd_sdram (); + ret = spd_sdram (); #else - ret = init_sdram_static_settings(); + ret = init_sdram_static_settings(); #endif */ diff --git a/board/g2000/strataflash.c b/board/g2000/strataflash.c index 06fedeccd3..8446e02106 100644 --- a/board/g2000/strataflash.c +++ b/board/g2000/strataflash.c @@ -85,12 +85,8 @@ #define FLASH_OFFSET_USER_PROTECTION 0x85 #define FLASH_OFFSET_INTEL_PROTECTION 0x81 - #define FLASH_MAN_CFI 0x01000000 - - - typedef union { unsigned char c; unsigned short w; @@ -107,13 +103,10 @@ typedef union { flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ - /*----------------------------------------------------------------------- * Functions */ - - static void flash_add_byte(flash_info_t *info, cfiword_t * cword, uchar c); static void flash_make_cmd(flash_info_t * info, uchar cmd, void * cmdbuf); static void flash_write_cmd(flash_info_t * info, int sect, uchar offset, uchar cmd); @@ -286,28 +279,28 @@ void flash_print_info (flash_info_t *info) int erased; volatile unsigned long *flash; - /* - * Check if whole sector is erased - */ - if (i != (info->sector_count-1)) - size = info->start[i+1] - info->start[i]; - else - size = info->start[0] + info->size - info->start[i]; - erased = 1; - flash = (volatile unsigned long *)info->start[i]; - size = size >> 2; /* divide by 4 for longword access */ - for (k=0; ksector_count-1)) + size = info->start[i+1] - info->start[i]; + else + size = info->start[0] + info->size - info->start[i]; + erased = 1; + flash = (volatile unsigned long *)info->start[i]; + size = size >> 2; /* divide by 4 for longword access */ + for (k=0; kstart[i], erased ? " E" : " ", @@ -464,7 +457,7 @@ static int flash_full_status_check(flash_info_t * info, ulong sector, ulong tout printf("Command Sequence Error.\n"); } else if(flash_isset(info, sector, 0, FLASH_STATUS_ECLBS)){ printf("Block Erase Error.\n"); - retcode = ERR_NOT_ERASED; + retcode = ERR_NOT_ERASED; } else if (flash_isset(info, sector, 0, FLASH_STATUS_PSLBS)) { printf("Locking Error\n"); } -- cgit v1.2.3