From 8bde7f776c77b343aca29b8c7b58464d915ac245 Mon Sep 17 00:00:00 2001 From: wdenk Date: Fri, 27 Jun 2003 21:31:46 +0000 Subject: * 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) --- board/esd/adciop/Makefile | 3 +- board/esd/adciop/flash.c | 4 +- board/esd/adciop/u-boot.lds | 5 + board/esd/ar405/Makefile | 2 +- board/esd/ar405/ar405.c | 3 +- board/esd/ar405/flash.c | 56 +++---- board/esd/ar405/u-boot.lds | 5 + board/esd/ash405/Makefile | 2 +- board/esd/ash405/ash405.c | 3 +- board/esd/ash405/flash.c | 32 ++-- board/esd/ash405/u-boot.lds | 4 + board/esd/canbt/Makefile | 2 +- board/esd/canbt/canbt.c | 6 +- board/esd/canbt/flash.c | 36 ++--- board/esd/canbt/u-boot.lds | 5 + board/esd/common/flash.c | 182 +++++++++++------------ board/esd/common/fpga.c | 86 +++++------ board/esd/cpci405/Makefile | 2 +- board/esd/cpci405/cpci405.c | 3 +- board/esd/cpci405/u-boot.lds | 5 + board/esd/cpci440/Makefile | 2 +- board/esd/cpci440/cpci440.c | 1 - board/esd/cpci440/init.S | 2 - board/esd/cpci440/strataflash.c | 3 - board/esd/cpci440/u-boot.lds | 5 + board/esd/cpciiser4/Makefile | 2 +- board/esd/cpciiser4/cpciiser4.c | 6 +- board/esd/cpciiser4/flash.c | 36 ++--- board/esd/cpciiser4/u-boot.lds | 5 + board/esd/dasa_sim/Makefile | 3 +- board/esd/dasa_sim/cmd_dasa_sim.c | 299 +++++++++++++++++++------------------- board/esd/dasa_sim/eeprom.c | 8 +- board/esd/dasa_sim/flash.c | 22 +-- board/esd/dasa_sim/u-boot.lds | 5 + board/esd/du405/Makefile | 2 +- board/esd/du405/du405.c | 5 +- board/esd/du405/u-boot.lds | 5 + board/esd/ocrtc/Makefile | 2 +- board/esd/ocrtc/ocrtc.c | 1 - board/esd/ocrtc/u-boot.lds | 5 + board/esd/pci405/Makefile | 2 +- board/esd/pci405/cmd_pci405.c | 2 +- board/esd/pci405/flash.c | 32 ++-- board/esd/pci405/pci405.c | 3 +- board/esd/pci405/u-boot.lds | 5 + board/esd/pmc405/Makefile | 2 +- board/esd/pmc405/pmc405.c | 1 - board/esd/pmc405/strataflash.c | 59 ++++---- board/esd/pmc405/u-boot.lds | 4 + 49 files changed, 517 insertions(+), 458 deletions(-) (limited to 'board/esd') diff --git a/board/esd/adciop/Makefile b/board/esd/adciop/Makefile index d4a4e65099..474c93642c 100644 --- a/board/esd/adciop/Makefile +++ b/board/esd/adciop/Makefile @@ -1,3 +1,4 @@ + # # (C) Copyright 2000 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. @@ -28,7 +29,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o ../common/pci.o $(LIB): $(OBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/adciop/flash.c b/board/esd/adciop/flash.c index 69618de1fc..d9eccba1ea 100644 --- a/board/esd/adciop/flash.c +++ b/board/esd/adciop/flash.c @@ -96,8 +96,8 @@ unsigned long flash_init (void) FLASH_BASE0_PRELIM+size_b0+size_b1-monitor_flash_len, FLASH_BASE0_PRELIM+size_b0+size_b1-1, &flash_info[1]); - /* monitor protection OFF by default (one is enough) */ - flash_protect(FLAG_PROTECT_CLEAR, + /* monitor protection OFF by default (one is enough) */ + flash_protect(FLAG_PROTECT_CLEAR, FLASH_BASE0_PRELIM+size_b0-monitor_flash_len, FLASH_BASE0_PRELIM+size_b0-1, &flash_info[0]); diff --git a/board/esd/adciop/u-boot.lds b/board/esd/adciop/u-boot.lds index ddf1307e28..b07d11786f 100644 --- a/board/esd/adciop/u-boot.lds +++ b/board/esd/adciop/u-boot.lds @@ -107,6 +107,11 @@ SECTIONS _edata = .; PROVIDE (edata = .); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + __start___ex_table = .; __ex_table : { *(__ex_table) } __stop___ex_table = .; diff --git a/board/esd/ar405/Makefile b/board/esd/ar405/Makefile index 39d2feceb4..f5bda5519a 100644 --- a/board/esd/ar405/Makefile +++ b/board/esd/ar405/Makefile @@ -28,7 +28,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/ar405/ar405.c b/board/esd/ar405/ar405.c index f23b822665..d0b06e6487 100644 --- a/board/esd/ar405/ar405.c +++ b/board/esd/ar405/ar405.c @@ -25,8 +25,9 @@ #include "ar405.h" #include #include -#include +/*cmd_boot.c*/ +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* ------------------------------------------------------------------------- */ diff --git a/board/esd/ar405/flash.c b/board/esd/ar405/flash.c index 3a644f9cc5..a651b6f926 100644 --- a/board/esd/ar405/flash.c +++ b/board/esd/ar405/flash.c @@ -43,8 +43,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 #include #include -#include #include /* ------------------------------------------------------------------------- */ @@ -33,6 +32,8 @@ #define FPGA_DEBUG #endif +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + /* fpga configuration data - gzip compressed and generated by bin2c */ const unsigned char fpgadata[] = { diff --git a/board/esd/ash405/flash.c b/board/esd/ash405/flash.c index f904affc4f..89af1190a8 100644 --- a/board/esd/ash405/flash.c +++ b/board/esd/ash405/flash.c @@ -43,8 +43,8 @@ unsigned long flash_init (void) { unsigned long size_b0; int i; - uint pbcr; - unsigned long base_b0; + uint pbcr; + unsigned long base_b0; int size_val = 0; /* Init: no FLASHes known */ @@ -61,14 +61,14 @@ unsigned long flash_init (void) size_b0, size_b0<<20); } - /* Setup offsets */ - flash_get_offsets (-size_b0, &flash_info[0]); + /* Setup offsets */ + flash_get_offsets (-size_b0, &flash_info[0]); - /* Re-do sizing to get full correct info */ - mtdcr(ebccfga, pb0cr); - pbcr = mfdcr(ebccfgd); - mtdcr(ebccfga, pb0cr); - base_b0 = -size_b0; + /* Re-do sizing to get full correct info */ + mtdcr(ebccfga, pb0cr); + pbcr = mfdcr(ebccfgd); + mtdcr(ebccfga, pb0cr); + base_b0 = -size_b0; switch (size_b0) { case 1 << 20: size_val = 0; @@ -87,15 +87,15 @@ unsigned long flash_init (void) break; } pbcr = (pbcr & 0x0001ffff) | base_b0 | (size_val << 17); - mtdcr(ebccfgd, pbcr); + mtdcr(ebccfgd, pbcr); - /* Monitor protection ON by default */ - (void)flash_protect(FLAG_PROTECT_SET, - -CFG_MONITOR_LEN, - 0xffffffff, - &flash_info[0]); + /* Monitor protection ON by default */ + (void)flash_protect(FLAG_PROTECT_SET, + -CFG_MONITOR_LEN, + 0xffffffff, + &flash_info[0]); - flash_info[0].size = size_b0; + flash_info[0].size = size_b0; return (size_b0); } diff --git a/board/esd/ash405/u-boot.lds b/board/esd/ash405/u-boot.lds index 97851f125d..ba555501ed 100644 --- a/board/esd/ash405/u-boot.lds +++ b/board/esd/ash405/u-boot.lds @@ -119,6 +119,10 @@ SECTIONS _edata = .; PROVIDE (edata = .); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + __start___ex_table = .; __ex_table : { *(__ex_table) } __stop___ex_table = .; diff --git a/board/esd/canbt/Makefile b/board/esd/canbt/Makefile index 39d2feceb4..f5bda5519a 100644 --- a/board/esd/canbt/Makefile +++ b/board/esd/canbt/Makefile @@ -28,7 +28,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/canbt/canbt.c b/board/esd/canbt/canbt.c index 708101e2ad..ae0e8805f2 100644 --- a/board/esd/canbt/canbt.c +++ b/board/esd/canbt/canbt.c @@ -25,7 +25,11 @@ #include "canbt.h" #include #include -#include + + +/*cmd_boot.c*/ +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + /* ------------------------------------------------------------------------- */ diff --git a/board/esd/canbt/flash.c b/board/esd/canbt/flash.c index 685850e84f..de847f9bea 100644 --- a/board/esd/canbt/flash.c +++ b/board/esd/canbt/flash.c @@ -43,8 +43,8 @@ unsigned long flash_init (void) { unsigned long size_b0; int i; - uint pbcr; - unsigned long base_b0; + uint pbcr; + unsigned long base_b0; /* Init: no FLASHes known */ for (i=0; iflash_id & FLASH_VENDMASK) == FLASH_MAN_SST) || + if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM640U)) { for (i = 0; i < info->sector_count; i++) info->start[i] = base + (i * 0x00010000); - } else if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL322B) || + } else if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL322B) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL323B) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL324B)) { @@ -58,7 +58,7 @@ static void flash_get_offsets (ulong base, flash_info_t *info) base += 64 << 10; ++i; } - } else if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL322T) || + } else if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL322T) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL323T) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320T) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL324T)) { @@ -75,7 +75,7 @@ static void flash_get_offsets (ulong base, flash_info_t *info) --i; info->start[i] = base; } - } else { + } else { if (info->flash_id & FLASH_BTYPE) { /* set sector offsets for bottom boot block type */ info->start[0] = base + 0x00000000; @@ -103,10 +103,10 @@ static void flash_get_offsets (ulong base, flash_info_t *info) void flash_print_info (flash_info_t *info) { int i; - int k; - int size; - int erased; - volatile unsigned long *flash; + int k; + int size; + int erased; + volatile unsigned long *flash; if (info->flash_id == FLASH_UNKNOWN) { printf ("missing or unknown FLASH type\n"); @@ -161,28 +161,28 @@ void flash_print_info (flash_info_t *info) printf (" Sector Start Addresses:"); for (i=0; isector_count; ++i) { #ifdef CFG_FLASH_EMPTY_INFO - /* - * Check if whole sector is erased - */ - if (i != (info->sector_count-1)) - size = info->start[i+1] - info->start[i]; - else - size = info->start[0] + info->size - info->start[i]; - erased = 1; - flash = (volatile unsigned long *)info->start[i]; - size = size >> 2; /* divide by 4 for longword access */ - for (k=0; ksector_count-1)) + size = info->start[i+1] - info->start[i]; + else + size = info->start[0] + info->size - info->start[i]; + erased = 1; + flash = (volatile unsigned long *)info->start[i]; + size = size >> 2; /* divide by 4 for longword access */ + for (k=0; kstart[i], erased ? " E" : " ", @@ -216,7 +216,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info) short n; CFG_FLASH_WORD_SIZE value; ulong base = (ulong)addr; - volatile CFG_FLASH_WORD_SIZE *addr2 = (CFG_FLASH_WORD_SIZE *)addr; + volatile CFG_FLASH_WORD_SIZE *addr2 = (CFG_FLASH_WORD_SIZE *)addr; /* Write auto select command: read Manufacturer ID */ addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; @@ -282,37 +282,37 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info) break; /* => 2 MB */ case (CFG_FLASH_WORD_SIZE)AMD_ID_LV320T: - info->flash_id += FLASH_AM320T; - info->sector_count = 71; + info->flash_id += FLASH_AM320T; + info->sector_count = 71; info->size = 0x00400000; break; /* => 4 MB */ case (CFG_FLASH_WORD_SIZE)AMD_ID_LV320B: - info->flash_id += FLASH_AM320B; + info->flash_id += FLASH_AM320B; info->sector_count = 71; info->size = 0x00400000; break; /* => 4 MB */ case (CFG_FLASH_WORD_SIZE)AMD_ID_DL322T: - info->flash_id += FLASH_AMDL322T; - info->sector_count = 71; + info->flash_id += FLASH_AMDL322T; + info->sector_count = 71; info->size = 0x00400000; break; /* => 4 MB */ case (CFG_FLASH_WORD_SIZE)AMD_ID_DL322B: - info->flash_id += FLASH_AMDL322B; + info->flash_id += FLASH_AMDL322B; info->sector_count = 71; info->size = 0x00400000; break; /* => 4 MB */ case (CFG_FLASH_WORD_SIZE)AMD_ID_DL323T: - info->flash_id += FLASH_AMDL323T; + info->flash_id += FLASH_AMDL323T; info->sector_count = 71; info->size = 0x00400000; break; /* => 4 MB */ case (CFG_FLASH_WORD_SIZE)AMD_ID_DL323B: - info->flash_id += FLASH_AMDL323B; + info->flash_id += FLASH_AMDL323B; info->sector_count = 71; info->size = 0x00400000; break; /* => 4 MB */ case (CFG_FLASH_WORD_SIZE)AMD_ID_LV640U: - info->flash_id += FLASH_AM640U; + info->flash_id += FLASH_AM640U; info->sector_count = 128; info->size = 0x00800000; break; /* => 8 MB */ @@ -335,11 +335,11 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info) } /* set up sector start address table */ - if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) || + if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM640U)) { for (i = 0; i < info->sector_count; i++) info->start[i] = base + (i * 0x00010000); - } else if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL322B) || + } else if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL322B) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL323B) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320B) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL324B)) { @@ -353,7 +353,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info) base += 64 << 10; ++i; } - } else if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL322T) || + } else if (((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL322T) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL323T) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM320T) || ((info->flash_id & FLASH_TYPEMASK) == FLASH_AMDL324T)) { @@ -370,7 +370,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info) --i; info->start[i] = base; } - } else { + } else { if (info->flash_id & FLASH_BTYPE) { /* set sector offsets for bottom boot block type */ info->start[0] = base + 0x00000000; @@ -397,10 +397,10 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info) /* read sector protection at sector address, (A7 .. A0) = 0x02 */ /* D0 = 1 if protected */ addr2 = (volatile CFG_FLASH_WORD_SIZE *)(info->start[i]); - if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) - info->protect[i] = 0; - else - info->protect[i] = addr2[CFG_FLASH_READ2] & 1; + if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) + info->protect[i] = 0; + else + info->protect[i] = addr2[CFG_FLASH_READ2] & 1; } /* @@ -424,7 +424,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) volatile CFG_FLASH_WORD_SIZE *addr2; int flag, prot, sect, l_sect; ulong start, now, last; - int i; + int i; if ((s_first < 0) || (s_first > s_last)) { if (info->flash_id == FLASH_UNKNOWN) { @@ -463,25 +463,25 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) for (sect = s_first; sect<=s_last; sect++) { if (info->protect[sect] == 0) { /* not protected */ addr2 = (CFG_FLASH_WORD_SIZE *)(info->start[sect]); - if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) { - addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; - addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; - addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00800080; - addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; - addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; - addr2[0] = (CFG_FLASH_WORD_SIZE)0x00500050; /* block erase */ - for (i=0; i<50; i++) - udelay(1000); /* wait 1 ms */ - } else { - if (sect == s_first) { - addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; - addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; - addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00800080; - addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; - addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; - } - addr2[0] = (CFG_FLASH_WORD_SIZE)0x00300030; /* sector erase */ - } + if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) { + addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; + addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; + addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00800080; + addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; + addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; + addr2[0] = (CFG_FLASH_WORD_SIZE)0x00500050; /* block erase */ + for (i=0; i<50; i++) + udelay(1000); /* wait 1 ms */ + } else { + if (sect == s_first) { + addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; + addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; + addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00800080; + addr[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; + addr[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; + } + addr2[0] = (CFG_FLASH_WORD_SIZE)0x00300030; /* sector erase */ + } l_sect = sect; } } @@ -602,42 +602,42 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) */ static int write_word (flash_info_t *info, ulong dest, ulong data) { - volatile CFG_FLASH_WORD_SIZE *addr2 = (CFG_FLASH_WORD_SIZE *)(info->start[0]); - volatile CFG_FLASH_WORD_SIZE *dest2 = (CFG_FLASH_WORD_SIZE *)dest; - volatile CFG_FLASH_WORD_SIZE *data2 = (CFG_FLASH_WORD_SIZE *)&data; + volatile CFG_FLASH_WORD_SIZE *addr2 = (CFG_FLASH_WORD_SIZE *)(info->start[0]); + volatile CFG_FLASH_WORD_SIZE *dest2 = (CFG_FLASH_WORD_SIZE *)dest; + volatile CFG_FLASH_WORD_SIZE *data2 = (CFG_FLASH_WORD_SIZE *)&data; ulong start; int flag; - int i; + int i; /* Check if Flash is (sufficiently) erased */ if ((*((volatile CFG_FLASH_WORD_SIZE *)dest) & - (CFG_FLASH_WORD_SIZE)data) != (CFG_FLASH_WORD_SIZE)data) { + (CFG_FLASH_WORD_SIZE)data) != (CFG_FLASH_WORD_SIZE)data) { return (2); } /* Disable interrupts which might cause a timeout here */ flag = disable_interrupts(); - for (i=0; i<4/sizeof(CFG_FLASH_WORD_SIZE); i++) - { - addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; - addr2[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; - addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00A000A0; - - dest2[i] = data2[i]; - - /* re-enable interrupts if necessary */ - if (flag) - enable_interrupts(); - - /* data polling for D7 */ - start = get_timer (0); - while ((dest2[i] & (CFG_FLASH_WORD_SIZE)0x00800080) != - (data2[i] & (CFG_FLASH_WORD_SIZE)0x00800080)) { - if (get_timer(start) > CFG_FLASH_WRITE_TOUT) { - return (1); - } - } - } + for (i=0; i<4/sizeof(CFG_FLASH_WORD_SIZE); i++) + { + addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00AA00AA; + addr2[CFG_FLASH_ADDR1] = (CFG_FLASH_WORD_SIZE)0x00550055; + addr2[CFG_FLASH_ADDR0] = (CFG_FLASH_WORD_SIZE)0x00A000A0; + + dest2[i] = data2[i]; + + /* re-enable interrupts if necessary */ + if (flag) + enable_interrupts(); + + /* data polling for D7 */ + start = get_timer (0); + while ((dest2[i] & (CFG_FLASH_WORD_SIZE)0x00800080) != + (data2[i] & (CFG_FLASH_WORD_SIZE)0x00800080)) { + if (get_timer(start) > CFG_FLASH_WRITE_TOUT) { + return (1); + } + } + } return (0); } diff --git a/board/esd/common/fpga.c b/board/esd/common/fpga.c index 50bce2e0f6..f27943f518 100644 --- a/board/esd/common/fpga.c +++ b/board/esd/common/fpga.c @@ -57,16 +57,16 @@ #define SET_FPGA(data) out32(GPIO0_OR, data) #define FPGA_WRITE_1 { \ - SET_FPGA(FPGA_PRG | FPGA_DATA); /* set clock to 0 */ \ - SET_FPGA(FPGA_PRG | FPGA_DATA); /* set data to 1 */ \ - SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA); /* set clock to 1 */ \ - SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA);} /* set data to 1 */ + SET_FPGA(FPGA_PRG | FPGA_DATA); /* set clock to 0 */ \ + SET_FPGA(FPGA_PRG | FPGA_DATA); /* set data to 1 */ \ + SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA); /* set clock to 1 */ \ + SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA);} /* set data to 1 */ #define FPGA_WRITE_0 { \ - SET_FPGA(FPGA_PRG | FPGA_DATA); /* set clock to 0 */ \ - SET_FPGA(FPGA_PRG); /* set data to 0 */ \ - SET_FPGA(FPGA_PRG | FPGA_CLK); /* set clock to 1 */ \ - SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA);} /* set data to 1 */ + SET_FPGA(FPGA_PRG | FPGA_DATA); /* set clock to 0 */ \ + SET_FPGA(FPGA_PRG); /* set data to 0 */ \ + SET_FPGA(FPGA_PRG | FPGA_CLK); /* set clock to 1 */ \ + SET_FPGA(FPGA_PRG | FPGA_CLK | FPGA_DATA);} /* set data to 1 */ static int fpga_boot(unsigned char *fpgadata, int size) @@ -94,10 +94,10 @@ static int fpga_boot(unsigned char *fpgadata, int size) while (1) { if ((fpgadata[index] == 0xff) && (fpgadata[index+1] == 0xff) && - (fpgadata[index+2] == 0xff) && (fpgadata[index+3] == 0xff)) - break; /* preamble found */ + (fpgadata[index+2] == 0xff) && (fpgadata[index+3] == 0xff)) + break; /* preamble found */ else - index++; + index++; } #else /* search for preamble 0xFF2X */ @@ -134,10 +134,10 @@ static int fpga_boot(unsigned char *fpgadata, int size) udelay(1000); /* wait 1ms */ /* Check for timeout - 100us max, so use 3ms */ if (count++ > 3) - { - DBG("FPGA: Booting failed!\n"); - return ERROR_FPGA_PRG_INIT_LOW; - } + { + DBG("FPGA: Booting failed!\n"); + return ERROR_FPGA_PRG_INIT_LOW; + } } DBG("%s, ",((in32(GPIO0_IR) & FPGA_DONE) == 0) ? "NOT DONE" : "DONE" ); @@ -153,10 +153,10 @@ static int fpga_boot(unsigned char *fpgadata, int size) udelay(1000); /* wait 1ms */ /* Check for timeout */ if (count++ > 3) - { - DBG("FPGA: Booting failed!\n"); - return ERROR_FPGA_PRG_INIT_HIGH; - } + { + DBG("FPGA: Booting failed!\n"); + return ERROR_FPGA_PRG_INIT_HIGH; + } } DBG("%s, ",((in32(GPIO0_IR) & FPGA_DONE) == 0) ? "NOT DONE" : "DONE" ); @@ -172,17 +172,17 @@ static int fpga_boot(unsigned char *fpgadata, int size) for (i=index; i= 1) && (b <= MAX_ONES)) { for(bit=0; bit= (MAX_ONES+2)) && (b <= 254)) { for(bit=0; bit<(b-(MAX_ONES+2)); bit++) - { - FPGA_WRITE_0; - } - FPGA_WRITE_1; + { + FPGA_WRITE_0; + } + FPGA_WRITE_1; } else if (b == 255) - { - FPGA_WRITE_1; - } + { + FPGA_WRITE_1; + } } #endif @@ -246,10 +246,10 @@ static int fpga_boot(unsigned char *fpgadata, int size) udelay(1000); /* wait 1ms */ /* Check for timeout */ if (count++ > 3) - { - DBG("FPGA: Booting failed!\n"); - return ERROR_FPGA_PRG_DONE; - } + { + DBG("FPGA: Booting failed!\n"); + return ERROR_FPGA_PRG_DONE; + } } DBG("FPGA: Booting successful!\n"); diff --git a/board/esd/cpci405/Makefile b/board/esd/cpci405/Makefile index 39d2feceb4..f5bda5519a 100644 --- a/board/esd/cpci405/Makefile +++ b/board/esd/cpci405/Makefile @@ -28,7 +28,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/cpci405/cpci405.c b/board/esd/cpci405/cpci405.c index 5a6a27c825..3f0ef1e9c1 100644 --- a/board/esd/cpci405/cpci405.c +++ b/board/esd/cpci405/cpci405.c @@ -24,11 +24,10 @@ #include #include #include -#include #include /* ------------------------------------------------------------------------- */ - +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /*cmd_boot.c*/ #if 0 #define FPGA_DEBUG #endif diff --git a/board/esd/cpci405/u-boot.lds b/board/esd/cpci405/u-boot.lds index 97851f125d..311a5fe7f2 100644 --- a/board/esd/cpci405/u-boot.lds +++ b/board/esd/cpci405/u-boot.lds @@ -119,6 +119,11 @@ SECTIONS _edata = .; PROVIDE (edata = .); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + __start___ex_table = .; __ex_table : { *(__ex_table) } __stop___ex_table = .; diff --git a/board/esd/cpci440/Makefile b/board/esd/cpci440/Makefile index 4e1f701af2..f706ebcd68 100644 --- a/board/esd/cpci440/Makefile +++ b/board/esd/cpci440/Makefile @@ -29,7 +29,7 @@ OBJS = $(BOARD).o strataflash.o SOBJS = init.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/cpci440/cpci440.c b/board/esd/cpci440/cpci440.c index 51a5edd20a..66cfe0648f 100644 --- a/board/esd/cpci440/cpci440.c +++ b/board/esd/cpci440/cpci440.c @@ -66,7 +66,6 @@ int board_pre_init (void) } - int checkboard (void) { sys_info_t sysinfo; diff --git a/board/esd/cpci440/init.S b/board/esd/cpci440/init.S index 2dab9f9a29..82f37fd996 100644 --- a/board/esd/cpci440/init.S +++ b/board/esd/cpci440/init.S @@ -92,5 +92,3 @@ tlbtab: tlbentry( CFG_ISRAM_BASE + 0x1000, SZ_4K, 0x80001000, 0, AC_R|AC_W|AC_X ) tlbentry( CFG_SDRAM_BASE, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X ) tlbtab_end - - diff --git a/board/esd/cpci440/strataflash.c b/board/esd/cpci440/strataflash.c index de57318e26..2f055c20d5 100644 --- a/board/esd/cpci440/strataflash.c +++ b/board/esd/cpci440/strataflash.c @@ -89,8 +89,6 @@ #define FLASH_MAN_CFI 0x01000000 - - typedef union { unsigned char c; unsigned short w; @@ -113,7 +111,6 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ */ - static void flash_add_byte(flash_info_t *info, cfiword_t * cword, uchar c); static void flash_make_cmd(flash_info_t * info, uchar cmd, void * cmdbuf); static void flash_write_cmd(flash_info_t * info, int sect, uchar offset, uchar cmd); diff --git a/board/esd/cpci440/u-boot.lds b/board/esd/cpci440/u-boot.lds index 35d99318dd..46ccf31d47 100644 --- a/board/esd/cpci440/u-boot.lds +++ b/board/esd/cpci440/u-boot.lds @@ -126,6 +126,11 @@ SECTIONS _edata = .; PROVIDE (edata = .); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + __start___ex_table = .; __ex_table : { *(__ex_table) } __stop___ex_table = .; diff --git a/board/esd/cpciiser4/Makefile b/board/esd/cpciiser4/Makefile index 39d2feceb4..f5bda5519a 100644 --- a/board/esd/cpciiser4/Makefile +++ b/board/esd/cpciiser4/Makefile @@ -28,7 +28,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/cpciiser4/cpciiser4.c b/board/esd/cpciiser4/cpciiser4.c index 2e10412615..725abe9e1f 100644 --- a/board/esd/cpciiser4/cpciiser4.c +++ b/board/esd/cpciiser4/cpciiser4.c @@ -25,7 +25,11 @@ #include "cpciiser4.h" #include #include -#include + +/*cmd_boot.c*/ + +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + /* ------------------------------------------------------------------------- */ diff --git a/board/esd/cpciiser4/flash.c b/board/esd/cpciiser4/flash.c index 685850e84f..de847f9bea 100644 --- a/board/esd/cpciiser4/flash.c +++ b/board/esd/cpciiser4/flash.c @@ -43,8 +43,8 @@ unsigned long flash_init (void) { unsigned long size_b0; int i; - uint pbcr; - unsigned long base_b0; + uint pbcr; + unsigned long base_b0; /* Init: no FLASHes known */ for (i=0; i 10) - { - printf("\nTimeout: ret=%08x - Please try again!\n", ret); - break; - } - } - } - - pci_read_config_dword(CFG_PCI9054_DEV_FN, 0x50, &value); - - return value; + unsigned int value; + unsigned int ret; + int count; + + pci_write_config_dword (CFG_PCI9054_DEV_FN, 0x4c, + (offs << 16) | 0x0003); + count = 0; + + for (;;) { + udelay (10 * 1000); + pci_read_config_dword (CFG_PCI9054_DEV_FN, 0x4c, &ret); + if ((ret & 0x80000000) != 0) { + break; + } else { + count++; + if (count > 10) { + printf ("\nTimeout: ret=%08x - Please try again!\n", ret); + break; + } + } + } + + pci_read_config_dword (CFG_PCI9054_DEV_FN, 0x50, &value); + + return value; } -static int PciEepromWriteLongVPD(int offs, unsigned int value) +static int PciEepromWriteLongVPD (int offs, unsigned int value) { - unsigned int ret; - int count; - - pci_write_config_dword(CFG_PCI9054_DEV_FN, 0x50, value); - pci_write_config_dword(CFG_PCI9054_DEV_FN, 0x4c, (offs<<16) | 0x80000003); - count = 0; - - for (;;) - { - udelay(10 * 1000); - pci_read_config_dword(CFG_PCI9054_DEV_FN, 0x4c, &ret); - if ((ret & 0x80000000) == 0) - { - break; - } - else - { - count++; - if (count > 10) - { - printf("\nTimeout: ret=%08x - Please try again!\n", ret); - break; - } - } - } - - return TRUE; + unsigned int ret; + int count; + + pci_write_config_dword (CFG_PCI9054_DEV_FN, 0x50, value); + pci_write_config_dword (CFG_PCI9054_DEV_FN, 0x4c, + (offs << 16) | 0x80000003); + count = 0; + + for (;;) { + udelay (10 * 1000); + pci_read_config_dword (CFG_PCI9054_DEV_FN, 0x4c, &ret); + if ((ret & 0x80000000) == 0) { + break; + } else { + count++; + if (count > 10) { + printf ("\nTimeout: ret=%08x - Please try again!\n", ret); + break; + } + } + } + + return TRUE; } -static void showPci9054(void) +static void showPci9054 (void) { - int val; - int l, i; - - /* read 9054-values */ - for (l=0; l<6; l++) - { - printf("%02x: ", l*0x10); - for (i=0; i<4; i++) - { - pci_read_config_dword(CFG_PCI9054_DEV_FN, l*16+i*4, &val); - printf("%08x ", val); - } - printf("\n"); - } - printf("\n"); - - for (l=0; l<7; l++) - { - printf("%02x: ", l*0x10); - for (i=0; i<4; i++) - printf("%08x ", PciEepromReadLongVPD((i+l*4)*4)); - printf("\n"); - } - printf("\n"); + int val; + int l, i; + + /* read 9054-values */ + for (l = 0; l < 6; l++) { + printf ("%02x: ", l * 0x10); + for (i = 0; i < 4; i++) { + pci_read_config_dword (CFG_PCI9054_DEV_FN, + l * 16 + i * 4, + &val); + printf ("%08x ", val); + } + printf ("\n"); + } + printf ("\n"); + + for (l = 0; l < 7; l++) { + printf ("%02x: ", l * 0x10); + for (i = 0; i < 4; i++) + printf ("%08x ", + PciEepromReadLongVPD ((i + l * 4) * 4)); + printf ("\n"); + } + printf ("\n"); } -static void updatePci9054(void) +static void updatePci9054 (void) { - int val; + int val; - /* - * Set EEPROM write-protect register to 0 - */ - out32(pci9054_iobase+0x0c, in32(pci9054_iobase+0x0c) & 0xffff00ff); + /* + * Set EEPROM write-protect register to 0 + */ + out32 (pci9054_iobase + 0x0c, + in32 (pci9054_iobase + 0x0c) & 0xffff00ff); - /* Long Serial EEPROM Load Registers... */ - val = PciEepromWriteLongVPD(0x00, 0x905410b5); - val = PciEepromWriteLongVPD(0x04, 0x09800001); /* other input controller */ - val = PciEepromWriteLongVPD(0x08, 0x28140100); + /* Long Serial EEPROM Load Registers... */ + val = PciEepromWriteLongVPD (0x00, 0x905410b5); + val = PciEepromWriteLongVPD (0x04, 0x09800001); /* other input controller */ + val = PciEepromWriteLongVPD (0x08, 0x28140100); - val = PciEepromWriteLongVPD(0x0c, 0x00000000); /* MBOX0... */ - val = PciEepromWriteLongVPD(0x10, 0x00000000); + val = PciEepromWriteLongVPD (0x0c, 0x00000000); /* MBOX0... */ + val = PciEepromWriteLongVPD (0x10, 0x00000000); - /* las0: fpga access (0x0000.0000 ... 0x0003.ffff) */ - val = PciEepromWriteLongVPD(0x14, 0xfffc0000); /* LAS0RR... */ - val = PciEepromWriteLongVPD(0x18, 0x00000001); /* LAS0BA */ + /* las0: fpga access (0x0000.0000 ... 0x0003.ffff) */ + val = PciEepromWriteLongVPD (0x14, 0xfffc0000); /* LAS0RR... */ + val = PciEepromWriteLongVPD (0x18, 0x00000001); /* LAS0BA */ - val = PciEepromWriteLongVPD(0x1c, 0x00200000); /* MARBR... */ - val = PciEepromWriteLongVPD(0x20, 0x00300500); /* LMISC/BIGEND */ + val = PciEepromWriteLongVPD (0x1c, 0x00200000); /* MARBR... */ + val = PciEepromWriteLongVPD (0x20, 0x00300500); /* LMISC/BIGEND */ - val = PciEepromWriteLongVPD(0x24, 0x00000000); /* EROMRR... */ - val = PciEepromWriteLongVPD(0x28, 0x00000000); /* EROMBA */ + val = PciEepromWriteLongVPD (0x24, 0x00000000); /* EROMRR... */ + val = PciEepromWriteLongVPD (0x28, 0x00000000); /* EROMBA */ - val = PciEepromWriteLongVPD(0x2c, 0x43030000); /* LBRD0... */ + val = PciEepromWriteLongVPD (0x2c, 0x43030000); /* LBRD0... */ - val = PciEepromWriteLongVPD(0x30, 0x00000000); /* DMRR... */ - val = PciEepromWriteLongVPD(0x34, 0x00000000); - val = PciEepromWriteLongVPD(0x38, 0x00000000); + val = PciEepromWriteLongVPD (0x30, 0x00000000); /* DMRR... */ + val = PciEepromWriteLongVPD (0x34, 0x00000000); + val = PciEepromWriteLongVPD (0x38, 0x00000000); - val = PciEepromWriteLongVPD(0x3c, 0x00000000); /* DMPBAM... */ - val = PciEepromWriteLongVPD(0x40, 0x00000000); + val = PciEepromWriteLongVPD (0x3c, 0x00000000); /* DMPBAM... */ + val = PciEepromWriteLongVPD (0x40, 0x00000000); - /* Extra Long Serial EEPROM Load Registers... */ - val = PciEepromWriteLongVPD(0x44, 0x010212fe); /* PCISID... */ + /* Extra Long Serial EEPROM Load Registers... */ + val = PciEepromWriteLongVPD (0x44, 0x010212fe); /* PCISID... */ - /* las1: 505-sram access (0x0004.0000 ... 0x001f.ffff) */ - /* Offset to LAS1: Group 1: 0x00040000 */ - /* Group 2: 0x00080000 */ - /* Group 3: 0x000c0000 */ - val = PciEepromWriteLongVPD(0x48, 0xffe00000); /* LAS1RR */ - val = PciEepromWriteLongVPD(0x4c, 0x00040001); /* LAS1BA */ - val = PciEepromWriteLongVPD(0x50, 0x00000208); /* LBRD1 */ /* so wars bisher */ + /* las1: 505-sram access (0x0004.0000 ... 0x001f.ffff) */ + /* Offset to LAS1: Group 1: 0x00040000 */ + /* Group 2: 0x00080000 */ + /* Group 3: 0x000c0000 */ + val = PciEepromWriteLongVPD (0x48, 0xffe00000); /* LAS1RR */ + val = PciEepromWriteLongVPD (0x4c, 0x00040001); /* LAS1BA */ + val = PciEepromWriteLongVPD (0x50, 0x00000208); /* LBRD1 */ /* so wars bisher */ - val = PciEepromWriteLongVPD(0x54, 0x00004c06); /* HotSwap... */ + val = PciEepromWriteLongVPD (0x54, 0x00004c06); /* HotSwap... */ - printf("Finished writing defaults into PLX PCI9054 EEPROM!\n"); + printf ("Finished writing defaults into PLX PCI9054 EEPROM!\n"); } -static void clearPci9054(void) +static void clearPci9054 (void) { - int val; + int val; - /* - * Set EEPROM write-protect register to 0 - */ - out32(pci9054_iobase+0x0c, in32(pci9054_iobase+0x0c) & 0xffff00ff); + /* + * Set EEPROM write-protect register to 0 + */ + out32 (pci9054_iobase + 0x0c, + in32 (pci9054_iobase + 0x0c) & 0xffff00ff); - /* Long Serial EEPROM Load Registers... */ - val = PciEepromWriteLongVPD(0x00, 0xffffffff); - val = PciEepromWriteLongVPD(0x04, 0xffffffff); /* other input controller */ + /* Long Serial EEPROM Load Registers... */ + val = PciEepromWriteLongVPD (0x00, 0xffffffff); + val = PciEepromWriteLongVPD (0x04, 0xffffffff); /* other input controller */ - printf("Finished clearing PLX PCI9054 EEPROM!\n"); + printf ("Finished clearing PLX PCI9054 EEPROM!\n"); } /* ------------------------------------------------------------------------- */ -int do_pci9054(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) +int do_pci9054 (cmd_tbl_t * cmdtp, int flag, int argc, + char *argv[]) { - if (strcmp(argv[1], "info") == 0) - { - showPci9054(); - return 0; - } - - if (strcmp(argv[1], "update") == 0) - { - updatePci9054(); - return 0; - } - - if (strcmp(argv[1], "clear") == 0) - { - clearPci9054(); - return 0; - } - - printf("Usage:\n%s\n", cmdtp->usage); - return 1; + if (strcmp (argv[1], "info") == 0) { + showPci9054 (); + return 0; + } + + if (strcmp (argv[1], "update") == 0) { + updatePci9054 (); + return 0; + } + + if (strcmp (argv[1], "clear") == 0) { + clearPci9054 (); + return 0; + } + + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; } +cmd_tbl_t U_BOOT_CMD (pci9054) = MK_CMD_ENTRY( + "pci9054", 3, 1, do_pci9054, + "pci9054 - PLX PCI9054 EEPROM access\n", + "pci9054 info - print EEPROM values\n" + "pci9054 update - updates EEPROM with default values\n" +); + /* ------------------------------------------------------------------------- */ diff --git a/board/esd/dasa_sim/eeprom.c b/board/esd/dasa_sim/eeprom.c index 59ef1d6ab4..1b4c7b34f7 100644 --- a/board/esd/dasa_sim/eeprom.c +++ b/board/esd/dasa_sim/eeprom.c @@ -46,7 +46,7 @@ unsigned int eepromReadLong(int offs) ret = *(unsigned short *)EEPROM_CAP; if ((ret & 0x8000) != 0) - break; + break; } value = *(unsigned long *)EEPROM_DATA; @@ -83,7 +83,7 @@ void eepromWriteLong(int offs, unsigned int value) ret = *(unsigned short *)EEPROM_CAP; if ((ret & 0x8000) == 0) - break; + break; } } @@ -107,7 +107,7 @@ void i2c_read (uchar *addr, int alen, uchar *buffer, int len) int i; int len2, ptr; - /* printf("\naddr=%x alen=%x buffer=%x len=%x", addr[0], addr[1], *(short *)addr, alen, buffer, len); // test-only */ + /* printf("\naddr=%x alen=%x buffer=%x len=%x", addr[0], addr[1], *(short *)addr, alen, buffer, len); /###* test-only */ ptr = *(short *)addr; @@ -146,7 +146,7 @@ void i2c_write (uchar *addr, int alen, uchar *buffer, int len) int i; int len2, ptr; - /* printf("\naddr=%x alen=%x buffer=%x len=%x", addr[0], addr[1], *(short *)addr, alen, buffer, len); // test-only */ + /* printf("\naddr=%x alen=%x buffer=%x len=%x", addr[0], addr[1], *(short *)addr, alen, buffer, len); /###* test-only */ ptr = *(short *)addr; diff --git a/board/esd/dasa_sim/flash.c b/board/esd/dasa_sim/flash.c index 32cd64cf08..d2ac13fcd8 100644 --- a/board/esd/dasa_sim/flash.c +++ b/board/esd/dasa_sim/flash.c @@ -43,8 +43,8 @@ static void flash_get_offsets (ulong base, flash_info_t *info); unsigned long flash_init (void) { unsigned long size_b0; - int i; - unsigned long base_b0; + int i; + unsigned long base_b0; /* Init: no FLASHes known */ for (i=0; i #include <405gp_i2c.h> #include -#include + +/*cmd_boot.c*/ + +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* ------------------------------------------------------------------------- */ diff --git a/board/esd/du405/u-boot.lds b/board/esd/du405/u-boot.lds index 463e38816b..b1793a2782 100644 --- a/board/esd/du405/u-boot.lds +++ b/board/esd/du405/u-boot.lds @@ -119,6 +119,11 @@ SECTIONS _edata = .; PROVIDE (edata = .); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + __start___ex_table = .; __ex_table : { *(__ex_table) } __stop___ex_table = .; diff --git a/board/esd/ocrtc/Makefile b/board/esd/ocrtc/Makefile index 45d3d8d73f..b059f7394a 100644 --- a/board/esd/ocrtc/Makefile +++ b/board/esd/ocrtc/Makefile @@ -28,7 +28,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/ocrtc/ocrtc.c b/board/esd/ocrtc/ocrtc.c index 3c3d56eb4f..0600273eb4 100644 --- a/board/esd/ocrtc/ocrtc.c +++ b/board/esd/ocrtc/ocrtc.c @@ -26,7 +26,6 @@ #include #include #include -#include /* ------------------------------------------------------------------------- */ diff --git a/board/esd/ocrtc/u-boot.lds b/board/esd/ocrtc/u-boot.lds index 8e940a8460..251a4cce9a 100644 --- a/board/esd/ocrtc/u-boot.lds +++ b/board/esd/ocrtc/u-boot.lds @@ -119,6 +119,11 @@ SECTIONS _edata = .; PROVIDE (edata = .); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + __start___ex_table = .; __ex_table : { *(__ex_table) } __stop___ex_table = .; diff --git a/board/esd/pci405/Makefile b/board/esd/pci405/Makefile index 62d7bf91dd..fd72b18809 100644 --- a/board/esd/pci405/Makefile +++ b/board/esd/pci405/Makefile @@ -28,7 +28,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o cmd_pci405.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/pci405/cmd_pci405.c b/board/esd/pci405/cmd_pci405.c index 555dc0c230..df91cd4176 100644 --- a/board/esd/pci405/cmd_pci405.c +++ b/board/esd/pci405/cmd_pci405.c @@ -22,12 +22,12 @@ */ #include +#include #include #include #include #include #include <405gp_pci.h> -#include #include "pci405.h" diff --git a/board/esd/pci405/flash.c b/board/esd/pci405/flash.c index 1707dcf6e1..3b21781d7d 100644 --- a/board/esd/pci405/flash.c +++ b/board/esd/pci405/flash.c @@ -43,8 +43,8 @@ unsigned long flash_init (void) { unsigned long size_b0; int i; - uint pbcr; - unsigned long base_b0; + uint pbcr; + unsigned long base_b0; int size_val = 0; /* Init: no FLASHes known */ @@ -61,14 +61,14 @@ unsigned long flash_init (void) size_b0, size_b0<<20); } - /* Setup offsets */ - flash_get_offsets (-size_b0, &flash_info[0]); + /* Setup offsets */ + flash_get_offsets (-size_b0, &flash_info[0]); - /* Re-do sizing to get full correct info */ - mtdcr(ebccfga, pb0cr); - pbcr = mfdcr(ebccfgd); - mtdcr(ebccfga, pb0cr); - base_b0 = -size_b0; + /* Re-do sizing to get full correct info */ + mtdcr(ebccfga, pb0cr); + pbcr = mfdcr(ebccfgd); + mtdcr(ebccfga, pb0cr); + base_b0 = -size_b0; switch (size_b0) { case 1 << 20: size_val = 0; @@ -87,15 +87,15 @@ unsigned long flash_init (void) break; } pbcr = (pbcr & 0x0001ffff) | base_b0 | (size_val << 17); - mtdcr(ebccfgd, pbcr); + mtdcr(ebccfgd, pbcr); - /* Monitor protection ON by default */ - (void)flash_protect(FLAG_PROTECT_SET, - -monitor_flash_len, - 0xffffffff, - &flash_info[0]); + /* Monitor protection ON by default */ + (void)flash_protect(FLAG_PROTECT_SET, + -monitor_flash_len, + 0xffffffff, + &flash_info[0]); - flash_info[0].size = size_b0; + flash_info[0].size = size_b0; return (size_b0); } diff --git a/board/esd/pci405/pci405.c b/board/esd/pci405/pci405.c index 18d24a8738..cc45fa909f 100644 --- a/board/esd/pci405/pci405.c +++ b/board/esd/pci405/pci405.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include <405gp_pci.h> @@ -33,7 +32,7 @@ /* ------------------------------------------------------------------------- */ - +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);/*cmd_boot.c*/ #if 0 #define FPGA_DEBUG #endif diff --git a/board/esd/pci405/u-boot.lds b/board/esd/pci405/u-boot.lds index 97851f125d..311a5fe7f2 100644 --- a/board/esd/pci405/u-boot.lds +++ b/board/esd/pci405/u-boot.lds @@ -119,6 +119,11 @@ SECTIONS _edata = .; PROVIDE (edata = .); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + __start___ex_table = .; __ex_table : { *(__ex_table) } __stop___ex_table = .; diff --git a/board/esd/pmc405/Makefile b/board/esd/pmc405/Makefile index 2fa097a09c..c4198c4fc9 100644 --- a/board/esd/pmc405/Makefile +++ b/board/esd/pmc405/Makefile @@ -28,7 +28,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o strataflash.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/esd/pmc405/pmc405.c b/board/esd/pmc405/pmc405.c index 78eed9f3d0..5c2e98c57e 100644 --- a/board/esd/pmc405/pmc405.c +++ b/board/esd/pmc405/pmc405.c @@ -24,7 +24,6 @@ #include #include #include -#include #include /* ------------------------------------------------------------------------- */ diff --git a/board/esd/pmc405/strataflash.c b/board/esd/pmc405/strataflash.c index 6578ed9d5c..d21d885fae 100644 --- a/board/esd/pmc405/strataflash.c +++ b/board/esd/pmc405/strataflash.c @@ -24,7 +24,7 @@ #include #include -#undef DEBUG_FLASH +#undef DEBUG_FLASH /* * This file implements a Common Flash Interface (CFI) driver for ppcboot. * The width of the port and the width of the chips are determined at initialization. @@ -89,8 +89,6 @@ #define FLASH_MAN_CFI 0x01000000 - - typedef union { unsigned char c; unsigned short w; @@ -113,7 +111,6 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */ */ - static void flash_add_byte(flash_info_t *info, cfiword_t * cword, uchar c); static void flash_make_cmd(flash_info_t * info, uchar cmd, void * cmdbuf); static void flash_write_cmd(flash_info_t * info, int sect, uchar offset, uchar cmd); @@ -249,7 +246,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) flash_write_cmd(info, sect, 0, FLASH_CMD_CLEAR_STATUS); flash_write_cmd(info, sect, 0, FLASH_CMD_BLOCK_ERASE); flash_write_cmd(info, sect, 0, FLASH_CMD_ERASE_CONFIRM); - + if(flash_full_status_check(info, sect, info->erase_blk_tout, "erase")) { rcode = 1; } else @@ -277,7 +274,7 @@ void flash_print_info (flash_info_t *info) info->size >> 20, info->sector_count); printf(" Erase timeout %ld ms, write timeout %ld ms, buffer write timeout %ld ms, buffer size %d\n", info->erase_blk_tout, info->write_tout, info->buffer_write_tout, info->buffer_size); - + printf (" Sector Start Addresses:"); for (i=0; isector_count; ++i) { #ifdef CFG_FLASH_EMPTY_INFO @@ -286,28 +283,28 @@ void flash_print_info (flash_info_t *info) int erased; volatile unsigned long *flash; - /* - * Check if whole sector is erased - */ - if (i != (info->sector_count-1)) - size = info->start[i+1] - info->start[i]; - else - size = info->start[0] + info->size - info->start[i]; - erased = 1; - flash = (volatile unsigned long *)info->start[i]; - size = size >> 2; /* divide by 4 for longword access */ - for (k=0; ksector_count-1)) + size = info->start[i+1] - info->start[i]; + else + size = info->start[0] + info->size - info->start[i]; + erased = 1; + flash = (volatile unsigned long *)info->start[i]; + size = size >> 2; /* divide by 4 for longword access */ + for (k=0; kstart[i], erased ? " E" : " ", @@ -414,7 +411,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) else flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR); - if((retcode = flash_full_status_check(info, sector, info->erase_blk_tout, + if((retcode = flash_full_status_check(info, sector, info->erase_blk_tout, prot?"protect":"unprotect")) == 0) { info->protect[sector] = prot; @@ -464,7 +461,7 @@ static int flash_full_status_check(flash_info_t * info, ulong sector, ulong tout printf("Command Sequence Error.\n"); } else if(flash_isset(info, sector, 0, FLASH_STATUS_ECLBS)){ printf("Block Erase Error.\n"); - retcode = ERR_NOT_ERASED; + retcode = ERR_NOT_ERASED; } else if (flash_isset(info, sector, 0, FLASH_STATUS_PSLBS)) { printf("Locking Error\n"); } @@ -733,7 +730,7 @@ static int find_sector(flash_info_t *info, ulong addr) { int sector; for(sector = info->sector_count - 1; sector >= 0; sector--) { - if(addr >= info->start[sector]) + if(addr >= info->start[sector]) break; } return sector; @@ -741,7 +738,7 @@ static int find_sector(flash_info_t *info, ulong addr) static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, int len) { - + int sector; int cnt; int retcode; @@ -789,8 +786,8 @@ static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, in flash_write_cmd(info, sector, 0, FLASH_CMD_WRITE_BUFFER_CONFIRM); retcode = flash_full_status_check(info, sector, info->buffer_write_tout, "buffer write"); - } + } flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); return retcode; -} +} #endif /* CFG_USE_FLASH_BUFFER_WRITE */ diff --git a/board/esd/pmc405/u-boot.lds b/board/esd/pmc405/u-boot.lds index 463e38816b..bfd71dbfcb 100644 --- a/board/esd/pmc405/u-boot.lds +++ b/board/esd/pmc405/u-boot.lds @@ -119,6 +119,10 @@ SECTIONS _edata = .; PROVIDE (edata = .); + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + __start___ex_table = .; __ex_table : { *(__ex_table) } __stop___ex_table = .; -- cgit v1.2.1