diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2008-05-18 19:09:56 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-05-19 00:56:49 +0200 |
commit | a559317143b4f95927b08cd388707e6f077e95fa (patch) | |
tree | 4646bc010504ece41392eb61e9e1ee2cbfe72598 /board | |
parent | 91f221317af64191ee8caf303ea9305943158691 (diff) | |
download | u-boot-imx-a559317143b4f95927b08cd388707e6f077e95fa.zip u-boot-imx-a559317143b4f95927b08cd388707e6f077e95fa.tar.gz u-boot-imx-a559317143b4f95927b08cd388707e6f077e95fa.tar.bz2 |
sc520_spunk: Fix flash
flash.c:593: warning: dereferencing type-punned pointer will break strict-aliasing rules
flash.c:398: error: label at end of compound statement
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/sc520_spunk/flash.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/board/sc520_spunk/flash.c b/board/sc520_spunk/flash.c index 4942e59..0b4bf68 100644 --- a/board/sc520_spunk/flash.c +++ b/board/sc520_spunk/flash.c @@ -33,7 +33,6 @@ #define PROBE_BUFFER_SIZE 1024 static unsigned char buffer[PROBE_BUFFER_SIZE]; - #define SC520_MAX_FLASH_BANKS 1 #define SC520_FLASH_BANK0_BASE 0x38000000 /* BOOTCS */ #define SC520_FLASH_BANKSIZE 0x8000000 @@ -62,7 +61,6 @@ flash_info_t flash_info[SC520_MAX_FLASH_BANKS]; /*----------------------------------------------------------------------- */ - static u32 _probe_flash(u32 addr, u32 bw, int il) { u32 result=0; @@ -180,7 +178,6 @@ static u32 _probe_flash(u32 addr, u32 bw, int il) break; } - return result; } @@ -215,11 +212,9 @@ static int identify_flash(unsigned address, int width) enable_interrupts(); } - vendor = res >> 16; device = res & 0xffff; - return res; } @@ -385,7 +380,6 @@ void flash_print_info(flash_info_t *info) break; } - printf(" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count); @@ -399,13 +393,13 @@ void flash_print_info(flash_info_t *info) } printf ("\n"); - done: +done: + return; } /*----------------------------------------------------------------------- */ - static u32 _amd_erase_flash(u32 addr, u32 sector) { unsigned elapsed; @@ -467,7 +461,6 @@ static u32 _intel_erase_flash(u32 addr, u32 sector) *(volatile u16*)(addr + sector) = 0x0020; /* erase setup */ *(volatile u16*)(addr + sector) = 0x00D0; /* erase confirm */ - /* Wait at least 80us - let's wait 1 ms */ __udelay(1000); @@ -486,7 +479,6 @@ static u32 _intel_erase_flash(u32 addr, u32 sector) return 0; } - extern int _intel_erase_flash_end; asm ("_intel_erase_flash_end:\n" ".long 0\n"); @@ -548,7 +540,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) printf ("\n"); } - /* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last; sect++) { @@ -566,7 +557,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) enable_interrupts(); } - if (res) { printf("Erase timed out, sector %d\n", sect); return res; @@ -576,7 +566,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) } } - return 0; } @@ -586,11 +575,11 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) * 1 - write timeout * 2 - Flash not erased */ -static int _amd_write_word(unsigned start, unsigned dest, unsigned data) +static int _amd_write_word(unsigned start, unsigned dest, u16 data) { - volatile u16 *addr2 = (u16*)start; - volatile u16 *dest2 = (u16*)dest; - volatile u16 *data2 = (u16*)&data; + volatile u16 *addr2 = (volatile u16*)start; + volatile u16 *dest2 = (volatile u16*)dest; + volatile u16 *data2 = (volatile u16*)&data; int i; unsigned elapsed; @@ -601,7 +590,6 @@ static int _amd_write_word(unsigned start, unsigned dest, unsigned data) for (i = 0; i < 2; i++) { - addr2[0x5555] = 0x00AA; addr2[0x2aaa] = 0x0055; addr2[0x5555] = 0x00A0; @@ -630,7 +618,6 @@ extern int _amd_write_word_end; asm ("_amd_write_word_end:\n" ".long 0\n"); - static int _intel_write_word(unsigned start, unsigned dest, unsigned data) { int i; @@ -663,14 +650,12 @@ static int _intel_write_word(unsigned start, unsigned dest, unsigned data) return 0; - } extern int _intel_write_word_end; asm ("_intel_write_word_end:\n" ".long 0\n"); - /*----------------------------------------------------------------------- * Copy memory to flash, returns: * 0 - OK @@ -715,10 +700,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) return 3; } - wp = (addr & ~3); /* get lower word aligned address */ - /* * handle unaligned start bytes */ @@ -805,5 +788,4 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) } return rc; - } |