Commit Graph

2837 Commits

Author SHA1 Message Date
Ying Zhang 7cb4f1cc80 spl: env_common.c: make CONFIG_SPL_BUILD contain function env_import
The functionality env_import will be used in the SPL. They
had been excluded by ifndef CONFIG_SPL_BUILD. Now, put it
into the SPL.

Signed-off-by: Ying Zhang <b40530@freescale.com>
Acked-by: Tom Rini <trini@ti.com>
Acked-by: York Sun <yorksun@freescale.com>
2013-08-20 09:46:57 -07:00
Matthias Fuchs 3fb8588912 ppc4xx: Remove support for PPC405CR CPUs
This patch removes support for the APM 405CR CPU.
This CPU is EOL and no board uses this chip.

Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu>
2013-08-20 11:35:24 -04:00
Wolfgang Denk cb3761ea99 SPDX-License-Identifier: convert BSD-3-Clause files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini Don't remove some copyrights by accident]
Signed-off-by: Tom Rini <trini@ti.com>
2013-08-19 15:45:35 -04:00
Tom Rini e20cc2ca15 Merge branch 'master' of git://88.191.163.10/u-boot-arm
Fixup an easy conflict over adding the clk_get prototype and USB_OTG
defines for am33xx having moved.

Conflicts:
	arch/arm/include/asm/arch-am33xx/hardware.h

Signed-off-by: Tom Rini <trini@ti.com>
2013-08-18 14:14:34 -04:00
Simon Glass 1fd1e2f69f image: Display FIT timestamp when booting
The timestamp is shown in fit_print_contents() but for some reason not
in fit_image_print(). This seems to be an oversight, since it is the latter
which is used by bootm.

Add timestamp printing in this case.

(There is code duplication in these two function, for looking at in a future
patch).

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-08-16 13:45:15 -04:00
Paul B. Henson bd4a3997f1 bootm: fix conditional controlling call to fixup_silent_linux
This function is only defined if CONFIG_SILENT_CONSOLE is set and
CONFIG_SILENT_U_BOOT_ONLY is not set, the call to it should be based
on the same conditions.

Signed-off-by: Paul B. Henson <henson@acm.org>
Acked-by: Simon Glass <sjg@chromium.org>
2013-08-16 13:45:15 -04:00
Simon Glass 8d51aacd8c RFC: bootm: Add silent_linux environment variable
At present the console for linux is silent if the U-Boot console is silent,
unless CONFIG_SILENT_U_BOOT_ONLY is set. I wonder if a better way would be
to have an environment variable to control this? Then we can control the
verbosity from scripts, and set the variable to 'no' for those boards that
want Linux to boot with console output.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-08-16 13:45:15 -04:00
Taras Kondratiuk 62cf11c092 SPL: Limit image name print length
If image name is longer than 32 bytes, then it will be truncated.
This will remove '\0' at the end of the line, so printf will
go out of string limit.

