summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* env: Hide '.' variables in env print by defaultJoe Hershberger2012-12-1310-21/+29
| | | | | | | | | | When printing all variables with env print, don't print variables that begin with '.'. If env print is called with a '-a' switch, then include variables that begin with '.' (just like the ls command). Variables printed explicitly will be printed even without the -a. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Use getenv_yesno() more generallyJoe Hershberger2012-12-132-6/+14
| | | | | | | Move the getenv_yesno() to env_common.c and change most checks for 'y' or 'n' to use this helper. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Refactor apply into change_okJoe Hershberger2012-12-132-20/+17
| | | | | | | | | | | | | | | | Move the read of the old value to inside the check function. In some cases it can be avoided all together and at the least the code is only called from one place. Also name the function and the callback to more clearly describe what it does. Pass the ENTRY instead of just the name for direct access to the whole data structure. Pass an enum to the callback that specifies the operation being approved. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Refactor do_apply to a flagJoe Hershberger2012-12-133-32/+21
| | | | | | | | | | Use a flag in hsearch_r for insert mode passed from import to allow the behavior be different based on use. Now that "do_check" is called for all imports, ensure console init is complete before updating the console on relocation import Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* gpt: Support for new "gpt" commandPiotr Wilczek2012-12-132-0/+334
| | | | | | | | | | New command - "gpt" is supported. It restores the GPT partition table. It looks into the given environment variable for partitions definition. It can be enabled at target configuration file with CONFIG_CMD_GPT. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
* cmd:spl:fix: Prevent from a build error on boards, which don't support FDTŁukasz Majewski2012-12-111-0/+2
| | | | | | | | Do not compile in FDT related code, when it is not supported. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Stefano Babic <sbabic@denx.de>
* tpm: Add TPM stress testLuigi Semenzato2012-12-111-6/+87
| | | | | | | | Add a simple command to stress-test a TPM (Trusted Platform Module). Signed-off-by: Luigi Semenzato <semenzato@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* console: Enable function to display console infoSimon Glass2012-12-111-2/+4
| | | | | | | | | | | The CONFIG_SYS_CONSOLE_INFO_QUIET option should suppress the console information, but allow boards to display it later if required. Adjust the code to support this. This is used to avoid printing the information while the LCD display is not ready, since it only becomes ready when stdio init is complete. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add console command to access io space registersVadim Bendebury2012-12-112-0/+94
| | | | | | | | | | | | | | | | | | | Provide u-boot console functions to access IO space registers. A no thrills implementation, accessing one register at a time. For example: boot > iod 80 0080: 00000094 boot > iod.w 80 0080: 0094 boot > iod.b 80 0080: 94 boot > iow.b 0x80 12 boot > iod 0x80 0080: 00000012 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* fdt: edid: Enable fdt_add_edid() function when CONFIG_LCD definedTom Wai-Hong Tam2012-12-111-1/+1
| | | | | | | This function can be used for LCDs as well as monitors. Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* edid: Add I2C command for printing the EDIDTom Wai-Hong Tam2012-12-111-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a single command to read the EDID information over I2C. For example: SMDK5250 # i2c dev 7 Setting bus to 7 SMDK5250 # i2c edid 50 EDID version: 1.4 Product ID code: 305c Manufacturer: AUO Serial number: 00000000 Manufactured in week: 0 year: 2011 Video input definition: digital signal, voltage level 0, blank to black Monitor is non-RGB Maximum visible display size: 26 cm x 14 cm Power management features: no active off, no suspend, no standby Estabilished timings: Standard timings: 1366x768 60 Hz (detailed) 1366x768 60 Hz (detailed) Monitor ID: 2VD2K.B116XW Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* edid: Library of EDID decode and printTom Wai-Hong Tam2012-12-112-0/+308
| | | | | | | | | | | | | | | | | | | This implements a library for accessing EDID data from an LCD panel. This is used to obtain information about the panel such as its resolution and type. This is a tidied-up version of the original code pulled from https://github.com/ynezz/u-boot-edid. The changes we made are: - removed bit fields in the struct; - removed endianness cases in the struct; - fixed some wrong definitions; - fixed to fit 80 columns; - fixed some code styles. Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* Add hash command to perform hashing using various algorithmsSimon Glass2012-12-112-0/+64
| | | | | | | | | | | | | | | | | | | | | This new command supports hashing SHA1 and SHA256. It could be extended to others such as MD5 and the CRC algorithms. The syntax is modeled on those: hash <algorithm> <address> <length> [*<dest_addr> | <dest_envvar>] to calculate a hash, and: hash -v <algorithm> <address> <length> [*<verify_addr> | <verify_envvar>] to verify a hash. Use CONFIG_CMD_HASH to enable the command, CONFIG_SHA1 to enable SHA1 and CONFIG_SHA256 to enable SHA256. The existing sha1sum command remains. Signed-off-by: Simon Glass <sjg@chromium.org>
* sha1sum: Use generic hash layerSimon Glass2012-12-111-125/+4
| | | | | | Update the code to use the hash layer instead of local code. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add generic hash APISimon Glass2012-12-112-0/+222
| | | | | | | | We have a SHA1 command and want to add a SHA256 command also. Instead of duplicating the code, create a generic hash API which can process commands for different algorithms. Signed-off-by: Simon Glass <sjg@chromium.org>
* stdio: remove useless strncpyVincent Palatin2012-12-111-1/+0
| | | | | | | | | | | | | | The name is already copied when we memcpy() the whole structure. This is because struct stdio_dev has this field: char name[16]; /* Device name */ So the data is inline, rather than being a pointer. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* Fix use of conditional LMBSimon Glass2012-12-111-1/+1
| | | | | | This code was not guarded with CONFIG_LMB so failed to build on x86. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add a command to read raw blocks from a partitionKenneth Waters2012-12-112-0/+82
| | | | | | | | | | Sometimes data is on a block device and within a partition, but not in a particular filesystem. This commands permits reading raw data from a partition. Signed-off-by: Kenneth Waters <kwaters@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* Add gettime commandAnton Staaf2012-12-112-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Gettime returns the current timer value. If CONFIG_SYS_HZ is defined then the timer value is also converted to seconds. Tegra20 (SeaBoard) # gettime Timer val: 7754 Seconds : 7 Remainder : 754 sys_hz = 1000 There has been some discussion about whether this is useful enough to be included in U-Boot. The following boards do not have CONFIG_SYS_HZ defined: M52277EVB M52277EVB_stmicro M53017EVB M54418TWR M54418TWR_nand_mii M54418TWR_nand_rmii M54418TWR_nand_rmii_lowfreq M54418TWR_serial_mii M54418TWR_serial_rmii Signed-off-by: Anton Staaf <robotboy@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* Add new bootstage step for the main loopSimon Glass2012-12-111-0/+2
| | | | | | Mark when we get to the main loop. Signed-off-by: Simon Glass <sjg@chromium.org>
* i2c: kerneldoc: Add kerneldoc annotations to cmd_i2c.cMarek Vasut2012-12-111-15/+179
| | | | | | | | Add kerneldoc style documentation into cmd_i2c.c to properly describe all overridable functions and most of the command interface. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Heiko Schocher <hs@denx.de>
* i2c: Use __weak instead of __attribute__((weak, alias))Marek Vasut2012-12-111-9/+7
| | | | | | | | | Use __weak from linux/compiler.h instead of __attribute__((weak, alias)) to define overridable function. This patch is intended as a cleanup patch to bring some consistency into the code. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Heiko Schocher <hs@denx.de>
* cmd_led.c: Standardize format of help and usage info.Robert P. J. Day2012-12-061-3/+3
| | | | | | | Current "led" help and usage info has redundancy and extraneous newlines, tweak it to be consistent with other commands. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
* env: Enable getenv_f() for SPL_BUILDStefan Roese2012-12-051-0/+3
| | | | | | | | | | | | With this patch, getenv_f() can be included easily into the SPL binary. With this, SPL boards can now use getenv_f() to read environment variables (e.g. to detect if the OS or U-Boot shall be executed). In the approach this is done for env stored in NOR flash, as this will be used by an upcoming MPC5200 board port. Signed-off-by: Stefan Roese <sr@denx.de>
* SPL: Port SPL framework to powerpcStefan Roese2012-12-051-0/+16
| | | | | | | | | | | | | This patch enables the SPL framework to be used on powerpc platforms and not only ARM. timer_init() does not exist on PPC systems. The timer (decrementer) is initialized and enabled in interrupt_init() here. And currently interrupt_init() is called after relocation to SDRAM. Since the only powerpc SPL implementation (a3m071) doesn't need a timer, let's remove this timer_init() call for PPC systems. Signed-off-by: Stefan Roese <sr@denx.de>
* x86: Add CBMEM console driver for corebootVadim Bendebury2012-11-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch builds upon the recently introduced CBMEM console feature of coreboot. CBMEM console uses a memry area allocated by coreboot to store the console output. The memory area has a certain structure, which allows to determine where the buffer is, the buffer size and the location of the pointer in the buffer. This allows different phases of the firmware (rom based coreboot, ram based coreboot, u-boot after relocation with this change) to keep adding text to the same buffer. Note that this patch introduces a new console driver and adds the driver to the list of drivers to be used for console output, i.e. it engages only after u-boot relocates. Usiong CBMEM console for capturing the pre-relocation console output will be done under a separate change. >From Linux, run the cbmem.py utility (which is a part of the coreboot package) to see the output, e.g.: vvvvvvvvvvvvvvvvv SCSI: AHCI 0001.0300 32 slots 6 ports ? Gbps 0xf impl SATA mode flags: 64bit ilck stag led pmp pio ... Magic signature found Kernel command line: "cros_secure quiet loglevel=1 console=tty2... ^^^^^^^^^^^^^^^^^ Note that the entire u-boot output fits into the buffer only if the coreboot log level is reduced from the most verbose. Ether the buffer size will have to be increased, or the coreboot verbosity permanently reduced. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* fdt: Correct global_data condition in mainSimon Glass2012-11-281-2/+0
| | | | | | | | We need an extra condition here in case we want to use fdt without the silent console/cmdline editing/post options. It is easier to just remove the #ifdef. Signed-off-by: Simon Glass <sjg@chromium.org>
* mmc: Fix incorrect handling of 'read' & 'write' commandsTaylor Hutt2012-11-271-5/+4
| | | | | | | | | | | | | | | | | If a malformed 'read' or 'write' command is issued, the Sandbox U-Boot can crash because the command-handling code does no error checking on the number of provided arguments. This change makes the mmc 'erase', 'read' and 'write' commands only function if the proper number of arguments are supplied. Also puts the else assignment at the beginning fo the if() statement to shortens the generated code. This removes an unnecessary jump from the generated code. Signed-off-by: Taylor Hutt <thutt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Andy Fleming <afleming@freescale.com>
* common: rework bouncebuf implementationStephen Warren2012-11-271-34/+41
| | | | | | | | | | | | | | | | | | | | | | | | | The current bouncebuf API requires all parameters to be passed to both bounce_buffer_start() and bounce_buffer_stop(). Modify the bouncebuf start function to accept a state structure as a parameter, and only require that state struct to be passed to the stop function. This simplifies usage of the bounce buffer by clients. Don't modify the data pointer, but rather store the temporary buffer in this state struct. The bouncebuf code ensures that client code can always use a single buffer pointer in the state structure, irrespective of whether a bounce buffer actually had to be allocated. Move cache management logic into the bounce buffer code, so that each client doesn't have to duplicate this. I believe there's no need to invalidate the buffer before a DMA operation, since flushing the cache should prevent any write-backs. Update the MXS MMC driver for this change. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Andy Fleming <afleming@freescale.com>
* Merge branch 'master' of git://git.denx.de/u-boot-nand-flashTom Rini2012-11-261-0/+22
|\
| * nand: Add torture featureBenoît Thébaudeau2012-11-261-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a NAND Flash torture feature, which is useful as a block stress test to determine if a block is still good and reliable (or should be marked as bad), e.g. after a write error. This code is ported from mtd-utils' lib/libmtd.c. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Scott Wood <scottwood@freescale.com> [scottwood@freescale.com: removed unnec. ifdef and unwrapped error strings] Signed-off-by: Scott Wood <scottwood@freescale.com>
* | Merge branch 'master' of git://git.denx.de/u-boot-fdtTom Rini2012-11-203-1/+239
|\ \
| * \ Merge branch 'next'Gerald Van Baren2012-11-193-1/+239
| |\ \ | | |/ | |/|
| | * fdt: Set kernaddr if fdt indicates a kernel is presentSimon Glass2012-11-121-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If kernel-offset is specified in the fdt, set an environment variable so that scripts can access the attached kernel. This can be used by a packaging program to tell U-Boot about a kernel that has been downloaded alongside U-Boot. The value in the fdt is the offset of the kernel from the start of the U-Boot image, so we can find it just by adding CONFIG_SYS_TEXT_BASE. It is then fairly easy to put something like this in the environment variables in the board header file: "if test ${kernaddr} != \"\"; then "\ "echo \"Using bundled kernel\"; "\ "bootm ${kernaddr};" \ "fi; "\ /* rest of boot sequence follows here */ Signed-off-by: Simon Glass <sjg@chromium.org>
| | * fdt: Add option to default to most compatible conf in a fit imageGabe Black2012-11-122-0/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When booting a fit image with multiple configurations, the user either has to specify which configuration to use explicitly, or there has to be a default defined which is chosen automatically. This change adds an option to change that behavior so that a configuration can be selected explicitly, or the configuration which has the device tree that claims to be compatible with the earliest item in U-Boot's device tree. In other words, if U-Boot claimed to be compatible with A, B, and then C, and the configurations claimed to be compatible with A, D and B, D and D, E, the first configuration, A, D, would be chosen. Both the first and second configurations match, but the first one matches a more specific entry in U-Boot's device tree. The order in the kernel's device tree is ignored. Signed-off-by: Gabe Black <gabeblack@google.com> Commit-Ready: Gabe Black <gabeblack@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| | * fdt: Allow device tree to specify secure bootingDoug Anderson2012-11-121-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When secure booting is chosen: * The u-boot shell is never invoked during boot--we just do a simple table lookup to find the command. This means we could even remove the shell parsing from u-boot and still be able to boot. * The boot command can't be interruped. * Failure doesn't cause us to fall back to the shell. Signed-off-by: Gabe Black <gabeblack@google.com> Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| | * fdt: Tell the FDT library where the device tree isGabe Black2012-11-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a call to set_working_fdt_addr near the end of u-boot initialization which tells the fdt command/library where the device tree is. This makes it possible to use the fdt command to look at the active device tree since otherwise there would be no way to know what address it was at to set things up manually. Signed-off-by: Gabe Black <gabeblack@google.com> Signed-off-by: Simon Glass <sjg@chromium.org>
| | * fdt: Load boot command from device treeChe-Liang Chiou2012-11-121-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | Load boot command from /config/bootcmd of device tree if present. Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* | | usb: use linux/usb/ch9.h instead of usbdescriptors.hIlya Yanok2012-11-202-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux usb/ch9.h seems to have all the same information (and more) as usbdescriptors.h so use the former instead of the later one. As a consequense of this change USB_SPEED_* values don't correspond directly to EHCI speed encoding anymore, I've added necessary recoding in EHCI driver. Also there is no point to put speed into pipe anymore so it's removed and a bunch of host drivers fixed to look at usb_device->speed instead. Old usbdescriptors.h included is not removed as it seems to be used by old USB device code. This makes usb.h and usbdevice.h incompatible. Fortunately the only place that tries to include both are the old MUSB code and it needs usb.h only for USB_DMA_MINALIGN used in aligned attribute on musb_regs structure but this attribute seems to be unneeded (old MUSB code doesn't support any DMA at all). Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
* | | USB: add arrow key support to usb_kbdAllen Martin2012-11-201-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue, but this allows arrow keys to work until this driver is converted. Signed-off-by: Allen Martin <amartin@nvidia.com>
* | | USB: make usb_kbd obey USB DMA alignment requirementsAllen Martin2012-11-201-1/+4
|/ / | | | | | | | | | | | | | | | | | | Change usb_kbd driver to obey alignment requirements for USB DMA on the buffer used for data transfer. This is necessary for architectures that enable dcache and enable USB DMA. Signed-off-by: Allen Martin <amartin@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* | Merge branch 'master' of git://git.denx.de/u-boot-videoTom Rini2012-11-192-7/+176
|\ \
| * | lcd: Implement RLE8 bitmap decodingTom Wai-Hong Tam2012-11-071-0/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for drawing compressed RLE8 bitmaps. Reference: http://www.digicamsoft.com/bmp/bmp.html Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Che-Liang Chiou <clchiou@chromium.org> [agust: fix some minor style issues and build warnings] Signed-off-by: Anatolij Gustschin <agust@denx.de>
| * | lcd: Fix BMP decode bug that skips the wrong padded rowTom Wai-Hong Tam2012-11-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixed 2 things: - Rename padded_line to padded_width since it is (width + padded_row) not line. - When finished a line, should skip the padded_row that is (padded_width - width) instead of (width - padded_width). Reference: http://en.wikipedia.org/wiki/BMP_file_format Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| * | lcd: Provide an API to access LCD parametersVadim Bendebury2012-11-071-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a basic API to provide access to lcd parameters such as screen size, and to position the cursor on the screen. This matches up with the video API for the same purpose. Unfortunately they are not yet combined. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| * | video: Provide an API to access video parametersStefan Reinauer2012-11-061-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a basic API to provide access to video parameters such as screen size, and to position the cursor on the screen. Also add a prototype for video_display_bitmap() which was missing. Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Anatolij Gustschin <agust@denx.de>
* | | Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-stagingTom Rini2012-11-191-1/+1
|\ \ \ | |_|/ |/| |
| * | cmd_mmc.c: Fix typo, "dislay" -> "display"Robert P. J. Day2012-11-141-1/+1
| |/ | | | | | | Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
* | common/command.c: revert changes from commit 199adb60Anatolij Gustschin2012-11-081-8/+1
|/ | | | | | | | | | | | | | | commit 199adb601ff34bdbbd0667fac80dfe0a87bffc2b "common/misc: sparse fixes" broke the help command trying to fix the sparse error "command.c:44:38: error: bad constant expression". As Henrik points out, the fix was bad because the commit used CONFIG_SYS_MAXARGS whereas the code intended to use the maximum number of commands (not arguments to a command). Revert command.c changes to the original code as asked by Wolfgang. Reported-by: Henrik Nordström <henrik@henriknordstrom.net> Signed-off-by: Anatolij Gustschin <agust@denx.de>
* Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2012-11-051-4/+4
|\
OpenPOWER on IntegriCloud