From: Erik M. <er...@us...> - 2001-10-31 16:44:21
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv12627 Modified Files: flash.c h3600.c linux.c main.c param_block.c Log Message: Get rid of blockSize Clean up flash functions More support for Ipaq Index: flash.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/flash.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- flash.c 2001/10/25 09:59:23 1.7 +++ flash.c 2001/10/31 16:44:18 1.8 @@ -67,6 +67,16 @@ + +/* dummy function for enable_vpp and disable_vpp */ +int flash_dummy_ok(void) +{ + return 0; +} + + + + /* initialise the flash blocks table */ static void init_flash(void) { @@ -86,8 +96,16 @@ SerialOutputString("undefined flash_driver\n"); return; } -#endif +#endif + + /* fill out missing flash driver functions */ + if(flash_driver->enable_vpp == NULL) + flash_driver->enable_vpp = flash_dummy_ok; + + if(flash_driver->disable_vpp == NULL) + flash_driver->disable_vpp = flash_dummy_ok; + /* initialise flash blocks table */ num_flash_blocks = 0; while(flash_descriptors[i].size != 0) { @@ -165,6 +183,9 @@ SerialOutputHex((u32)start); SerialOutputByte('\n'); #endif + + flash_driver->enable_vpp(); + while(cur < end) { if(*cur != 0xffffffff) { SerialOutputString("erasing dirty block at 0x"); @@ -179,6 +200,7 @@ SerialOutputString("flash erase error at 0x"); SerialOutputHex((u32)cur); SerialOutputByte('\n'); + flash_driver->disable_vpp(); return rv; } @@ -187,6 +209,8 @@ cur ++; } + flash_driver->disable_vpp(); + return 0; } @@ -227,6 +251,8 @@ SerialOutputByte('\n'); #endif + flash_driver->enable_vpp(); + while(i < nwords) { /* nothing to write */ if(dst[i] == src[i]) { @@ -253,6 +279,8 @@ nerase++; if(rv < 0) { /* something is obviously wrong */ + flash_driver->disable_vpp(); + return rv; } @@ -276,6 +304,8 @@ if(nerrors > 2 * nwords) { printerrprefix(); SerialOutputString("too many flash errors, probably hardware error\n"); + flash_driver->disable_vpp(); + return -EFLASHPGM; } } @@ -293,6 +323,8 @@ SerialOutputString(" words scanned down\n"); SerialOutputByte('\n'); #endif + + flash_driver->disable_vpp(); return 0; } Index: h3600.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/h3600.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- h3600.c 2001/10/28 20:27:38 1.2 +++ h3600.c 2001/10/31 16:44:18 1.3 @@ -33,8 +33,42 @@ +/* taken from Linux include/asm-arm/arch-sa1100/h3600.h */ +#define EGPIO_H3600_VPP_ON (1 << 0) +#define EGPIO_H3600_RS232_ON (1 << 7) /* UART3 transceiver force on. Active high. */ + + +/* H3600 EGPIO register */ +static u32 *EGPIO = (u32 *)0x49000000; + +/* the EGPIO register is write only, so we need a shadow register to + * remember the state + */ +static u32 shadow_egpio; + + + + +static void h3600_clr_egpio(u32 x) +{ + shadow_egpio &= ~x; + *EGPIO = shadow_egpio; +} + + + + +static void h3600_set_egpio(u32 x) +{ + shadow_egpio |= x; + *EGPIO = shadow_egpio; +} + + + + /* flash descriptor for H3600 flash */ -/* 2x 28F640J3A (16MB) */ +/* 2x Intel 28F640J3A (16MB) */ static flash_descriptor_t h3600_flash_descriptors[] = { { @@ -50,35 +84,46 @@ -static void init_h3600_flash_driver(void) +static int h3600_flash_enable_vpp(void) { - flash_descriptors = h3600_flash_descriptors; - flash_driver = &intel32_flash_driver; + h3600_set_egpio(EGPIO_H3600_VPP_ON); + + return 0; } -__initlist(init_h3600_flash_driver, INIT_LEVEL_OTHER_STUFF); -/* H3600 EGPIO register */ -static u32 *EGPIO = (u32 *)0x49000000; +static int h3600_flash_disable_vpp(void) +{ + h3600_clr_egpio(EGPIO_H3600_VPP_ON); -/* the EGPIO register is write only, so we need a shadow register to - * remember the state - */ -static u32 shadow_egpio; + return 0; +} -/* taken from Linux include/asm-arm/arch-sa1100/h3600.h */ -#define EGPIO_H3600_VPP_ON (1 << 0) -#define EGPIO_H3600_RS232_ON (1 << 7) /* UART3 transceiver force on. Active high. */ +static void init_h3600_flash_driver(void) +{ + flash_descriptors = h3600_flash_descriptors; + + flash_driver = &intel32_flash_driver; + + flash_driver->enable_vpp = h3600_flash_enable_vpp; + flash_driver->disable_vpp = h3600_flash_disable_vpp; +} + +__initlist(init_h3600_flash_driver, INIT_LEVEL_OTHER_STUFF); + + + static void h3600_init_egpio(void) { + shadow_egpio = 0; + /* enable RS232 tranceiver */ - shadow_egpio = EGPIO_H3600_RS232_ON; - *EGPIO = shadow_egpio; + h3600_set_egpio(EGPIO_H3600_RS232_ON); } Index: linux.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/linux.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- linux.c 2001/10/14 20:24:32 1.4 +++ linux.c 2001/10/31 16:44:18 1.5 @@ -28,7 +28,6 @@ #include <blob/linux.h> #include <blob/arch.h> #include <blob/command.h> -#include <blob/flash.h> #include <blob/init.h> #include <blob/main.h> #include <blob/memory.h> @@ -157,7 +156,7 @@ params->hdr.size = tag_size(tag_initrd); params->u.initrd.start = RAMDISK_RAM_BASE; - params->u.initrd.size = INITRD_LEN; + params->u.initrd.size = RAMDISK_FLASH_LEN; params = tag_next(params); } Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/main.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- main.c 2001/10/29 11:48:13 1.7 +++ main.c 2001/10/31 16:44:18 1.8 @@ -64,13 +64,13 @@ blob_status_t blob_status; +static char *version_str = PACKAGE " version " VERSION " for " BOARD_NAME "\n"; int main(void) { - u32 blockSize = 0x00800000; int numRead = 0; char commandline[MAX_COMMANDLINE_LENGTH]; int i; @@ -89,7 +89,6 @@ blob_status.kernelType = fromFlash; blob_status.ramdiskSize = 0; blob_status.ramdiskType = fromFlash; - blob_status.blockSize = blockSize; blob_status.downloadSpeed = baud115k2; blob_status.terminalSpeed = baud9k6; blob_status.load_ramdisk = 1; @@ -98,6 +97,9 @@ /* call SerialInit() because the default 9k6 speed might not be what the user requested */ +#ifdef H3600 + blob_status.terminalSpeed = baud115k2; /* DEBUG */ +#endif SerialInit(blob_status.terminalSpeed); /* parse the core tag, for critical things like terminal speed */ @@ -107,9 +109,8 @@ /* Print the required GPL string */ SerialOutputString("\nConsider yourself LARTed!\n\n"); - SerialOutputString(PACKAGE " version " VERSION " for " - BOARD_NAME "\n" - "Copyright (C) 1999 2000 2001 " + SerialOutputString(version_str); + SerialOutputString("Copyright (C) 1999 2000 2001 " "Jan-Derk Bakker and Erik Mouw\n"); SerialOutputString(PACKAGE " comes with ABSOLUTELY NO WARRANTY; " "read the GNU GPL for details.\n"); @@ -132,12 +133,6 @@ if(blob_status.load_ramdisk) do_reload("ramdisk"); -#ifdef BLOB_DEBUG - /* print some information */ - SerialOutputString("Flash blockSize = 0x"); - SerialOutputHex(blockSize); - SerialOutputByte('\n'); -#endif /* wait 10 seconds before starting autoboot */ SerialOutputString("Autoboot in progress, press any key to stop "); for(i = 0; i < blob_status.boot_delay; i++) { @@ -190,27 +185,27 @@ if(strncmp(argv[1], "blob", 4) == 0) { /* download blob */ startAddress = BLOB_RAM_BASE; - bufLen = blob_status.blockSize - BLOB_BLOCK_OFFSET; + bufLen = BLOB_FLASH_LEN; numRead = &blob_status.blobSize; blob_status.blobType = fromDownload; #ifdef PARAM_START } else if(strncmp(argv[1], "param", 5) == 0) { /* download kernel */ startAddress = PARAM_RAM_BASE; - bufLen = PARAM_LEN; + bufLen = PARAM_FLASH_LEN; numRead = &blob_status.paramSize; blob_status.paramType = fromDownload; #endif } else if(strncmp(argv[1], "kernel", 6) == 0) { /* download kernel */ startAddress = KERNEL_RAM_BASE; - bufLen = blob_status.blockSize - KERNEL_BLOCK_OFFSET; + bufLen = KERNEL_FLASH_LEN; numRead = &blob_status.kernelSize; blob_status.kernelType = fromDownload; } else if(strncmp(argv[1], "ramdisk", 7) == 0) { /* download ramdisk */ startAddress = RAMDISK_RAM_BASE; - bufLen = blob_status.blockSize - RAMDISK_BLOCK_OFFSET; + bufLen = RAMDISK_FLASH_LEN; numRead = &blob_status.ramdiskSize; blob_status.ramdiskType = fromDownload; } else { @@ -281,29 +276,29 @@ if(strncmp(argv[1], "blob", 4) == 0) { src = (u32 *)BLOB_RAM_BASE; - dst = (u32 *)BLOB_START; - maxSize = BLOB_LEN; + dst = (u32 *)BLOB_FLASH_BASE; + maxSize = BLOB_FLASH_LEN; numBytes = blob_status.blobSize; type = blob_status.blobType; #ifdef PARAM_START } else if(strncmp(argv[1], "param", 5) == 0) { src = (u32 *)PARAM_RAM_BASE; - dst = (u32 *)PARAM_START; - maxSize = PARAM_LEN; + dst = (u32 *)PARAM_FLASH_BASE; + maxSize = PARAM_FLASH_LEN; numBytes = blob_status.paramSize; type = blob_status.paramType; #endif } else if(strncmp(argv[1], "kernel", 6) == 0) { src = (u32 *)KERNEL_RAM_BASE; - dst = (u32 *)KERNEL_START; + dst = (u32 *)KERNEL_FLASH_BASE; numBytes = blob_status.kernelSize; - maxSize = KERNEL_LEN; + maxSize = KERNEL_FLASH_LEN; type = blob_status.kernelType; } else if(strncmp(argv[1], "ramdisk", 7) == 0) { src = (u32 *)RAMDISK_RAM_BASE; - dst = (u32 *)INITRD_START; + dst = (u32 *)RAMDISK_FLASH_BASE; numBytes = blob_status.ramdiskSize; - maxSize = INITRD_LEN; + maxSize = RAMDISK_FLASH_LEN; type = blob_status.ramdiskType; } else { printerror(EINVAL, argv[1]); @@ -404,11 +399,7 @@ static int PrintStatus(int argc, char *argv[]) { - SerialOutputString("Bootloader : " PACKAGE "\n"); - SerialOutputString("Version : " VERSION "\n"); - - SerialOutputString("Blocksize : 0x"); - SerialOutputHex(blob_status.blockSize); + SerialOutputString(version_str); SerialOutputString("\nDownload speed: "); PrintSerialSpeed(blob_status.downloadSpeed); @@ -477,31 +468,31 @@ if(strcmp(what, "blob") == 0) { dst = (u32 *)BLOB_RAM_BASE; - src = (u32 *)BLOB_START; - numWords = BLOB_LEN / 4; + src = (u32 *)BLOB_FLASH_BASE; + numWords = BLOB_FLASH_LEN / 4; blob_status.blobSize = 0; blob_status.blobType = fromFlash; SerialOutputString("Loading blob from flash "); #ifdef PARAM_START } else if(strcmp(what, "param") == 0) { dst = (u32 *)PARAM_RAM_BASE; - src = (u32 *)PARAM_START; - numWords = PARAM_LEN / 4; + src = (u32 *)PARAM_FLASH_BASE; + numWords = PARAM_FLASH_LEN / 4; blob_status.paramSize = 0; blob_status.paramType = fromFlash; SerialOutputString("Loading paramater block from flash "); #endif } else if(strcmp(what, "kernel") == 0) { dst = (u32 *)KERNEL_RAM_BASE; - src = (u32 *)KERNEL_START; - numWords = KERNEL_LEN / 4; + src = (u32 *)KERNEL_FLASH_BASE; + numWords = KERNEL_FLASH_LEN / 4; blob_status.kernelSize = 0; blob_status.kernelType = fromFlash; SerialOutputString("Loading kernel from flash "); } else if(strcmp(what, "ramdisk") == 0) { dst = (u32 *)RAMDISK_RAM_BASE; - src = (u32 *)INITRD_START; - numWords = INITRD_LEN / 4; + src = (u32 *)RAMDISK_FLASH_BASE; + numWords = RAMDISK_FLASH_LEN / 4; blob_status.ramdiskSize = 0; blob_status.ramdiskType = fromFlash; SerialOutputString("Loading ramdisk from flash "); Index: param_block.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/param_block.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- param_block.c 2001/10/07 19:34:17 1.2 +++ param_block.c 2001/10/31 16:44:18 1.3 @@ -38,7 +38,6 @@ #include <blob/types.h> #include <blob/param_block.h> #include <blob/main.h> -#include <blob/flash.h> #include <blob/util.h> #include <blob/sa1100.h> |