Signed-off-by: Taras Kondratiuk <taras@ti.com>
Reviewed-by: Tom Rini <trini@ti.com>
2013-08-16 13:45:15 -04:00
Angus Ainslie 6e66bd5591 Enable xmodem support
This is a trivial patch that just enables xmodem downloads using the existing
ymodem framework.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
2013-08-16 13:45:15 -04:00
Tom Rini df785a7ffb Merge branch 'dcc' of git://www.denx.de/git/u-boot-microblaze 2013-08-13 16:49:44 -04:00
Jagannadha Sutradharudu Teki 32749e91aa serial: arm_dcc: Remove stdio structure support
Removed stdio structure ops support on arm_dcc
driver, and need to register with serial core
so-that it can access like remianing serial drivers.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2013-08-13 08:38:29 +02:00
Tom Rini c15438eaea Merge branch 'master' of git://www.denx.de/git/u-boot-video 2013-08-12 18:06:30 -04:00
Marek Vasut ac8ba84c56 video: Encapsulate font in video_font_data.h
This patch moves all the font configuration values into video_font_data.h
so they are all in the right place with the font. The video_font.h now only
includes video_font_data.h and will allow us to select and include different
font once more fonts are added.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
[agust: fixed build warning for mcc200]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-08-12 22:28:41 +02:00
Gerlando Falauto 3488850629 cmd_sf: let "sf update" erase last sector as a whole
make "sf update" work with unaligned `len' parameter, by deleting the
whole last sector before writing, so to allow for:

 sf update ${load_addr_r} 0 ${filesize}

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Cc: Valentin Longchamp <valentin.longchamp@keymile.com>
Cc: Holger Brunck <holger.brunck@keymile.com>
Acked-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
2013-08-07 01:05:07 +05:30
Jagannadha Sutradharudu Teki 402ba1e3a0 cmd_sf|env_sf: Fix code cleanup
- line over 80 characters
- add tabs
- CHECK: Alignment should match open parenthesis

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
2013-08-06 23:58:43 +05:30
Nikita Kiryanov 0adc331b37 usb_hub: fix power cycling logic
When power cycling the hub ports, a misbehaving port will prevent all ports
from being powered on because we quit at the first sign of trouble.

Skip problematic ports instead of failing the entire power on.

Cc: Marek Vasut <marex@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
2013-07-29 23:01:33 +02:00
Lukasz Majewski 6bed7ce569 dfu: Implementation of target reset after communication with dfu-util's -R switch
This patch extends dfu code to support transmission with -R switch
specified at dfu-util.

When -R is specified, the extra USB_REQ_DFU_DETACH request is sent after
successful data transmission. Then dfu resources are released and reset
command is issued.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2013-07-29 23:01:33 +02:00
Tom Rini e4c444b34b spl_mmc.c: Detect missing kernel image in RAW MMC
Currently, we assume that if we can read from MMC correctly, we have
found a valid image.  This is not the case as an empty area will read
just fine.  Add a check for a valid IH_MAGIC.

Signed-off-by: Tom Rini <trini@ti.com>
Reviewed-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-07-26 16:39:10 -04:00
Tom Rini 9fab4bf4cc powerpc/ppc4xx: Convert new gdsys files to SPDX license tags
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-26 15:32:59 -04:00
Dirk Eibach 869b550ea3 powerpc/ppc4xx: Add fpgad command for dumping gdsys fpga registers
Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>
Signed-off-by: Stefan Roese <sr@denx.de>
2013-07-25 19:35:42 +02:00
Tom Rini c2120fbfbc Merge branch 'master' of git://git.denx.de/u-boot-i2c
The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
	board/sandburst/common/ppc440gx_i2c.c
	board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:50:24 -04:00
Wolfgang Denk e85427fd66 Add eCos-2.0 SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-07-24 09:45:01 -04:00
Wolfgang Denk 1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Axel Lin cfb25cc40e cmd_i2c: Use ARRAY_SIZE instead of reinventing it
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Glass <sjg@chromium.org>
2013-07-23 08:34:57 +02:00
Heiko Schocher 9a2accb44f i2c, multibus: get rid of CONFIG_I2C_MUX
CONFIG_I2C_MUX is replaced through the new i2c multibus/multiadapter
framework, configured through CONFIG_SYS_I2C. As CONFIG_I2C_MUX
is only used on the keymile boards, and they are now completely
moved to the new framework, remove CONFIG_I2C_MUX.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Holger Brunck <holger.brunck@keymile.com>
Tested-By: Holger Brunck <holger.brunck@keymile.com>
2013-07-23 08:34:53 +02:00
Heiko Schocher ea818dbbcd i2c, soft-i2c: switch to new multibus/multiadapter support
- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
2013-07-23 05:54:29 +02:00
Heiko Schocher 3f4978c713 i2c: common changes for multibus/multiadapter support
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>
2013-07-23 05:54:28 +02:00
Simon Glass 576aacdb91 bootm: Move fixup_silent_linux() earlier in the bootm stages
Before the bootm refactor, fixup_silent_linux() was done only in the
monolithic bootm case, not in the subcommand case. With the refactor, it
is done always, which is good. Unfortunately it is done too late, since it
is the PREP or CMDLINE stages that set up the command line for Linux.

Move fixup_silent_linux() into the LOADOS stage, which is where we find
out the OS being used, and can thus decide whether to perform this step.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-17 10:37:11 -04:00
Reinhard Pfau be6c1529c1 tpm: add AUTH1 cmds for LoadKey2 and GetPubKey
Extend the tpm library with support for single authorized (AUTH1) commands
as specified in the TCG Main Specification 1.2. (The internally used helper
functions are implemented in a way that they could also be used for double
authorized commands if someone needs it.)

Provide enums with the return codes from the TCG Main specification.

For now only a single OIAP session is supported.

OIAP authorized version of the commands TPM_LoadKey2 and TPM_GetPubKey are
provided. Both features are available using the 'tpm' command, too.

Authorized commands are enabled with CONFIG_TPM_AUTH_SESSIONS. (Note that
this also requires CONFIG_SHA1 to be enabled.)

Signed-off-by: Reinhard Pfau <reinhard.pfau@gdsys.cc>
Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>
Acked-by: Che-Liang Chiou <clchiou@chromium.org>
Signed-off-by: Andy Fleming <afleming@freescale.com>
2013-07-16 17:44:29 -05:00
Frederic Leroy 04735e9c55 Fix ext2/ext4 filesystem accesses beyond 2TiB
With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives

We now use lbaint_t for partition offset to reflect the lbaint_t change,
and access partitions beyond or crossing the 2.1TiB limit.
This required changes to signature of ext4fs_devread(), and type of all
variables relatives to block sector.

ext2/ext4 fs uses logical block represented by a 32 bit value. Logical
block is a multiple of device block sector. To avoid overflow problem
when calling ext4fs_devread(), we need to cast the sector parameter.

Signed-off-by: Frédéric Leroy <fredo@starox.org>
2013-07-15 17:06:13 -04:00
Lan Yixun (dlan) 0eb33ad253 common: remove unaligned access error in bootmenu_getoption()
Some ARM compilers may emit code that makes unaligned accesses when
faced with constructs such as:

    char name[12] = "bootmenu_";

same fix as commit: 064d55f8bc

=========================================================
data abort

    MAYBE you should read doc/README.arm-unaligned-accesses

pc : [<3ff4b60c>]          lr : [<3ff4b7b0>]
sp : 3f346a58  ip : 3ff9c8e6     fp : 02000060
r10: 00000000  r9 : 3df47fc0     r8 : 3f347f40
r7 : 00000000  r6 : 00000000     r5 : 00000003  r4 : 3f759140
r3 : 000003f0  r2 : 00000000     r1 : 000003f1  r0 : 00000000
Flags: nzCv  IRQs on  FIQs off  Mode SVC_32
Resetting CPU ...
======================================================

Signed-off-by: Lan Yixun (dlan) <dennis.yxun@gmail.com>
2013-07-15 17:06:13 -04:00
Simon Glass 4f6aa3468d scsi: Correct types of scsi_read/write()
The block device expects to see lbaint_t for the blknr parameter. Change
the SCSI read/write functions to suit.

This fixes the following build warnings for coreboot:

cmd_scsi.c: In function ‘scsi_scan’:
cmd_scsi.c:119:30: error: assignment from incompatible pointer type [-Werror]
cmd_scsi.c:120:32: error: assignment from incompatible pointer type [-Werror]

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-15 17:06:09 -04:00
Simon Glass b7a1d13462 bootm: Handle errors consistently
A recent bootm fix left the error path incomplete. If CONFIG_TRACE is
set it may still not be a supported command, so cover that with the
unsupported subcommand print.  Once we handle BOOTM_STATE_OS_GO, we can
just move into the error handler itself, no need for a goto there.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Update slightly based on Simon's changes to also cover
CONFIG_TRACE/BOOTM_STATE_FAKE_OS_GO]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-12 17:16:37 -04:00
Stefano Babic e3a5bbce45 common/image.c: Fix regression with ramdisk load/entry points in FIT
A FIT image with a ramdisk that sets the entry or load points to 0x0
must be treated as meaning "leave in place" and NOT "relocate to 0x0".
This regression was introduced in a51ec63.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2013-07-12 15:04:43 -04:00
Simon Glass d72da15828 bootm: Correct the arguments for the ELF image loader
The arguments were out of place since commit 983c72f, since this file was
missed and not tested. Correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-12 10:32:39 -04:00
Simon Glass f320a4d845 bootm: Use selected configuration for ramdisk and fdt
If a specific configuraion is selected by the bootm command, e.g. with
'bootm 84000000#recoveryconf' we must honour this for not just the kernel,
but also the ramdisk and FDT.

In the conversion to using a common fit_image_load() function for loading
images from FITs (commits a51ec63 and 53f375f) this feature was lost.
Reinstate it by passing the selected configuration back from
fit_image_load() to boot_get_kernel(), then use this configuration
(which is stored in images->fit_uname_cfg) in both boot_get_ramdisk()
and boot_get_fdt().

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-12 10:32:39 -04:00
Simon Glass 7af26b1669 blackfin: x86: bootm: Handle PREP stage of bootm
The OS function is now always called with the PREP stage. Adjust the
remaining bootm OS functions to deal with this correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-12 10:32:39 -04:00
Simon Glass ec39029193 bootm: Remove extra OK message
This is not needed as we already print 'OK' later in all cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-12 10:32:39 -04:00
Tom Rini 970150a167 cmd_bootm.c: Re-order bootm_load_os return check for ELDK4.2
With ELDK4.2 we were getting a warning that load_end may be used
uninitialized in calling lmb_reserve.  This could not be the case,
however.  If we re-order the checks (and make them slightly clearer as
well) the warning goes away.  bootm_load_os may only return 0 on
success, BOOTM_ERR_OVERLAP in a non-fatal overlap (already covered in
comments) or a fatal BOOTM_ERR that is covered in the error handler.

Signed-off-by: Tom Rini <trini@ti.com>
2013-07-12 10:32:39 -04:00
Tom Rini 225fd8c5d4 cmd_bootm.c: Make bootz handle BOOTM_STATE_FINDOTHER itself
As a zImage does not have a U-Boot header, we cannot really do what
BOOTM_STATE_FINDOTHER does, exactly.  Break the ramdisk/fdt portions of
bootm_find_other into bootm_find_ramdisk/fdt which can be called in both
cases.

Signed-off-by: Tom Rini <trini@ti.com>
2013-07-10 09:15:15 -04:00
Tom Rini 2b9599e010 cmd_bootm.c: Make bootz consume 'bootz' from argv, decrement argc
Like 'bootm', 'bootz' needs to consume 'bootz' so that the rest of the
state functions will work.

Signed-off-by: Tom Rini <trini@ti.com>
2013-07-10 09:15:15 -04:00
Simon Glass fb1b139bb7 bootm: Add the missing PREP stage to bootz and correct image handling
In the recent bootm refactor, the PREP stage was missing in the bootz
command. This causes unpredictable behaviour.

The use of a local variable means that the reset of cmd_bootm.c does not
in fact use the same image structure, so remove this.

Also manually set the OS type to Linux, since this is the only possibility
at present, and we need to select the right boot function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-10 09:15:14 -04:00
Simon Glass a5266d6b5d bootm: Clean up bootz_setup() function
This function has no prototype in the headers and passes void * around, thus
requiring several casts. Tidy this up.

- Add new patch to clean up bootz_setup() function

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-10 09:15:14 -04:00
Simon Glass a26913f32d bootm: Require boot function only if it is about to be used
The original bootm code (before commit 35fc84f) did not check for a valid
boot function in the subcommand case, which was incorrect.

This check was introduced in all cases, but in fact we should only check
for the function when we need it. Otherwise in some cases the check fires
before the OS type is known.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-10 09:15:14 -04:00
Simon Glass 385501d38b bootm: Disable interrupts only when loading
With the move of the interrupt code to earlier in the sequence, we
exposed a problem where the interrupts are disabled at each bootm
stage. This is not correct - it should be done only once. Let's disable
interrupts in the LOAD stage. Put the code in a function for clarity.

Also, bootz lost its interrupt code altogether, so reinstate it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-07-10 09:15:14 -04:00
Tom Rini 2f4998ab44 Merge branch 'master' of git://git.denx.de/u-boot-video 2013-07-10 08:42:25 -04:00
Anatolij Gustschin ff8fb56b6f video: consolidate splash screen alignment code
Code for checking "splashpos" environment variable is
duplicated in drivers, move it to the common function.
Call this function also in the bmp display command to
consider "splashpos" settings.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
2013-07-08 20:21:24 +02:00
Tom Rini c479c1361a cmd_bootm.c: Correct check/return for unsupported sub-command
With the do_bootm_states re-organization, we have the call to any
potential sub-commands in a single spot.  If one fails, we can then stop
right there and return to the caller.  Prior to these calls we have
already ensured that ret is zero so we will not be returning this error
for some other case.

Signed-off-by: Tom Rini <trini@ti.com>
Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
2013-07-04 10:53:38 -04:00
Robert Winkler 59b1592211 video: lcd: Make splash_screen_prepare weak, remove config macro
Remove CONFIG_SPLASH_SCREEN_PREPARE from README
Add doc/README.splashprepare to document functionality

Signed-off-by: Robert Winkler <robert.winkler@boundarydevices.com>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
2013-07-01 21:47:16 +02:00
Robert Winkler dd4425e852 video: lcd: Add CONFIG_SPLASH_SCREEN_PREPARE support to CONFIG_VIDEO
Create splash.c/h to put the function and any future common splash
screen code in.

Signed-off-by: Robert Winkler <robert.winkler@boundarydevices.com>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
2013-07-01 21:45:22 +02:00
Piotr Wilczek f7ef9d610c lcd: align bmp header when uncopmressing image
When compressed image is loaded, it must be decompressed
to an aligned address + 2 to avoid unaligned access exception
on some ARM platforms.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Wolfgang Denk <wd@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-07-01 20:47:18 +02:00
Stephen Warren 5af7d0f090 lcd: remove unaligned access in lcd_dt_simplefb_configure_node()
Some ARM compilers may emit code that makes unaligned accesses when
faced with constructs such as:

const char format[] = "r5g6b5";

Make this data static since it doesn't chagne; the compiler will simply
place it into the .rodata section directly, and avoid any unaligned run-
time initialization.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
2013-07-01 20:11:33 +02:00
Tom Rini 5a34d9bf31 Merge branch 'master' of git://git.denx.de/u-boot-nand-flash 2013-07-01 10:11:56 -04:00
Simon Glass 5ff0d0832e bootm: Disable interrupts before loading OS
This restores the ordering of interrupt disable to what it what before
commit 35fc84fa. It seems that on some archiectures (e.g. PowerPC) the
OS is loaded into an interrupt region, which can cause problems if
interrupts are still running.

Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-28 16:26:50 -04:00
Tom Rini d366438d8a cmd_bootm.c: Correct BOOTM_ERR_OVERLAP handling
With 35fc84fa1 [Refactor the bootm command to reduce code duplication]
we stopped checking the return value of bootm_load_os (unintentionally!)
and simply returned if we had a non-zero return value from the function.
This broke the valid case of a legacy image file of a single kernel
loaded into an overlapping memory area (the default way of booting
nearly all TI platforms).

The best way to fix this problem in the new code is to make
bootm_load_os be the one to see if we have a problem with this, and if
it's fatal return BOOTM_ERR_RESET and if it's not BOOTM_ERR_OVERLAP, so
that we can avoid calling lmb_reserve() but continue with booting.  We
however still need to handle the other BOOTM_ERR values so re-work
do_bootm_states so that we have an error handler at the bottom we can
goto for problems from bootm_load_os, or problems from the other callers
(as the code was before).  Add a comment to do_bootm_states noting the
existing restriction on negative return values.

Signed-off-by: Tom Rini <trini@ti.com>

---
Changes in v2:
- Rework so that only bootm_load_os and boot_selected_os head down into
  the err case code, and other errors simply return back to the caller.
  Fixes 'spl export'.
2013-06-28 16:24:13 -04:00
Sascha Silbe ff8fef5666 Fix block device accesses beyond 2TiB
With CONFIG_SYS_64BIT_LBA, lbaint_t gets defined as a 64-bit type,
which is required to represent block numbers for storage devices that
exceed 2TiB (the block size usually is 512B), e.g. recent hard drives.

For some obscure reason, the current U-Boot code uses lbaint_t for the
number of blocks to read (a rather optimistic estimation of how RAM
sizes will evolve), but not for the starting address. Trying to access
blocks beyond the 2TiB boundary will simply wrap around and read a
block within the 0..2TiB range.

We now use lbaint_t for block start addresses, too. This required
changes to all block drivers as the signature of block_read(),
block_write() and block_erase() in block_dev_desc_t changed.

Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>
2013-06-26 10:26:06 -04:00
Steven Stallion eeaef5e430 cmd_bootm: Add command line arguments to Plan 9
This patch introduces support for command line arguments to Plan 9.
Plan 9 generally dedicates a small region of kernel memory (known
as CONFADDR) for runtime configuration.  A new environment variable
named confaddr was introduced to indicate this location when copying
arguments.

Signed-off-by: Steven Stallion <sstallion@gmail.com>
[trini: Adapt for Simon's changes about correcting argc, no need to bump
by 2 now]
Signed-off-by: Tom Rini <trini@ti.com>
2013-06-26 10:25:22 -04:00
Simon Glass 4d0985295b image: Add support for signing of FIT configurations
While signing images is useful, it does not provide complete protection
against several types of attack. For example, it it possible to create a
FIT with the same signed images, but with the configuration changed such
that a different one is selected (mix and match attack). It is also possible
to substitute a signed image from an older FIT version into a newer FIT
(roll-back attack).

Add support for signing of FIT configurations using the libfdt's region
support.

Please see doc/uImage.FIT/signature.txt for more information.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:18:56 -04:00
Simon Glass 19c402afa2 image: Add RSA support for image signing
RSA provides a public key encryption facility which is ideal for image
signing and verification.

Images are signed using a private key by mkimage. Then at run-time, the
images are verified using a private key.

This implementation uses openssl for the host part (mkimage). To avoid
bringing large libraries into the U-Boot binary, the RSA public key
is encoded using a simple numeric representation in the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:18:56 -04:00
Simon Glass 56518e7104 image: Support signing of images
Add support for signing images using a new signature node. The process
is handled by fdt_add_verification_data() which now takes parameters to
provide the keys and related information.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:18:56 -04:00
Simon Glass 3e569a6b1e image: Add signing infrastructure
Add a structure to describe an algorithm which can sign and (later) verify
images.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:18:56 -04:00
Simon Glass d0ae31eb07 Add a 'fake' go command to the bootm command
For tracing it is useful to run as much of U-Boot as possible so as to get
a complete picture. Quite a bit of work happens in bootm, and we don't want
to have to stop tracing before bootm starts.

Add a way of doing a 'fake' boot of the OS - which does everything up to
the point where U-Boot is about to jump to the OS image. This allows
tracing to record right until the end.

This requires arch support to work.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:18:56 -04:00
Simon Glass 35fc84fa1f Refactor the bootm command to reduce code duplication
At present the bootm code is mostly duplicated for the plain 'bootm'
command and its sub-command variant. This makes the code harder to
maintain and means that changes must be made to several places.

Introduce do_bootm_states() which performs selected portions of the bootm
work, so that both plain 'bootm' and 'bootm <sub_command>' can use the
same code.

Additional duplication exists in bootz, so tidy that up as well. This
is not intended to change behaviour, apart from minor fixes where the
previously-duplicated code missed some chunks of code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:18:56 -04:00
Simon Glass 983c72f479 Clarify bootm OS arguments
At present the arguments to bootm are processed in a somewhat confusing
way. Sub-functions must know how many arguments their calling functions
have processed, and the OS boot function must also have this information.
Also it isn't obvious that 'bootm' and 'bootm start' provide arguments in
the same way.

Adjust the code so that arguments are removed from the list before calling
a sub-function. This means that all functions can know that argv[0] is the
first argument of which they need to take notice.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:16:41 -04:00
Simon Glass 71c52dba2b Add trace support to generic board
Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:16:41 -04:00
Simon Glass cabcbb56c8 Add a trace command
Add a trace command with sub-commands to start/stop tracing, print out
statistics and dump trace information to memory for later upload to a host.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:16:41 -04:00
Simon Glass b8bcaa3ad3 Add function to print a number with grouped digits
Move bootstage's numbering printing code into a generic place so that it can
be used by tracing also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:16:41 -04:00
Simon Glass 5d3bd34545 bootstage: Correct printf types
The unstash code is a bit loose with its printf() types, which gives
warnings on sandbox. Correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:16:41 -04:00
Simon Glass 92765f4209 Fix missing return in do_mem_loop()
For some reason this does not normally cause a compiler warning, but the code
seems to be incorrect. Add the missing return.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-26 10:16:41 -04:00
Rob Herring 98f646764d pxe: add ipappend support
Add ipappend support to pass network device information to the kernel.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:10:14 -05:00
Joe Hershberger 58d9ff936f net: Fix build regression in cmd_pxe.c
Not all boards define an SOC.  As a result, we can't depend on that.

This was introduced in 39f985536d

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-06-24 19:10:03 -05:00
Rob Herring 39f985536d pxe: add support for per arch and SoC default paths
A pxelinux server setup for "default" menu is typically an x86 binary.
This does not work well with a mixed architecture setup. Extend the default
search to look for default-<arch>-<soc> and then default-<arch> before
falling back to just "default".

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:34 -05:00
Rob Herring 8577fec976 pxe: add support for ontimeout token
ontimeout is similar to default, but is the selection on menu timeout.
This is how cobbler sets a default. The label default is supposed to be
the default selection when <enter> is pressed. If both default and
ontimeout are set, last one parsed wins.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:34 -05:00
Rob Herring 32d2ffe731 pxe: simplify menu display and selection
Menus with lots of entries and long append lines are hard to read.
Just show a numbered list using the label or name and make the choice
by entering the number.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:34 -05:00
Rob Herring e82eeb5709 pxe: always display a menu when present
The prompt flag is for displaying a "boot:" prompt in pxelinux. This
doesn't make sense for u-boot as we don't support the pxelinux command
interface. So we should just ignore prompt statements and always show the
menu if a menu is present.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:34 -05:00
Rob Herring e6b6ccf203 pxe: try bootz if bootm fails to find a valid image
Standard pxelinux servers will typically use a zImage rather than u-boot
image format, so fallback to bootz if bootm fails.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:34 -05:00
Rob Herring da620222f8 bootz: un-staticize do_bootz
Make do_bootz available for other functions like do_bootm is.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:33 -05:00
Rob Herring 500f304b6b pxe: fix handling of different localboot values
Add support for value of -1 For localboot. A value of -1 means return to
u-boot prompt.

The localboot value is often 0, so we need to distinguish the value from
localboot being selected. A value of greater than or equal to 0 means
attempt local boot command.

If localboot is selected, we don't want to try other entries.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:33 -05:00
Rob Herring 23b7194e61 pxe: make string parameters const
Convert a bunch of string parameters to be const.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:33 -05:00
Rob Herring ef034c9d70 pxe: Use ethact setting for pxe
Get the MAC address using eth_getenv_enetaddr_by_index so that the MAC
address of ethact is used. This enables using the a NIC other than the
first one for PXE boot.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-06-24 19:07:32 -05:00
Tom Rini 348e47f766 Merge branch 'master' of git://git.denx.de/u-boot-arm 2013-06-22 07:38:12 -04:00
Scott Wood 9b80aa8ec9 nand: Don't call adjust_size_for_badblocks for erase
adjust_size_for_badblocks reduces the operation size to account
for the block skipping done by the read/write functions when an
interval (partition name or whole chip) is specified rather than a data
amount.

Erase does not do block skipping, except for erase.spread which takes
a data amount rather than an interval (and thus already does not call
adjust_size_for_badblocks).  Calling adjust_size_for_badblocks when
block skipping is not done means that if bad blocks are present,
the "nand erase.part" and "nand erase.chip" commands will fail to erase
blocks at the end of the interval.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Harvey Chapman <hchapman@3gfp.com>
Acked-by: Heiko Schocher <hs@denx.de>
2013-06-21 11:47:43 -05:00
Ying Zhang f90572d91b Makefile: move the common makefile line to public area
Move the common makefile line shared by the SPL and non-SPL to the public area,
so that we can avoid excessive SPL symbols. Some of them will be used by the
SPL later.

This patch is on top of the patch "common/Makefile: Add new symbol
CONFIG_SPL_ENV_SUPPORT for environment in SPL".

Signed-off-by: Ying Zhang <b40530@freescale.com>
Acked-by: Tom Rini <trini@ti.com>
Acked-by: Tom Rini <trini@ti.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
2013-06-20 17:08:51 -05:00
Ying Zhang ba1bee43ec common/Makefile: Add new symbol CONFIG_SPL_ENV_SUPPORT for environment in SPL
There will need the environment in SPL for reasons other than network
support (in particular, hwconfig contains info for how to set up DDR).

Add a new symbol CONFIG_SPL_ENV_SUPPORT to replace CONFIG_SPL_NET_SUPPORT
for environment in common/Makefile.

Signed-off-by: Ying Zhang <b40530@freescale.com>
Reviewed-by: Tom Rini <trini@ti.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
2013-06-20 17:08:51 -05:00
Albert ARIBAUD 69f14dc2fd Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
Conflicts:
	spl/Makefile
2013-06-19 12:53:59 +02:00
Simon Glass 2f99807125 image: Use ENOENT instead of ENOMEDIUM for better compatibility
This error may not be defined on some platforms such as MacOS so host
compilation will fail. Use one of the more common errors instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
Tested-by: Lubomir Popov <lpopov@mm-sol.com>
2013-06-17 09:56:42 -04:00
Tom Rini dfdb3d37dd Merge branch 'master' of git://www.denx.de/git/u-boot-mmc 2013-06-14 16:06:49 -04:00
Stephen Warren 5c088ee841 env_mmc: allow negative CONFIG_ENV_OFFSET
A negative value of CONFIG_ENV_OFFSET is treated as a backwards offset
from the end of the eMMC device/partition, rather than a forwards offset
from the start.

This is useful when a single board may be stuffed with different eMMC
devices, each of which has a different capacity, and you always want the
environment to be stored at the very end of the device (or eMMC boot
partition for example).

One example of this case is NVIDIA's Ventana reference board.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
2013-06-13 16:52:20 -05:00
Tom Rini f0df254663 Merge branch 'master' of git://git.denx.de/u-boot-spi 2013-06-13 15:18:35 -04:00
Amar 2a91c91346 COMMON: MMC: Command to support EMMC booting and to resize EMMC boot partition
This patch adds commands to access(open/close) and resize boot partitions on EMMC.

Signed-off-by: Amar <amarendra.xt@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2013-06-13 17:35:14 +09:00
Tom Rini b7ab8b8ff0 Merge branch 'master' of git://git.denx.de/u-boot-usb 2013-06-12 16:33:49 -04:00
Kuo-Jung Su e82a316d7f usb: ehci: add Faraday USB 2.0 EHCI support
This patch adds support to both Faraday FUSBH200 and FOTG210,
the differences between Faraday EHCI and standard EHCI are
listed bellow:

1. The PORTSC starts at 0x30 instead of 0x44.
2. The CONFIGFLAG(0x40) is not only un-implemented, and
   also has its address space removed.
3. Faraday EHCI is a TDI design, but it doesn't
   compatible with the general TDI implementation
   found at both U-Boot and Linux.
4. The ISOC descriptors differ from standard EHCI in
   several ways. But since U-boot doesn't support ISOC,
   we don't have to worry about that.

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
CC: Marek Vasut <marex@denx.de>
2013-06-12 22:22:51 +02:00
Kuo-Jung Su aa1550588c usb: hub: make minimum power-on delay configurable
This patch makes the minimum power-on delay for USB HUB
become configurable. The original design waits at least
100 msec here, but some EHCI controlers(e.g. Faraday EHCI)
are known to require much longer delay interval.

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
CC: Marek Vasut <marex@denx.de>
2013-06-12 22:22:51 +02:00
Vincent Palatin 5da2dc9789 usb: workaround non-working keyboards.
If the USB keyboard is not answering properly the first request on its
interrupt endpoint, just skip it and try the next one.

This workarounds an issue with a wireless mouse dongle which presents
itself both as a keyboard and a mouse but has a non-functional keyboard
interface.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 012bbf0ce0301be2482857e3f03b481dd15c2340)
Rebased to upstream/master:
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-06-12 22:22:50 +02:00
Vincent Palatin 09defbc75b usb: properly re-initialize the USB keyboard.
Allow to reconfigure properly the USB keyboard driver when we enumerate
several times the USB devices and its position in the device tree has
changes.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-06-12 22:22:50 +02:00
Scott Wood a166fbca20 powerpc: fix 8xx and 82xx type-punning warnings with GCC 4.7
C99's strict aliasing rules are insane to use in low-level code such as a
bootloader, but as Wolfgang has rejected -fno-strict-aliasing in the
past, add a union so that 16-bit accesses can be performed.

Compile-tested only.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Wolfgang Denk <wd@denx.de>
2013-06-11 22:01:45 +02:00
Stephen Warren 064d55f8bc fdt: remove unaligned access in fdt_fixup_ethernet()
Some ARM compilers may emit code that makes unaligned accesses when
faced with constructs such as:

char mac[16] = "ethaddr";

Replace this with a strcpy() call instead to avoid this. strcpy() is
used here, rather than replacing all usage of the mac variable with the
string itself, since the loop itself sprintf()s to the variable each
iteration, so strcpy() is doing basically the same thing.

Reported-by: Florian Meier
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
2013-06-07 14:17:01 -04:00
Masahiro Yamada a0ba279ac6 generic_board: reduce the redundancy of gd_t struct members
This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

  /* TODO: is this the same as relocaddr, or something else? */
  unsigned long dest_addr;        /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
2013-06-07 14:17:01 -04:00
Peter Korsgaard 2b75b0ad3a spl_mmc: add Falcon mode support for raw variant
If Falcon mode support is enabled (and the system isn't directed into
booting u-boot), it will instead try to load kernel from sector
CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR and
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS of kernel argument parameters
starting from sector CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
2013-06-07 14:17:00 -04:00
Peter Korsgaard 721931f805 spl_mmc: mmc_load_image_raw(): Add sector argument
So we can use it for falcon mode as well.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
2013-06-07 14:17:00 -04:00
Peter Korsgaard 7ad2cc7964 spl_mmc: add Falcon mode support for FAT variant
If Falcon mode support is enabled (and the system isn't directed into
booting u-boot), it will instead try to load kernel from
CONFIG_SPL_FAT_LOAD_KERNEL_NAME file and kernel argument parameters from
CONFIG_SPL_FAT_LOAD_ARGS_NAME, both from the same partition as u-boot.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
2013-06-07 14:17:00 -04:00
Peter Korsgaard 2fabd0bcaa spl_mmc: mmc_load_image_fat(): Add filename argument and move fat init out
So we can use it for falcon mode as well.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
2013-06-07 08:37:48 -04:00
Peter Korsgaard 79adb7a2b5 spl_mmc: return error from mmc_load_image_{raw, fat} rather than hanging
So we can instead fallback to doing something else on errors.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
2013-06-07 08:37:48 -04:00
Tom Rini 47b8e52744 Merge branch 'master' of git://git.denx.de/u-boot-video 2013-06-07 08:35:36 -04:00
Stephen Warren 6a195d2d8a lcd: add functions to set up simplefb device tree
simple-framebuffer is a new device tree binding that describes a pre-
configured frame-buffer memory region and its format. The Linux kernel
contains a driver that supports this binding. Implement functions to
create a DT node (or fill in an existing node) with parameters that
describe the framebuffer format that U-Boot is using.

This will be immediately used by the Raspberry Pi board in U-Boot, and
likely will be used by the Samsung ARM ChromeBook support soon too. It
could well be used by many other boards (e.g. Tegra boards with built-in
LCD panels, which aren't yet supported by the Linux kernel).

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Simon Glass <sjg@chromium.org>
2013-06-05 22:40:03 +02:00
Stephen Warren 99bd544ee7 fdt: allow bootdelay to be specified via device tree
This can be useful to force bootcmd to execute as soon as U-Boot has
started.

My use-case is: An SoC-specific tool pushes U-Boot into RAM, along with
an image to be written to device boot flash, with the DT config property
"bootcmd" set to contain a command to write that image to flash. In this
scenario, we don't want to allow any stale bootdelay value taken from
the current flash content to affect how long it takes before the
flashing process starts.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2013-06-04 16:06:32 -04:00
Masahiro Yamada b8521b740b common: board_f: Do not call board_postclk_init twice
The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-06-04 16:06:32 -04:00
Simon Glass c6ac13bdea sandbox: image: Adjust FIT image printing to work with sandbox
Use map_sysmem() to convert from address to pointer, so that sandbox can
print FIT information without crashing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass 4651800d51 image: Use fit_image_load() to load kernel
Use the new common code to load a kernel. The functionality should not
change.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass aed161e5fe sandbox: Adjust bootm command to work with sandbox
Use map_sysmem() when converting from addresses to pointers, so that
bootm can be used with sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass 53f375fa81 image: Use fit_image_load() to load FDT
Use the new common code to load a flat device tree. Also fix up a few casts
so that this code works with sandbox. Other than that the functionality
should not change.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass a51ec63b85 image: Use fit_image_load() to load ramdisk
Use the new common code to load a ramdisk. The functionality should not
change.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass 782cfbb259 image: Introduce fit_image_load() to load images from FITs
At present code to load an image from a FIT is duplicated in the three
places where it is needed (kernel, fdt, ramdisk).

The differences between these different code copies is fairly minor.
Create a new function in the fit code which can handle any of the
requirements of those cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass d34d186ef9 main: Add debug_bootkeys to avoid #ifdefs
Define a simple debug condition at the top of the file, to avoid using
lots of #ifdefs later on.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2013-06-04 16:06:31 -04:00
Simon Glass 3e4088737b main: Add debug_parser() to avoid #ifdefs
Define a simple debug condition at the top of the file, to avoid using
lots of #ifdefs later on.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2013-06-04 16:06:31 -04:00
Simon Glass fbcdf32af7 main: Correct header order
The headers are a bit out of order, so fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass 4933381a5b main: Fix typos and checkpatch warnings in command line reading
There are a few over-long lines and other checkpatch problems in this area
of the code. Prepare the ground for the next patch by tidying these up.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2013-06-04 16:06:31 -04:00
Simon Glass f2abca8459 main: Use get/setenv_ulong()
These functions are now available, so use them to avoid extra code here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2013-06-04 16:06:31 -04:00
Simon Glass bc2b4c27d0 main: Move boot_delay code into its own function
Move this code into its own function, since it clutters up main_loop().

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass 063ae006ae main: Separate out the two abortboot() functions
There are two implementations of abortboot(). Turn these into two separate
functions, and create a single abortboot() which calls either one or the
other.

Also it seems that nothing uses abortboot() outside main, so make it static.

At this point there is no further use of CONFIG_MENU in main.c.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2013-06-04 16:06:31 -04:00
Simon Glass ea5427e260 net: Add prototype for update_tftp
This function should be declared in net.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2013-06-04 16:06:31 -04:00
Jagannadha Sutradharudu Teki 60b6614ac8 cmd_sf: Add print mesgs on sf read/write commands
This patch adds a print messages while using 'sf read' and
'sf write' commands to make sure that how many bytes read/written
from/into flash device.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Acked-by: Tom Rini <trini@ti.com>
2013-06-03 00:04:41 +05:30
Jagannadha Sutradharudu Teki 96bbf55651 cmd_sf: Add print mesg for 'sf erase' command
This patch adds a print messages while using 'sf erase' command
to make sure that how many bytes erased in flash device.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Acked-by: Tom Rini <trini@ti.com>
2013-06-03 00:04:40 +05:30
Tom Rini d6639d10db Merge branch 'master' of git://git.denx.de/u-boot-nand-flash 2013-05-31 18:28:47 -04:00
Sergey Lapin dfe64e2c89 mtd: resync with Linux-3.7.1
This patch is essentially an update of u-boot MTD subsystem to
the state of Linux-3.7.1 with exclusion of some bits:

- the update is concentrated on NAND, no onenand or CFI/NOR/SPI
flashes interfaces are updated EXCEPT for API changes.

- new large NAND chips support is there, though some updates
have got in Linux-3.8.-rc1, (which will follow on top of this patch).

To produce this update I used tag v3.7.1 of linux-stable repository.

The update was made using application of relevant patches,
with changes relevant to U-Boot-only stuff sticked together
to keep bisectability. Then all changes were grouped together
to this patch.

Signed-off-by: Sergey Lapin <slapin@ossfans.org>
[scottwood@freescale.com: some eccstrength and build fixes]
Signed-off-by: Scott Wood <scottwood@freescale.com>
2013-05-31 17:12:03 -05:00
Albert ARIBAUD a19b0dd62d Merge branch 'u-boot/master' into 'u-boot-arm/master'
Conflicts:
	common/cmd_fpga.c
	drivers/usb/host/ohci-at91.c
2013-05-30 14:45:06 +02:00
York Sun e79394643b common: Update cmd_bdinfo for PPC
Add board detail function to print more individual board information.

Signed-off-by: York Sun <yorksun@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
2013-05-24 16:54:09 -05:00
Masahiro Yamada 53237afe5b cmd_mem: fix cp command
The "cp" command has not worked since
commit 0628ab8ec5,
because of the following lines, which set the destination
and the source to the same address.

	buf = map_sysmem(addr, bytes);
	src = map_sysmem(addr, bytes);

Tested-by: Tom Rini <trini@ti.com>
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-05-24 10:38:08 -04:00
Harvey Chapman e834402fa0 nand: adjust erase/read/write partition/chip size for bad blocks
Adjust the sizes calculated for whole partition/chip operations by
removing the size of bad blocks so we don't try to erase/read/write
past a partition/chip boundary.

Signed-off-by: Harvey Chapman <hchapman@3gfp.com>
2013-05-22 16:41:46 -05:00
Doug Anderson 5e5745465c fdt_support: Use CONFIG_NR_DRAM_BANKS if defined
It appears that there are some cases where we have more than 4 banks
of memory.  Use CONFIG_NR_DRAM_BANKS if it's defined to handle this.
This will take up a little extra stack space (64 bytes extra if we go
up to 8 banks), but that seems OK.

Signed-off-by: Doug Anderson <dianders@chromium.org>
2013-05-17 14:43:29 -04:00
Doug Anderson a558ad7113 bootm: Avoid 256-byte overflow in fixup_silent_linux()
This makes fixup_silent_linux() use malloc() to allocate its
working space, meaning that our maximum kernel command line
should only be limited by malloc().  Previously it was silently
overflowing the stack.

Note that nothing about this change increases the kernel's maximum
command line length.  If you have a command line that is >256
bytes it's up to you to make sure that kernel can handle it.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2013-05-17 14:43:29 -04:00
Wolfgang Denk d6ed322222 Power: remove support for Freescale MPC8220
The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>
2013-05-15 08:41:03 -04:00
Ying Zhang ade8a1a6d3 drivers/mmc: move spl_mmc.c to common/spl
The mpc85xx repuires a special layout on the memory device that is
connected to the eSDHC controller interface. But the file spl_mmc.c
didn't handle this specfic case, there needs a special treatmen, in
the powerpc drictory. So, there is no longer to keep spl_mmc.c on
mpc85xx, CONFIG_SPL_FRAMEWORK is not set.

When CONFIG_SPL_MMC_SUPPORT is set and CONFIG_SPL_FRAMEWORK is not
set, there was an error in drivers/mmc/spl_mmc.c:

drivers/mmc/libmmc.o:(.got2+0x8): undefined reference to `spl_image'.

