diff options
author | wdenk | 2003-06-27 21:31:46 +0000 |
---|---|---|
committer | wdenk | 2003-06-27 21:31:46 +0000 |
commit | 8bde7f776c77b343aca29b8c7b58464d915ac245 (patch) | |
tree | 20f1fd99975215e7c658454a15cdb4ed4694e2d4 /board/cradle | |
parent | 993cad9364c6b87ae429d1ed1130d8153f6f027e (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/cradle')
-rw-r--r-- | board/cradle/Makefile | 2 | ||||
-rw-r--r-- | board/cradle/config.mk | 1 | ||||
-rw-r--r-- | board/cradle/flash.c | 172 | ||||
-rw-r--r-- | board/cradle/memsetup.S | 4 | ||||
-rw-r--r-- | board/cradle/u-boot.lds | 25 |
5 files changed, 104 insertions, 100 deletions
diff --git a/board/cradle/Makefile b/board/cradle/Makefile index b694e10e664..5a321eb3939 100644 --- a/board/cradle/Makefile +++ b/board/cradle/Makefile @@ -29,7 +29,7 @@ OBJS := cradle.o flash.o SOBJS := memsetup.o $(LIB): $(OBJS) $(SOBJS) - $(AR) crv $@ $^ + $(AR) crv $@ $(OBJS) $(SOBJS) clean: rm -f $(SOBJS) $(OBJS) diff --git a/board/cradle/config.mk b/board/cradle/config.mk index 297757223c0..3ffcfe84448 100644 --- a/board/cradle/config.mk +++ b/board/cradle/config.mk @@ -1,3 +1,2 @@ TEXT_BASE = 0xa0f08000 #TEXT_BASE = 0 - diff --git a/board/cradle/flash.c b/board/cradle/flash.c index 463026d0ea8..e2d174e524d 100644 --- a/board/cradle/flash.c +++ b/board/cradle/flash.c @@ -45,26 +45,26 @@ ulong flash_init(void) { ulong flashbase = 0; flash_info[i].flash_id = - (INTEL_MANUFACT & FLASH_VENDMASK) | - (INTEL_ID_28F128J3 & FLASH_TYPEMASK); + (INTEL_MANUFACT & FLASH_VENDMASK) | + (INTEL_ID_28F128J3 & FLASH_TYPEMASK); flash_info[i].size = FLASH_BANK_SIZE; flash_info[i].sector_count = CFG_MAX_FLASH_SECT; memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT); switch (i) { - case 0: - flashbase = PHYS_FLASH_1; - break; - case 1: - flashbase = PHYS_FLASH_2; - break; - default: - panic("configured to many flash banks!\n"); - break; + case 0: + flashbase = PHYS_FLASH_1; + break; + case 1: + flashbase = PHYS_FLASH_2; + break; + default: + panic("configured to many flash banks!\n"); + break; } for (j = 0; j < flash_info[i].sector_count; j++) { - flash_info[i].start[j] = flashbase + j*MAIN_SECT_SIZE; + flash_info[i].start[j] = flashbase + j*MAIN_SECT_SIZE; } size += flash_info[i].size; } @@ -72,14 +72,14 @@ ulong flash_init(void) /* Protect monitor and environment sectors */ flash_protect(FLAG_PROTECT_SET, - CFG_FLASH_BASE, - CFG_FLASH_BASE + monitor_flash_len - 1, - &flash_info[0]); + CFG_FLASH_BASE, + CFG_FLASH_BASE + monitor_flash_len - 1, + &flash_info[0]); flash_protect(FLAG_PROTECT_SET, - CFG_ENV_ADDR, - CFG_ENV_ADDR + CFG_ENV_SIZE - 1, - &flash_info[0]); + CFG_ENV_ADDR, + CFG_ENV_ADDR + CFG_ENV_SIZE - 1, + &flash_info[0]); return size; } @@ -94,40 +94,40 @@ void flash_print_info (flash_info_t *info) { switch (info->flash_id & FLASH_VENDMASK) { - case (INTEL_MANUFACT & FLASH_VENDMASK): - printf("Intel: "); - break; - default: - printf("Unknown Vendor "); - break; + case (INTEL_MANUFACT & FLASH_VENDMASK): + printf("Intel: "); + break; + default: + printf("Unknown Vendor "); + break; } switch (info->flash_id & FLASH_TYPEMASK) { - case (INTEL_ID_28F320J3A & FLASH_TYPEMASK): - printf("28F320J3A (32Mbit)\n"); - break; - case (INTEL_ID_28F128J3 & FLASH_TYPEMASK): - printf("28F128J3 (128Mbit)\n"); - break; - default: - printf("Unknown Chip Type\n"); - goto Done; - break; + case (INTEL_ID_28F320J3A & FLASH_TYPEMASK): + printf("28F320J3A (32Mbit)\n"); + break; + case (INTEL_ID_28F128J3 & FLASH_TYPEMASK): + printf("28F128J3 (128Mbit)\n"); + break; + default: + printf("Unknown Chip Type\n"); + goto Done; + break; } printf(" Size: %ld MB in %d Sectors\n", - info->size >> 20, info->sector_count); + info->size >> 20, info->sector_count); printf(" Sector Start Addresses:"); for (i = 0; i < info->sector_count; i++) { - if ((i % 5) == 0) - { - printf ("\n "); - } - printf (" %08lX%s", info->start[i], - info->protect[i] ? " (RO)" : " "); + if ((i % 5) == 0) + { + printf ("\n "); + } + printf (" %08lX%s", info->start[i], + info->protect[i] ? " (RO)" : " "); } printf ("\n"); info++; @@ -145,25 +145,25 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) int rc = ERR_OK; if (info->flash_id == FLASH_UNKNOWN) - return ERR_UNKNOWN_FLASH_TYPE; + return ERR_UNKNOWN_FLASH_TYPE; if ((s_first < 0) || (s_first > s_last)) { - return ERR_INVAL; + return ERR_INVAL; } if ((info->flash_id & FLASH_VENDMASK) != - (INTEL_MANUFACT & FLASH_VENDMASK)) { - return ERR_UNKNOWN_FLASH_VENDOR; + (INTEL_MANUFACT & FLASH_VENDMASK)) { + return ERR_UNKNOWN_FLASH_VENDOR; } prot = 0; for (sect=s_first; sect<=s_last; ++sect) { if (info->protect[sect]) { - prot++; + prot++; } } if (prot) - return ERR_PROTECTED; + return ERR_PROTECTED; /* * Disable interrupts which might cause a timeout @@ -183,24 +183,24 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) reset_timer_masked(); if (info->protect[sect] == 0) { /* not protected */ - vu_short *addr = (vu_short *)(info->start[sect]); - - *addr = 0x20; /* erase setup */ - *addr = 0xD0; /* erase confirm */ - - while ((*addr & 0x80) != 0x80) { - if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) { - *addr = 0xB0; /* suspend erase */ - *addr = 0xFF; /* reset to read mode */ - rc = ERR_TIMOUT; - goto outahere; - } - } - - /* clear status register command */ - *addr = 0x50; - /* reset to read mode */ - *addr = 0xFF; + vu_short *addr = (vu_short *)(info->start[sect]); + + *addr = 0x20; /* erase setup */ + *addr = 0xD0; /* erase confirm */ + + while ((*addr & 0x80) != 0x80) { + if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) { + *addr = 0xB0; /* suspend erase */ + *addr = 0xFF; /* reset to read mode */ + rc = ERR_TIMOUT; + goto outahere; + } + } + + /* clear status register command */ + *addr = 0x50; + /* reset to read mode */ + *addr = 0xFF; } printf("ok.\n"); } @@ -258,30 +258,30 @@ static int write_word (flash_info_t *info, ulong dest, ushort data) while(((val = *addr) & 0x80) != 0x80) { if (get_timer_masked() > CFG_FLASH_WRITE_TOUT) { - rc = ERR_TIMOUT; - /* suspend program command */ - *addr = 0xB0; - goto outahere; + rc = ERR_TIMOUT; + /* suspend program command */ + *addr = 0xB0; + goto outahere; } } if(val & 0x1A) { /* check for error */ printf("\nFlash write error %02x at address %08lx\n", - (int)val, (unsigned long)dest); + (int)val, (unsigned long)dest); if(val & (1<<3)) { - printf("Voltage range error.\n"); - rc = ERR_PROG_ERROR; - goto outahere; + printf("Voltage range error.\n"); + rc = ERR_PROG_ERROR; + goto outahere; } if(val & (1<<1)) { - printf("Device protect error.\n"); - rc = ERR_PROTECTED; - goto outahere; + printf("Device protect error.\n"); + rc = ERR_PROTECTED; + goto outahere; } if(val & (1<<4)) { - printf("Programming error.\n"); - rc = ERR_PROG_ERROR; - goto outahere; + printf("Programming error.\n"); + rc = ERR_PROG_ERROR; + goto outahere; } rc = ERR_PROG_ERROR; goto outahere; @@ -317,19 +317,19 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) { data = 0; for (i=0, cp=wp; i<l; ++i, ++cp) { - data = (data >> 8) | (*(uchar *)cp << 8); + data = (data >> 8) | (*(uchar *)cp << 8); } for (; i<2 && cnt>0; ++i) { - data = (data >> 8) | (*src++ << 8); - --cnt; - ++cp; + data = (data >> 8) | (*src++ << 8); + --cnt; + ++cp; } for (; cnt==0 && i<2; ++i, ++cp) { - data = (data >> 8) | (*(uchar *)cp << 8); + data = (data >> 8) | (*(uchar *)cp << 8); } if ((rc = write_word(info, wp, data)) != 0) { - return (rc); + return (rc); } wp += 2; } @@ -340,7 +340,7 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) while (cnt >= 2) { data = *((vu_short*)src); if ((rc = write_word(info, wp, data)) != 0) { - return (rc); + return (rc); } src += 2; wp += 2; diff --git a/board/cradle/memsetup.S b/board/cradle/memsetup.S index 2f1e042fbb0..8800cb0cb72 100644 --- a/board/cradle/memsetup.S +++ b/board/cradle/memsetup.S @@ -170,8 +170,8 @@ memsetup: SET_LED 2 mem_init: - @ get memory controller base address - ldr r1, =MEMC_BASE + @ get memory controller base address + ldr r1, =MEMC_BASE @**************************************************************************** diff --git a/board/cradle/u-boot.lds b/board/cradle/u-boot.lds index 46beb152c77..d321b627945 100644 --- a/board/cradle/u-boot.lds +++ b/board/cradle/u-boot.lds @@ -26,30 +26,35 @@ OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS { - . = 0x00000000; + . = 0x00000000; - . = ALIGN(4); + . = ALIGN(4); .text : { cpu/pxa/start.o (.text) *(.text) } - . = ALIGN(4); - .rodata : { *(.rodata) } + . = ALIGN(4); + .rodata : { *(.rodata) } - . = ALIGN(4); - .data : { *(.data) } + . = ALIGN(4); + .data : { *(.data) } - . = ALIGN(4); - .got : { *(.got) } + . = ALIGN(4); + .got : { *(.got) } + + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; armboot_end_data = .; - . = ALIGN(4); + . = ALIGN(4); bss_start = .; - .bss : { *(.bss) } + .bss : { *(.bss) } bss_end = .; armboot_end = .; + } |