Commit Graph

4093 Commits

Author SHA1 Message Date
Tom Rini f5fd45ff64 Merge branch 'master' of git://www.denx.de/git/u-boot-imx 2016-10-08 09:33:37 -04:00
B, Ravi d2d9bdfcf9 spl: saveenv: adding saveenv support in SPL
By default saveenv option is not supported for SPL. This patch
enable the support for save environment variable for SPL build.

Enable save environment support in SPL after setenv. By default
the saveenv option is not provided in SPL, but some boards need
this support in 'Falcon' boot, where SPL need to boot from
different images based on environment variable set by OS. For
example OS may set "reboot_image" environment variable to
"recovery" inorder to boot recovery image by SPL. The SPL read
"reboot_image" and act accordingly and change the reboot_image
to default mode using setenv and save the environemnt.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Reviewed-by: Simon Glass <sig@chromium.org>

change in v1:
	- dropped SUPPORT, use CONFIG_SPL_SAVEENV
	- updates the comments in mmc_private.h
2016-10-08 09:33:36 -04:00
Chris Packham 43e0a3dec0 common/console.c: ensure GD_FLG_SILENT is set or cleared
When CONFIG_SILENT_CONSOLE is defined and the default environment has
silent=1 it is not possible for a user to make the console un-silent if
the environment is not available when console_init_f() is called (for
example because the environment is in SPI).

Add a new helper function console_update_silent() and call it from both
console_init_f() and console_init_r().

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-10-07 14:26:29 +00:00
Robert P. J. Day fc0b5948e0 Various, accumulated typos collected from around the tree.
Fix various misspellings of:

 * deprecated
 * partition
 * preceding,preceded
 * preparation
 * its versus it's
 * export
 * existing
 * scenario
 * redundant
 * remaining
 * value
 * architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2016-10-06 20:57:40 -04:00
Simon Glass d32b2d1c61 spl: Make spl_boot_list a local variable
There is no need for this to be in the BSS region. By moving it we can delay
use of BSS in SPL. This is useful for machines where the BSS region is not
in writeable space. On 64-bit x86, SPL runs from SPI flash and it is easier
to eliminate BSS use than link SPL to run with BSS at a particular
cache-as-RAM (CAR) address.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:08:55 -04:00
Simon Glass f4d7d8596f spl: Update spl_load_simple_fit() to take an spl_image param
Upda the SPL FIT code to use the spl_image parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:08:54 -04:00
Simon Glass 710e9ca579 spl: Update fat functions to take an spl_image parameter
Update the fat loader to avoid using the spl_image global variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:08:53 -04:00
Simon Glass b4a6c2aae6 spl: Update ext functions to take an spl_image parameter
Update the ext loader to avoid using the spl_image global variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:08:53 -04:00
Simon Glass 2a2ee2ac35 spl: Pass spl_image as a parameter to load_image() methods
Rather than having a global variable, pass the spl_image as a parameter.
This avoids BSS use, and makes it clearer what the function is actually
doing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:08:52 -04:00
Simon Glass 97d9df0a91 spl: Convert spl_board_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code. Update existing users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:08:50 -04:00
Simon Glass 7ec0389354 spl: Convert spl_net_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code. We need two variants - one for BOOT_DEVICE_CPGMAC and one for
BOOT_DEVICE_USBETH.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:08:18 -04:00
Simon Glass 139db7af4e spl: Convert spl_spi_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code. Also set up the sunxi function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:07:34 -04:00
Simon Glass 0a9b73a13e spl: spi: Move the generic SPI loader into common/spl
All the other SPL loaders are in this directory, so move the SPI one in
there too.