Now, the solution is to move the file "spl_mmc.c" to directory "common/spl".

Signed-off-by: Ying Zhang <b40530@freescale.com>
2013-05-15 08:41:03 -04:00
Simon Glass c19d13b030 arm: Refactor bootm to reduce #ifdefs
With fewer #ifdefs the code is more readable and more of the code is
compiled for all boards. Add defines in the header file to control
what features are enabled, and then use if() instead of #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-14 15:37:25 -04:00
Simon Glass 13d06981a9 image: Add device tree setup to image library
This seems to be a common function for several architectures, so create
a common function rather than duplicating the code in each arch.

Also make an attempt to avoid introducing #ifdefs in the new code, partly
by removing useless #ifdefs around function declarations in the image.h
header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-14 15:37:25 -04:00
Simon Glass 44d3a3066b image: Split libfdt code into image-fdt.c
The image file is still very large, and some of the code is only used when
libfdt is in use. Move this code into a new file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-14 15:37:25 -04:00
Simon Glass 87ebee39e9 image: Add CONFIG_FIT_SPL_PRINT to control FIT image printing in SPL
This code is very large, and in SPL it isn't always useful to print
out image information (in fact there might not even be a console
active). So disable this feature unless this option is set.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-14 15:37:25 -04:00
Simon Glass 1fe7d93891 image: Remove remaining #ifdefs in image-fit.c
There are only two left. One is unnecessary and the other can be moved
to the header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-14 15:37:25 -04:00
Simon Glass 35e7b0f179 sandbox: image: Add support for booting images in sandbox
Much of the image code uses addresses as ulongs and pointers interchangeably,
casting between the two forms as needed.

