提交 a5593171 编写于 作者: J Jean-Christophe PLAGNIOL-VILLARD 提交者: Wolfgang Denk

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: NJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
上级 91f22131
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#define PROBE_BUFFER_SIZE 1024 #define PROBE_BUFFER_SIZE 1024
static unsigned char buffer[PROBE_BUFFER_SIZE]; static unsigned char buffer[PROBE_BUFFER_SIZE];
#define SC520_MAX_FLASH_BANKS 1 #define SC520_MAX_FLASH_BANKS 1
#define SC520_FLASH_BANK0_BASE 0x38000000 /* BOOTCS */ #define SC520_FLASH_BANK0_BASE 0x38000000 /* BOOTCS */
#define SC520_FLASH_BANKSIZE 0x8000000 #define SC520_FLASH_BANKSIZE 0x8000000
...@@ -62,7 +61,6 @@ flash_info_t flash_info[SC520_MAX_FLASH_BANKS]; ...@@ -62,7 +61,6 @@ flash_info_t flash_info[SC520_MAX_FLASH_BANKS];
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
*/ */
static u32 _probe_flash(u32 addr, u32 bw, int il) static u32 _probe_flash(u32 addr, u32 bw, int il)
{ {
u32 result=0; u32 result=0;
...@@ -180,7 +178,6 @@ static u32 _probe_flash(u32 addr, u32 bw, int il) ...@@ -180,7 +178,6 @@ static u32 _probe_flash(u32 addr, u32 bw, int il)
break; break;
} }
return result; return result;
} }
...@@ -215,11 +212,9 @@ static int identify_flash(unsigned address, int width) ...@@ -215,11 +212,9 @@ static int identify_flash(unsigned address, int width)
enable_interrupts(); enable_interrupts();
} }
vendor = res >> 16; vendor = res >> 16;
device = res & 0xffff; device = res & 0xffff;
return res; return res;
} }
...@@ -385,7 +380,6 @@ void flash_print_info(flash_info_t *info) ...@@ -385,7 +380,6 @@ void flash_print_info(flash_info_t *info)
break; break;
} }
printf(" Size: %ld MB in %d Sectors\n", printf(" Size: %ld MB in %d Sectors\n",
info->size >> 20, info->sector_count); info->size >> 20, info->sector_count);
...@@ -399,13 +393,13 @@ void flash_print_info(flash_info_t *info) ...@@ -399,13 +393,13 @@ void flash_print_info(flash_info_t *info)
} }
printf ("\n"); printf ("\n");
done: done:
return;
} }
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
*/ */
static u32 _amd_erase_flash(u32 addr, u32 sector) static u32 _amd_erase_flash(u32 addr, u32 sector)
{ {
unsigned elapsed; unsigned elapsed;
...@@ -467,7 +461,6 @@ static u32 _intel_erase_flash(u32 addr, u32 sector) ...@@ -467,7 +461,6 @@ static u32 _intel_erase_flash(u32 addr, u32 sector)
*(volatile u16*)(addr + sector) = 0x0020; /* erase setup */ *(volatile u16*)(addr + sector) = 0x0020; /* erase setup */
*(volatile u16*)(addr + sector) = 0x00D0; /* erase confirm */ *(volatile u16*)(addr + sector) = 0x00D0; /* erase confirm */
/* Wait at least 80us - let's wait 1 ms */ /* Wait at least 80us - let's wait 1 ms */
__udelay(1000); __udelay(1000);
...@@ -486,7 +479,6 @@ static u32 _intel_erase_flash(u32 addr, u32 sector) ...@@ -486,7 +479,6 @@ static u32 _intel_erase_flash(u32 addr, u32 sector)
return 0; return 0;
} }
extern int _intel_erase_flash_end; extern int _intel_erase_flash_end;
asm ("_intel_erase_flash_end:\n" asm ("_intel_erase_flash_end:\n"
".long 0\n"); ".long 0\n");
...@@ -548,7 +540,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) ...@@ -548,7 +540,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
printf ("\n"); printf ("\n");
} }
/* 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++) {
...@@ -566,7 +557,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) ...@@ -566,7 +557,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
enable_interrupts(); enable_interrupts();
} }
if (res) { if (res) {
printf("Erase timed out, sector %d\n", sect); printf("Erase timed out, sector %d\n", sect);
return res; return res;
...@@ -576,7 +566,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) ...@@ -576,7 +566,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
} }
} }
return 0; return 0;
} }
...@@ -586,11 +575,11 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) ...@@ -586,11 +575,11 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
* 1 - write timeout * 1 - write timeout
* 2 - Flash not erased * 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 *addr2 = (volatile u16*)start;
volatile u16 *dest2 = (u16*)dest; volatile u16 *dest2 = (volatile u16*)dest;
volatile u16 *data2 = (u16*)&data; volatile u16 *data2 = (volatile u16*)&data;
int i; int i;
unsigned elapsed; unsigned elapsed;
...@@ -601,7 +590,6 @@ static int _amd_write_word(unsigned start, unsigned dest, unsigned data) ...@@ -601,7 +590,6 @@ static int _amd_write_word(unsigned start, unsigned dest, unsigned data)
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
addr2[0x5555] = 0x00AA; addr2[0x5555] = 0x00AA;
addr2[0x2aaa] = 0x0055; addr2[0x2aaa] = 0x0055;
addr2[0x5555] = 0x00A0; addr2[0x5555] = 0x00A0;
...@@ -630,7 +618,6 @@ extern int _amd_write_word_end; ...@@ -630,7 +618,6 @@ extern int _amd_write_word_end;
asm ("_amd_write_word_end:\n" asm ("_amd_write_word_end:\n"
".long 0\n"); ".long 0\n");
static int _intel_write_word(unsigned start, unsigned dest, unsigned data) static int _intel_write_word(unsigned start, unsigned dest, unsigned data)
{ {
int i; int i;
...@@ -663,14 +650,12 @@ static int _intel_write_word(unsigned start, unsigned dest, unsigned data) ...@@ -663,14 +650,12 @@ static int _intel_write_word(unsigned start, unsigned dest, unsigned data)
return 0; return 0;
} }
extern int _intel_write_word_end; extern int _intel_write_word_end;
asm ("_intel_write_word_end:\n" asm ("_intel_write_word_end:\n"
".long 0\n"); ".long 0\n");
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
* Copy memory to flash, returns: * Copy memory to flash, returns:
* 0 - OK * 0 - OK
...@@ -715,10 +700,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) ...@@ -715,10 +700,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
return 3; return 3;
} }
wp = (addr & ~3); /* get lower word aligned address */ wp = (addr & ~3); /* get lower word aligned address */
/* /*
* handle unaligned start bytes * handle unaligned start bytes
*/ */
...@@ -805,5 +788,4 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) ...@@ -805,5 +788,4 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
} }
return rc; return rc;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册