There are two board-specific SPI loaders (fsl and sunxi). These remain in
the drivers/mtd/spi directory, since they do not contain generic code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:07:33 -04:00
Simon Glass 7557147927 spl: Convert spl_sata_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:07:33 -04:00
Simon Glass 56df46351a spl: Convert spl_usb_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:07:29 -04:00
Simon Glass dd6bf9025c spl: Convert spl_ymodem_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:06:59 -04:00
Simon Glass 548b3ee73c spl: Convert spl_nor_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:06:59 -04:00
Simon Glass afa6e6c488 spl: Convert spl_onenand_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:06:58 -04:00
Simon Glass d5c2b11ce4 spl: Convert spl_nand_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:06:57 -04:00
Simon Glass 7d7dd821b0 spl: Convert spl_ubi_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:06:56 -04:00
Simon Glass 0fed9c7ed6 spl: Convert spl_mmc_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:06:56 -04:00
Simon Glass 98136b2f26 spl: Convert spl_ram_load_image() to use linker list
Add a linker list declaration for this method and remove the explicit
switch() code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Include updating the DFU case]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-10-06 15:06:35 -04:00
Simon Glass a0a8029058 spl: Add a way to declare an SPL image loader
Add a linker list macro which can be used to declare an SPL image loader.
Update spl_load_image() to search available loaders for the correct one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 14:53:36 -04:00
Simon Glass ecdfd69a4b spl: Convert boot_device into a struct
At present some spl_xxx_load_image() functions take a parameter and some
don't. Of those that do, most take an integer but one takes a string.

Convert this parameter into a struct so that we can pass all functions the
same thing. This will allow us to use a common function signature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 14:53:36 -04:00
Simon Glass a807ab3303 spl: Kconfig: Move SPL_DISPLAY_PRINT to Kconfig
Move this option to Kconfig and tidy up existing uses. Also add a function
comment to the header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 14:48:21 -04:00
Simon Glass ca12e65caa spl: Add a parameter to jump_to_image_linux()
Instead of using the global spl_image variable, pass the required struct in
as an argument.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 14:48:19 -04:00
Simon Glass 71316c1d8c spl: Add a parameter to spl_parse_image_header()
Instead of using the global spl_image variable, pass the required struct in
as an argument.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 14:48:17 -04:00
Simon Glass d95ceb97c0 spl: Add a parameter to spl_set_header_raw_uboot()
Rather than act on the global variable, pass the required struct in as a
parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06 14:48:15 -04:00
Albert ARIBAUD \(3ADEV\) ed0c2c0a9e tools: mkimage: add support for Vybrid image format
This format can be flashed directly at address 0 of
the NAND FLASH, as it contains all necessary headers.

Signed-off-by: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
2016-10-06 09:06:16 +02:00
Petr Kulhavy 6f6c863094 fastboot: move FASTBOOT_FLASH options into Kconfig
Move FASTBOOT_MBR_NAME and FASTBOOT_GPT_NAME into Kconfig.
Add dependency on the FASTBOOT_FLASH setting (also for FASTBOOT_MBR_NAME).
Remove the now redundant GPT_ENTRY_NAME.

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Steve Rae <steve.rae@raedomain.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Add FIXME about xxx_PARTITION needing to be in Kconfig]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-10-01 20:04:59 -04:00
Petr Kulhavy b6dd69a4d6 fastboot: add support for writing MBR
Add special target "mbr" (otherwise configurable via CONFIG_FASTBOOT_MBR_NAME)
to write MBR partition table.
Partitions are now searched using the generic function which finds any
partiiton by name. For MBR the partition names hda1, sda1, etc. are used.

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Steve Rae <steve.rae@raedomain.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-10-01 20:04:51 -04:00
Petr Kulhavy 87b8530fe2 disk: part: implement generic function part_get_info_by_name()
So far partition search by name has been supported only on the EFI partition
table. This patch extends the search to all partition tables.

Rename part_get_info_efi_by_name() to part_get_info_by_name(), move it from
part_efi.c into part.c and make it a generic function which traverses all part
drivers and searches all partitions (in the order given by the linked list).

For this a new variable struct part_driver.max_entries is added, which limits
the number of partitions searched. For EFI this was GPT_ENTRY_NUMBERS.
Similarly the limit is defined for DOS, ISO, MAC and AMIGA partition tables.

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Steve Rae <steve.rae@raedomain.com>
2016-10-01 20:04:45 -04:00
Zubair Lutfullah Kakakhel ba07984068 bootm: fix passing argc to standalone apps
This bug appears in b6396403 which makes u-boot unable to pass
arguments via bootm to a standalone application without this patch.