This doesn't work with sandbox, which has a U-Boot RAM buffer which is
separate from the host machine's memory.

Adjust the cost so that translating from a U-Boot address to a pointer uses
map_sysmem(). This allows bootm to work correctly on sandbox.

Note that there are no exhaustive tests for this code on sandbox, so it is
possible that some dark corners remain.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de> (v1)
2013-05-14 15:37:25 -04:00
Simon Glass d8b75360ee image: Rename hash printing to fit_image_print_verification_data()
This function will be used to print signatures as well as hashes, so rename
it. Also make it static since it is not used outside this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2013-05-14 15:37:25 -04:00
Simon Glass 003efd7da4 image: Export fit_conf_get_prop_node()
This function will be needed by signature checking code, so export it,
and also add docs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-14 15:37:25 -04:00
Simon Glass e754da2aee image: Move error! string to common place
The string " error\n" appears in each error string. Move it out to a
common place.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2013-05-14 15:37:25 -04:00
Simon Glass ab9efc665a image: Move hash checking into its own function
The existing function is long and most of the code is indented a long
way. Before adding yet more code, split this out into its own function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de> (v1)
2013-05-14 15:37:25 -04:00
Simon Glass b8da836650 image: Rename fit_image_check_hashes() to fit_image_verify()
This is the main entry point to the FIT image verification code. We will
be using it to handle image verification with signatures, so rename the
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2013-05-14 15:37:25 -04:00
Simon Glass 604f23dde0 image: Move HOSTCC image code to tools/
This code is never compiled into U-Boot, so move it into a separate
file in tools/ to avoid the large #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2013-05-14 15:37:25 -04:00
Simon Glass 53fbb7e885 image: Split FIT code into new image-fit.c
The FIT code is about half the size of the >3000-line image.c. Split this
code into its own file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2013-05-14 15:37:25 -04:00
Simon Glass 61a439a873 image: Export fit_check_ramdisk()
One we split out the FIT code from image.c we will need this function.
Export it in the header.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
2013-05-14 15:37:25 -04:00
Simon Glass 859e92b775 image: Move timestamp #ifdefs to header file
Rather than repeat the line
 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || \
	defined(USE_HOSTCC)

