summaryrefslogtreecommitdiff
path: root/board/eric/flash.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2008-05-20 16:00:29 +0200
committerWolfgang Denk <wd@denx.de>2008-05-21 00:14:08 +0200
commit53677ef18e25c97ac613349087c5cb33ae5a2741 (patch)
treef947d34d6efaee2401ea0e4c6104ef2f6a0f7ad0 /board/eric/flash.c
parent727f63334676e760877d43bfb8f0e9331ac8b101 (diff)
downloadu-boot-imx-53677ef18e25c97ac613349087c5cb33ae5a2741.zip
u-boot-imx-53677ef18e25c97ac613349087c5cb33ae5a2741.tar.gz
u-boot-imx-53677ef18e25c97ac613349087c5cb33ae5a2741.tar.bz2
Big white-space cleanup.
This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'board/eric/flash.c')
-rw-r--r--board/eric/flash.c195
1 files changed, 99 insertions, 96 deletions
diff --git a/board/eric/flash.c b/board/eric/flash.c
index c08a760..2c7d2a0 100644
--- a/board/eric/flash.c
+++ b/board/eric/flash.c
@@ -564,17 +564,17 @@ ulong flash_get_size (volatile FLASH_WORD_SIZE *addr, flash_info_t *info)
info->flash_id += FLASH_28F320J3A;
info->sector_count = 32;
info->size = 0x00400000;
- break; /* => 32 MBit */
+ break; /* => 32 MBit */
case (INTEL_ID_28F640J3A & FLASH_ID_MASK):
info->flash_id += FLASH_28F640J3A;
info->sector_count = 64;
info->size = 0x00800000;
- break; /* => 64 MBit */
+ break; /* => 64 MBit */
case (INTEL_ID_28F128J3A & FLASH_ID_MASK):
info->flash_id += FLASH_28F128J3A;
info->sector_count = 128;
info->size = 0x01000000;
- break; /* => 128 MBit */
+ break; /* => 128 MBit */
default:
/* FIXME*/
@@ -981,148 +981,151 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
* 2 - Flash not erased
*/
#ifndef CFG_FLASH_16BIT
-static int write_word (flash_info_t *info, ulong dest, ulong data)
+static int write_word (flash_info_t * info, ulong dest, ulong data)
{
- vu_long *addr = (vu_long*)(info->start[0]);
- ulong start,barf;
+ vu_long *addr = (vu_long *) (info->start[0]);
+ ulong start, barf;
int flag;
/* Check if Flash is (sufficiently) erased */
- if ((*((vu_long *)dest) & data) != data) {
+ if ((*((vu_long *) dest) & data) != data) {
return (2);
}
/* Disable interrupts which might cause a timeout here */
- flag = disable_interrupts();
+ flag = disable_interrupts ();
- if(info->flash_id > FLASH_AMD_COMP) {
- /* AMD stuff */
- addr[0x0555] = 0x00AA00AA;
- addr[0x02AA] = 0x00550055;
- addr[0x0555] = 0x00A000A0;
- } else {
- /* intel stuff */
- *addr = 0x00400040;
- }
- *((vu_long *)dest) = data;
+ if (info->flash_id > FLASH_AMD_COMP) {
+ /* AMD stuff */
+ addr[0x0555] = 0x00AA00AA;
+ addr[0x02AA] = 0x00550055;
+ addr[0x0555] = 0x00A000A0;
+ } else {
+ /* intel stuff */
+ *addr = 0x00400040;
+ }
+ *((vu_long *) dest) = data;
/* re-enable interrupts if necessary */
if (flag)
- enable_interrupts();
+ enable_interrupts ();
/* data polling for D7 */
start = get_timer (0);
- if(info->flash_id > FLASH_AMD_COMP) {
+ if (info->flash_id > FLASH_AMD_COMP) {
- while ((*((vu_long *)dest) & 0x00800080) != (data & 0x00800080)) {
- if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
- return (1);
+ while ((*((vu_long *) dest) & 0x00800080) !=
+ (data & 0x00800080)) {
+ if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
+ return (1);
+ }
}
- }
- } else {
+ } else {
- while(!(addr[0] & 0x00800080)){ /* wait for error or finish */
- if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
- return (1);
- }
+ while (!(addr[0] & 0x00800080)) { /* wait for error or finish */
+ if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
+ return (1);
+ }
- if( addr[0] & 0x003A003A) { /* check for error */
- barf = addr[0] & 0x003A0000;
- if( barf ) {
- barf >>=16;
- } else {
- 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);
- }
+ if (addr[0] & 0x003A003A) { /* check for error */
+ barf = addr[0] & 0x003A0000;
+ if (barf) {
+ barf >>= 16;
+ } else {
+ 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 (0);
+ return (0);
-}
+ }
#else
-static int write_short (flash_info_t *info, ulong dest, ushort data)
+static int write_short (flash_info_t * info, ulong dest, ushort data)
{
- vu_short *addr = (vu_short*)(info->start[0]);
- ulong start,barf;
+ vu_short *addr = (vu_short *) (info->start[0]);
+ ulong start, barf;
int flag;
/* Check if Flash is (sufficiently) erased */
- if ((*((vu_short *)dest) & data) != data) {
+ if ((*((vu_short *) dest) & data) != data) {
return (2);
}
/* Disable interrupts which might cause a timeout here */
- flag = disable_interrupts();
+ flag = disable_interrupts ();
- if(info->flash_id < FLASH_AMD_COMP) {
- /* AMD stuff */
- addr[0x0555] = 0x00AA;
- addr[0x02AA] = 0x0055;
- addr[0x0555] = 0x00A0;
- } else {
- /* intel stuff */
- *addr = 0x00D0;
- *addr = 0x0040;
- }
- *((vu_short *)dest) = data;
+ if (info->flash_id < FLASH_AMD_COMP) {
+ /* AMD stuff */
+ addr[0x0555] = 0x00AA;
+ addr[0x02AA] = 0x0055;
+ addr[0x0555] = 0x00A0;
+ } else {
+ /* intel stuff */
+ *addr = 0x00D0;
+ *addr = 0x0040;
+ }
+ *((vu_short *) dest) = data;
/* re-enable interrupts if necessary */
if (flag)
- enable_interrupts();
+ enable_interrupts ();
/* data polling for D7 */
start = get_timer (0);
- if(info->flash_id < FLASH_AMD_COMP) {
- /* AMD stuff */
- while ((*((vu_short *)dest) & 0x0080) != (data & 0x0080)) {
- if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
- return (1);
+ if (info->flash_id < FLASH_AMD_COMP) {
+ /* AMD stuff */
+ while ((*((vu_short *) dest) & 0x0080) != (data & 0x0080)) {
+ if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
+ return (1);
+ }
}
- }
- } else {
- /* intel stuff */
- while(!(addr[0] & 0x0080)){ /* wait for error or finish */
- if (get_timer(start) > CFG_FLASH_WRITE_TOUT) return (1);
- }
+ } else {
+ /* intel stuff */
+ while (!(addr[0] & 0x0080)) { /* wait for error or finish */
+ if (get_timer (start) > CFG_FLASH_WRITE_TOUT)
+ return (1);
+ }
- if( addr[0] & 0x003A) { /* check for error */
- barf = addr[0] & 0x003A;
- 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);
- }
- *addr = 0x00B0;
- *addr = 0x0070;
- while(!(addr[0] & 0x0080)){ /* wait for error or finish */
- if (get_timer(start) > CFG_FLASH_WRITE_TOUT) return (1);
+ if (addr[0] & 0x003A) { /* check for error */
+ barf = addr[0] & 0x003A;
+ 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);
+ }
+ *addr = 0x00B0;
+ *addr = 0x0070;
+ while (!(addr[0] & 0x0080)) { /* wait for error or finish */
+ if (get_timer (start) > CFG_FLASH_WRITE_TOUT)
+ return (1);
+ }
+ *addr = 0x00FF;
}
-
- *addr = 0x00FF;
-
- }
-
return (0);
-
}
-
-
#endif
-
-/*-----------------------------------------------------------------------
- */
+/*-----------------------------------------------------------------------*/