Steps to reproduce.

Compile a u-boot. Use mkimage to package the standalone hello_world.bin
file.

e.g. For the MIPS Boston platform

mkimage -n "hello" -A mips -O u-boot -C none -T standalone \
     -a 0xffffffff80200000 -d hello_world.bin \
     -ep 0xffffffff80200000 hello_out

Then tftp hello_out and run it using

boston # dhcp 192.168.154.45:hello_out
...
boston # bootm $loadaddr 123 321

Without the patch the following output is observed.

boston # bootm $loadaddr 123 321
   Image Name:   hello
   Image Type:   MIPS U-Boot Standalone Program (uncompressed)
   Data Size:    1240 Bytes = 1.2 KiB
   Load Address: 80200000
   Entry Point:  80200000
   Verifying Checksum ... OK
   Loading Standalone Program ... OK
Example expects ABI version 8
Actual U-Boot ABI version 8
Hello World
argc = 0
argv[0] = "0xffffffff88000000"

With the patch, you see the following.

boston # bootm $loadaddr 123 321
   Image Name:   hello
   Image Type:   MIPS U-Boot Standalone Program (uncompressed)
   Data Size:    1240 Bytes = 1.2 KiB
   Load Address: 80200000
   Entry Point:  80200000
   Verifying Checksum ... OK
   Loading Standalone Program ... OK
Example expects ABI version 8
Actual U-Boot ABI version 8
Hello World
argc = 3
argv[0] = "0xffffffff88000000"
argv[1] = "123"
argv[2] = "321"
argv[3] = "<NULL>"

Without the patch, the go command at the entry point seems to work.

boston # go 0xffffffff80200000 123 321
Example expects ABI version 8
Actual U-Boot ABI version 8
Hello World
argc = 3
argv[0] = "0xffffffff80200000"
argv[1] = "123"
argv[2] = "321"
argv[3] = "<NULL>"
Hit any key to exit ...

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-10-01 20:04:37 -04:00
Sanchayan Maity 54a708ca06 cmd: dfu: Add error handling for failed registration
Without this, if g_dnl_register() fails, DFU code continues on
blindly and crashes. This fix makes it simply print an error
message instead.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
[l.majewski@samsung.com - some manual tweaks needed]
2016-09-27 23:30:22 +02:00
B, Ravi 6f8387f120 dra7x: boot: add dfu bootmode support
This patch enables the DFU boot mode support
for dra7x platform.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-09-27 23:30:20 +02:00
B, Ravi 52f2acc5e0 spl: dfu: adding dfu support functions for SPL-DFU
Adding support functions to run dfu spl commands.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-09-27 23:30:19 +02:00
B, Ravi 05341a8764 common: dfu: saperate the dfu common functionality
The cmd_dfu functionality is been used by both SPL and
u-boot, saperating the core dfu functionality moving
it to common/dfu.c.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-09-27 23:30:18 +02:00
B, Ravi bc5dbcb918 spl: dfu: add dfu support in SPL
Traditionally the DFU support is available only
as part 2nd stage boot loader(u-boot) and DFU
is not supported in SPL.

The SPL-DFU feature is useful for boards which
does not have MMC/SD, ethernet boot mechanism
to boot the board and only has USB inteface.

This patch add DFU support in SPL with RAM
memory device support to load and execute u-boot.
And then leverage full functionality DFU in
u-boot to flash boot inital binary images to
factory or bare-metal boards to memory devices
like SPI, eMMC, MMC/SD card using USB interface.