everywhere, put this in a header file and #define IMAGE_ENABLE_TIMESTAMP
to either 1 or 0. Then we can use a plain if() in most code and avoid
the #ifdefs.

The compiler's dead code elimination ensures that the result is the same.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
2013-05-14 15:37:25 -04:00
Simon Glass 6f907b422e hash: Add a way to calculate a hash for any algortihm
Rather than needing to call one of many hashing algorithms in U-Boot,
provide a function hash_block() which handles this, and can support all
available hash algorithms.

Once we have md5 supported within hashing, we can use this function in
the FIT image code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-14 15:37:24 -04:00
Simon Glass 9602286d3d env: Fix minor comment typos in cmd_nvedit
This should say 'environmnent'.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-14 15:37:24 -04:00
Tom Rini 805fa87f6d Merge branch 'master' of git://git.denx.de/u-boot-blackfin into powerpc-eldk53-warning-fixes 2013-05-14 11:45:41 -04:00
Simon Glass a92181b399 x86: Fix warning in cmd_ximg.c when CONFIG_GZIP is not defined
This local variable is not used unless CONFIG_GZIP is defined. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-13 13:33:22 -07:00
Simon Glass fb7db41cd4 bootstage: Allow marking a particular line of code
Add a function which allows a (file, function, line number) to be marked
in bootstage.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2013-05-13 13:33:22 -07:00
Doug Anderson 158e7d059c Call bootstage_relocate() after malloc is initted
In a previous CL we added the bootstage_relocate(), which should be
called after malloc is initted.  Now we call it on generic board.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-05-13 13:33:21 -07:00
Doug Anderson 150678a582 bootstage: Copy bootstage strings post-relocation
Any pointers to name strings that were passed to bootstage_mark_name()
pre-relocation should be copied post-relocation so that they don't get
trashed as the original location of U-Boot is re-used for other
purposes.

