diff options
Diffstat (limited to 'board/LEOX')
-rw-r--r-- | board/LEOX/elpt860/Makefile | 3 | ||||
-rw-r--r-- | board/LEOX/elpt860/README.LEOX | 64 | ||||
-rw-r--r-- | board/LEOX/elpt860/elpt860.c | 84 | ||||
-rw-r--r-- | board/LEOX/elpt860/flash.c | 230 | ||||
-rw-r--r-- | board/LEOX/elpt860/u-boot.lds | 4 | ||||
-rw-r--r-- | board/LEOX/elpt860/u-boot.lds.debug | 1 |
6 files changed, 195 insertions, 191 deletions
diff --git a/board/LEOX/elpt860/Makefile b/board/LEOX/elpt860/Makefile index abca765..3e73163 100644 --- a/board/LEOX/elpt860/Makefile +++ b/board/LEOX/elpt860/Makefile @@ -1,3 +1,4 @@ + ####################################################################### # # Copyright (C) 2000, 2001, 2002, 2003 @@ -35,7 +36,7 @@ LIB = lib$(BOARD).a OBJS = $(BOARD).o flash.o $(LIB): .depend $(OBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) ######################################################################### diff --git a/board/LEOX/elpt860/README.LEOX b/board/LEOX/elpt860/README.LEOX index 9ace97b..23bc302 100644 --- a/board/LEOX/elpt860/README.LEOX +++ b/board/LEOX/elpt860/README.LEOX @@ -1,20 +1,20 @@ ============================================================================= - U-Boot port on the LEOX's ELPT860 CPU board - ------------------------------------------- + U-Boot port on the LEOX's ELPT860 CPU board + ------------------------------------------- LEOX.org is about the development of free hardware and software resources - for system on chip. + for system on chip. For more information, contact The LEOX team <team@leox.org> References: ~~~~~~~~~~ 1) Get the last stable release from denx.de: - o ftp://ftp.denx.de/pub/u-boot/u-boot-0.2.0.tar.bz2 + o ftp://ftp.denx.de/pub/u-boot/u-boot-0.2.0.tar.bz2 2) Get the current CVS snapshot: - o cvs -d:pserver:anonymous@cvs.u-boot.sourceforge.net:/cvsroot/u-boot login - o cvs -z6 -d:pserver:anonymous@cvs.u-boot.sourceforge.net:/cvsroot/u-boot co -P u-boot + o cvs -d:pserver:anonymous@cvs.u-boot.sourceforge.net:/cvsroot/u-boot login + o cvs -z6 -d:pserver:anonymous@cvs.u-boot.sourceforge.net:/cvsroot/u-boot co -P u-boot ============================================================================= @@ -42,7 +42,7 @@ U-Boot, at the address of 0x03000000. ============================================================================= - U-Boot test results + U-Boot test results ============================================================================= @@ -54,7 +54,7 @@ U-Boot, at the address of 0x03000000. U-Boot 0.2.2 (Jan 19 2003 - 11:08:39) CPU: XPC860xxZPnnB at 50 MHz: 4 kB I-Cache 4 kB D-Cache FEC present - *** Warning: CPU Core has Silicon Bugs -- Check the Errata *** + *** Warning: CPU Core has Silicon Bugs -- Check the Errata *** Board: ### No HW ID - assuming ELPT860 DRAM: 16 MB FLASH: 512 kB @@ -101,7 +101,7 @@ saveenv - save environment variables to persistent storage setenv - set environment variables sleep - delay execution for some time tftpboot- boot image via network using TFTP protocol - and env variables ipaddr and serverip + and env variables ipaddr and serverip version - print monitor version ? - alias for 'help' @@ -143,8 +143,8 @@ LEOX_elpt860: flinfo Bank # 1: AMD AM29F040 (4 Mbits) Size: 512 KB in 8 Sectors Sector Start Addresses: - 02000000 (RO) 02010000 (RO) 02020000 (RO) 02030000 (RO) 02040000 - 02050000 02060000 02070000 + 02000000 (RO) 02010000 (RO) 02020000 (RO) 02030000 (RO) 02040000 + 02050000 02060000 02070000 ################################################## # Board Information Structure @@ -177,7 +177,7 @@ baudrate = 9600 bps U-Boot 0.2.2 (Jan 19 2003 - 11:08:39) CPU: XPC860xxZPnnB at 50 MHz: 4 kB I-Cache 4 kB D-Cache FEC present - *** Warning: CPU Core has Silicon Bugs -- Check the Errata *** + *** Warning: CPU Core has Silicon Bugs -- Check the Errata *** Board: ### No HW ID - assuming ELPT860 DRAM: 16 MB FLASH: 512 kB @@ -219,7 +219,7 @@ Hit any key to exit ... U-Boot 0.2.2 (Jan 19 2003 - 11:08:39) CPU: XPC860xxZPnnB at 50 MHz: 4 kB I-Cache 4 kB D-Cache FEC present - *** Warning: CPU Core has Silicon Bugs -- Check the Errata *** + *** Warning: CPU Core has Silicon Bugs -- Check the Errata *** Board: ### No HW ID - assuming ELPT860 DRAM: 16 MB FLASH: 512 kB @@ -237,7 +237,7 @@ TFTP from server 192.168.0.1; our IP address is 192.168.0.30 Filename '/home/leox/uImage'. Load address: 0x400000 Loading: ################################################################# - ############################# + ############################# done Bytes transferred = 477294 (7486e hex) ## Booting image at 00400000 ... @@ -282,8 +282,8 @@ Looking up port of RPC 100005/2 on 192.168.0.1 VFS: Mounted root (nfs filesystem). Freeing unused kernel memory: 44k init INIT: version 2.78 booting - Welcome to DENX Embedded Linux Environment - Press 'I' to enter interactive startup. + Welcome to DENX Embedded Linux Environment + Press 'I' to enter interactive startup. Mounting proc filesystem: [ OK ] Configuring kernel parameters: [ OK ] Cannot access the Hardware Clock via any known method. @@ -316,7 +316,7 @@ bash-2.04# U-Boot 0.2.2 (Jan 19 2003 - 11:08:39) CPU: XPC860xxZPnnB at 50 MHz: 4 kB I-Cache 4 kB D-Cache FEC present - *** Warning: CPU Core has Silicon Bugs -- Check the Errata *** + *** Warning: CPU Core has Silicon Bugs -- Check the Errata *** Board: ### No HW ID - assuming ELPT860 DRAM: 16 MB FLASH: 512 kB @@ -334,11 +334,11 @@ TFTP from server 192.168.0.1; our IP address is 192.168.0.30 Filename '/home/leox/pMulti'. Load address: 0x400000 Loading: ################################################################# - ################################################################# - ################################################################# - ################################################################# - ################################################################# - ######################################################## + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ######################################################## done Bytes transferred = 1947816 (1db8a8 hex) ## Booting image at 00400000 ... @@ -398,22 +398,22 @@ ELPT860 login: root Password: Welcome to Linux-2.4.4 for ELPT CPU board (MPC860T @ 50MHz) - a8888b. - d888888b. - 8P"YP"Y88 + a8888b. + d888888b. + 8P"YP"Y88 _ _ 8|o||o|88 | | |_| 8' .88 | | _ ____ _ _ _ _ 8`._.' Y8. | | | | _ \| | | |\ \/ / d/ `8b. | |___ | | | | | |_| |/ \ .dP . Y8b. |_____||_|_| |_|\____|\_/\_/ d8:' " `::88b. - d8" `Y88b - :8P ' :888 - 8a. : _a88P - ._/"Yaa_ : .| 88P| - \ YP" `| 8P `. - / \._____.d| .' - `--..__)888888P`._.' + d8" `Y88b + :8P ' :888 + 8a. : _a88P + ._/"Yaa_ : .| 88P| + \ YP" `| 8P `. + / \._____.d| .' + `--..__)888888P`._.' login[21]: root login on `ttyS0' diff --git a/board/LEOX/elpt860/elpt860.c b/board/LEOX/elpt860/elpt860.c index 2564546..254497f 100644 --- a/board/LEOX/elpt860/elpt860.c +++ b/board/LEOX/elpt860/elpt860.c @@ -95,7 +95,7 @@ const uint sdram_table[] = /* * Single Read. (Offset 0 in UPMA RAM) */ - 0x0F0FFC24, 0x0F0CFC04, 0xFF0FFC04, 0x00AF3C04, + 0x0F0FFC24, 0x0F0CFC04, 0xFF0FFC04, 0x00AF3C04, 0xFF0FFC00, /* last */ /* * SDRAM Initialization (offset 5 in UPMA RAM) @@ -109,28 +109,28 @@ const uint sdram_table[] = /* * Burst Read. (Offset 8 in UPMA RAM) */ - 0x0F0FFC24, 0x0F0CFC04, 0xFF0FFC04, 0x00AF3C04, + 0x0F0FFC24, 0x0F0CFC04, 0xFF0FFC04, 0x00AF3C04, 0xF00FFC00, 0xF00FFC00, 0xF00FFC00, 0xFF0FFC00, - 0x0FFCCC04, 0xFFAFFC05, 0xFFAFFC04, 0xFFAFFC04, + 0x0FFCCC04, 0xFFAFFC05, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, /* last */ /* * Single Write. (Offset 18 in UPMA RAM) */ - 0x0F0FFC24, 0x0F0CFC04, 0xFF0FFC04, 0x00AF0C00, + 0x0F0FFC24, 0x0F0CFC04, 0xFF0FFC04, 0x00AF0C00, 0xFF0FFC04, 0x0FFCCC04, 0xFFAFFC05, /* last */ - _NOT_USED_, + _NOT_USED_, /* * Burst Write. (Offset 20 in UPMA RAM) */ - 0x0F0FFC24, 0x0F0CFC04, 0xFF0FFC00, 0x00AF0C00, - 0xF00FFC00, 0xF00FFC00, 0xF00FFC04, 0x0FFCCC04, - 0xFFAFFC04, 0xFFAFFC05, 0xFFAFFC04, 0xFFAFFC04, + 0x0F0FFC24, 0x0F0CFC04, 0xFF0FFC00, 0x00AF0C00, + 0xF00FFC00, 0xF00FFC00, 0xF00FFC04, 0x0FFCCC04, + 0xFFAFFC04, 0xFFAFFC05, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, /* last */ /* * Refresh (Offset 30 in UPMA RAM) */ - 0x0FFC3C04, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04, - 0xFFFFFC05, 0xFFFFFC04, 0xFFFFFC05, _NOT_USED_, + 0x0FFC3C04, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04, + 0xFFFFFC05, 0xFFFFFC04, 0xFFFFFC05, _NOT_USED_, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, 0xFFAFFC04, /* last */ /* * Exception. (Offset 3c in UPMA RAM) @@ -152,8 +152,8 @@ board_pre_init (void) { volatile immap_t *immr = (immap_t *) CFG_IMMR; - /* - * Light up the red led on ELPT860 pcb (DS1) (PCDAT) + /* + * Light up the red led on ELPT860 pcb (DS1) (PCDAT) */ immr->im_ioport.iop_pcdat &= ~CFG_DS1; /* PCDAT (DS1 = 0) */ immr->im_ioport.iop_pcpar &= ~CFG_DS1; /* PCPAR (0=general purpose I/O) */ @@ -170,20 +170,20 @@ board_pre_init (void) * Return 1 if no second DRAM bank, otherwise returns 0 */ -int +int checkboard (void) { unsigned char *s = getenv("serial#"); if ( !s || strncmp(s, "ELPT860", 7) ) printf ("### No HW ID - assuming ELPT860\n"); - + return ( 0 ); /* success */ } /* ------------------------------------------------------------------------- */ -long int +long int initdram (int board_type) { volatile immap_t *immap = (immap_t *)CFG_IMMR; @@ -194,7 +194,7 @@ initdram (int board_type) /* * This sequence initializes SDRAM chips on ELPT860 board */ - upmconfig(UPMA, (uint *)init_sdram_table, + upmconfig(UPMA, (uint *)init_sdram_table, sizeof(init_sdram_table)/sizeof(uint)); memctl->memc_mptpr = 0x0200; @@ -203,7 +203,7 @@ initdram (int board_type) memctl->memc_mar = 0x00000088; memctl->memc_mcr = 0x80002000; /* CS1: SDRAM bank 0 */ - upmconfig(UPMA, (uint *)sdram_table, + upmconfig(UPMA, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint)); /* @@ -257,8 +257,8 @@ initdram (int board_type) * * try 8 column mode */ - size8 = dram_size (CFG_MAMR_8COL, - (ulong *) SDRAM_BASE1_PRELIM, + size8 = dram_size (CFG_MAMR_8COL, + (ulong *) SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE); udelay (1000); @@ -266,15 +266,15 @@ initdram (int board_type) /* * try 9 column mode */ - size9 = dram_size (CFG_MAMR_9COL, - (ulong *) SDRAM_BASE1_PRELIM, + size9 = dram_size (CFG_MAMR_9COL, + (ulong *) SDRAM_BASE1_PRELIM, SDRAM_MAX_SIZE); if ( size8 < size9 ) /* leave configuration at 9 columns */ { size_b0 = size9; /* debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size >> 20); */ - } + } else /* back to 8 columns */ { size_b0 = size8; @@ -282,14 +282,14 @@ initdram (int board_type) udelay (500); /* debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size >> 20); */ } - + udelay (1000); /* * Adjust refresh rate depending on SDRAM type, both banks * For types > 128 MBit leave it at the current (fast) rate */ - if ( size_b0 < 0x02000000 ) + if ( size_b0 < 0x02000000 ) { /* reduce to 15.6 us (62.4 us / quad) */ memctl->memc_mptpr = CFG_MPTPR_2BK_4K; @@ -304,7 +304,7 @@ initdram (int board_type) { unsigned long reg; - + /* adjust refresh rate depending on SDRAM type, one bank */ reg = memctl->memc_mptpr; reg >>= 1; /* reduce to CFG_MPTPR_1BK_8K / _4K */ @@ -312,7 +312,7 @@ initdram (int board_type) } udelay(10000); - + return (size_b0); } @@ -326,9 +326,9 @@ initdram (int board_type) * - short between data lines */ -static long int -dram_size (long int mamr_value, - long int *base, +static long int +dram_size (long int mamr_value, + long int *base, long int maxsize) { volatile immap_t *immap = (immap_t *)CFG_IMMR; @@ -337,38 +337,38 @@ dram_size (long int mamr_value, ulong cnt, val; ulong save[32]; /* to make test non-destructive */ unsigned char i = 0; - + memctl->memc_mamr = mamr_value; - - for (cnt = maxsize/sizeof(long); cnt > 0; cnt >>= 1) + + for (cnt = maxsize/sizeof(long); cnt > 0; cnt >>= 1) { addr = base + cnt; /* pointer arith! */ - + save[i++] = *addr; *addr = ~cnt; } - + /* write 0 to base address */ addr = base; save[i] = *addr; *addr = 0; - + /* check at base address */ - if ( (val = *addr) != 0 ) + if ( (val = *addr) != 0 ) { *addr = save[i]; return (0); } - - for (cnt = 1; cnt <= maxsize/sizeof(long); cnt <<= 1) + + for (cnt = 1; cnt <= maxsize/sizeof(long); cnt <<= 1) { addr = base + cnt; /* pointer arith! */ - + val = *addr; *addr = save[--i]; - - if ( val != (~cnt) ) + + if ( val != (~cnt) ) { return (cnt * sizeof(long)); } @@ -388,7 +388,7 @@ void reset_phy (void) { volatile immap_t *immr = (immap_t *) CFG_IMMR; - + /* * Ensure LBK LXT901 ethernet 1 & 2 = 0 ... for normal loopback in effect * and no AUI loopback diff --git a/board/LEOX/elpt860/flash.c b/board/LEOX/elpt860/flash.c index 7107aaa..c1b3b85 100644 --- a/board/LEOX/elpt860/flash.c +++ b/board/LEOX/elpt860/flash.c @@ -79,41 +79,41 @@ static int write_byte (flash_info_t *info, ulong dest, uchar data); /*----------------------------------------------------------------------- */ -unsigned long +unsigned long flash_init (void) { volatile immap_t *immap = (immap_t *)CFG_IMMR; volatile memctl8xx_t *memctl = &immap->im_memctl; unsigned long size_b0; int i; - + /* Init: no FLASHes known */ - for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) + for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) { flash_info[i].flash_id = FLASH_UNKNOWN; } - + /* Static FLASH Bank configuration here - FIXME XXX */ - - size_b0 = flash_get_size ((volatile unsigned char *)FLASH_BASE0_PRELIM, + + size_b0 = flash_get_size ((volatile unsigned char *)FLASH_BASE0_PRELIM, &flash_info[0]); - - if ( flash_info[0].flash_id == FLASH_UNKNOWN ) + + if ( flash_info[0].flash_id == FLASH_UNKNOWN ) { printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n", size_b0, size_b0<<20); } - + /* Remap FLASH according to real size */ memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size_b0 & OR_AM_MSK); memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_PS_8 | BR_V; - + /* Re-do sizing to get full correct info */ - size_b0 = flash_get_size ((volatile unsigned char *)CFG_FLASH_BASE, + size_b0 = flash_get_size ((volatile unsigned char *)CFG_FLASH_BASE, &flash_info[0]); - + flash_get_offsets (CFG_FLASH_BASE, &flash_info[0]); - + #if CFG_MONITOR_BASE >= CFG_FLASH_BASE /* monitor protection ON by default */ flash_protect (FLAG_PROTECT_SET, @@ -121,7 +121,7 @@ flash_init (void) CFG_MONITOR_BASE + monitor_flash_len-1, &flash_info[0]); #endif - + #ifdef CFG_ENV_IS_IN_FLASH /* ENV protection ON by default */ flash_protect(FLAG_PROTECT_SET, @@ -131,14 +131,14 @@ flash_init (void) #endif flash_info[0].size = size_b0; - + return (size_b0); } /*----------------------------------------------------------------------- */ -static void -flash_get_offsets (ulong base, +static void +flash_get_offsets (ulong base, flash_info_t *info) { int i; @@ -146,7 +146,7 @@ flash_get_offsets (ulong base, #define SECTOR_64KB 0x00010000 /* set up sector start adress table */ - for (i = 0; i < info->sector_count; i++) + for (i = 0; i < info->sector_count; i++) { info->start[i] = base + (i * SECTOR_64KB); } @@ -154,38 +154,38 @@ flash_get_offsets (ulong base, /*----------------------------------------------------------------------- */ -void +void flash_print_info (flash_info_t *info) { int i; - - if ( info->flash_id == FLASH_UNKNOWN ) + + if ( info->flash_id == FLASH_UNKNOWN ) { printf ("missing or unknown FLASH type\n"); return; } - switch ( info->flash_id & FLASH_VENDMASK ) + switch ( info->flash_id & FLASH_VENDMASK ) { case FLASH_MAN_AMD: printf ("AMD "); break; case FLASH_MAN_FUJ: printf ("FUJITSU "); break; case FLASH_MAN_STM: printf ("STM (Thomson) "); break; default: printf ("Unknown Vendor "); break; } - - switch ( info->flash_id & FLASH_TYPEMASK ) + + switch ( info->flash_id & FLASH_TYPEMASK ) { case FLASH_AM040: printf ("AM29F040 (4 Mbits)\n"); break; default: printf ("Unknown Chip Type\n"); break; } - - printf (" Size: %ld KB in %d Sectors\n", + + printf (" Size: %ld KB in %d Sectors\n", info->size >> 10, info->sector_count); - + printf (" Sector Start Addresses:"); - for (i=0; i<info->sector_count; ++i) + for (i=0; i<info->sector_count; ++i) { if ((i % 5) == 0) printf ("\n "); @@ -210,9 +210,9 @@ flash_print_info (flash_info_t *info) * The following code cannot be run from FLASH! */ -static ulong -flash_get_size (volatile unsigned char *addr, - flash_info_t *info) +static ulong +flash_get_size (volatile unsigned char *addr, + flash_info_t *info) { short i; uchar value; @@ -222,10 +222,10 @@ flash_get_size (volatile unsigned char *addr, addr[0x0555] = 0xAA; addr[0x02AA] = 0x55; addr[0x0555] = 0x90; - + value = addr[0]; - switch ( value ) + switch ( value ) { /* case AMD_MANUFACT: */ case 0x01: @@ -246,10 +246,10 @@ flash_get_size (volatile unsigned char *addr, info->size = 0; return (0); /* no or unknown flash */ } - + value = addr[1]; /* device ID */ - - switch ( value ) + + switch ( value ) { case STM_ID_F040B: case AMD_ID_F040B: @@ -264,13 +264,13 @@ flash_get_size (volatile unsigned char *addr, } /* set up sector start adress table */ - for (i = 0; i < info->sector_count; i++) + for (i = 0; i < info->sector_count; i++) { info->start[i] = base + (i * 0x00010000); } - + /* check for protected sectors */ - for (i = 0; i < info->sector_count; i++) + for (i = 0; i < info->sector_count; i++) { /* read sector protection at sector address, (A7 .. A0) = 0x02 */ /* D0 = 1 if protected */ @@ -281,13 +281,13 @@ flash_get_size (volatile unsigned char *addr, /* * Prevent writes to uninitialized FLASH. */ - if ( info->flash_id != FLASH_UNKNOWN ) + if ( info->flash_id != FLASH_UNKNOWN ) { addr = (volatile unsigned char *)info->start[0]; - + *addr = 0xF0; /* reset bank */ } - + return (info->size); } @@ -296,21 +296,21 @@ flash_get_size (volatile unsigned char *addr, */ int -flash_erase (flash_info_t *info, - int s_first, +flash_erase (flash_info_t *info, + int s_first, int s_last) { volatile unsigned char *addr = (volatile unsigned char *)(info->start[0]); int flag, prot, sect, l_sect; ulong start, now, last; - - if ( (s_first < 0) || (s_first > s_last) ) + + if ( (s_first < 0) || (s_first > s_last) ) { - if ( info->flash_id == FLASH_UNKNOWN ) + if ( info->flash_id == FLASH_UNKNOWN ) { printf ("- missing\n"); - } - else + } + else { printf ("- no sectors to erase\n"); } @@ -318,44 +318,44 @@ flash_erase (flash_info_t *info, } if ( (info->flash_id == FLASH_UNKNOWN) || - (info->flash_id > FLASH_AMD_COMP) ) + (info->flash_id > FLASH_AMD_COMP) ) { printf ("Can't erase unknown flash type %08lx - aborted\n", info->flash_id); return ( 1 ); } - + prot = 0; - for (sect=s_first; sect<=s_last; ++sect) + for (sect=s_first; sect<=s_last; ++sect) { - if ( info->protect[sect] ) + if ( info->protect[sect] ) { prot++; } } - - if ( prot ) + + if ( prot ) { printf ("- Warning: %d protected sectors will not be erased!\n", prot); - } - else + } + else { printf ("\n"); } - + l_sect = -1; - + /* Disable interrupts which might cause a timeout here */ flag = disable_interrupts(); - + addr[0x0555] = 0xAA; addr[0x02AA] = 0x55; addr[0x0555] = 0x80; addr[0x0555] = 0xAA; addr[0x02AA] = 0x55; - + /* Start erase on unprotected sectors */ - for (sect = s_first; sect<=s_last; sect++) + for (sect = s_first; sect<=s_last; sect++) { if (info->protect[sect] == 0) /* not protected */ { @@ -364,26 +364,26 @@ flash_erase (flash_info_t *info, l_sect = sect; } } - + /* re-enable interrupts if necessary */ if ( flag ) enable_interrupts(); - + /* wait at least 80us - let's wait 1 ms */ udelay (1000); - + /* * We wait for the last triggered sector */ if ( l_sect < 0 ) goto DONE; - + start = get_timer (0); last = start; addr = (volatile unsigned char *)(info->start[l_sect]); - while ( (addr[0] & 0x80) != 0x80 ) + while ( (addr[0] & 0x80) != 0x80 ) { - if ( (now = get_timer(start)) > CFG_FLASH_ERASE_TOUT ) + if ( (now = get_timer(start)) > CFG_FLASH_ERASE_TOUT ) { printf ("Timeout\n"); return ( 1 ); @@ -395,14 +395,14 @@ flash_erase (flash_info_t *info, last = now; } } - + DONE: /* reset to read mode */ addr = (volatile unsigned char *)info->start[0]; addr[0] = 0xF0; /* reset bank */ - + printf (" done\n"); - + return ( 0 ); } @@ -413,10 +413,10 @@ DONE: * 2 - Flash not erased */ -int -write_buff (flash_info_t *info, - uchar *src, - ulong addr, +int +write_buff (flash_info_t *info, + uchar *src, + ulong addr, ulong cnt) { ulong cp, wp, data; @@ -428,16 +428,16 @@ write_buff (flash_info_t *info, /* Width of the data bus: 8 bits */ wp = addr; - + while ( cnt ) { bdata = *src++; - + if ( (rc = write_byte(info, wp, bdata)) != 0 ) { return (rc); } - + ++wp; --cnt; } @@ -449,72 +449,72 @@ write_buff (flash_info_t *info, /* Width of the data bus: 32 bits */ wp = (addr & ~3); /* get lower word aligned address */ - + /* * handle unaligned start bytes */ - if ( (l = addr - wp) != 0 ) + if ( (l = addr - wp) != 0 ) { data = 0; - for (i=0, cp=wp; i<l; ++i, ++cp) + for (i=0, cp=wp; i<l; ++i, ++cp) { data = (data << 8) | (*(uchar *)cp); } - for (; i<4 && cnt>0; ++i) + for (; i<4 && cnt>0; ++i) { data = (data << 8) | *src++; --cnt; ++cp; } - for (; cnt==0 && i<4; ++i, ++cp) + for (; cnt==0 && i<4; ++i, ++cp) { data = (data << 8) | (*(uchar *)cp); } - - if ( (rc = write_word(info, wp, data)) != 0 ) + + if ( (rc = write_word(info, wp, data)) != 0 ) { return (rc); } wp += 4; } - + /* * handle word aligned part */ - while ( cnt >= 4 ) + while ( cnt >= 4 ) { data = 0; - for (i=0; i<4; ++i) + for (i=0; i<4; ++i) { data = (data << 8) | *src++; } - if ( (rc = write_word(info, wp, data)) != 0 ) + if ( (rc = write_word(info, wp, data)) != 0 ) { return (rc); } wp += 4; cnt -= 4; } - - if ( cnt == 0 ) + + if ( cnt == 0 ) { return (0); } - + /* * handle unaligned tail bytes */ data = 0; - for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) + for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) { data = (data << 8) | *src++; --cnt; } - for (; i<4; ++i, ++cp) + for (; i<4; ++i, ++cp) { data = (data << 8) | (*(uchar *)cp); } - + return (write_word(info, wp, data)); } } @@ -525,38 +525,38 @@ write_buff (flash_info_t *info, * 1 - write timeout * 2 - Flash not erased */ -static int -write_word (flash_info_t *info, - ulong dest, +static int +write_word (flash_info_t *info, + ulong dest, ulong data) { vu_long *addr = (vu_long*)(info->start[0]); ulong start; 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(); - + addr[0x0555] = 0x00AA00AA; addr[0x02AA] = 0x00550055; addr[0x0555] = 0x00A000A0; - + *((vu_long *)dest) = data; - + /* re-enable interrupts if necessary */ if ( flag ) enable_interrupts(); /* data polling for D7 */ start = get_timer (0); - while ( (*((vu_long *)dest) & 0x00800080) != (data & 0x00800080) ) + while ( (*((vu_long *)dest) & 0x00800080) != (data & 0x00800080) ) { - if ( get_timer(start) > CFG_FLASH_WRITE_TOUT ) + if ( get_timer(start) > CFG_FLASH_WRITE_TOUT ) { return (1); } @@ -571,38 +571,38 @@ write_word (flash_info_t *info, * 1 - write timeout * 2 - Flash not erased */ -static int -write_byte (flash_info_t *info, - ulong dest, +static int +write_byte (flash_info_t *info, + ulong dest, uchar data) { volatile unsigned char *addr = (volatile unsigned char *)(info->start[0]); ulong start; int flag; - + /* Check if Flash is (sufficiently) erased */ - if ( (*((volatile unsigned char *)dest) & data) != data ) + if ( (*((volatile unsigned char *)dest) & data) != data ) { return (2); } /* Disable interrupts which might cause a timeout here */ flag = disable_interrupts(); - + addr[0x0555] = 0xAA; addr[0x02AA] = 0x55; addr[0x0555] = 0xA0; - + *((volatile unsigned char *)dest) = data; - + /* re-enable interrupts if necessary */ if ( flag ) enable_interrupts(); /* data polling for D7 */ start = get_timer (0); - while ( (*((volatile unsigned char *)dest) & 0x80) != (data & 0x80) ) + while ( (*((volatile unsigned char *)dest) & 0x80) != (data & 0x80) ) { - if ( get_timer(start) > CFG_FLASH_WRITE_TOUT ) + if ( get_timer(start) > CFG_FLASH_WRITE_TOUT ) { return (1); } diff --git a/board/LEOX/elpt860/u-boot.lds b/board/LEOX/elpt860/u-boot.lds index cecb210..d23af96 100644 --- a/board/LEOX/elpt860/u-boot.lds +++ b/board/LEOX/elpt860/u-boot.lds @@ -123,6 +123,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/LEOX/elpt860/u-boot.lds.debug b/board/LEOX/elpt860/u-boot.lds.debug index b81235f..269e8d9 100644 --- a/board/LEOX/elpt860/u-boot.lds.debug +++ b/board/LEOX/elpt860/u-boot.lds.debug @@ -137,4 +137,3 @@ SECTIONS _end = . ; PROVIDE (end = .); } - |