This SPL-DFU support can be enabled through
Menuconfig->Boot Images->Enable SPL-DFU support

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-09-27 23:30:17 +02:00
Masahiro Yamada 1221ce459d treewide: replace #include <asm/errno.h> with <linux/errno.h>
Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content.  (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23 17:55:42 -04:00
Masahiro Yamada 8319aeb1da usb: squash lines for immediate return
This makes functions much simpler.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-09-23 17:53:48 -04:00
Paul Burton bd86ef117d image-fit: Fix fit_get_node_from_config semantics
Commit bac17b78da ("image-fit: switch ENOLINK to ENOENT") changed
fit_get_node_from_config to return -ENOENT when a property doesn't
exist, but didn't change any of its callers which check return values.
Notably it didn't change boot_get_ramdisk, which leads to U-Boot failing
to boot FIT images which don't include ramdisks with the following
message:

  Ramdisk image is corrupt or invalid

It also didn't take into account that by returning -ENOENT to denote the
lack of a property we lost the ability to determine from the return
value of fit_get_node_from_config whether it was the property or the
configuration node that was missing, which may potentially lead callers
to accept invalid FIT images.

Fix this by having fit_get_node_from_config return -EINVAL when the
configuration node isn't found and -ENOENT when the property isn't
found, which seems to make semantic sense. Callers that previously
checked for -ENOLINK are adjusted to check for -ENOENT, which fixes the
breakage introduced by commit bac17b78da ("image-fit: switch ENOLINK
to ENOENT").

The only other user of the return fit_get_node_from_config return value,
indirectly, is bootm_find_os which already checked for -ENOENT. From a
read-through of the code I suspect it ought to have been checking for
-ENOLINK prior to bac17b78da ("image-fit: switch ENOLINK to ENOENT")
anyway, which would make it right after this patch, but this would be
good to get verified by someone who knows this x86 code or is able to
test it.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Jonathan Gray <jsg@jsg.id.au>
Cc: Marek Vasut <marex@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: George McCollister <george.mccollister@gmail.com>
Tested-by: George McCollister <george.mccollister@gmail.com>
2016-09-22 11:34:58 -04:00
Tom Rini 423620b9d4 Merge branch 'master' of git://git.denx.de/u-boot-mips 2016-09-21 14:50:18 -04:00
Paul Burton 8ebf50692e board_f: Add a mach_cpu_init callback
Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-09-21 15:04:04 +02:00
Siva Durga Prasad Paladugu a4d88920e5 Kconfig: Move config IDENT_STRING to Kconfig
Move the config IDENT_STRING to Kconfig and migrate all boards

[sivadur: Migrate zynq boards]
Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
[trini: Update configs, add some default to sunxi Kconfig]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-20 09:30:23 -04:00
Simon Glass f73329ee82 Kconfig: tpl: Add some TPL support options to Kconfig
Some of the SPL options have TPL equivalents. Add these to Kconfig so that
we can convert these options over to work from Kconfig.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-16 17:03:40 -04:00
Simon Glass 11bde1cd59 Kconfig: spl: Add SPL support options to Kconfig
There are a lot of SPL options in U-Boot to enable various features and
drivers. Currently these do not use Kconfig. Add them to Kconfig along
with suitable help, and drop them from the README.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-16 17:03:39 -04:00
Simon Glass 76f1f38816 Use separate options for TPL support
At present TPL uses the same options as SPL support. In a few cases the board
config enables or disables the SPL options depending on whether
CONFIG_TPL_BUILD is defined.

With the move to Kconfig, options are determined for the whole build and
(without a hack like an #undef in a header file) cannot be controlled in this
way.

Create new TPL options for these and update users. This will allow Kconfig
conversion to proceed for these boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-16 17:03:39 -04:00
Simon Glass c2ae7d8220 Kconfig: Move SPL settings into their own file
Move the SPL settings into common/spl where most of the SPL code is kept.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-16 17:03:36 -04:00
Heiko Schocher 9dd1d0aa4e common, kconfig: move VERSION_VARIABLE to Kconfig
move VERSION_VARIABLE from board config file into a
Kconfig option.

Signed-off-by: Heiko Schocher <hs@denx.de>
2016-09-09 18:14:18 -04:00
Jonathan Gray bac17b78da image-fit: switch ENOLINK to ENOENT
ENOLINK is not required by POSIX and does not exist on OpenBSD
and likely other systems.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2016-09-07 08:49:06 -04:00