diff options
Diffstat (limited to 'common')
78 files changed, 633 insertions, 590 deletions
diff --git a/common/Makefile b/common/Makefile index b9f4ca7..ee0cb33 100644 --- a/common/Makefile +++ b/common/Makefile @@ -153,8 +153,10 @@ COBJS-$(CONFIG_CMD_DOC) += docecc.o COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o COBJS-y += flash.o COBJS-$(CONFIG_CMD_KGDB) += kgdb.o +COBJS-$(CONFIG_KALLSYMS) += kallsyms.o COBJS-$(CONFIG_LCD) += lcd.o COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o +COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o COBJS-$(CONFIG_UPDATE_TFTP) += update.o COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o diff --git a/common/cmd_ambapp.c b/common/cmd_ambapp.c index 06531f1..bb20ab5 100644 --- a/common/cmd_ambapp.c +++ b/common/cmd_ambapp.c @@ -273,6 +273,7 @@ int ambapp_init_reloc(void) } U_BOOT_CMD(ambapp, 1, 1, do_ambapp_print, - "list AMBA Plug&Play information", - "ambapp\n" - " - lists AMBA (AHB & APB) Plug&Play devices present on the system\n"); + "list AMBA Plug&Play information", + "ambapp\n" + " - lists AMBA (AHB & APB) Plug&Play devices present on the system" +); diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index b230924..11c1547 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -384,5 +384,5 @@ static void print_str(const char *name, const char *str) U_BOOT_CMD( bdinfo, 1, 1, do_bdinfo, "print Board Info structure", - NULL + "" ); diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c index cd9e720..8be1c25 100644 --- a/common/cmd_bedbug.c +++ b/common/cmd_bedbug.c @@ -108,7 +108,7 @@ int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD (ds, 3, 1, do_bedbug_dis, "disassemble memory", - "ds <address> [# instructions]\n"); + "ds <address> [# instructions]"); /* ====================================================================== * Entry point from the interpreter to the assembler. Assembles @@ -160,7 +160,7 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } /* do_bedbug_asm */ U_BOOT_CMD (as, 2, 0, do_bedbug_asm, - "assemble memory", "as <address>\n"); + "assemble memory", "as <address>"); /* ====================================================================== * Used to set a break point from the interpreter. Simply calls into the @@ -181,7 +181,7 @@ U_BOOT_CMD (break, 3, 0, do_bedbug_break, " - Set or clear a breakpoint\n" "break <address> - Break at an address\n" "break off <bp#> - Disable breakpoint.\n" - "break show - List breakpoints.\n"); + "break show - List breakpoints."); /* ====================================================================== * Called from the debug interrupt routine. Simply calls the CPU-specific @@ -278,7 +278,7 @@ int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD (continue, 1, 0, do_bedbug_continue, "continue from a breakpoint", - " - continue from a breakpoint.\n"); + ""); /* ====================================================================== * Interpreter command to continue to the next instruction, stepping into @@ -309,7 +309,7 @@ int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD (step, 1, 1, do_bedbug_step, "single step execution.", - " - single step execution.\n"); + ""); /* ====================================================================== * Interpreter command to continue to the next instruction, stepping over @@ -340,7 +340,7 @@ int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD (next, 1, 1, do_bedbug_next, "single step execution, stepping over subroutines.", - " - single step execution, stepping over subroutines.\n"); + ""); /* ====================================================================== * Interpreter command to print the current stack. This assumes an EABI @@ -385,7 +385,7 @@ int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD (where, 1, 1, do_bedbug_stack, "Print the running stack.", - " - Print the running stack.\n"); + ""); /* ====================================================================== * Interpreter command to dump the registers. Calls the CPU-specific @@ -405,7 +405,7 @@ int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } /* do_bedbug_rdump */ U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump, - "Show registers.", " - Show registers.\n"); + "Show registers.", ""); /* ====================================================================== */ diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index abbb070..fc8462e 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -141,7 +141,7 @@ U_BOOT_CMD( bmp, 5, 1, do_bmp, "manipulate BMP image data", "info <imageAddr> - display image info\n" - "bmp display <imageAddr> [x y] - display image at x,y\n" + "bmp display <imageAddr> [x y] - display image at x,y" ); /* diff --git a/common/cmd_boot.c b/common/cmd_boot.c index efc1a02..bfc1db2 100644 --- a/common/cmd_boot.c +++ b/common/cmd_boot.c @@ -66,7 +66,7 @@ U_BOOT_CMD( go, CONFIG_SYS_MAXARGS, 1, do_go, "start application at address 'addr'", "addr [arg ...]\n - start application at address 'addr'\n" - " passing 'arg' as arguments\n" + " passing 'arg' as arguments" ); extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); @@ -74,5 +74,5 @@ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); U_BOOT_CMD( reset, 1, 0, do_reset, "Perform RESET of the CPU", - NULL + "" ); diff --git a/common/cmd_bootldr.c b/common/cmd_bootldr.c index 48d113f..b2a8b0e 100644 --- a/common/cmd_bootldr.c +++ b/common/cmd_bootldr.c @@ -170,4 +170,5 @@ int do_bootldr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD(bootldr, 2, 0, do_bootldr, "boot ldr image from memory", "[addr]\n" - " - boot ldr image stored in memory\n"); + "" +); diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index bd1813a..367d5a7 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -948,7 +948,7 @@ U_BOOT_CMD( "\tbdt - OS specific bd_t processing\n" "\tcmdline - OS specific command line processing/setup\n" "\tprep - OS specific prep before relocation or go\n" - "\tgo - start OS\n" + "\tgo - start OS" ); /*******************************************************************/ @@ -973,14 +973,14 @@ int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( boot, 1, 1, do_bootd, "boot default, i.e., run 'bootcmd'", - NULL + "" ); /* keep old command name "bootd" for backward compatibility */ U_BOOT_CMD( bootd, 1, 1, do_bootd, "boot default, i.e., run 'bootcmd'", - NULL + "" ); #endif @@ -1068,7 +1068,7 @@ U_BOOT_CMD( "addr [addr ...]\n" " - print header information for application image starting at\n" " address 'addr' in memory; this includes verification of the\n" - " image contents (magic number, header and payload checksums)\n" + " image contents (magic number, header and payload checksums)" ); #endif @@ -1135,7 +1135,7 @@ U_BOOT_CMD( "list all images found in flash", "\n" " - Prints information about all images found at sector\n" - " boundaries in flash.\n" + " boundaries in flash." ); #endif diff --git a/common/cmd_cache.c b/common/cmd_cache.c index c0f2cba..0dfa336 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -99,14 +99,14 @@ U_BOOT_CMD( icache, 2, 1, do_icache, "enable or disable instruction cache", "[on, off]\n" - " - enable or disable instruction cache\n" + " - enable or disable instruction cache" ); U_BOOT_CMD( dcache, 2, 1, do_dcache, "enable or disable data cache", "[on, off]\n" - " - enable or disable data (writethrough) cache\n" + " - enable or disable data (writethrough) cache" ); #endif diff --git a/common/cmd_cplbinfo.c b/common/cmd_cplbinfo.c index 56e70d6..1a044d2 100644 --- a/common/cmd_cplbinfo.c +++ b/common/cmd_cplbinfo.c @@ -55,5 +55,5 @@ int do_cplbinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD(cplbinfo, 1, 0, do_cplbinfo, "display current CPLB tables", - "\n" - " - display current CPLB tables\n"); + "" +); diff --git a/common/cmd_dataflash_mmc_mux.c b/common/cmd_dataflash_mmc_mux.c index 4b2cf1c..97e303e 100644 --- a/common/cmd_dataflash_mmc_mux.c +++ b/common/cmd_dataflash_mmc_mux.c @@ -61,5 +61,5 @@ U_BOOT_CMD( dataflash_mmc_mux, 2, 1, do_dataflash_mmc_mux, "dataflash_mmc_mux\t- enable or disable MMC or SPI\n", "[mmc, spi]\n" - " - enable or disable MMC or SPI\n" + " - enable or disable MMC or SPI" ); diff --git a/common/cmd_date.c b/common/cmd_date.c index 3d78be2..b69e935 100644 --- a/common/cmd_date.c +++ b/common/cmd_date.c @@ -218,5 +218,5 @@ U_BOOT_CMD( "[MMDDhhmm[[CC]YY][.ss]]\ndate reset\n" " - without arguments: print date & time\n" " - with numeric argument: set the system date & time\n" - " - with 'reset' argument: reset the RTC\n" + " - with 'reset' argument: reset the RTC" ); diff --git a/common/cmd_dcr.c b/common/cmd_dcr.c index 7aed06c..4f23b8d 100644 --- a/common/cmd_dcr.c +++ b/common/cmd_dcr.c @@ -224,22 +224,22 @@ int do_setidcr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( getdcr, 2, 1, do_getdcr, "Get an AMCC PPC 4xx DCR's value", - "dcrn - return a DCR's value.\n" + "dcrn - return a DCR's value." ); U_BOOT_CMD( setdcr, 2, 1, do_setdcr, "Set an AMCC PPC 4xx DCR's value", - "dcrn - set a DCR's value.\n" + "dcrn - set a DCR's value." ); U_BOOT_CMD( getidcr, 3, 1, do_getidcr, "Get a register value via indirect DCR addressing", - "adr_dcrn[.dat_dcrn] offset - write offset to adr_dcrn, read value from dat_dcrn.\n" + "adr_dcrn[.dat_dcrn] offset - write offset to adr_dcrn, read value from dat_dcrn." ); U_BOOT_CMD( setidcr, 4, 1, do_setidcr, "Set a register value via indirect DCR addressing", - "adr_dcrn[.dat_dcrn] offset value - write offset to adr_dcrn, write value to dat_dcrn.\n" + "adr_dcrn[.dat_dcrn] offset value - write offset to adr_dcrn, write value to dat_dcrn." ); diff --git a/common/cmd_df.c b/common/cmd_df.c index d64f900..7f957fe 100644 --- a/common/cmd_df.c +++ b/common/cmd_df.c @@ -34,4 +34,4 @@ usage: U_BOOT_CMD( sf, 2, 1, do_serial_flash, "Serial flash sub-system", - "probe [bus:]cs - init flash device on given SPI bus and CS\n") + "probe [bus:]cs - init flash device on given SPI bus and CS") diff --git a/common/cmd_diag.c b/common/cmd_diag.c index c2a6175..0436c49 100644 --- a/common/cmd_diag.c +++ b/common/cmd_diag.c @@ -72,5 +72,5 @@ U_BOOT_CMD( " - print information about specified tests\n" "diag run - run all available tests\n" "diag run [test1 [test2]]\n" - " - run specified tests\n" + " - run specified tests" ); diff --git a/common/cmd_display.c b/common/cmd_display.c index 4102424..3422395 100644 --- a/common/cmd_display.c +++ b/common/cmd_display.c @@ -74,5 +74,5 @@ U_BOOT_CMD( "display string on dot matrix display", "[<string>]\n" " - with <string> argument: display <string> on dot matrix display\n" - " - without arguments: clear dot matrix display\n" + " - without arguments: clear dot matrix display" ); diff --git a/common/cmd_doc.c b/common/cmd_doc.c index 3385c67..5cc90f0 100644 --- a/common/cmd_doc.c +++ b/common/cmd_doc.c @@ -202,7 +202,7 @@ U_BOOT_CMD( "doc write addr off size - read/write `size'" " bytes starting at offset `off'\n" " to/from memory address `addr'\n" - "doc erase off size - erase `size' bytes of DOC from offset `off'\n" + "doc erase off size - erase `size' bytes of DOC from offset `off'" ); int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -342,7 +342,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( docboot, 4, 1, do_docboot, "boot from DOC device", - "loadAddr dev\n" + "loadAddr dev" ); int doc_rw (struct DiskOnChip* this, int cmd, diff --git a/common/cmd_dtt.c b/common/cmd_dtt.c index 7783c88..3cfd36e 100644 --- a/common/cmd_dtt.c +++ b/common/cmd_dtt.c @@ -55,6 +55,6 @@ int do_dtt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( dtt, 1, 1, do_dtt, - "Digital Thermometer and Thermostat", - " - Read temperature from digital thermometer and thermostat.\n" + "Read temperature from Digital Thermometer and Thermostat", + "" ); diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c index e598bf1..102efaf 100644 --- a/common/cmd_eeprom.c +++ b/common/cmd_eeprom.c @@ -401,10 +401,6 @@ eeprom_probe (unsigned dev_addr, unsigned offset) #define CONFIG_SYS_I2C_SPEED 50000 #endif -#ifndef CONFIG_SYS_I2C_SLAVE -#define CONFIG_SYS_I2C_SLAVE 0xFE -#endif - void eeprom_init (void) { #if defined(CONFIG_SPI) @@ -428,7 +424,7 @@ U_BOOT_CMD( "EEPROM sub-system", "read devaddr addr off cnt\n" "eeprom write devaddr addr off cnt\n" - " - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'\n" + " - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'" ); #else /* One EEPROM */ U_BOOT_CMD( @@ -436,7 +432,7 @@ U_BOOT_CMD( "EEPROM sub-system", "read addr off cnt\n" "eeprom write addr off cnt\n" - " - read/write `cnt' bytes at EEPROM offset `off'\n" + " - read/write `cnt' bytes at EEPROM offset `off'" ); #endif /* CONFIG_SYS_I2C_MULTI_EEPROMS */ diff --git a/common/cmd_elf.c b/common/cmd_elf.c index 83e7589..abec7dd 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -313,11 +313,11 @@ unsigned long load_elf_image (unsigned long addr) U_BOOT_CMD( bootelf, 2, 0, do_bootelf, "Boot from an ELF image in memory", - " [address] - load address of ELF image.\n" + " [address] - load address of ELF image." ); U_BOOT_CMD( bootvx, 2, 0, do_bootvx, "Boot vxWorks from an ELF image", - " [address] - load address of vxWorks ELF image.\n" + " [address] - load address of vxWorks ELF image." ); diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c index 923b355..6ee60c6 100644 --- a/common/cmd_ext2.c +++ b/common/cmd_ext2.c @@ -118,7 +118,7 @@ U_BOOT_CMD( ext2ls, 4, 1, do_ext2ls, "list files in a directory (default /)", "<interface> <dev[:part]> [directory]\n" - " - list files from 'dev' on 'interface' in a 'directory'\n" + " - list files from 'dev' on 'interface' in a 'directory'" ); /****************************************************************************** @@ -256,5 +256,5 @@ U_BOOT_CMD( "load binary file from a Ext2 filesystem", "<interface> <dev[:part]> [addr] [filename] [bytes]\n" " - load binary file 'filename' from 'dev' on 'interface'\n" - " to address 'addr' from ext2 filesystem\n" + " to address 'addr' from ext2 filesystem" ); diff --git a/common/cmd_fat.c b/common/cmd_fat.c index 4a26b80..f3089a2 100644 --- a/common/cmd_fat.c +++ b/common/cmd_fat.c @@ -91,7 +91,7 @@ U_BOOT_CMD( "load binary file from a dos filesystem", "<interface> <dev[:part]> <addr> <filename> [bytes]\n" " - load binary file 'filename' from 'dev' on 'interface'\n" - " to address 'addr' from dos filesystem\n" + " to address 'addr' from dos filesystem" ); int do_fat_ls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -138,7 +138,7 @@ U_BOOT_CMD( fatls, 4, 1, do_fat_ls, "list files in a directory (default /)", "<interface> <dev[:part]> [directory]\n" - " - list files from 'dev' on 'interface' in a 'directory'\n" + " - list files from 'dev' on 'interface' in a 'directory'" ); int do_fat_fsinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -176,7 +176,7 @@ U_BOOT_CMD( fatinfo, 3, 1, do_fat_fsinfo, "print information about filesystem", "<interface> <dev[:part]>\n" - " - print information about filesystem from 'dev' on 'interface'\n" + " - print information about filesystem from 'dev' on 'interface'" ); #ifdef NOT_IMPLEMENTED_YET diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c index c043b97..8e18c71 100644 --- a/common/cmd_fdc.c +++ b/common/cmd_fdc.c @@ -903,6 +903,6 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( fdcboot, 3, 1, do_fdcboot, "boot from floppy device", - "loadAddr drive\n" + "loadAddr drive" ); #endif diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index bcf98d9..3cc6586 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c @@ -143,11 +143,11 @@ int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( fdosboot, 3, 0, do_fdosboot, "boot from a dos floppy file", - "[loadAddr] [filename]\n" + "[loadAddr] [filename]" ); U_BOOT_CMD( fdosls, 2, 0, do_fdosls, "list files in a directory", - "[directory]\n" + "[directory]" ); diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index 0947b72..8683772 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -840,5 +840,5 @@ U_BOOT_CMD( "fdt chosen [<start> <end>] - Add/update the /chosen branch in the tree\n" " <start>/<end> - initrd start/end addr\n" "NOTE: Dereference aliases by omiting the leading '/', " - "e.g. fdt print ethernet0.\n" + "e.g. fdt print ethernet0." ); diff --git a/common/cmd_flash.c b/common/cmd_flash.c index f1f3517..9f27ab0 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -712,7 +712,7 @@ U_BOOT_CMD( flinfo, 2, 1, do_flinfo, "print FLASH memory information", "\n - print information for all FLASH memory banks\n" - "flinfo N\n - print information for FLASH memory bank # N\n" + "flinfo N\n - print information for FLASH memory bank # N" ); U_BOOT_CMD( @@ -726,7 +726,7 @@ U_BOOT_CMD( "erase N:SF[-SL]\n - erase sectors SF-SL in FLASH bank # N\n" "erase bank N\n - erase FLASH bank # N\n" TMP_ERASE - "erase all\n - erase all FLASH banks\n" + "erase all\n - erase all FLASH banks" ); U_BOOT_CMD( @@ -751,7 +751,7 @@ U_BOOT_CMD( " - make sectors SF-SL writable in FLASH bank # N\n" "protect off bank N\n - make FLASH bank # N writable\n" TMP_PROT_OFF - "protect off all\n - make all FLASH banks writable\n" + "protect off all\n - make all FLASH banks writable" ); #undef TMP_ERASE diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index 362bffd..2e017b8 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -357,9 +357,10 @@ U_BOOT_CMD (fpga, 6, 1, do_fpga, "\tload\tLoad device from memory buffer\n" "\tloadb\tLoad device from bitstream buffer (Xilinx devices only)\n" "\tloadmk\tLoad device generated with mkimage\n" - "\tdump\tLoad device to memory buffer\n" + "\tdump\tLoad device to memory buffer" #if defined(CONFIG_FIT) + "\n" "\tFor loadmk operating on FIT format uImage address must include\n" - "\tsubimage unit name in the form of addr:<subimg_uname>\n" + "\tsubimage unit name in the form of addr:<subimg_uname>" #endif ); diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 16439ac..ae26845 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -27,11 +27,6 @@ * There are several parameters in many of the commands that bear further * explanations: * - * Two of the commands (imm and imw) take a byte/word/long modifier - * (e.g. imm.w specifies the word-length modifier). This was done to - * allow manipulating word-length registers. It was not done on any other - * commands because it was not deemed useful. - * * {i2c_chip} is the I2C chip address (the first byte sent on the bus). * Each I2C chip on the bus has a unique address. On the I2C data bus, * the address is the upper seven bits and the LSB is the "read/write" @@ -69,11 +64,11 @@ * {addr} field (since .1 is the default, it doesn't actually have to * be specified). Examples: given a memory chip at I2C chip address * 0x50, the following would happen... - * imd 50 0 10 display 16 bytes starting at 0x000 + * i2c md 50 0 10 display 16 bytes starting at 0x000 * On the bus: <S> A0 00 <E> <S> A1 <rd> ... <rd> - * imd 50 100 10 display 16 bytes starting at 0x100 + * i2c md 50 100 10 display 16 bytes starting at 0x100 * On the bus: <S> A2 00 <E> <S> A3 <rd> ... <rd> - * imd 50 210 10 display 16 bytes starting at 0x210 + * i2c md 50 210 10 display 16 bytes starting at 0x210 * On the bus: <S> A4 10 <E> <S> A5 <rd> ... <rd> * This is awfully ugly. It would be nice if someone would think up * a better way of handling this. @@ -135,12 +130,27 @@ DECLARE_GLOBAL_DATA_PTR; #endif -static int -mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]); +/* TODO: Implement architecture-specific get/set functions */ +unsigned int __def_i2c_get_bus_speed(void) +{ + return CONFIG_SYS_I2C_SPEED; +} +unsigned int i2c_get_bus_speed(void) + __attribute__((weak, alias("__def_i2c_get_bus_speed"))); + +int __def_i2c_set_bus_speed(unsigned int speed) +{ + if (speed != CONFIG_SYS_I2C_SPEED) + return -1; + + return 0; +} +int i2c_set_bus_speed(unsigned int) + __attribute__((weak, alias("__def_i2c_set_bus_speed"))); /* * Syntax: - * imd {i2c_chip} {addr}{.0, .1, .2} {len} + * i2c md {i2c_chip} {addr}{.0, .1, .2} {len} */ #define DISP_LINE_LEN 16 @@ -244,20 +254,11 @@ int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -int do_i2c_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - return mod_i2c_mem (cmdtp, 1, flag, argc, argv); -} - -int do_i2c_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - return mod_i2c_mem (cmdtp, 0, flag, argc, argv); -} /* Write (fill) memory * * Syntax: - * imw {i2c_chip} {addr}{.0, .1, .2} {data} [{count}] + * i2c mw {i2c_chip} {addr}{.0, .1, .2} {data} [{count}] */ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -341,7 +342,7 @@ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* Calculate a CRC on memory * * Syntax: - * icrc32 {i2c_chip} {addr}{.0, .1, .2} {count} + * i2c crc32 {i2c_chip} {addr}{.0, .1, .2} {count} */ int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -410,8 +411,8 @@ int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* Modify memory. * * Syntax: - * imm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2} - * inm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2} + * i2c mm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2} + * i2c nm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2} */ static int @@ -544,7 +545,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) /* * Syntax: - * iprobe {addr}{.0, .1, .2} + * i2c probe {addr}{.0, .1, .2} */ int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -586,7 +587,7 @@ int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* * Syntax: - * iloop {i2c_chip} {addr}{.0, .1, .2} [{length}] [{delay}] + * i2c loop {i2c_chip} {addr}{.0, .1, .2} [{length}] [{delay}] * {length} - Number of bytes to read * {delay} - A DECIMAL number and defaults to 1000 uSec */ @@ -708,7 +709,7 @@ static void decode_bits (u_char const b, char const *str[], int const do_once) /* * Syntax: - * sdram {i2c_chip} + * i2c sdram {i2c_chip} */ int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { @@ -1186,13 +1187,6 @@ int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } #endif -#if defined(CONFIG_I2C_CMD_TREE) -int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) -{ - i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); - return 0; -} - #if defined(CONFIG_I2C_MUX) int do_i2c_add_bus(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { @@ -1262,52 +1256,55 @@ int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { + /* Strip off leading 'i2c' command argument */ + argc--; + argv++; + #if defined(CONFIG_I2C_MUX) - if (!strncmp(argv[1], "bu", 2)) - return do_i2c_add_bus(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "bu", 2)) + return do_i2c_add_bus(cmdtp, flag, argc, argv); #endif /* CONFIG_I2C_MUX */ - if (!strncmp(argv[1], "sp", 2)) - return do_i2c_bus_speed(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "sp", 2)) + return do_i2c_bus_speed(cmdtp, flag, argc, argv); #if defined(CONFIG_I2C_MULTI_BUS) - if (!strncmp(argv[1], "de", 2)) - return do_i2c_bus_num(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "de", 2)) + return do_i2c_bus_num(cmdtp, flag, argc, argv); #endif /* CONFIG_I2C_MULTI_BUS */ - if (!strncmp(argv[1], "md", 2)) - return do_i2c_md(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "mm", 2)) - return do_i2c_mm(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "mw", 2)) - return do_i2c_mw(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "nm", 2)) - return do_i2c_nm(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "cr", 2)) - return do_i2c_crc(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "pr", 2)) - return do_i2c_probe(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "re", 2)) - return do_i2c_reset(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "lo", 2)) - return do_i2c_loop(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "md", 2)) + return do_i2c_md(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "mm", 2)) + return mod_i2c_mem (cmdtp, 1, flag, argc, argv); + if (!strncmp(argv[0], "mw", 2)) + return do_i2c_mw(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "nm", 2)) + return mod_i2c_mem (cmdtp, 0, flag, argc, argv); + if (!strncmp(argv[0], "cr", 2)) + return do_i2c_crc(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "pr", 2)) + return do_i2c_probe(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "re", 2)) + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + return 0; + if (!strncmp(argv[0], "lo", 2)) + return do_i2c_loop(cmdtp, flag, argc, argv); #if defined(CONFIG_CMD_SDRAM) - if (!strncmp(argv[1], "sd", 2)) - return do_sdram(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "sd", 2)) + return do_sdram(cmdtp, flag, argc, argv); #endif else cmd_usage(cmdtp); return 0; } -#endif /* CONFIG_I2C_CMD_TREE */ /***************************************************/ -#if defined(CONFIG_I2C_CMD_TREE) U_BOOT_CMD( i2c, 6, 1, do_i2c, "I2C sub-system", + "speed [speed] - show or set I2C bus speed\n" #if defined(CONFIG_I2C_MUX) - "bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes.\n" + "i2c bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes\n" #endif /* CONFIG_I2C_MUX */ - "speed [speed] - show or set I2C bus speed\n" #if defined(CONFIG_I2C_MULTI_BUS) "i2c dev [dev] - show or set current I2C bus\n" #endif /* CONFIG_I2C_MULTI_BUS */ @@ -1318,66 +1315,12 @@ U_BOOT_CMD( "i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n" "i2c probe - show devices on the I2C bus\n" "i2c reset - re-init the I2C Controller\n" - "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n" + "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device" #if defined(CONFIG_CMD_SDRAM) - "i2c sdram chip - print SDRAM configuration information\n" + "\n" + "i2c sdram chip - print SDRAM configuration information" #endif ); -#endif /* CONFIG_I2C_CMD_TREE */ -U_BOOT_CMD( - imd, 4, 1, do_i2c_md, \ - "i2c memory display", \ - "chip address[.0, .1, .2] [# of objects]\n - i2c memory display\n" \ -); - -U_BOOT_CMD( - imm, 3, 1, do_i2c_mm, - "i2c memory modify (auto-incrementing)", - "chip address[.0, .1, .2]\n" - " - memory modify, auto increment address\n" -); -U_BOOT_CMD( - inm, 3, 1, do_i2c_nm, - "memory modify (constant address)", - "chip address[.0, .1, .2]\n - memory modify, read and keep address\n" -); - -U_BOOT_CMD( - imw, 5, 1, do_i2c_mw, - "memory write (fill)", - "chip address[.0, .1, .2] value [count]\n - memory write (fill)\n" -); - -U_BOOT_CMD( - icrc32, 5, 1, do_i2c_crc, - "checksum calculation", - "chip address[.0, .1, .2] count\n - compute CRC32 checksum\n" -); - -U_BOOT_CMD( - iprobe, 1, 1, do_i2c_probe, - "probe to discover valid I2C chip addresses", - "\n -discover valid I2C chip addresses\n" -); - -/* - * Require full name for "iloop" because it is an infinite loop! - */ -U_BOOT_CMD( - iloop, 5, 1, do_i2c_loop, - "infinite loop on address range", - "chip address[.0, .1, .2] [# of objects]\n" - " - loop, reading a set of addresses\n" -); - -#if defined(CONFIG_CMD_SDRAM) -U_BOOT_CMD( - isdram, 2, 1, do_sdram, - "print SDRAM configuration information", - "chip\n - print SDRAM configuration information\n" - " (valid chip values 50..57)\n" -); -#endif #if defined(CONFIG_I2C_MUX) diff --git a/common/cmd_ide.c b/common/cmd_ide.c index d86bf37..4d7a0ac 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -45,10 +45,6 @@ #include <mpc5xxx.h> #endif -#ifdef CONFIG_MPC512X -#include <mpc512x.h> -#endif - #include <ide.h> #include <ata.h> @@ -2108,11 +2104,11 @@ U_BOOT_CMD( "ide read addr blk# cnt\n" "ide write addr blk# cnt - read/write `cnt'" " blocks starting at block `blk#'\n" - " to/from memory address `addr'\n" + " to/from memory address `addr'" ); U_BOOT_CMD( diskboot, 3, 1, do_diskboot, "boot from IDE device", - "loadAddr dev:part\n" + "loadAddr dev:part" ); diff --git a/common/cmd_immap.c b/common/cmd_immap.c index c8367f0..37e6058 100644 --- a/common/cmd_immap.c +++ b/common/cmd_immap.c @@ -615,39 +615,39 @@ do_mccinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( siuinfo, 1, 1, do_siuinfo, "print System Interface Unit (SIU) registers", - NULL + "" ); U_BOOT_CMD( memcinfo, 1, 1, do_memcinfo, "print Memory Controller registers", - NULL + "" ); U_BOOT_CMD( sitinfo, 1, 1, do_sitinfo, "print System Integration Timers (SIT) registers", - NULL + "" ); #ifdef CONFIG_8260 U_BOOT_CMD( icinfo, 1, 1, do_icinfo, "print Interrupt Controller registers", - NULL + "" ); #endif U_BOOT_CMD( carinfo, 1, 1, do_carinfo, "print Clocks and Reset registers", - NULL + "" ); U_BOOT_CMD( iopinfo, 1, 1, do_iopinfo, "print I/O Port registers", - NULL + "" ); U_BOOT_CMD( @@ -659,62 +659,61 @@ U_BOOT_CMD( U_BOOT_CMD( dmainfo, 1, 1, do_dmainfo, "print SDMA/IDMA registers", - NULL + "" ); U_BOOT_CMD( fccinfo, 1, 1, do_fccinfo, "print FCC registers", - NULL + "" ); U_BOOT_CMD( brginfo, 1, 1, do_brginfo, "print Baud Rate Generator (BRG) registers", - NULL + "" ); U_BOOT_CMD( i2cinfo, 1, 1, do_i2cinfo, "print I2C registers", - NULL + "" ); U_BOOT_CMD( sccinfo, 1, 1, do_sccinfo, "print SCC registers", - NULL + "" ); U_BOOT_CMD( smcinfo, 1, 1, do_smcinfo, "print SMC registers", - NULL + "" ); U_BOOT_CMD( spiinfo, 1, 1, do_spiinfo, "print Serial Peripheral Interface (SPI) registers", - NULL + "" ); U_BOOT_CMD( muxinfo, 1, 1, do_muxinfo, "print CPM Multiplexing registers", - NULL + "" ); U_BOOT_CMD( siinfo, 1, 1, do_siinfo, "print Serial Interface (SI) registers", - NULL + "" ); U_BOOT_CMD( mccinfo, 1, 1, do_mccinfo, "print MCC registers", - NULL + "" ); - #endif diff --git a/common/cmd_irq.c b/common/cmd_irq.c index a21aede..4604a5a 100644 --- a/common/cmd_irq.c +++ b/common/cmd_irq.c @@ -45,6 +45,5 @@ int do_interrupts(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( interrupts, 5, 0, do_interrupts, "enable or disable interrupts", - "[on, off]\n" - " - enable or disable interrupts\n" + "[on, off]" ); diff --git a/common/cmd_itest.c b/common/cmd_itest.c index 309b08b..5b301bf 100644 --- a/common/cmd_itest.c +++ b/common/cmd_itest.c @@ -191,5 +191,5 @@ int do_itest ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] ) U_BOOT_CMD( itest, 4, 0, do_itest, "return true/false on integer compare", - "[.b, .w, .l, .s] [*]value1 <op> [*]value2\n" + "[.b, .w, .l, .s] [*]value1 <op> [*]value2" ); diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 3bb6c3c..4db4a83 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -636,18 +636,17 @@ U_BOOT_CMD( "load binary file from a filesystem image", "[ off ] [ filename ]\n" " - load binary file from flash bank\n" - " with offset 'off'\n" + " with offset 'off'" ); U_BOOT_CMD( ls, 2, 1, do_jffs2_ls, "list files in a directory (default /)", - "[ directory ]\n" - " - list files in a directory.\n" + "[ directory ]" ); U_BOOT_CMD( fsinfo, 1, 1, do_jffs2_fsinfo, "print information about filesystems", - " - print information about filesystems\n" + "" ); /***************************************************/ diff --git a/common/cmd_license.c b/common/cmd_license.c index c3c3496..141215b 100644 --- a/common/cmd_license.c +++ b/common/cmd_license.c @@ -53,7 +53,8 @@ int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } U_BOOT_CMD(license, 1, 1, do_license, - "print GPL license text", - NULL); + "print GPL license text", + "" +); #endif /* CONFIG_CMD_LICENSE */ diff --git a/common/cmd_load.c b/common/cmd_load.c index 2b5a66d..73fbf74 100644 --- a/common/cmd_load.c +++ b/common/cmd_load.c @@ -1049,7 +1049,7 @@ U_BOOT_CMD( "load S-Record file over serial line", "[ off ] [ baud ]\n" " - load S-Record file over serial line" - " with offset 'off' and baudrate 'baud'\n" + " with offset 'off' and baudrate 'baud'" ); #else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */ @@ -1057,7 +1057,7 @@ U_BOOT_CMD( loads, 2, 0, do_load_serial, "load S-Record file over serial line", "[ off ]\n" - " - load S-Record file over serial line with offset 'off'\n" + " - load S-Record file over serial line with offset 'off'" ); #endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */ @@ -1073,14 +1073,14 @@ U_BOOT_CMD( "save S-Record file over serial line", "[ off ] [size] [ baud ]\n" " - save S-Record file over serial line" - " with offset 'off', size 'size' and baudrate 'baud'\n" + " with offset 'off', size 'size' and baudrate 'baud'" ); #else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */ U_BOOT_CMD( saves, 3, 0, do_save_serial, "save S-Record file over serial line", "[ off ] [size]\n" - " - save S-Record file over serial line with offset 'off' and size 'size'\n" + " - save S-Record file over serial line with offset 'off' and size 'size'" ); #endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */ #endif @@ -1093,7 +1093,7 @@ U_BOOT_CMD( "load binary file over serial line (kermit mode)", "[ off ] [ baud ]\n" " - load binary file over serial line" - " with offset 'off' and baudrate 'baud'\n" + " with offset 'off' and baudrate 'baud'" ); U_BOOT_CMD( @@ -1101,7 +1101,7 @@ U_BOOT_CMD( "load binary file over serial line (ymodem mode)", "[ off ] [ baud ]\n" " - load binary file over serial line" - " with offset 'off' and baudrate 'baud'\n" + " with offset 'off' and baudrate 'baud'" ); #endif @@ -1130,8 +1130,8 @@ int do_hwflow (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( hwflow, 2, 0, do_hwflow, - "turn the harwdare flow control on/off", - "[on|off]\n - change RTS/CTS hardware flow control over serial line\n" + "turn RTS/CTS hardware flow control in serial line on/off", + "[on|off]" ); #endif diff --git a/common/cmd_log.c b/common/cmd_log.c index a03835d..d422d9f 100644 --- a/common/cmd_log.c +++ b/common/cmd_log.c @@ -256,7 +256,7 @@ U_BOOT_CMD( "info - show pointer details\n" "log reset - clear contents\n" "log show - show contents\n" - "log append <msg> - append <msg> to the logbuffer\n" + "log append <msg> - append <msg> to the logbuffer" ); static int logbuff_printk(const char *line) diff --git a/common/cmd_mac.c b/common/cmd_mac.c index cf601e4..20403da 100644 --- a/common/cmd_mac.c +++ b/common/cmd_mac.c @@ -44,20 +44,6 @@ U_BOOT_CMD( " - program date\n" "mac ports\n" " - program the number of ports\n" - "mac 0\n" - " - program the MAC address for port 0\n" - "mac 1\n" - " - program the MAC address for port 1\n" - "mac 2\n" - " - program the MAC address for port 2\n" - "mac 3\n" - " - program the MAC address for port 3\n" - "mac 4\n" - " - program the MAC address for port 4\n" - "mac 5\n" - " - program the MAC address for port 5\n" - "mac 6\n" - " - program the MAC address for port 6\n" - "mac 7\n" - " - program the MAC address for port 7\n" + "mac X\n" + " - program the MAC address for port X [X=0...7]" ); diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 2d4fc2a..cdf8c79 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1172,39 +1172,39 @@ int do_unzip ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( md, 3, 1, do_mem_md, "memory display", - "[.b, .w, .l] address [# of objects]\n - memory display\n" + "[.b, .w, .l] address [# of objects]" ); U_BOOT_CMD( mm, 2, 1, do_mem_mm, - "memory modify (auto-incrementing)", - "[.b, .w, .l] address\n" " - memory modify, auto increment address\n" + "memory modify (auto-incrementing address)", + "[.b, .w, .l] address" ); U_BOOT_CMD( nm, 2, 1, do_mem_nm, "memory modify (constant address)", - "[.b, .w, .l] address\n - memory modify, read and keep address\n" + "[.b, .w, .l] address" ); U_BOOT_CMD( mw, 4, 1, do_mem_mw, "memory write (fill)", - "[.b, .w, .l] address value [count]\n - write memory\n" + "[.b, .w, .l] address value [count]" ); U_BOOT_CMD( cp, 4, 1, do_mem_cp, "memory copy", - "[.b, .w, .l] source target count\n - copy memory\n" + "[.b, .w, .l] source target count" ); U_BOOT_CMD( cmp, 4, 1, do_mem_cmp, "memory compare", - "[.b, .w, .l] addr1 addr2 count\n - compare memory\n" + "[.b, .w, .l] addr1 addr2 count" ); #ifndef CONFIG_CRC32_VERIFY @@ -1212,7 +1212,7 @@ U_BOOT_CMD( U_BOOT_CMD( crc32, 4, 1, do_mem_crc, "checksum calculation", - "address count [addr]\n - compute CRC32 checksum [save at addr]\n" + "address count [addr]\n - compute CRC32 checksum [save at addr]" ); #else /* CONFIG_CRC32_VERIFY */ @@ -1221,7 +1221,7 @@ U_BOOT_CMD( crc32, 5, 1, do_mem_crc, "checksum calculation", "address count [addr]\n - compute CRC32 checksum [save at addr]\n" - "-v address count crc\n - verify crc of memory area\n" + "-v address count crc\n - verify crc of memory area" ); #endif /* CONFIG_CRC32_VERIFY */ @@ -1230,43 +1230,40 @@ U_BOOT_CMD( base, 2, 1, do_mem_base, "print or set address offset", "\n - print address offset for memory commands\n" - "base off\n - set address offset for memory commands to 'off'\n" + "base off\n - set address offset for memory commands to 'off'" ); U_BOOT_CMD( loop, 3, 1, do_mem_loop, "infinite loop on address range", - "[.b, .w, .l] address number_of_objects\n" - " - loop on a set of addresses\n" + "[.b, .w, .l] address number_of_objects" ); #ifdef CONFIG_LOOPW U_BOOT_CMD( loopw, 4, 1, do_mem_loopw, "infinite write loop on address range", - "[.b, .w, .l] address number_of_objects data_to_write\n" - " - loop on a set of addresses\n" + "[.b, .w, .l] address number_of_objects data_to_write" ); #endif /* CONFIG_LOOPW */ U_BOOT_CMD( mtest, 5, 1, do_mem_mtest, - "simple RAM test", - "[start [end [pattern [iterations]]]]\n" - " - simple RAM read/write test\n" + "simple RAM read/write test", + "[start [end [pattern [iterations]]]]" ); #ifdef CONFIG_MX_CYCLIC U_BOOT_CMD( mdc, 4, 1, do_mem_mdc, "memory display cyclic", - "[.b, .w, .l] address count delay(ms)\n - memory display cyclic\n" + "[.b, .w, .l] address count delay(ms)" ); U_BOOT_CMD( mwc, 4, 1, do_mem_mwc, "memory write cyclic", - "[.b, .w, .l] address value delay(ms)\n - memory write cyclic\n" + "[.b, .w, .l] address value delay(ms)" ); #endif /* CONFIG_MX_CYCLIC */ @@ -1274,6 +1271,6 @@ U_BOOT_CMD( U_BOOT_CMD( unzip, 4, 1, do_unzip, "unzip a memory region", - "srcaddr dstaddr [dstsize]\n" + "srcaddr dstaddr [dstsize]" ); #endif /* CONFIG_CMD_UNZIP */ diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index 6470bac..b19ad0e 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -394,8 +394,7 @@ U_BOOT_CMD (frd, 3, 1, do_frd, " 0 - non blocking data read\n" " 1 - non blocking control read\n" " 2 - blocking data read\n" - " 3 - blocking control read\n"); - + " 3 - blocking control read"); U_BOOT_CMD (fwr, 4, 1, do_fwr, "write data to FSL", @@ -403,11 +402,11 @@ U_BOOT_CMD (fwr, 4, 1, do_fwr, " 0 - non blocking data write\n" " 1 - non blocking control write\n" " 2 - blocking data write\n" - " 3 - blocking control write\n"); + " 3 - blocking control write"); U_BOOT_CMD (rspr, 3, 1, do_rspr, "read/write special purpose register", "- reg_num [write value] read/write special purpose register\n" " 1 - MSR - Machine status register\n" " 3 - EAR - Exception address register\n" - " 5 - ESR - Exception status register\n"); + " 5 - ESR - Exception status register"); diff --git a/common/cmd_mgdisk.c b/common/cmd_mgdisk.c index 48323d4..aadc335 100644 --- a/common/cmd_mgdisk.c +++ b/common/cmd_mgdisk.c @@ -70,7 +70,7 @@ U_BOOT_CMD( " - random read : mgd read [from] [to] [size]\n" " - random write : mgd write [from] [to] [size]\n" " - sector read : mgd readsec [sector] [to] [counts]\n" - " - sector write : mgd writesec [from] [sector] [counts]\n" + " - sector write : mgd writesec [from] [sector] [counts]" ); #endif diff --git a/common/cmd_mii.c b/common/cmd_mii.c index d70031a..65e13c3 100644 --- a/common/cmd_mii.c +++ b/common/cmd_mii.c @@ -460,5 +460,5 @@ U_BOOT_CMD( "mii read <addr> <reg> - read MII PHY <addr> register <reg>\n" "mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>\n" "mii dump <addr> <reg> - pretty-print <addr> <reg> (0-5 only)\n" - "Addr and/or reg may be ranges, e.g. 2-7.\n" + "Addr and/or reg may be ranges, e.g. 2-7." ); diff --git a/common/cmd_misc.c b/common/cmd_misc.c index 024299a..b97537e 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -56,7 +56,7 @@ int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); U_BOOT_CMD( irqinfo, 1, 1, do_irqinfo, "print information about IRQs", - NULL + "" ); #endif @@ -64,5 +64,5 @@ U_BOOT_CMD( sleep , 2, 1, do_sleep, "delay execution for some time", "N\n" - " - delay execution for N seconds (N is _decimal_ !!!)\n" + " - delay execution for N seconds (N is _decimal_ !!!)" ); diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 039fe59..32fe49b 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -89,7 +89,7 @@ U_BOOT_CMD( mmc, 3, 1, do_mmc, "MMC sub-system", "init [dev] - init MMC sub system\n" - "mmc device [dev] - show or set current device\n" + "mmc device [dev] - show or set current device" ); #else /* !CONFIG_GENERIC_MMC */ @@ -135,9 +135,10 @@ int do_mmcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -U_BOOT_CMD(mmcinfo, 2, 0, do_mmcinfo, - "print MMC information", - "<dev num>\n"); +U_BOOT_CMD(mmcinfo, 2, 0, do_mmcinfo, + "mmcinfo <dev num>-- display MMC info\n", + "" +); int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -231,5 +232,5 @@ U_BOOT_CMD( "read <device num> addr blk# cnt\n" "mmc write <device num> addr blk# cnt\n" "mmc rescan <device num>\n" - "mmc list - list available devices\n"); + "mmc list - lists available devices"); #endif diff --git a/common/cmd_mp.c b/common/cmd_mp.c index a0839c2..faa8700 100644 --- a/common/cmd_mp.c +++ b/common/cmd_mp.c @@ -78,7 +78,7 @@ cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) " Default for r3 is <num> and r6 is 0\n" \ "\n" \ " When cpu <num> is released r4 and r5 = 0.\n" \ - " r7 will contain the size of the initial mapped area\n" + " r7 will contain the size of the initial mapped area" #endif U_BOOT_CMD( @@ -86,8 +86,9 @@ U_BOOT_CMD( "Multiprocessor CPU boot manipulation and release", "<num> reset - Reset cpu <num>\n" "cpu <num> status - Status of cpu <num>\n" - "cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]\n" + "cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]" #ifdef CPU_ARCH_HELP + "\n" CPU_ARCH_HELP #endif - ); +); diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 6a0849f..2d1446e 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -90,7 +90,8 @@ #include <jffs2/load_kernel.h> #include <linux/list.h> #include <linux/ctype.h> -#include <cramfs/cramfs_fs.h> +#include <linux/err.h> +#include <linux/mtd/mtd.h> #if defined(CONFIG_CMD_NAND) #ifdef CONFIG_NAND_LEGACY @@ -102,7 +103,6 @@ #endif #if defined(CONFIG_CMD_ONENAND) -#include <linux/mtd/mtd.h> #include <linux/mtd/onenand.h> #include <onenand_uboot.h> #endif @@ -137,14 +137,12 @@ #if defined(MTDIDS_DEFAULT) static const char *const mtdids_default = MTDIDS_DEFAULT; #else -#warning "MTDIDS_DEFAULT not defined!" static const char *const mtdids_default = NULL; #endif #if defined(MTDPARTS_DEFAULT) static const char *const mtdparts_default = MTDPARTS_DEFAULT; #else -#warning "MTDPARTS_DEFAULT not defined!" static const char *const mtdparts_default = NULL; #endif @@ -303,137 +301,91 @@ static void current_save(void) } /** - * Performs sanity check for supplied NOR flash partition. Table of existing - * NOR flash devices is searched and partition device is located. Alignment - * with the granularity of NOR flash sectors is verified. + * Performs sanity check for supplied flash partition. + * Table of existing MTD flash devices is searched and partition device + * is located. Alignment with the granularity of nand erasesize is verified. * * @param id of the parent device * @param part partition to validate * @return 0 if partition is valid, 1 otherwise */ -static int part_validate_nor(struct mtdids *id, struct part_info *part) +static int part_validate_eraseblock(struct mtdids *id, struct part_info *part) { -#if defined(CONFIG_CMD_FLASH) - /* info for FLASH chips */ - extern flash_info_t flash_info[]; - flash_info_t *flash; - int offset_aligned; - u32 end_offset, sector_size = 0; - int i; - - flash = &flash_info[id->num]; - - /* size of last sector */ - part->sector_size = flash->size - - (flash->start[flash->sector_count-1] - flash->start[0]); - - offset_aligned = 0; - for (i = 0; i < flash->sector_count; i++) { - if ((flash->start[i] - flash->start[0]) == part->offset) { - offset_aligned = 1; - break; - } - } - if (offset_aligned == 0) { - printf("%s%d: partition (%s) start offset alignment incorrect\n", - MTD_DEV_TYPE(id->type), id->num, part->name); + struct mtd_info *mtd; + char mtd_dev[16]; + int i, j; + ulong start; + + sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(id->type), id->num); + mtd = get_mtd_device_nm(mtd_dev); + if (IS_ERR(mtd)) { + printf("Partition %s not found on device %s!\n", part->name, mtd_dev); return 1; } - end_offset = part->offset + part->size; - offset_aligned = 0; - for (i = 0; i < flash->sector_count; i++) { - if (i) { - sector_size = flash->start[i] - flash->start[i-1]; - if (part->sector_size < sector_size) - part->sector_size = sector_size; - } - if ((flash->start[i] - flash->start[0]) == end_offset) - offset_aligned = 1; - } - - if (offset_aligned || flash->size == end_offset) - return 0; - - printf("%s%d: partition (%s) size alignment incorrect\n", - MTD_DEV_TYPE(id->type), id->num, part->name); -#endif - return 1; -} - -/** - * Performs sanity check for supplied NAND flash partition. Table of existing - * NAND flash devices is searched and partition device is located. Alignment - * with the granularity of nand erasesize is verified. - * - * @param id of the parent device - * @param part partition to validate - * @return 0 if partition is valid, 1 otherwise - */ -static int part_validate_nand(struct mtdids *id, struct part_info *part) -{ -#if defined(CONFIG_CMD_NAND) - /* info for NAND chips */ - nand_info_t *nand; + part->sector_size = mtd->erasesize; - nand = &nand_info[id->num]; + if (!mtd->numeraseregions) { + /* + * Only one eraseregion (NAND, OneNAND or uniform NOR), + * checking for alignment is easy here + */ + if ((unsigned long)part->offset % mtd->erasesize) { + printf("%s%d: partition (%s) start offset" + "alignment incorrect\n", + MTD_DEV_TYPE(id->type), id->num, part->name); + return 1; + } - part->sector_size = nand->erasesize; + if (part->size % mtd->erasesize) { + printf("%s%d: partition (%s) size alignment incorrect\n", + MTD_DEV_TYPE(id->type), id->num, part->name); + return 1; + } + } else { + /* + * Multiple eraseregions (non-uniform NOR), + * checking for alignment is more complex here + */ + + /* Check start alignment */ + for (i = 0; i < mtd->numeraseregions; i++) { + start = mtd->eraseregions[i].offset; + for (j = 0; j < mtd->eraseregions[i].numblocks; j++) { + if (part->offset == start) + goto start_ok; + start += mtd->eraseregions[i].erasesize; + } + } - if ((unsigned long)(part->offset) % nand->erasesize) { printf("%s%d: partition (%s) start offset alignment incorrect\n", - MTD_DEV_TYPE(id->type), id->num, part->name); - return 1; - } - - if (part->size % nand->erasesize) { - printf("%s%d: partition (%s) size alignment incorrect\n", - MTD_DEV_TYPE(id->type), id->num, part->name); + MTD_DEV_TYPE(id->type), id->num, part->name); return 1; - } - return 0; -#else - return 1; -#endif -} + start_ok: -/** - * Performs sanity check for supplied OneNAND flash partition. - * Table of existing OneNAND flash devices is searched and partition device - * is located. Alignment with the granularity of nand erasesize is verified. - * - * @param id of the parent device - * @param part partition to validate - * @return 0 if partition is valid, 1 otherwise - */ -static int part_validate_onenand(struct mtdids *id, struct part_info *part) -{ -#if defined(CONFIG_CMD_ONENAND) - /* info for OneNAND chips */ - struct mtd_info *mtd; - - mtd = &onenand_mtd; - - part->sector_size = mtd->erasesize; - - if ((unsigned long)(part->offset) % mtd->erasesize) { - printf("%s%d: partition (%s) start offset" - "alignment incorrect\n", - MTD_DEV_TYPE(id->type), id->num, part->name); - return 1; - } + /* Check end/size alignment */ + for (i = 0; i < mtd->numeraseregions; i++) { + start = mtd->eraseregions[i].offset; + for (j = 0; j < mtd->eraseregions[i].numblocks; j++) { + if ((part->offset + part->size) == start) + goto end_ok; + start += mtd->eraseregions[i].erasesize; + } + } + /* Check last sector alignment */ + if ((part->offset + part->size) == start) + goto end_ok; - if (part->size % mtd->erasesize) { printf("%s%d: partition (%s) size alignment incorrect\n", - MTD_DEV_TYPE(id->type), id->num, part->name); + MTD_DEV_TYPE(id->type), id->num, part->name); return 1; + + end_ok: + return 0; } return 0; -#else - return 1; -#endif } @@ -469,16 +421,11 @@ static int part_validate(struct mtdids *id, struct part_info *part) return 1; } - if (id->type == MTD_DEV_TYPE_NAND) - return part_validate_nand(id, part); - else if (id->type == MTD_DEV_TYPE_NOR) - return part_validate_nor(id, part); - else if (id->type == MTD_DEV_TYPE_ONENAND) - return part_validate_onenand(id, part); - else - DEBUGF("part_validate: invalid dev type\n"); - - return 1; + /* + * Now we need to check if the partition starts and ends on + * sector (eraseblock) regions + */ + return part_validate_eraseblock(id, part); } /** @@ -762,48 +709,19 @@ static int part_parse(const char *const partdef, const char **ret, struct part_i */ int mtd_device_validate(u8 type, u8 num, u32 *size) { - if (type == MTD_DEV_TYPE_NOR) { -#if defined(CONFIG_CMD_FLASH) - if (num < CONFIG_SYS_MAX_FLASH_BANKS) { - extern flash_info_t flash_info[]; - *size = flash_info[num].size; - - return 0; - } + struct mtd_info *mtd; + char mtd_dev[16]; - printf("no such FLASH device: %s%d (valid range 0 ... %d\n", - MTD_DEV_TYPE(type), num, CONFIG_SYS_MAX_FLASH_BANKS - 1); -#else - printf("support for FLASH devices not present\n"); -#endif - } else if (type == MTD_DEV_TYPE_NAND) { -#if defined(CONFIG_CMD_NAND) - if (num < CONFIG_SYS_MAX_NAND_DEVICE) { -#ifndef CONFIG_NAND_LEGACY - *size = nand_info[num].size; -#else - extern struct nand_chip nand_dev_desc[CONFIG_SYS_MAX_NAND_DEVICE]; - *size = nand_dev_desc[num].totlen; -#endif - return 0; - } + sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(type), num); + mtd = get_mtd_device_nm(mtd_dev); + if (IS_ERR(mtd)) { + printf("Device %s not found!\n", mtd_dev); + return 1; + } - printf("no such NAND device: %s%d (valid range 0 ... %d)\n", - MTD_DEV_TYPE(type), num, CONFIG_SYS_MAX_NAND_DEVICE - 1); -#else - printf("support for NAND devices not present\n"); -#endif - } else if (type == MTD_DEV_TYPE_ONENAND) { -#if defined(CONFIG_CMD_ONENAND) - *size = onenand_mtd.size; - return 0; -#else - printf("support for OneNAND devices not present\n"); -#endif - } else - printf("Unknown defice type %d\n", type); + *size = mtd->size; - return 1; + return 0; } /** @@ -1344,8 +1262,10 @@ static void list_partitions(void) } printf("\ndefaults:\n"); - printf("mtdids : %s\n", mtdids_default); - printf("mtdparts: %s\n", mtdparts_default); + printf("mtdids : %s\n", + mtdids_default ? mtdids_default : "none"); + printf("mtdparts: %s\n", + mtdparts_default ? mtdparts_default : "none"); } /** @@ -1943,7 +1863,7 @@ U_BOOT_CMD( chpart, 2, 0, do_chpart, "change active partition", "part-id\n" - " - change active partition (e.g. part-id = nand0,1)\n" + " - change active partition (e.g. part-id = nand0,1)" ); U_BOOT_CMD( @@ -1978,6 +1898,6 @@ U_BOOT_CMD( "<size> := standard linux memsize OR '-' to denote all remaining space\n" "<offset> := partition start offset within the device\n" "<name> := '(' NAME ')'\n" - "<ro-flag> := when set to 'ro' makes partition read-only (not used, passed to kernel)\n" + "<ro-flag> := when set to 'ro' makes partition read-only (not used, passed to kernel)" ); /***************************************************/ diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 1992531..9451416 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -476,25 +476,26 @@ usage: return 1; } -U_BOOT_CMD(nand, 5, 1, do_nand, - "NAND sub-system", - "info - show available NAND devices\n" - "nand device [dev] - show or set current device\n" - "nand read - addr off|partition size\n" - "nand write - addr off|partition size\n" - " read/write 'size' bytes starting at offset 'off'\n" - " to/from memory address 'addr', skipping bad blocks.\n" - "nand erase [clean] [off size] - erase 'size' bytes from\n" - " offset 'off' (entire device if not specified)\n" - "nand bad - show bad blocks\n" - "nand dump[.oob] off - dump page\n" - "nand scrub - really clean NAND erasing bad blocks (UNSAFE)\n" - "nand markbad off - mark bad block at offset (UNSAFE)\n" - "nand biterr off - make a bit error at offset (UNSAFE)\n" +U_BOOT_CMD(nand, CONFIG_SYS_MAXARGS, 1, do_nand, + "NAND sub-system", + "info - show available NAND devices\n" + "nand device [dev] - show or set current device\n" + "nand read - addr off|partition size\n" + "nand write - addr off|partition size\n" + " read/write 'size' bytes starting at offset 'off'\n" + " to/from memory address 'addr', skipping bad blocks.\n" + "nand erase [clean] [off size] - erase 'size' bytes from\n" + " offset 'off' (entire device if not specified)\n" + "nand bad - show bad blocks\n" + "nand dump[.oob] off - dump page\n" + "nand scrub - really clean NAND erasing bad blocks (UNSAFE)\n" + "nand markbad off [...] - mark bad block(s) at offset (UNSAFE)\n" + "nand biterr off - make a bit error at offset (UNSAFE)" #ifdef CONFIG_CMD_NAND_LOCK_UNLOCK - "nand lock [tight] [status]\n" - " bring nand to lock state or display locked pages\n" - "nand unlock [offset] [size] - unlock section\n" + "\n" + "nand lock [tight] [status]\n" + " bring nand to lock state or display locked pages\n" + "nand unlock [offset] [size] - unlock section" #endif ); @@ -673,8 +674,8 @@ usage: U_BOOT_CMD(nboot, 4, 1, do_nandboot, "boot from NAND device", - "[partition] | [[[loadAddr] dev] offset]\n"); - + "[partition] | [[[loadAddr] dev] offset]" +); #endif #else /* CONFIG_NAND_LEGACY */ @@ -941,7 +942,7 @@ U_BOOT_CMD( " offset `off' (entire device if not specified)\n" "nand bad - show bad blocks\n" "nand read.oob addr off size - read out-of-band data\n" - "nand write.oob addr off size - read out-of-band data\n" + "nand write.oob addr off size - read out-of-band data" ); int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -1081,7 +1082,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( nboot, 4, 1, do_nandboot, "boot from NAND device", - "loadAddr dev\n" + "loadAddr dev" ); #endif diff --git a/common/cmd_net.c b/common/cmd_net.c index 92bbf85..68183c4 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -40,7 +40,7 @@ int do_bootp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( bootp, 3, 1, do_bootp, "boot image via network using BOOTP/TFTP protocol", - "[loadAddress] [[hostIPaddr:]bootfilename]\n" + "[loadAddress] [[hostIPaddr:]bootfilename]" ); int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -51,7 +51,7 @@ int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( tftpboot, 3, 1, do_tftpb, "boot image via network using TFTP protocol", - "[loadAddress] [[hostIPaddr:]bootfilename]\n" + "[loadAddress] [[hostIPaddr:]bootfilename]" ); int do_rarpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -62,7 +62,7 @@ int do_rarpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( rarpboot, 3, 1, do_rarpb, "boot image via network using RARP/TFTP protocol", - "[loadAddress] [[hostIPaddr:]bootfilename]\n" + "[loadAddress] [[hostIPaddr:]bootfilename]" ); #if defined(CONFIG_CMD_DHCP) @@ -74,7 +74,7 @@ int do_dhcp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( dhcp, 3, 1, do_dhcp, "boot image via network using DHCP/TFTP protocol", - "[loadAddress] [[hostIPaddr:]bootfilename]\n" + "[loadAddress] [[hostIPaddr:]bootfilename]" ); #endif @@ -87,7 +87,7 @@ int do_nfs (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( nfs, 3, 1, do_nfs, "boot image via network using NFS protocol", - "[loadAddress] [[hostIPaddr:]bootfilename]\n" + "[loadAddress] [[hostIPaddr:]bootfilename]" ); #endif @@ -269,7 +269,7 @@ int do_ping (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( ping, 2, 1, do_ping, "send ICMP ECHO_REQUEST to network host", - "pingAddress\n" + "pingAddress" ); #endif diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 3ee971a..2186205 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -94,56 +94,72 @@ int get_env_id (void) * Command interface: print one or all environment variables */ -int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +/* + * state 0: finish printing this string and return (matched!) + * state 1: no matching to be done; print everything + * state 2: continue searching for matched name + */ +static int printenv(char *name, int state) { - int i, j, k, nxt; - int rcode = 0; - - if (argc == 1) { /* Print all env variables */ - for (i=0; env_get_char(i) != '\0'; i=nxt+1) { - for (nxt=i; env_get_char(nxt) != '\0'; ++nxt) - ; - for (k=i; k<nxt; ++k) - putc(env_get_char(k)); - putc ('\n'); - - if (ctrlc()) { - puts ("\n ** Abort\n"); - return 1; + int i, j; + char c, buf[17]; + + i = 0; + buf[16] = '\0'; + + while (state && env_get_char(i) != '\0') { + if (state == 2 && envmatch((uchar *)name, i) >= 0) + state = 0; + + j = 0; + do { + buf[j++] = c = env_get_char(i++); + if (j == sizeof(buf) - 1) { + if (state <= 1) + puts(buf); + j = 0; } - } + } while (c != '\0'); - printf("\nEnvironment size: %d/%ld bytes\n", - i, (ulong)ENV_SIZE); + if (state <= 1) { + if (j) + puts(buf); + putc('\n'); + } - return 0; + if (ctrlc()) + return -1; } - for (i=1; i<argc; ++i) { /* print single env variables */ - char *name = argv[i]; + if (state == 0) + i = 0; + return i; +} - k = -1; +int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + int i; + int rcode = 0; - for (j=0; env_get_char(j) != '\0'; j=nxt+1) { + if (argc == 1) { + /* print all env vars */ + rcode = printenv(NULL, 1); + if (rcode < 0) + return 1; + printf("\nEnvironment size: %d/%ld bytes\n", + rcode, (ulong)ENV_SIZE); + return 0; + } - for (nxt=j; env_get_char(nxt) != '\0'; ++nxt) - ; - k = envmatch((uchar *)name, j); - if (k < 0) { - continue; - } - puts (name); - putc ('='); - while (k < nxt) - putc(env_get_char(k++)); - putc ('\n'); - break; - } - if (k < 0) { - printf ("## Error: \"%s\" not defined\n", name); - rcode ++; + /* print selected env vars */ + for (i = 1; i < argc; ++i) { + char *name = argv[i]; + if (printenv(name, 2)) { + printf("## Error: \"%s\" not defined\n", name); + ++rcode; } } + return rcode; } @@ -553,7 +569,7 @@ int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( saveenv, 1, 0, do_saveenv, "save environment variables to persistent storage", - NULL + "" ); #endif @@ -586,7 +602,7 @@ U_BOOT_CMD( "print environment variables", "\n - print values of all environment variables\n" "printenv name ...\n" - " - print value of environment variable 'name'\n" + " - print value of environment variable 'name'" ); U_BOOT_CMD( @@ -595,7 +611,7 @@ U_BOOT_CMD( "name value ...\n" " - set environment variable 'name' to 'value ...'\n" "setenv name\n" - " - delete environment variable 'name'\n" + " - delete environment variable 'name'" ); #if defined(CONFIG_CMD_ASKENV) @@ -611,7 +627,7 @@ U_BOOT_CMD( " - get environment variable 'name' from stdin (max 'size' chars)\n" "askenv name [message] size\n" " - display 'message' string and get environment variable 'name'" - "from stdin (max 'size' chars)\n" + "from stdin (max 'size' chars)" ); #endif @@ -621,6 +637,6 @@ U_BOOT_CMD( run, CONFIG_SYS_MAXARGS, 1, do_run, "run commands in an environment variable", "var [...]\n" - " - run the commands in the environment variable(s) 'var'\n" + " - run the commands in the environment variable(s) 'var'" ); #endif diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c index 5832ff8..85bd2cb 100644 --- a/common/cmd_onenand.c +++ b/common/cmd_onenand.c @@ -19,6 +19,10 @@ #include <asm/io.h> +#if !defined(CONFIG_SYS_64BIT_VSPRINTF) +#warning Please define CONFIG_SYS_64BIT_VSPRINTF for correct output! +#endif + static struct mtd_info *mtd; static loff_t next_ofs; @@ -53,7 +57,7 @@ static int arg_off_size(int argc, char *argv[], ulong *off, size_t *size) } if ((*off + *size) > mtd->size) { - printf("total chip size (0x%x) exceeded!\n", mtd->size); + printf("total chip size (0x%llx) exceeded!\n", mtd->size); return -1; } @@ -482,5 +486,5 @@ U_BOOT_CMD( "onenand test [off size] - test 'size' bytes from\n" " offset 'off' (entire device if not specified)\n" "onenand dump[.oob] off - dump page\n" - "onenand markbad off - mark bad block at offset (UNSAFE)\n" + "onenand markbad off [...] - mark bad block(s) at offset (UNSAFE)" ); diff --git a/common/cmd_otp.c b/common/cmd_otp.c index 4be4344..30af5a3 100644 --- a/common/cmd_otp.c +++ b/common/cmd_otp.c @@ -233,4 +233,5 @@ U_BOOT_CMD(otp, 7, 0, do_otp, "otp write [--force] <addr> <page> [count] [half]\n" " - write 'count' half-pages starting at 'page' (offset 'half') from 'addr'\n" "otp lock <page> <count>\n" - " - lock 'count' pages starting at 'page'\n"); + " - lock 'count' pages starting at 'page'" +); diff --git a/common/cmd_pci.c b/common/cmd_pci.c index 4a9317f..8a260df 100644 --- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -555,5 +555,5 @@ U_BOOT_CMD( "pci modify[.b, .w, .l] b.d.f address\n" " - modify, auto increment CFG address\n" "pci write[.b, .w, .l] b.d.f address value\n" - " - write to CFG address\n" + " - write to CFG address" ); diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c index e448456..e576b0c 100644 --- a/common/cmd_pcmcia.c +++ b/common/cmd_pcmcia.c @@ -90,8 +90,8 @@ U_BOOT_CMD( pinit, 2, 0, do_pinit, "PCMCIA sub-system", "on - power on PCMCIA socket\n" - "pinit off - power off PCMCIA socket\n" - ); + "pinit off - power off PCMCIA socket" +); #endif diff --git a/common/cmd_portio.c b/common/cmd_portio.c index 41b1991..f8befee 100644 --- a/common/cmd_portio.c +++ b/common/cmd_portio.c @@ -94,7 +94,7 @@ int do_portio_out (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( out, 3, 1, do_portio_out, "write datum to IO port", - "[.b, .w, .l] port value\n - output to IO port\n" + "[.b, .w, .l] port value\n - output to IO port" ); int do_portio_in (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) @@ -159,5 +159,5 @@ U_BOOT_CMD( in, 2, 1, do_portio_in, "read data from an IO port", "[.b, .w, .l] port\n" - " - read datum from IO port\n" + " - read datum from IO port" ); diff --git a/common/cmd_reginfo.c b/common/cmd_reginfo.c index 0e28c05..abb9941 100644 --- a/common/cmd_reginfo.c +++ b/common/cmd_reginfo.c @@ -383,5 +383,6 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( reginfo, 2, 1, do_reginfo, "print register information", + "" ); #endif diff --git a/common/cmd_reiser.c b/common/cmd_reiser.c index 14e4bd4..8ede782 100644 --- a/common/cmd_reiser.c +++ b/common/cmd_reiser.c @@ -104,7 +104,7 @@ U_BOOT_CMD( reiserls, 4, 1, do_reiserls, "list files in a directory (default /)", "<interface> <dev[:part]> [directory]\n" - " - list files from 'dev' on 'interface' in a 'directory'\n" + " - list files from 'dev' on 'interface' in a 'directory'" ); /****************************************************************************** @@ -235,5 +235,5 @@ U_BOOT_CMD( "load binary file from a Reiser filesystem", "<interface> <dev[:part]> [addr] [filename] [bytes]\n" " - load binary file 'filename' from 'dev' on 'interface'\n" - " to address 'addr' from dos filesystem\n" + " to address 'addr' from dos filesystem" ); diff --git a/common/cmd_sata.c b/common/cmd_sata.c index e849778..a8147e0 100644 --- a/common/cmd_sata.c +++ b/common/cmd_sata.c @@ -200,4 +200,5 @@ U_BOOT_CMD( "sata device [dev] - show or set current device\n" "sata part [dev] - print partition table\n" "sata read addr blk# cnt\n" - "sata write addr blk# cnt\n"); + "sata write addr blk# cnt" +); diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index dd2c1ae..f89492f 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -623,11 +623,11 @@ U_BOOT_CMD( "scsi device [dev] - show or set current device\n" "scsi part [dev] - print partition table of one or all SCSI devices\n" "scsi read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n" - " to memory address `addr'\n" + " to memory address `addr'" ); U_BOOT_CMD( scsiboot, 3, 1, do_scsiboot, "boot from SCSI device", - "loadAddr dev:part\n" + "loadAddr dev:part" ); diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c index 9a5e720..f8b5d4d 100644 --- a/common/cmd_setexpr.c +++ b/common/cmd_setexpr.c @@ -66,5 +66,5 @@ U_BOOT_CMD( "set environment variable as the result of eval expression", "name value1 <op> value2\n" " - set environment variable 'name' to the result of the evaluated\n" - " express specified by <op>. <op> can be &, |, ^, +, -, *, /, %\n" + " express specified by <op>. <op> can be &, |, ^, +, -, *, /, %" ); diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 6a60b16..2d463a8 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -188,4 +188,5 @@ U_BOOT_CMD( " `offset' to memory at `addr'\n" "sf write addr offset len - write `len' bytes from memory\n" " at `addr' to flash at `offset'\n" - "sf erase offset len - erase `len' bytes from `offset'\n"); + "sf erase offset len - erase `len' bytes from `offset'" +); diff --git a/common/cmd_source.c b/common/cmd_source.c index 43e1315..965b8b1 100644 --- a/common/cmd_source.c +++ b/common/cmd_source.c @@ -229,10 +229,11 @@ U_BOOT_CMD( "run script from memory", "[addr]\n" "\t- run script starting at addr\n" - "\t- A valid image header must be present\n" + "\t- A valid image header must be present" #if defined(CONFIG_FIT) + "\n" "For FIT format uImage addr must include subimage\n" - "unit name in the form of addr:<subimg_uname>\n" + "unit name in the form of addr:<subimg_uname>" #endif ); @@ -251,6 +252,6 @@ do_autoscr (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( autoscr, 2, 0, do_autoscr, "DEPRECATED - use \"source\" command instead", - "DEPRECATED - use \"source\" command instead\n" + "" ); #endif diff --git a/common/cmd_spi.c b/common/cmd_spi.c index 746d14f..ab7aac7 100644 --- a/common/cmd_spi.c +++ b/common/cmd_spi.c @@ -142,5 +142,5 @@ U_BOOT_CMD( "<device> <bit_len> <dout> - Send <bit_len> bits from <dout> out the SPI\n" "<device> - Identifies the chip select of the device\n" "<bit_len> - Number of bits to send (base 10)\n" - "<dout> - Hexadecimal string that gets sent\n" + "<dout> - Hexadecimal string that gets sent" ); diff --git a/common/cmd_strings.c b/common/cmd_strings.c index 4517ba2..3a0d8ff 100644 --- a/common/cmd_strings.c +++ b/common/cmd_strings.c @@ -43,4 +43,5 @@ int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD(strings, 3, 1, do_strings, "display strings", "<addr> [byte count]\n" - " - display strings at <addr> for at least [byte count] or first double NUL\n"); + " - display strings at <addr> for at least [byte count] or first double NUL" +); diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 64a7307..bbca389 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -609,5 +609,5 @@ U_BOOT_CMD(ubi, 6, 1, do_ubi, "[Legends]\n" " volume: charater name\n" " size: KiB, MiB, GiB, and bytes\n" - " type: s[tatic] or d[ynamic] (default=dynamic)\n" + " type: s[tatic] or d[ynamic] (default=dynamic)" ); diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c index 4767aa4..d9f60d5 100644 --- a/common/cmd_ubifs.c +++ b/common/cmd_ubifs.c @@ -119,14 +119,17 @@ int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( ubifsmount, 2, 0, do_ubifs_mount, "mount UBIFS volume", - "\n"); + "" +); U_BOOT_CMD(ubifsls, 2, 0, do_ubifs_ls, - "list files in a directory", - "[directory]\n" - " - list files in a 'directory' (default '/')\n"); + "list files in a directory", + "[directory]\n" + " - list files in a 'directory' (default '/')" +); U_BOOT_CMD(ubifsload, 4, 0, do_ubifs_load, - "load file from an UBIFS filesystem", - "<addr> <filename> [bytes]\n" - " - load file 'filename' to address 'addr'\n"); + "load file from an UBIFS filesystem", + "<addr> <filename> [bytes]\n" + " - load file 'filename' to address 'addr'" +); diff --git a/common/cmd_universe.c b/common/cmd_universe.c index bfb91b5..0a6d722 100644 --- a/common/cmd_universe.c +++ b/common/cmd_universe.c @@ -382,5 +382,5 @@ U_BOOT_CMD( " 03 -> Configuration Space\n" " [vdw] = VMEbus Maximum Datawidth: 01 -> D8 Data Width\n" " 02 -> D16 Data Width\n" - " 03 -> D32 Data Width\n" + " 03 -> D32 Data Width" ); diff --git a/common/cmd_usb.c b/common/cmd_usb.c index a18e16e..7b8ee6b 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -686,14 +686,14 @@ U_BOOT_CMD( "usb part [dev] - print partition table of one or all USB storage" " devices\n" "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n" - " to memory address `addr'\n" + " to memory address `addr'" ); U_BOOT_CMD( usbboot, 3, 1, do_usbboot, "boot from USB device", - "loadAddr dev:part\n" + "loadAddr dev:part" ); #else @@ -702,6 +702,6 @@ U_BOOT_CMD( "USB sub-system", "reset - reset (rescan) USB controller\n" "usb tree - show USB device tree\n" - "usb info [dev] - show available USB devices\n" + "usb info [dev] - show available USB devices" ); #endif diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c index 84d9530..9c5b038 100644 --- a/common/cmd_vfd.c +++ b/common/cmd_vfd.c @@ -71,7 +71,7 @@ U_BOOT_CMD( "/N\n" " - load bitmap N to the VFDs (N is _decimal_ !!!)\n" "vfd ADDR\n" - " - load bitmap at address ADDR\n" + " - load bitmap at address ADDR" ); #endif diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c index a45d248..5593b2d 100644 --- a/common/cmd_ximg.c +++ b/common/cmd_ximg.c @@ -180,11 +180,12 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } U_BOOT_CMD(imxtract, 4, 1, do_imgextract, - "extract a part of a multi-image", - "addr part [dest]\n" - " - extract <part> from legacy image at <addr> and copy to <dest>\n" + "extract a part of a multi-image", + "addr part [dest]\n" + " - extract <part> from legacy image at <addr> and copy to <dest>" #if defined(CONFIG_FIT) - "addr uname [dest]\n" - " - extract <uname> subimage from FIT image at <addr> and copy to <dest>\n" + "\n" + "addr uname [dest]\n" + " - extract <uname> subimage from FIT image at <addr> and copy to <dest>" #endif ); diff --git a/common/cmd_yaffs2.c b/common/cmd_yaffs2.c index c47ea76..d448d04 100644 --- a/common/cmd_yaffs2.c +++ b/common/cmd_yaffs2.c @@ -143,71 +143,71 @@ int do_ydump (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( ymount, 3, 0, do_ymount, "mount yaffs", - "\n" + "" ); U_BOOT_CMD( yumount, 3, 0, do_yumount, "unmount yaffs", - "\n" + "" ); U_BOOT_CMD( yls, 4, 0, do_yls, "yaffs ls", - "[-l] name\n" + "[-l] name" ); U_BOOT_CMD( yrd, 2, 0, do_yrd, "read file from yaffs", - "filename\n" + "filename" ); U_BOOT_CMD( ywr, 4, 0, do_ywr, "write file to yaffs", - "filename value num_vlues\n" + "filename value num_vlues" ); U_BOOT_CMD( yrdm, 3, 0, do_yrdm, "read file to memory from yaffs", - "filename offset\n" + "filename offset" ); U_BOOT_CMD( ywrm, 4, 0, do_ywrm, "write file from memory to yaffs", - "filename offset size\n" + "filename offset size" ); U_BOOT_CMD( ymkdir, 2, 0, do_ymkdir, "YAFFS mkdir", - "dirname\n" + "dirname" ); U_BOOT_CMD( yrmdir, 2, 0, do_yrmdir, "YAFFS rmdir", - "dirname\n" + "dirname" ); U_BOOT_CMD( yrm, 2, 0, do_yrm, "YAFFS rm", - "path\n" + "path" ); U_BOOT_CMD( ymv, 4, 0, do_ymv, "YAFFS mv", - "oldPath newPath\n" + "oldPath newPath" ); U_BOOT_CMD( ydump, 2, 0, do_ydump, "YAFFS device struct", - "dirname\n" + "dirname" ); diff --git a/common/command.c b/common/command.c index c9a3f5b..b57f8df 100644 --- a/common/command.c +++ b/common/command.c @@ -39,7 +39,7 @@ do_version (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( version, 1, 1, do_version, "print monitor version", - NULL + "" ); #if defined(CONFIG_CMD_ECHO) @@ -73,7 +73,7 @@ U_BOOT_CMD( echo, CONFIG_SYS_MAXARGS, 1, do_echo, "echo args to console", "[args..]\n" - " - echo args to console; \\c suppresses newline\n" + " - echo args to console; \\c suppresses newline" ); #endif @@ -204,8 +204,7 @@ do_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( test, CONFIG_SYS_MAXARGS, 1, do_test, "minimal test like /bin/sh", - "[args..]\n" - " - test functionality\n" + "[args..]" ); int @@ -223,7 +222,7 @@ do_exit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( exit, 2, 1, do_exit, "exit script", - " - exit functionality\n" + "" ); @@ -286,21 +285,7 @@ int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int */ for (i = 1; i < argc; ++i) { if ((cmdtp = find_cmd_tbl (argv[i], cmd_start, cmd_items )) != NULL) { -#ifdef CONFIG_SYS_LONGHELP - /* found - print (long) help info */ - puts (cmdtp->name); - putc (' '); - if (cmdtp->help) { - puts (cmdtp->help); - } else { - puts ("- No help available.\n"); - rcode = 1; - } - putc ('\n'); -#else /* no long help available */ - if (cmdtp->usage) - printf ("%s - %s\n", cmdtp->name, cmdtp->usage); -#endif /* CONFIG_SYS_LONGHELP */ + rcode |= cmd_usage(cmdtp); } else { printf ("Unknown command '%s' - try 'help'" " without arguments for list of all" @@ -328,15 +313,15 @@ U_BOOT_CMD( "'help' prints online help for the monitor commands.\n\n" "Without arguments, it prints a short usage message for all commands.\n\n" "To get detailed help information for specific commands you can type\n" - "'help' with one or more command names as arguments.\n" + "'help' with one or more command names as arguments." ); -/* This do not ust the U_BOOT_CMD macro as ? can't be used in symbol names */ +/* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */ #ifdef CONFIG_SYS_LONGHELP cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { "?", CONFIG_SYS_MAXARGS, 1, do_help, "alias for 'help'", - NULL + "" }; #else cmd_tbl_t __u_boot_cmd_question_mark Struct_Section = { @@ -386,9 +371,22 @@ cmd_tbl_t *find_cmd (const char *cmd) return find_cmd_tbl(cmd, &__u_boot_cmd_start, len); } -void cmd_usage(cmd_tbl_t *cmdtp) +int cmd_usage(cmd_tbl_t *cmdtp) { - printf("Usage:\n%s - %s\n\n", cmdtp->name, cmdtp->usage); + printf("%s - %s\n\n", cmdtp->name, cmdtp->usage); + +#ifdef CONFIG_SYS_LONGHELP + printf("Usage:\n%s ", cmdtp->name); + + if (!cmdtp->help) { + puts ("- No additional help available.\n"); + return 1; + } + + puts (cmdtp->help); + putc ('\n'); +#endif /* CONFIG_SYS_LONGHELP */ + return 0; } #ifdef CONFIG_AUTO_COMPLETE diff --git a/common/env_onenand.c b/common/env_onenand.c index dbccc79..ed77051 100644 --- a/common/env_onenand.c +++ b/common/env_onenand.c @@ -109,7 +109,7 @@ int saveenv(void) if (onenand_write(&onenand_mtd, env_addr, onenand_mtd.writesize, &retlen, (u_char *) env_ptr)) { - printf("OneNAND: write failed at 0x%08x\n", instr.addr); + printf("OneNAND: write failed at 0x%llx\n", instr.addr); return 2; } diff --git a/common/fdt_support.c b/common/fdt_support.c index b54f886..fc077e8 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -495,7 +495,7 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) } #endif /* CONFIG_HAS_FSL_DR_USB */ -#if defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx) +#if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) /* * update crypto node properties to a specified revision of the SEC * called with sec_rev == 0 if not on an mpc8xxxE processor @@ -580,7 +580,7 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev) printf("WARNING: could not set crypto property: %s\n", fdt_strerror(err)); } -#endif /* defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx) */ +#endif /* defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) */ /* Resize the fdt to its actual size + a bit of padding */ int fdt_resize(void *blob) diff --git a/common/hush.c b/common/hush.c index cf5782a..97fd070 100644 --- a/common/hush.c +++ b/common/hush.c @@ -3627,7 +3627,7 @@ U_BOOT_CMD( "print local hushshell variables", "\n - print values of all hushshell variables\n" "showvar name ...\n" - " - print value of hushshell variable 'name'\n" + " - print value of hushshell variable 'name'" ); #endif diff --git a/common/kallsyms.c b/common/kallsyms.c new file mode 100644 index 0000000..ce42a93 --- /dev/null +++ b/common/kallsyms.c @@ -0,0 +1,44 @@ +/* + * Helper functions for working with the builtin symbol table + * + * Copyright (c) 2008-2009 Analog Devices Inc. + * Licensed under the GPL-2 or later. + */ + +#include <common.h> + +/* We need the weak marking as this symbol is provided specially */ +extern const char system_map[] __attribute__((weak)); + +/* Given an address, return a pointer to the symbol name and store + * the base address in caddr. So if the symbol map had an entry: + * 03fb9b7c_spi_cs_deactivate + * Then the following call: + * unsigned long base; + * const char *sym = symbol_lookup(0x03fb9b80, &base); + * Would end up setting the variables like so: + * base = 0x03fb9b7c; + * sym = "_spi_cs_deactivate"; + */ +const char *symbol_lookup(unsigned long addr, unsigned long *caddr) +{ + const char *sym, *csym; + char *esym; + unsigned long sym_addr; + + sym = system_map; + csym = NULL; + *caddr = 0; + + while (*sym) { + sym_addr = simple_strtoul(sym, &esym, 16); + sym = esym; + if (sym_addr > addr) + break; + *caddr = sym_addr; + csym = sym; + sym += strlen(sym) + 1; + } + + return csym; +} diff --git a/common/lcd.c b/common/lcd.c index 4155170..74a5c77 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -427,7 +427,7 @@ static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( cls, 1, 1, lcd_clear, "clear screen", - NULL + "" ); /*----------------------------------------------------------------------*/ diff --git a/common/modem.c b/common/modem.c new file mode 100644 index 0000000..a017b29 --- /dev/null +++ b/common/modem.c @@ -0,0 +1,118 @@ +/* + * (C) Copyright 2002-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> + +/* 'inline' - We have to do it fast */ +static inline void mdm_readline(char *buf, int bufsiz) +{ + char c; + char *p; + int n; + + n = 0; + p = buf; + for(;;) { + c = serial_getc(); + + /* dbg("(%c)", c); */ + + switch(c) { + case '\r': + break; + case '\n': + *p = '\0'; + return; + + default: + if(n++ > bufsiz) { + *p = '\0'; + return; /* sanity check */ + } + *p = c; + p++; + break; + } + } +} + +extern void dbg(const char *fmt, ...); +int mdm_init (void) +{ + char env_str[16]; + char *init_str; + int i; + extern char console_buffer[]; + extern void enable_putc(void); + extern int hwflow_onoff(int); + + enable_putc(); /* enable serial_putc() */ + +#ifdef CONFIG_HWFLOW + init_str = getenv("mdm_flow_control"); + if (init_str && (strcmp(init_str, "rts/cts") == 0)) + hwflow_onoff (1); + else + hwflow_onoff(-1); +#endif + + for (i = 1;;i++) { + sprintf(env_str, "mdm_init%d", i); + if ((init_str = getenv(env_str)) != NULL) { + serial_puts(init_str); + serial_puts("\n"); + for(;;) { + mdm_readline(console_buffer, CONFIG_SYS_CBSIZE); + dbg("ini%d: [%s]", i, console_buffer); + + if ((strcmp(console_buffer, "OK") == 0) || + (strcmp(console_buffer, "ERROR") == 0)) { + dbg("ini%d: cmd done", i); + break; + } else /* in case we are originating call ... */ + if (strncmp(console_buffer, "CONNECT", 7) == 0) { + dbg("ini%d: connect", i); + return 0; + } + } + } else + break; /* no init string - stop modem init */ + + udelay(100000); + } + + udelay(100000); + + /* final stage - wait for connect */ + for(;i > 1;) { /* if 'i' > 1 - wait for connection + message from modem */ + mdm_readline(console_buffer, CONFIG_SYS_CBSIZE); + dbg("ini_f: [%s]", console_buffer); + if (strncmp(console_buffer, "CONNECT", 7) == 0) { + dbg("ini_f: connected"); + return 0; + } + } + + return 0; +} diff --git a/common/serial.c b/common/serial.c index 09385d0..dd80e7c 100644 --- a/common/serial.c +++ b/common/serial.c @@ -68,6 +68,8 @@ struct serial_device *__default_serial_console (void) #else #error "CONFIG_SERIAL? missing." #endif +#elif defined(CONFIG_OMAP3_ZOOM2) + return ZOOM2_DEFAULT_SERIAL_DEVICE; #else #error No default console #endif diff --git a/common/system_map.c b/common/system_map.c new file mode 100644 index 0000000..8307293 --- /dev/null +++ b/common/system_map.c @@ -0,0 +1,8 @@ +/* + * The builtin symbol table for use with kallsyms + * + * Copyright (c) 2008-2009 Analog Devices Inc. + * Licensed under the GPL-2 or later. + */ + +const char const system_map[] = SYSTEM_MAP; |