This change introduces a new API call that should be called from
board_init_r() after malloc has been initted on any board that uses
bootstage.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-05-13 13:33:21 -07:00
Bob Liu 7d861d95a3 blackfin: bf609: add softswitch config command
Add softswitch_output command for bf609-ezkit to enable softswitches.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
2013-05-13 16:26:12 +08:00
Albert ARIBAUD cac423a730 Merge branch 'u-boot-ti/master' into 'u-boot-arm/master' 2013-05-11 22:24:28 +02:00
Albert ARIBAUD ec7023db8d Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
Conflicts:
	drivers/mtd/nand/mxc_nand_spl.c
	include/configs/m28evk.h
2013-05-11 09:25:36 +02:00
Albert ARIBAUD e825b100d2 Merge branch 'u-boot-pxa/master' into 'u-boot-arm/master' 2013-05-11 00:06:03 +02:00
SRICHARAN R 4a0eb75752 ARM: OMAP: Cleanup boot parameters usage
The boot parameters are read from individual variables
assigned for each of them. This been corrected and now
they are stored as a part of the global data 'gd'
structure. So read them from 'gd' instead.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
[trini: Add igep0033 hunk]
Signed-off-by: Tom Rini <trini@ti.com>
2013-05-10 08:25:56 -04:00
Michal Simek 5bd0bd7cef cmd: fpga: Do not include net.h
There is no reason to include net.h header in fpga code.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@ti.com>
2013-05-06 10:41:21 +02:00
Michal Simek 52c2064476 cmd: fpga: Move fpga_loadbitstream to fpga.c
In bitstream decoding you can directly check device
which you want to load and in fpga.c are fpga_validate
and fpga_dev_info functions which should be used for it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@ti.com>
2013-05-06 10:41:19 +02:00
Michal Simek fc598412ce cmd: fpga: Clean coding style
No functional changes.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@ti.com>
2013-05-06 10:41:18 +02:00
Vivek Gautam 55f4b57542 usb: fix: Fixing Port status and feature number constants
Fix the Port status bit constants and Port feature number
constants as a part of USB 2.0 and USB 3.0 Hub class.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
2013-05-06 02:16:36 +02:00
Vivek Gautam 0bf796f7ae usb: hub: Parallelize power-cycling of root-hub ports
Untill now we power-cycle (aka: disable power on a port
and re-enabling again) one port at a time.
Delay of 20ms for Port-power to change multiplies with
number of ports in this case.
So better we parallelize this process:
disable power on all ports, wait for port-power to stabilize
and then re-enable the power subsequently.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
2013-05-06 02:16:36 +02:00
Vivek Gautam 6497c66704 USB: SS: Add support for Super Speed USB interface
This adds usb framework support for super-speed usb, which will
further facilitate to add stack support for xHCI.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
2013-05-05 23:54:22 +02:00
Vivek Gautam 289f3cb28a usb: hub: Fix enumration timeout
Patch b6d7852c increases timeout for enumeration, taking
worst case to be 10 sec.
get_timer() api returns timestamp in milliseconds, which is
what we are checking in the do-while() loop in usb_hub_configure()
(get_timer(start) < CONFIG_SYS_HZ * 10).
This should give us a required check for 10 seconds, and thereby
we don't need to add additional mdelay of 100 microseconds in
each cycle.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Reviewed-by: Vipin Kumar <vipin.kumar@st.com>
2013-05-05 23:54:22 +02:00
Vivek Gautam 99c3491b78 usb: Update device class in usb device's descriptor
Fetch the device class into usb device's dwcriptors,
so that the host controller's driver can use this info
to differentiate between HUB and DEVICE.

Signed-off-by: Amar <amarendra.xt@samsung.com>
2013-05-05 23:54:22 +02:00
Vivek Gautam 020bbcb76b usb: hub: Power-cycle on root-hub ports
XHCI ports are powered on after a H/W reset, however
EHCI ports are not. So disabling and re-enabling power
on all ports invariably.

Signed-off-by: Amar <amarendra.xt@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
2013-05-05 23:54:22 +02:00
Vivek Gautam 605bd75af5 USB: Some cleanup prior to USB 3.0 interface addition
Some cleanup in usb framework, nothing much on feature side.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
2013-05-05 23:54:22 +02:00
Vivek Gautam ceb4972a8f usb: common: Weed out USB_**_PRINTFs from usb framework
USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF
are nothing but conditional debug prints, depending on DEBUG.
So better remove them and use debug() simply.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
2013-05-05 23:54:21 +02:00
Julius Werner 7d9aa8fd87 usb: Add new command to set USB 2.0 port test modes
This patch adds a new 'usb test' command, that will set a port to a USB
2.0 test mode (see USB 2.0 spec 7.1.20). It supports all five test modes
on both downstream hub ports and ordinary device's upstream ports. In
addition, it supports EHCI root hub ports.

Signed-off-by: Julius Werner <jwerner@chromium.org>
2013-05-05 23:54:21 +02:00
Michael Heimpold d196bd8803 env_mmc: add support for redundant environment
This patch add support for storing the environment redundant on
mmc devices. Substantially it re-uses the logic from the NAND implementation,
that means using an incremental counter for marking newer data.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
2013-05-01 16:41:10 -04:00
Andreas Bießmann d2eae43ba8 lib: consolidate hang()
Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>
2013-05-01 16:41:08 -04:00
Egbert Eich 0472fbfd32 part/dev_desc: Add log2 of blocksize to block_dev_desc data struct
log2 of the device block size serves as the shift value used to calculate
the block number to read in file systems when implementing avaiable block
sizes.
It is needed quite often in file systems thus it is pre-calculated and
stored in the block device descriptor.

Signed-off-by: Egbert Eich <eich@suse.com>
2013-05-01 16:24:02 -04:00
Wolfgang Denk 855f18ea0e setexpr: add regex substring matching and substitution
Add "setexpr name gsub r s [t]" and "setexpr name sub r s [t]"
commands which implement substring matching for the regular
expression <r> in the string <t>, and substitution of the string <s>.
The result is assigned to the environment variable <name>.  If <t> is
not supplied, the previous value of <name> is used instead.  "gsub"
performs global substitution, while "sub" will replace only the first
substring.

Both commands are closely modeled after the gawk functions with the
same names.

Examples:

- Generate broadcast address by substituting the last two numbers of
  the IP address by "255.255":

  	=> print ipaddr
	ipaddr=192.168.1.104
	=> setexpr broadcast sub "(.*\\.).*\\..*" "\\1255.255" $ipaddr
	broadcast=192.168.255.255

- Depending on keyboard configuration (German vs. US keyboard) a
  barcode scanner may initialize the MAC address as C0:E5:4E:02:06:DC
  or as C0>E5>4E>02>06>DC.  Make sure we always have a correct value:

	=> print ethaddr
	ethaddr=C0>E5>4E>02>06>DC
	=> setexpr ethaddr gsub > :
	ethaddr=C0:E5:4E:02:06:DC

- Do the same, but substitute one step at a time in a loop until no
  futher matches:

	=> setenv ethaddr C0>E5>4E>02>06>DC
	=> while setexpr ethaddr sub > :
	> do
	> echo -----
	> done
	ethaddr=C0:E5>4E>02>06>DC
	-----
	ethaddr=C0:E5:4E>02>06>DC
	-----
	ethaddr=C0:E5:4E:02>06>DC
	-----
	ethaddr=C0:E5:4E:02:06>DC
	-----
	ethaddr=C0:E5:4E:02:06:DC
	-----
	C0:E5:4E:02:06:DC: No match
	=> print ethaddr
	ethaddr=C0:E5:4E:02:06:DC

etc.

To enable this feature, the CONFIG_REGEX option has to be defined in
the board config file.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-05-01 16:24:01 -04:00
Wolfgang Denk 103c94b104 setexpr: simplify code, improve help message
Simplify the argument checking for the "setexpr" command.  This is
done mainly to make future extensions easier.

Also improve the help message for the one argument version of the
command - this does not "load an address", but a value, which in
this context may be a plain number or a pointer dereference.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-05-01 16:24:01 -04:00
Wolfgang Denk be29df6a1a "env grep" - add support for regular expression matches
When CONFIG_REGEX is enabled, the new option "-e" becomes available
which causes regular expression matches to be used.  This allows for
example things like these:

- print all MAC addresses:

	=> env grep -e eth.*addr
	eth1addr=00:10:ec:80:c5:15
	ethaddr=00:10:ec:00:c5:15

- print all variables that have at least 2 colons in their value:

	=> env grep -v -e :.*:
	addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off
	panic=1
	eth1addr=00:10:ec:80:c5:15
	ethaddr=00:10:ec:00:c5:15
	ver=U-Boot 2013.04-rc1-00289-g497746b-dirty (Mar 22 2013 - 12:50:25)

etc.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-05-01 16:24:00 -04:00
Wolfgang Denk d87244d5af "env grep" - add options to grep in name, value, or both.
Add options to "env grep" command:

-n : search only the envrironment variable names
-v : search only their values
-b : search both names and values (= default)

An option "--" will stop parsing options, so to print variables that
contain the striing "- " please use:

	env grep -- "- "

Or to print all environment varioables which have a '-' in their name,
use:

	env grep -n -- -

Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-05-01 16:24:00 -04:00
Wolfgang Denk 5a31ea04c9 "env grep" - reimplement command using hexport_r()
Also drop hstrstr_r() which is not needed any more.
The new code is way more flexible.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-05-01 16:24:00 -04:00
Wolfgang Denk ea009d4743 hashtable: preparations to use hexport_r() for "env grep"
The output of "env grep" is unsorted, and printing is done by a
private implementation to parse the hash table.  We have all the
needed code in place in hexport_r() alsready, so let's use this
instead.  Here we prepare the code for this, without any functional
changes yet.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-05-01 16:24:00 -04:00
Simon Glass 7eb2c8d573 sandbox: fs: Add support for saving files to host filesystem
This allows write of files from the host filesystem in sandbox. There is
currently no concept of overwriting the file and removing its existing
contents - all writing is done on top of what is there. This means that
writing 10 bytes to the start of a 1KB file will only update those 10
bytes, not truncate the file to 10 byte slong.

