summaryrefslogtreecommitdiff
path: root/board/eric/flash.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-27 21:31:46 +0000
committerwdenk <wdenk>2003-06-27 21:31:46 +0000
commit8bde7f776c77b343aca29b8c7b58464d915ac245 (patch)
tree20f1fd99975215e7c658454a15cdb4ed4694e2d4 /board/eric/flash.c
parent993cad9364c6b87ae429d1ed1130d8153f6f027e (diff)
* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
Diffstat (limited to 'board/eric/flash.c')
-rw-r--r--board/eric/flash.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/board/eric/flash.c b/board/eric/flash.c
index 5dfb620c6c..c08a760266 100644
--- a/board/eric/flash.c
+++ b/board/eric/flash.c
@@ -57,8 +57,8 @@ unsigned long flash_init (void)
{
unsigned long size_b0, size_b1;
int i;
- uint pbcr;
- unsigned long base_b0, base_b1;
+ uint pbcr;
+ unsigned long base_b0, base_b1;
/* Init: no FLASHes known */
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
@@ -88,9 +88,9 @@ unsigned long flash_init (void)
&flash_info[0]);
#else
(void)flash_protect(FLAG_PROTECT_SET,
- CFG_MONITOR_BASE,
- CFG_MONITOR_BASE+monitor_flash_len-1,
- &flash_info[0]);
+ CFG_MONITOR_BASE,
+ CFG_MONITOR_BASE+monitor_flash_len-1,
+ &flash_info[0]);
#endif
size_b1 = 0 ;
flash_info[0].size = size_b0;
@@ -137,9 +137,9 @@ unsigned long flash_init (void)
&flash_info[0]);
#else
(void)flash_protect(FLAG_PROTECT_SET,
- CFG_MONITOR_BASE,
- CFG_MONITOR_BASE+monitor_flash_len-1,
- &flash_info[0]);
+ CFG_MONITOR_BASE,
+ CFG_MONITOR_BASE+monitor_flash_len-1,
+ &flash_info[0]);
#endif
if (size_b1) {
@@ -170,7 +170,6 @@ unsigned long flash_init (void)
}
-
/*-----------------------------------------------------------------------
*/
@@ -186,7 +185,7 @@ static void flash_get_offsets (ulong base, flash_info_t *info)
info->start[i] = base + (i * info->size/info->sector_count);
}
} else if (info->flash_id & FLASH_BTYPE) {
- if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
+ if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
#ifndef CFG_FLASH_16BIT
/* set sector offsets for bottom boot block type */
@@ -200,9 +199,9 @@ static void flash_get_offsets (ulong base, flash_info_t *info)
info->start[7] = base + 0x0001C000;
for (i = 8; i < info->sector_count; i++) {
info->start[i] = base + (i * 0x00020000) - 0x000E0000;
- }
- }
- else {
+ }
+ }
+ else {
/* set sector offsets for bottom boot block type */
info->start[0] = base + 0x00000000;
info->start[1] = base + 0x00008000;
@@ -224,9 +223,9 @@ static void flash_get_offsets (ulong base, flash_info_t *info)
info->start[7] = base + 0x0000E000;
for (i = 8; i < info->sector_count; i++) {
info->start[i] = base + (i * 0x00010000) - 0x00070000;
- }
+ }
}
- else {
+ else {
/* set sector offsets for bottom boot block type */
info->start[0] = base + 0x00000000;
info->start[1] = base + 0x00004000;
@@ -240,7 +239,7 @@ static void flash_get_offsets (ulong base, flash_info_t *info)
} else {
/* set sector offsets for top boot block type */
i = info->sector_count - 1;
- if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
+ if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
#ifndef CFG_FLASH_16BIT
info->start[i--] = base + info->size - 0x00004000;
@@ -254,7 +253,7 @@ static void flash_get_offsets (ulong base, flash_info_t *info)
info->start[i] = base + i * 0x00020000;
}
- } else {
+ } else {
info->start[i--] = base + info->size - 0x00008000;
info->start[i--] = base + info->size - 0x0000C000;
@@ -275,7 +274,7 @@ static void flash_get_offsets (ulong base, flash_info_t *info)
info->start[i] = base + i * 0x00010000;
}
- } else {
+ } else {
info->start[i--] = base + info->size - 0x00004000;
info->start[i--] = base + info->size - 0x00006000;
@@ -408,8 +407,8 @@ ulong flash_get_size (volatile FLASH_WORD_SIZE *addr, flash_info_t *info)
/*
* Note: if it is an AMD flash and the word at addr[0000]
- * is 0x00890089 this routine will think it is an Intel
- * flash device and may(most likely) cause trouble.
+ * is 0x00890089 this routine will think it is an Intel
+ * flash device and may(most likely) cause trouble.
*/
addr[0x0000] = 0x00900090;
@@ -421,8 +420,8 @@ ulong flash_get_size (volatile FLASH_WORD_SIZE *addr, flash_info_t *info)
/*
* Note: if it is an AMD flash and the word at addr[0000]
- * is 0x0089 this routine will think it is an Intel
- * flash device and may(most likely) cause trouble.
+ * is 0x0089 this routine will think it is an Intel
+ * flash device and may(most likely) cause trouble.
*/
addr[0x0000] = 0x0090;
@@ -631,7 +630,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
if ((info->flash_id == FLASH_UNKNOWN) ||
((info->flash_id > FLASH_AMD_COMP) &&
- ( (info->flash_id & FLASH_VENDMASK) != FLASH_MAN_INTEL ) ) ){
+ ( (info->flash_id & FLASH_VENDMASK) != FLASH_MAN_INTEL ) ) ){
printf ("Can't erase unknown flash type - aborted\n");
return 1;
}
@@ -1035,13 +1034,13 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
if( barf ) {
barf >>=16;
} else {
- barf = addr[0] & 0x0000003A;
+ barf = addr[0] & 0x0000003A;
}
printf("\nFlash write error at address %lx\n",(unsigned long)dest);
if(barf & 0x0002) printf("Block locked, not erased.\n");
if(barf & 0x0010) printf("Programming error.\n");
if(barf & 0x0008) printf("Vpp Low error.\n");
- return(2);
+ return(2);
}
@@ -1074,7 +1073,7 @@ static int write_short (flash_info_t *info, ulong dest, ushort data)
addr[0x0555] = 0x00A0;
} else {
/* intel stuff */
- *addr = 0x00D0;
+ *addr = 0x00D0;
*addr = 0x0040;
}
*((vu_short *)dest) = data;
@@ -1087,7 +1086,7 @@ static int write_short (flash_info_t *info, ulong dest, ushort data)
start = get_timer (0);
if(info->flash_id < FLASH_AMD_COMP) {
- /* AMD stuff */
+ /* AMD stuff */
while ((*((vu_short *)dest) & 0x0080) != (data & 0x0080)) {
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
return (1);
@@ -1106,7 +1105,7 @@ static int write_short (flash_info_t *info, ulong dest, ushort data)
if(barf & 0x0002) printf("Block locked, not erased.\n");
if(barf & 0x0010) printf("Programming error.\n");
if(barf & 0x0008) printf("Vpp Low error.\n");
- return(2);
+ return(2);
}
*addr = 0x00B0;
*addr = 0x0070;
@@ -1127,4 +1126,3 @@ static int write_short (flash_info_t *info, ulong dest, ushort data)
/*-----------------------------------------------------------------------
*/
-