|
|
|
@ -138,18 +138,14 @@ int write_flash(char *addr, char value) |
|
|
|
|
char *adr = (char *)0xFF800000; |
|
|
|
|
int cnt = 0; |
|
|
|
|
char status,oldstatus; |
|
|
|
|
*(adr+0x55) = 0xAA; |
|
|
|
|
|
|
|
|
|
udelay(1); |
|
|
|
|
*(adr+0xAA) = 0x55; |
|
|
|
|
udelay(1); |
|
|
|
|
*(adr+0x55) = 0xA0; |
|
|
|
|
udelay(1); |
|
|
|
|
*(adr+0x55) = 0xAA; udelay (1); |
|
|
|
|
*(adr+0xAA) = 0x55; udelay (1); |
|
|
|
|
*(adr+0x55) = 0xA0; udelay (1); |
|
|
|
|
*addr = value; |
|
|
|
|
|
|
|
|
|
status = *addr; |
|
|
|
|
do { |
|
|
|
|
|
|
|
|
|
oldstatus = status; |
|
|
|
|
status = *addr; |
|
|
|
|
|
|
|
|
@ -165,14 +161,16 @@ int write_flash(char *addr, char value) |
|
|
|
|
oldstatus = *addr; |
|
|
|
|
status = *addr; |
|
|
|
|
|
|
|
|
|
if ((oldstatus & 0x40) == (status & 0x40)) return 0; |
|
|
|
|
else { |
|
|
|
|
if ((oldstatus & 0x40) == (status & 0x40)) { |
|
|
|
|
return 0; |
|
|
|
|
} else { |
|
|
|
|
*(adr+0x55) = 0xF0; |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unsigned update_flash(unsigned char* buf){ |
|
|
|
|
unsigned update_flash (unsigned char *buf) |
|
|
|
|
{ |
|
|
|
|
switch ((*buf) & 0x3) { |
|
|
|
|
case TRY_WORKING: |
|
|
|
|
printf ("found 3 and converted it to 2\n"); |
|
|
|
@ -180,6 +178,7 @@ unsigned update_flash(unsigned char* buf){ |
|
|
|
|
*((unsigned char *)0xFF800000) = 0xF0; |
|
|
|
|
udelay (100); |
|
|
|
|
printf ("buf [%#010x] %#010x\n", buf, (*buf)); |
|
|
|
|
/* XXX - fall through??? */ |
|
|
|
|
case BOOT_WORKING : |
|
|
|
|
return BOOT_WORKING; |
|
|
|
|
} |
|
|
|
@ -189,7 +188,6 @@ unsigned update_flash(unsigned char* buf){ |
|
|
|
|
unsigned scan_flash (void) |
|
|
|
|
{ |
|
|
|
|
char section[] = "kernel"; |
|
|
|
|
ulong sp; |
|
|
|
|
int cfgFileLen = (CFG_FLASH_ERASE_SECTOR_LENGTH >> 1); |
|
|
|
|
int sectionPtr = 0; |
|
|
|
|
int foundItem = 0; /* 0: None, 1: section found, 2: "=" found */ |
|
|
|
@ -202,19 +200,16 @@ unsigned scan_flash(void) |
|
|
|
|
if ((buf[bufPtr]==0xFF) && (*(int*)(buf+bufPtr)==0xFFFFFFFF)) { |
|
|
|
|
return BOOT_DEFAULT; |
|
|
|
|
} |
|
|
|
|
switch(foundItem) |
|
|
|
|
{ |
|
|
|
|
/* This is the scanning loop, we try to find a particular
|
|
|
|
|
* quoted value |
|
|
|
|
*/ |
|
|
|
|
switch (foundItem) { |
|
|
|
|
case 0: |
|
|
|
|
if ((section[sectionPtr] == 0)) { |
|
|
|
|
++foundItem; |
|
|
|
|
} |
|
|
|
|
else if(buf[bufPtr] == section[sectionPtr]){ |
|
|
|
|
} else if (buf[bufPtr] == section[sectionPtr]) { |
|
|
|
|
++sectionPtr; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
sectionPtr = 0; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -226,7 +221,7 @@ unsigned scan_flash(void) |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
default: |
|
|
|
|
return update_flash(buf[bufPtr - 1]); |
|
|
|
|
return update_flash (&buf[bufPtr - 1]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -262,6 +257,7 @@ void barcobcd_boot(void) |
|
|
|
|
char *bootm_args[2]; |
|
|
|
|
char *buf; |
|
|
|
|
int cnt; |
|
|
|
|
extern int do_bootm (cmd_tbl_t *, int, int, char *[]); |
|
|
|
|
|
|
|
|
|
buf = (char *)(0x00800000); |
|
|
|
|
/* make certain there are enough chars to print the command line here!
|
|
|
|
@ -328,13 +324,40 @@ U_BOOT_CMD( |
|
|
|
|
/*
|
|
|
|
|
* We are not using serial communication, so just provide empty functions |
|
|
|
|
*/ |
|
|
|
|
int serial_init(void){return 0;} |
|
|
|
|
void serial_setbrg(void){} |
|
|
|
|
void serial_putc(const char c){} |
|
|
|
|
void serial_puts(const char *c){} |
|
|
|
|
void serial_addr(unsigned int i){} |
|
|
|
|
int serial_getc(void){return 0;} |
|
|
|
|
int serial_tstc(void){return 0;} |
|
|
|
|
|
|
|
|
|
unsigned long post_word_load(void){return 0l;}; |
|
|
|
|
void post_word_store(unsigned long val){} |
|
|
|
|
int serial_init (void) |
|
|
|
|
{ |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
void serial_setbrg (void) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
void serial_putc (const char c) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
void serial_puts (const char *c) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
void serial_addr (unsigned int i) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
int serial_getc (void) |
|
|
|
|
{ |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
int serial_tstc (void) |
|
|
|
|
{ |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unsigned long post_word_load (void) |
|
|
|
|
{ |
|
|
|
|
return 0l; |
|
|
|
|
} |
|
|
|
|
void post_word_store (unsigned long val) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|