If the file does not exist it is created.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01 11:17:21 -04:00
Simon Glass 4ca30d6024 sandbox: Support 'source' command
Enhance the source command to work with sandbox, by using map_sysmem() to
convert a ulong address into a pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01 11:17:21 -04:00
Simon Glass 095686d3f5 Revert "fdt- Tell the FDT library where the device tree is"
This reverts commit 3b73459ea3.

In practice it doesn't seem like a good idea to make the the working
FDT point to the control FDT. Now that we can access the control FDT
using the 'fdt' command, there is no need for this feature. Remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01 11:17:21 -04:00
Simon Glass a92fd6577e sandbox: fdt: Support fdt command for sandbox
By using map_sysmem() we can get the fdt command to work correctly with
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01 11:17:21 -04:00
Simon Glass 4b5786550d fdt: Allow fdt command to check and update control FDT
There is an existing fdt command to deal with the working FDT. Enhance this
to support the control FDT also (CONFIG_OF_CONTROL).

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01 11:17:21 -04:00
Simon Glass 76b8f79c29 Add getenv_hex() to return an environment variable as hex
This conversion is required in a number of places in U-Boot. Add a
standard function to provide this feature, so we avoid all the different
variations in the way it is coded.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01 11:17:21 -04:00
Simon Glass d14da91307 fdt: Add a parameter to fdt_valid()
At present this only checks working_fdt, but we want to check other FDTs
also. So add the FDT to check as a parameter to fdt_valid().

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01 11:17:21 -04:00
Simon Glass f828bf25fe sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file
With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-05-01 11:17:21 -04:00
Simon Glass a733b06b69 sandbox: Switch over to generic board
Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
2013-05-01 11:17:21 -04:00
Benoît Thébaudeau ccca7dfd02 Add fuse API and commands
This can be useful for fuse-like hardware, OTP SoC options, etc.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-04-28 11:07:40 +02:00
Stefan Roese 352ef3f1b6 flash: Add optional verify-after-write feature
Sometimes it might make sense to verify the written data to NOR flash.
This patch adds this feature. To enable this verify-after-write, you
need to define CONFIG_FLASH_VERIFY in your board config header.

Please note that this option is useless in nearly all cases,
since such flash programming errors usually are detected earlier
while unprotecting/erasing/programming. Please only enable
this option if you really know what you are doing.

Signed-off-by: Stefan Roese <sr@denx.de>
2013-04-22 10:56:38 +02:00
Jaehoon Chung 64f4a6192f mmc: support the correct card version for eMMC
eMMC vesrion is supported up to v4.5.
But bootloader isn't saw the exact eMMC version.
After applied this patch,
if use the mmcinfo command, then can see the exactly mmc version.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Rommel Custodio <sessyargc@gmail.com>
2013-04-17 10:58:51 -04:00
Maxime Larocque 22a4a6c5c2 printenv: Correct out-of-memory condition check.
In common/cmd_nvedit.c, en env_print(), the wrong type is used for len.
hexport_r() returns -1 on error (like OOM), which is converted to
0xffffffff when put in an unsigned. Said value is obviously bigger then
0, and as a result an uninitialized string is then displayed. Other
usages of hexport_r() in the code correctly uses ssize_t to keep its
return value.

Signed-off-by: Maxime Larocque <maxmtl2002@yahoo.ca>
2013-04-17 10:58:14 -04:00
Simon Glass 7525c2dac7 x86: Allow setup code to manage its own global data
Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-04-15 16:26:41 -07:00
Simon Glass 8b42dfc3b6 x86: Fix DRAM bank size init with generic board
The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-04-15 16:26:09 -07:00
Tom Rini 17059f972f Merge branch 'master' of git://git.denx.de/u-boot-arm 2013-04-15 07:46:11 -04:00
Che-liang Chiou 8732b0700d tpm: Add TPM command library
TPM command library implements a subset of TPM commands defined in TCG
Main Specification 1.2 that are useful for implementing secure boot.
More TPM commands could be added out of necessity.

You may exercise these commands through the 'tpm' command.  However, the
raw TPM commands are too primitive for writing secure boot in command
interpreter scripts; so the 'tpm' command also provides helper functions
to make scripting easier.

For example, to define a counter in TPM non-volatile storage and
initialize it to zero:

$ tpm init
$ tpm startup TPM_ST_CLEAR
$ tpm nv_define d 0x1001 0x1
$ tpm nv_write d 0x1001 0

And then increment the counter by one:

$ tpm nv_read d 0x1001 i
$ setexpr.l i $i + 1
$ tpm nv_write d 0x1001 $i

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
2013-04-12 14:13:13 -07:00
Albert ARIBAUD 1812201997 Merge branch 'u-boot/master' into 'u-boot-arm/master'
Conflicts:
	drivers/video/exynos_fb.c
2013-04-12 22:07:57 +02:00
Joe Hershberger 785881f775 env: Add redundant env support to UBI env
Allow the user to specify two UBI volumes to use for the environment

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-04-11 15:52:55 -04:00
Joe Hershberger 2b74433f36 env: Add support for UBI environment
UBI is a better place for the environment on NAND devices because it
handles wear-leveling and bad blocks.

Gluebi is needed in Linux to access the env as an MTD partition.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-04-11 15:52:55 -04:00
Joe Hershberger a7eb1d66c7 mtd: Make mtdparts work with pre-reloc env
The env in UBI needs to look up the mtd partition as part of relocation,
which happens before relocation.  Make the mtdparts code capable of
working on the default env to start with.

The code tries to set values in the env as well, but again, the env
isn't there yet, so add a check to setenv to not allow sets before the
env is relocated.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-04-11 15:52:54 -04:00
Joe Hershberger 147162dac6 ubi: ubifs: Turn off verbose prints
The prints are out of control.  SILENCE!

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-04-11 15:52:54 -04:00
Joe Hershberger 7182906750 ubi: Expose a few simple functions from the cmd_ubi
Part, Read, and Write functionality that will be used by env_ubi.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2013-04-11 15:52:54 -04:00
Vadim Bendebury 3d38910151 Do not call board_early_init_f() twice
Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
   . built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
2013-04-11 15:40:23 -04:00
Tom Rini c4df2f4100 cmd_nand.c: Fix CONFIG_CMD_NAND_YAFFS
The flag changed from WITH_INLINE_OOB to WITH_YAFFS_OOB by accident in
418396e.

Signed-off-by: Tom Rini <trini@ti.com>
2013-04-10 15:22:24 +02:00
Tom Rini c39d6a0ea5 nand: Extend nand_(read|write)_skip_bad with *actual and limit parameters
We make these two functions take a size_t pointer to how much space
was used on NAND to read or write the buffer (when reads/writes happen)
so that bad blocks can be accounted for.  We also make them take an
loff_t limit on how much data can be read or written.  This means that
we can now catch the case of when writing to a partition would exceed
the partition size due to bad blocks.  To do this we also need to make
check_skip_len count not just complete blocks used but partial ones as
well.  All callers of nand_(read|write)_skip_bad are adjusted to call
these with the most sensible limits available.

The changes were started by Pantelis and finished by Tom.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Signed-off-by: Tom Rini <trini@ti.com>
2013-04-10 15:22:22 +02:00
Mingkai Hu 381c6e2c90 cmd_sf: include header file common.h before div64.h
The header file div64.h includes <asm/types.h> which defines
the phys_addr_t according to the macro CONFIG_PHYS_64BIT, while
the macro CONFIG_PHYS_64BIT is included in common.h which comes
after div64.h, so in order to get consistent type definition for
phys_addr_t, common.h should be included before div64.h, Or else,
the parameters of phys_addr_t type will be passed wrongly when
CONFIG_PHYS_64BIT is defined.

Signed-off-by: Mingkai Hu <Mingkai.Hu@freescale.com>
2013-04-08 12:00:51 -04:00
York Sun a6142706f5 common/cmd_test: Avoid macro expansion
cmd_test.c adds "true" and "false" as new commands. We need to avoid macro
expansion for U_BOOT_CMD.

Signed-off-by: York Sun <yorksun@freescale.com>
2013-04-08 12:00:51 -04:00
Tom Rini cd0f4fa1ca Revert "env: fix potential stack overflow in environment functions"
Wolfgang requested this be reverted and Rob agreed after further
discussion.  This was a symptom of a larger problem we need to deal
with.

This reverts commit 60d7d5a631.

Signed-off-by: Tom Rini <trini@ti.com>
2013-04-05 14:55:21 -04:00
Albert ARIBAUD fed029f3c3 Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master' 2013-04-04 15:44:57 +02:00
Stephen Warren 9fd383724c mmc: don't allow extra cmdline arguments
The "mmc rescan" command takes no arguments. However, executing
"mmc rescan 1" succeeds, leading the user to believe that MMC device 1
has been rescanned. In fact, the "current" MMC device has been
rescanned, and the current device may well not be 1. Add error-checking
to the "mmc" command to explicitly reject any extra command-line
arguments so that it's more obvious when U-Boot isn't doing what the
user thought they asked it to.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
2013-04-02 16:23:35 -04:00
Rob Herring 60d7d5a631 env: fix potential stack overflow in environment functions
Most of the various environment functions create CONFIG_ENV_SIZE buffers on
the stack. At least on ARM and PPC which have 4KB stacks, this can overflow
the stack if we have large environment sizes. So move all the buffers off
the stack to static buffers.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-04-02 16:23:34 -04:00
York Sun 472d546054 Consolidate bool type
'bool' is defined in random places. This patch consolidates them into a
single header file include/linux/types.h, using stdbool.h introduced in C99.

All other #define, typedef and enum are removed. They are all consistent with
true = 1, false = 0.

