summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* fdt: Update functions which write to an FDT to return -ENOSPCSimon Glass2014-06-111-2/+2
| | | | | | | | | | When writing values into an FDT it is possible that there will be insufficient space. If the caller gets a useful error then it can potentially deal with the situation. Adjust these functions to return -ENOSPC when the FDT is full. Signed-off-by: Simon Glass <sjg@chromium.org>
* hash: Export the function to show a hashSimon Glass2014-06-111-4/+3
| | | | | | This function is useful for displaying a hash value, so export it. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini2014-06-101-6/+5
|\
| * usb: hub: remove CONFIG_USB_HUB_MIN_POWER_ON_DELAYStephen Warren2014-06-011-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we wait the correct specification-mandated time at the end of usb_hub_power_on(), I suspect that CONFIG_USB_HUB_MIN_POWER_ON_DELAY has no purpose. For cm_t35.h, we already wait longer than the original MIN_POWER_ON_DELAY, so this change is safe. For gw_ventana.h, we will wait as long as the original MIN_POWER_ON_DELAY iff pgood_delay was at least 200ms. I'm not sure if this is the case or not, hence I've CC'd relevant people to test this change. Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Tim Harvey <tharvey@gateworks.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
| * usb: hub: fix power good delay timingStephen Warren2014-06-011-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | usb_hub_power_on() currently waits for the maximum of (a) the hub port's power output to become good, (b) the max time the USB specification allows a device to take to connect. However, these two operations must occur in series rather than in parallel. First, the power supply ramps up to the level required to power the USB device, and then the device may take a certain amount of time to connect (assert D+/D- pullups). Related, the maximum time that a device has to assert pullups is 1s not 100ms. This is explained in "Connect Timing ECN.pdf", itself part of usb_20_042814.zip from www.usb.org. Signed-off-by: Stephen Warren <swarren@nvidia.com>
* | fs: fatwrite: use map_sysmem before use file_fat_writeWu, Josh2014-06-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | When the map_sysmem, then the fatwrite command can support sandbox. Following command will show how to use it: => sb bind 0 sd.img => fatls host 0 => fatwrite host 0 $memaddr filename $filesize Signed-off-by: Josh Wu <josh.wu@atmel.com> Acked-by: Simon Glass <sjg@chromium.org>
* | nand_spl: remove nand_spl infrastructureMasahiro Yamada2014-06-051-1/+1
| | | | | | | | | | | | | | Remove the common infrastructure of nand_spl and clean-up the code inside ifdef(CONFIG_NAND_U_BOOT)..endif. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* | bootm: make use of legacy image format configurableHeiko Schocher2014-06-059-11/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | make the use of legacy image format configurable through the config define CONFIG_IMAGE_FORMAT_LEGACY. When relying on signed FIT images with required signature check the legacy image format should be disabled. Therefore introduce this new define and enable legacy image format if CONFIG_FIT_SIGNATURE is not set. If CONFIG_FIT_SIGNATURE is set disable per default the legacy image format. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Lars Steubesand <lars.steubesand@philips.com> Cc: Mike Pearce <mike@kaew.be> Cc: Wolfgang Denk <wd@denx.de> Cc: Tom Rini <trini@ti.com> Cc: Michal Simek <monstr@monstr.eu> Acked-by: Simon Glass <sjg@chromium.org>
* | env_eeprom: Assign default environment during board_init_fSiva Durga Prasad Paladugu2014-06-051-2/+10
| | | | | | | | | | | | | | | | | | Assign default environment and set env valid during board_init_f before relocation as the actual environment will be read from eeprom later. Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Acked-by: Michal Simek <monstr@monstr.eu>
* | Correct return code from builtin_run_command_list()Simon Glass2014-06-051-1/+1
| | | | | | | | | | | | | | | | The return code is not consistent with cli_simple_run_command_list(). For the last command in a sequence, the return code is actually inverted. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Fix hush to give the correct return code for a simple commandSimon Glass2014-06-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a simple command like 'false' is provided, hush should return the result of that command. However, hush only does this if the FLAG_EXIT_FROM_LOOP flag is provided. Without this flag, hush will happily execute the empty string command immediate after 'false' and then return a success code. This behaviour does not seem very useful, and requiring the flag also seems wrong, since it means that hush will execute only the first command in a sequence. Add a check for empty string and fall out of the loop in that case. That at least fixes the simple command case. This is a change in behaviour but it is unlikely that the old behaviour would be considered correct in any case. Reported-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net> Signed-off-by: Simon Glass <sjg@chromium.org>
* | Fix itest mask overflowSimon Glass2014-06-051-1/+1
|/ | | | | | | The mask value used in itest overflows and therefore it can return an incorrect result for something like 'itest 0 == 1'. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2014-05-301-0/+1
|\
| * mkimage: add atmelimageAndreas Bießmann2014-05-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new atmelimage converts a machine code BLOB to bootable ROM image. Atmel ROM has no sophisticated image format, it only checks the first 7 ARM vectors. The vectors can contain valid B or LDR opcodes, the 6'th vector contains the image size to load. Additionally the PMECC header can be written by the atmelimage target. The parameters must be given via the -n switch as a coma separated list. For example: mkimage -T atmelimage \ -n usePmecc=1,sectorPerPage=4,sectorSize=512,spareSize=64,eccBits=4,eccOffset=36 \ -d spl/u-boot-spl.bin boot.bin A provided image can be checked for correct header setup. It prints out the PMECC header parameters if it has one and the 6'th interrupt vector content. ---8<--- Image Type: ATMEL ROM-Boot Image with PMECC Header PMECC header ==================== eccOffset: 36 sectorSize: 512 eccBitReq: 4 spareSize: 64 nbSectorPerPage: 4 usePmecc: 1 ==================== 6'th vector has 17044 set --->8--- A SPL binary modified with the atmelimage mkimage target was succesfully booted on a sama5d34ek via MMC and NAND. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Cc: Bo Shen <voice.shen@atmel.com> Cc: Heiko Schocher <hs@denx.de> Tested-by: Bo Shen <voice.shen@atmel.com>
* | main: Avoid unncessary strdup()/free()Simon Glass2014-05-291-4/+2
| | | | | | | | | | | | | | It doesn't seem necessary to use memory allocation in this code. The setenv() will make a copy anyway. Signed-off-by: Simon Glass <sjg@chromium.org>
* | main: Make the execution path a little clearer in main.cSimon Glass2014-05-293-73/+86
| | | | | | | | | | | | | | | | | | bootdelay_process() never returns in some circumstances, whichs makes the control flow confusing. Change it so that the decision about how to execute the boot command is made in the main_loop() code, so it is easier to follow. Move CLI stuff to cli.c. Signed-off-by: Simon Glass <sjg@chromium.org>
* | main: Hide the hush/simple details inside cli.cSimon Glass2014-05-293-15/+25
| | | | | | | | | | | | | | Move these details from main (which doesn't care which parser is used) to cli.c where they belong. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Simplify the main loopSimon Glass2014-05-291-27/+32
| | | | | | | | | | | | | | The main loop is easier to follow if the code is grouped into separate functions. Make this change, so that main_loop() is easier to read. Signed-off-by: Simon Glass <sjg@chromium.org>
* | m68k: powerpc: Clean up do_mdm_initSimon Glass2014-05-292-21/+4
| | | | | | | | | | | | | | | | This code seems unnecessarily complex. We really just need to check the global_data. Now that is it all in one place, and not arch-specific, this is pretty easy. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Rename bootretry functions and remove #ifdefsSimon Glass2014-05-297-40/+16
| | | | | | | | | | | | | | Add a bootretry_ prefix to these two functions, and remove the need for the #ifdef around everything (it moves to the Makefile). Signed-off-by: Simon Glass <sjg@chromium.org>
* | Move bootretry code into bootretry.c and clean upSimon Glass2014-05-299-55/+75
| | | | | | | | | | | | | | This code is only used by one board, so it seems a shame to clutter up the readline code with it. Move it into its own file. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Move command line API into cli.cSimon Glass2014-05-293-93/+107
| | | | | | | | | | | | | | We now have a single entry point to the CLI, whether simple or hush. Put this in its own file. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Move autoboot code to autoboot.cSimon Glass2014-05-293-364/+370
| | | | | | | | | | | | | | The autoboot code is complex and long. It deserves its own file with a simple interface from main.c. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Add cli_ prefix to readline functionsSimon Glass2014-05-2910-30/+32
| | | | | | | | | | | | This makes it clear where the code resides. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Split out simple parser and readline into separate filesSimon Glass2014-05-294-1013/+1021
| | | | | | | | | | | | | | It doesn't make sense to have the simple parser and the readline code all in main. Split them out into separate files. Signed-off-by: Simon Glass <sjg@chromium.org>
* | move CLI prototypes to cli.h and add commentsSimon Glass2014-05-299-0/+9
| | | | | | | | | | | | | | Move the CLI prototypes from common.h to cli.h as part of an effort to reduce the size of common.h. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Rename hush to cli_hushSimon Glass2014-05-293-4/+4
| | | | | | | | | | | | Hush is a command-line interpreter, so rename it to make that clearer. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Remove unnecessary use of hush header fileSimon Glass2014-05-292-5/+0
| | | | | | | | | | | | | | Some files include hush.h but don't actually use it. Remove this where possible. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: rename device struct to udeviceHeiko Schocher2014-05-272-4/+4
|/ | | | | | | | | | | | using UBI and DM together leads in compiler error, as both define a "struct device", so rename "struct device" in include/dm/device.h to "struct udevice", as we use linux code (MTD/UBI/UBIFS some USB code,...) and cannot change the linux "struct device" Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de>
* Merge branch 'master' of git://git.denx.de/u-boot-mmcTom Rini2014-05-236-334/+540
|\
| * cmd_mmc: use new mmc_select_hwpart() functionStephen Warren2014-05-231-15/+6
| | | | | | | | | | | | | | | | | | | | The implementation of mmc_select_hwpart() was cribbed from do_mmcops(). Update do_mmcops() to call mmc_select_hwpart() to avoid duplication. <panto> Manual patch update due to patch order. Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
| * cmd_part: fix typo in part command help textStephen Warren2014-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | All the sub-commands start with the main command name, but it was missing from one of the help texts. <panto> typos fix. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Tom Rini <trini@ti.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
| * eMMC: cmd_mmc.c adds the 'rpmb' sub-command for the 'mmc' commandPierre Aubert2014-05-231-296/+510
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This sub-command adds support for the RPMB partition of an eMMC: * mmc rpmb key <address of the authentication key> Programs the authentication key in the eMMC This key can not be overwritten. * mmc rpmb read <address> <block> <#count> [address of key] Reads <#count> blocks of 256 bytes in the RPMB partition beginning at block number <block>. If the optionnal address of the authentication key is provided, the Message Authentication Code (MAC) is verified on each block. * mmc rpmb write <address> <block> <#count> <address of key> Writes <#count> blocks of 256 bytes in the RPMB partition beginning at block number <block>. The datas are signed with the key provided. * mmc rpmb counter Returns the 'Write counter' of the RPMB partition. The sub-command is conditional on compilation flag CONFIG_SUPPORT_EMMC_RPMB Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com> Signed-off-by: Pierre Aubert <p.aubert@staubli.com> CC: Wolfgang Denk <wd@denx.de>
| * Add the function 'confirm_yesno' for interactivePierre Aubert2014-05-234-36/+37
| | | | | | | | | | | | | | | | User's confirmation is asked in different commands. This commit adds a function for such confirmation. Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com> Signed-off-by: Pierre Aubert <p.aubert@staubli.com>
* | Merge branch 'fpga' of git://www.denx.de/git/u-boot-microblazeTom Rini2014-05-221-4/+87
|\ \
| * | fpga: Added support to load bit stream from SD/MMCSiva Durga Prasad Paladugu2014-05-201-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support to load a bitstream image in chunks by reading it in chunks from SD/MMC. Command format: loadfs [dev] [address] [image size] [blocksize] <interface> [<dev[:part]>] <filename> Example: fpga loadfs 0 1000000 3dbafc 4000 mmc 0 fpga.bin Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
| * | fpga: Add support to load partial bitstreamsMichal Simek2014-05-201-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support to load partial bitstreams. The partial bitstreams can be loaded using the below commands Commands: fpga loadp <dev> <addr> <size> fpga loadbp <dev> <addr> <size> The full bit streams can be loaded using the old commands(fpga load and fpga loadb). Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
| * | fpga: Define bitstream type based on command selectionMichal Simek2014-05-201-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up partial, full and compressed bitstream handling. U-Boot supports full bitstream loading and partial based on detection which is not 100% correct. Extending fpga_load/fpga_loadbitstream() with one more argument which stores bitstream type. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
| * | fpga: Guard the LOADMK functionality with CMD_FPGA_LOADMKSiva Durga Prasad Paladugu2014-05-201-0/+8
| |/ | | | | | | | | | | | | | | | | Guard the LOADMK functionality with config to provide an option to enable or disable it. Enable it for all platforms in mainline which enable CONFIG_CMD_FPGA. Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* | Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2014-05-221-1/+1
|\ \
| * | Merge remote-tracking branch 'u-boot/master'Albert ARIBAUD2014-05-207-47/+44
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: boards.cfg Conflicts were trivial once u-boot-arm/master boards.cfg was reformatted (commit 6130c146) to match u-boot/master's own reformatting (commit 1b37fa83).
| * | Merge branch 'master' of git://git.denx.de/u-boot-armStefano Babic2014-05-1529-287/+649
| |\ \
| * | | nand: remove CONFIG_SYS_NAND_PAGE_SIZETim Harvey2014-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only need to read in the size of struct image_header and thus don't need to know the page size of the nand device. Cc: Scott Wood <scottwood@freescale.com> Signed-off-by: Tim Harvey <tharvey@gateworks.com> Acked-by: Stefano Babic <sbabic@denx.de> Acked-by: Scott Wood <scottwood@freescale.com>
* | | | Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini2014-05-226-18/+239
|\ \ \ \ | |_|_|/ |/| | |
| * | | usb/gadget: add the fastboot gadgetSebastian Siewior2014-05-082-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains an implementation of the fastboot protocol on the device side and documentation. This is based on USB download gadget infrastructure. The fastboot function implements the getvar, reboot, download and reboot commands. What is missing is the flash handling i.e. writting the image to media. v3 (Rob Herring): This is based on http://patchwork.ozlabs.org/patch/126798/ with the following changes: - Rebase to current mainline and updates for current gadget API - Use SPDX identifiers for licenses - Traced the history and added missing copyright to cmd_fastboot.c - Use load_addr/load_size for transfer buffer - Allow vendor strings to be optional - Set vendor/product ID from config defines - Allow Ctrl-C to exit fastboot mode v4: - Major re-write to use the USB download gadget. Consolidated function code to a single file. - Moved globals into single struct. - Use puts and putc as appropriate. - Added CONFIG_USB_FASTBOOT_BUF_ADDR and CONFIG_USB_FASTBOOT_BUF_SIZE to set the fastboot transfer buffer. v5: - Add CONFIG option documentation to README - Rebase using new downloader registration Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Rob Herring <robh@kernel.org>
| * | | image: add support for Android's boot image formatSebastian Siewior2014-05-084-6/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the Android boot-image format. The header file is from the Android project and got slightly alterted so the struct + its defines are not generic but have something like a namespace. The header file is from bootloader/legacy/include/boot/bootimg.h. The header parsing has been written from scratch and I looked at bootloader/legacy/usbloader/usbloader.c for some details. The image contains the physical address (load address) of the kernel and ramdisk. This address is considered only for the kernel image. The "second image" defined in the image header is currently not supported. I haven't found anything that is creating this. v3 (Rob Herring): This is based on http://patchwork.ozlabs.org/patch/126797/ with the following changes: - Rebased to current mainline - Moved android image handling to separate functions in common/image-android.c - s/u8/char/ in header to fix string function warnings - Use SPDX identifiers for licenses - Cleaned-up file source information: android_image.h is from file include/boot/bootimg.h in repository: https://android.googlesource.com/platform/bootable/bootloader/legacy The git commit hash is 4205b865141ff2e255fe1d3bd16de18e217ef06a usbloader.c would be from the same commit, but it does not appear to have been used for any actual code. v4: - s/andriod/android/ - Use a separate flag ep_found to track if the entry point has been set rather than using a magic value. Cc: Wolfgang Denk <wd@denx.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Tom Rini <trini@ti.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
| * | | ums: allow the user to specify the device typeStephen Warren2014-05-081-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow an optional devtype parameter to the ums command, which specifies the type of the device to be exported. This could allow exporting a SATA or even another USB device. Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
| * | | ums: move all variable declarations to the start of the blockStephen Warren2014-05-081-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's easier to assign values to the variables inside an if statement body if the assignment and declaration are separate. Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
| * | | ums: use get_device() not find_mmc_device();Stephen Warren2014-05-081-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | get_device() is a generic routine that will support any type of block device. Use this instead of the type-specific find_mmc_device(), for future flexibility. Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
| * | | ums: move IO support code to common locationStephen Warren2014-05-081-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's nothing Samsung-/board-specfic about the implementation of ums_init(). Move the code into cmd_usb_mass_storage.c, so that it can be shared by any user of that command. Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>