Replace FALSE, False with false. Replace TRUE, True with true.
Skip *.py, *.php, lib/* files.

Signed-off-by: York Sun <yorksun@freescale.com>
2013-04-01 16:33:52 -04:00
Tom Rini 5644369450 Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-staging 2013-03-31 08:43:12 -04:00
Anatolij Gustschin 1d3dea12e2 video: bcm2835: fix build issues
After merging LCD patches for v2013.04 the bcm2835 video
driver building is broken due to removal of many global
variables. Fix the driver.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Stephen Warren <swarren@wwwdotorg.org>
2013-03-29 14:29:39 +01:00
Anatolij Gustschin d0f34f10f1 Merge branch 'for-v2013.04'
Conflicts:
	drivers/video/Makefile

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-03-29 13:54:10 +01:00
Akshay Saraswat 1f9c92808a gen: Add sha h/w acceleration to hash
Adding H/W acceleration support to hash which can be used
to test SHA 256 hash algorithm.

Signed-off-by: ARUN MANKUZHI <arun.m@samsung.com>
Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
2013-03-29 20:10:42 +09:00
Pali Rohár e7abe91967 New command bootmenu: ANSI terminal boot menu support
The "bootmenu" command uses U-Boot menu interfaces and provides
a simple mechanism for creating menus with several boot items.
When running this command the menu will be assembled as defined
by a set of environment variables which contain a title and
command key-value pairs. The "Up" and "Down" keys are used for
navigation through the items. Current active menu item is
highlighted and can be selected using the "Enter" key.

The command interprets and generates various ANSI escape
sequencies, so for proper menu rendering and item selection
the used terminal should support them.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
[agust: various fixes and documentation updates]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-03-29 09:35:34 +01:00
Anatolij Gustschin 6a3439fdad menu: export menu_default_choice() function
Checking the default menu item and obtaining its data can
be useful in custom menu code. Export menu_default_choice()
function which serves this purpose.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-03-29 09:35:34 +01:00
Pali Rohár fc9d64ffcd menu: Add support for user defined item choice function
Selecting menu items is currently done in menu_interactive_choice()
by reading the user input strings from standard input.

Extend menu_interactive_choice() to support user defined function
for selecting menu items. This function and its argument can be
specified when creating the menu.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-03-29 09:35:33 +01:00
Albert ARIBAUD 009d75ccc1 Merge branch 'u-boot/master' into 'u-boot-arm/master'
Conflicts:
	drivers/spi/tegra20_sflash.c
	include/fdtdec.h
	lib/fdtdec.c
2013-03-28 18:50:01 +01:00
Steven Stallion 04d414090c image: Add support for Plan 9
Signed-off-by: Steven Stallion <sstallion@gmail.com>
Cc: Tom Rini <trini@ti.com>
Reviewed-by: Tom Rini <trini@ti.com>
2013-03-27 15:30:11 -04:00
Tom Rini 0171d52c41 cmd_ext4: BREAK and correct ext4write parameter order
The ext4write command was taking the in-memory address and filename path
in reverse order from the rest of the filesystem read and write
commands.  This corrects the order to be the same as fatload, etc.

Signed-off-by: Tom Rini <trini@ti.com>
2013-03-27 15:30:11 -04:00
Tom Rini 268d966dff env_callback: Mark find_env_callback as static
This is not called outside of env_callback.c so mark static, remove from
<env_callback.h>

Cc: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Tom Rini <trini@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2013-03-27 15:30:11 -04:00
Albert ARIBAUD 412665b461 Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master' 2013-03-26 09:51:09 +01:00
Andre Renaud 317461c1db Fix bitmap offsets for non 8-bit LCDs
Currently bitmap logos don't interpret the X coordinate
correctly if the bpp is anything other than 8.

Signed-off-by: Andre Renaud <andre@bluewatersys.com>
2013-03-21 10:50:42 +01:00
Jeroen Hofstee a5796c51ce common/lcd.c: move the macro's to the c file
Hide the console macros since some reference global data which is
no longer present.

cc: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2013-03-21 10:38:51 +01:00
Jeroen Hofstee 6b035141f6 common/lcd: cosmetic: clean up a bit
- Make the brackets of the function calls more consistent
 - Remove really unnecessary brackets
 - Removes the extern from the function definitions
 - Remove curly brackets from single line statements
 - Remove lcd_setmem proto since it is already in common.h
 - Cleanup comments, remove useless comments
 - Remove NOT_USED_SO_FAR ifdef
 - Cleanup coding style

cc: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
[agust: rebased the original patch]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-03-21 10:31:38 +01:00
Jeroen Hofstee 00a0ca5986 common/lcd.c: remove global lcd_base
lcd_base is available as gd->fb_base as well, there is no need
to keep a seperate copy.

For completeness the ack of Bo Shen is for the atmel part.
Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Bo Shen <voice.shen@atmel.com>
Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stelian Pop <stelian@popies.net>
Cc: Tom Warren <twarren@nvidia.com>
Acked-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
[agust: also fix cm_t35 board while rebasing]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-03-21 10:16:53 +01:00
Jeroen Hofstee f1d205a19c common/lcd.c: cleanup use of global variables
console_col, console_row, lcd_line_length, lcd_console_address had
to be declared in board / driver specific code, but were not actually
used there on many boards. Get rid of the global variables.

for completeness, the ack of Bo Shen is for the atmel part
Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Bo Shen <voice.shen@atmel.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stelian Pop <stelian@popies.net>
Cc: Tom Warren <twarren@nvidia.com>
Acked-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
[agust: rebased and fixed cm_t35 board]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-03-21 10:11:17 +01:00
Wolfgang Denk 46d1d5dd43 common/lcd.c: cleanup use of global variables
lcd_color_fg and lcd_color_bg had to be declared in board specific
code, but were not actually used there; in addition, we have getter /
setter functions for these, which were not used either.

Get rid of the global variables, and use the getter function where
needed (so far no setter calls are needed).

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Bo Shen <voice.shen@atmel.com>
Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stelian Pop <stelian@popies.net>
Cc: Tom Warren <twarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Jeroen Hofstee <jeroen@myspectrum.nl>
[agust: also fixed cm_t35 board while rebasing]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2013-03-21 09:05:08 +01:00
Tom Rini 8b906a9f0b Merge branch 'spi' of git://git.denx.de/u-boot-x86 2013-03-20 14:55:10 -04:00
Stephen Warren 6d3307195d lcd: calculate line_length after lcd_ctrl_init()
When an LCD driver is actually driving a regular external display, e.g.
an HDMI monitor, the display resolution might not be known until the
display controller has initialized, i.e. during lcd_ctrl_init(). However,
lcd.c calculates lcd_line_length before calling this function, thus
relying on a hard-coded resolution in struct panel_info.

Instead, defer this calculation until after lcd_ctrl_init() has had the
chance to dynamically determine the resolution. This needs to happen
before lcd_clear(), since the value is used there.

grep indicates that no code outside lcd.c uses this lcd_line_length; in
particular, no lcd_ctrl_init() implementations read it.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
2013-03-20 15:29:39 +01:00
Simon Glass 1e7133e99e sf: Use unsigned type for buffers
The verify code is broken on archs with signed char. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-19 08:45:38 -07:00
Tom Rini 3c47f2f487 Merge branch 'master' of git://git.denx.de/u-boot-usb 2013-03-18 15:33:47 -04:00
Tom Rini 0ce033d258 Merge branch 'master' of git://git.denx.de/u-boot-arm
Albert's rework of the linker scripts conflicted with Simon's making
everyone use __bss_end.  We also had a minor conflict over
README.scrapyard being added to in mainline and enhanced in
u-boot-arm/master with proper formatting.

Conflicts:
	arch/arm/cpu/ixp/u-boot.lds
	arch/arm/cpu/u-boot.lds
	arch/arm/lib/Makefile
	board/actux1/u-boot.lds
	board/actux2/u-boot.lds
	board/actux3/u-boot.lds
	board/dvlhost/u-boot.lds
	board/freescale/mx31ads/u-boot.lds
	doc/README.scrapyard
	include/configs/tegra-common.h

Build tested for all of ARM and run-time tested on am335x_evm.

Signed-off-by: Tom Rini <trini@ti.com>
2013-03-18 14:37:18 -04:00
Lukasz Majewski b528f71394 usb:gadget: USB Mass Storage Gadget support
This patch adds the USB Mass Storage Gadget to u-boot
New command called "ums" is implemented to provide access
to on-device embedded persistent memory.

USB Mass Storage is supposed to work on top of the USB
Gadget framework

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>
CC: Marek Vasut <marek.vasut@gmail.com>
2013-03-18 18:58:53 +01:00
Pantelis Antoniou df93cd9c6f dfu: Fix crash when wrong number of arguments given
Fix obvious crash when not enough arguments are given to the dfu
command.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
2013-03-16 21:12:01 +01:00
Pantelis Antoniou ea3e21226f dfu: Only perform DFU board_usb_init() for TRATS
USB initialization shouldn't happen for all the boards.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
2013-03-16 21:12:01 +01:00
Simon Glass e424c15c1f x86: Enable generic board support
This enables generic board support so that x86 boards can define
CONFIG_SYS_GENERIC_BOARD.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-15 16:14:00 -04:00
Simon Glass be274b99ab x86: Adjust board_r.c for x86
For x86 the global_data is managed entirely by the start.S code so we do
not need to touch it. However, we do have some more initcalls to add.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-15 16:14:00 -04:00
Simon Glass 48a3380675 x86: Adjust board_f.c for x86
For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-15 16:14:00 -04:00
Simon Glass c2240d4dbe Adjust board_r.c for ppc
This adds ppc features to the generic post-relocation board init.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-15 16:14:00 -04:00
Simon Glass e4fef6cfcc Adjust board_f.c for ppc
This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-15 16:14:00 -04:00
Simon Glass 632efa7440 Add CONFIG_SYS_SYM_OFFSETS to support offset symbols
Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-15 16:14:00 -04:00
Simon Glass 8cae8a68ed Add spl load feature
This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-15 16:13:59 -04:00
Simon Glass 6f6430d72b Introduce generic post-relocation board_r.c
This file handles common post-relocation init for boards which use
the generic framework.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-03-15 16:13:59 -04:00
Simon Glass 1938f4a5b6 Introduce generic pre-relocation board_f.c
This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>
2013-03-15 16:13:59 -04:00
Albert ARIBAUD 6579d15c58 Merge branch 'u-boot-imx/master' into 'u-boot-arm/master' 2013-03-15 15:18:31 +01:00