android_image: add dt_size field into first unused header field

dtb (compiled dts script) file for a device is now supported in u-boot
by placing it in the "2nd-bootloader" area.  This goes behind the ramdisk
at a page aligned location.

We complish this by adding a new "dt_size" field into the boot.img header.

This does 2 things:
- U-boot will know that the 2nd-bootloader slot is actually a dtb file
- And it will know how much to load of the 2nd-bootloader slot into memory

Signed-off-by: Michael Scott <michael.scott@linaro.org>
fastboot: make do_fastboot available as external

In upcoming changes which detect a reboot to bootloader mode, we need
to start fastboot from elsewhere in the code base.

So let's share it.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
download mode: use google fastboot vid/pid when cmd_fastboot is enabled

By using Google vid/pid for fastboot mode, the end user doesn't need any
additional configuration to support it.  Otherwise Nvidia vid/pids would need
to be enabled.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
bootai: introduce support for booting from an android image into cmd_bootm

Many Android devices use a partition to contain boot binary called a boot.img.
This binary format is described in include/android_image.h.
As a summary, it contains the following page aligned sections:
- A header area with several boot support fields (cmdline, page size, etc) and
length/offsets of each of the other sections
- a kernel image of some sort (zImage, Image, Image.gz, etc)
- a gzipped cpio filesystem used as initrd
- a possible 3rd section to contain a 2nd-bootloader or device tree binary

do_bootai function supports this boot method, by taking 1 parameter which
describes the location of the media being loaded (currently mmc0) and then
performs the following:
- if the environment variable "recovery" is set to 1 then use
CONFIG_CMD_BOOTAI_RECOVERY_PART as the partition name to load the boot.img
binary from, otherwise use CONFIG_CMD_BOOTAI_BOOT_PART
(each platform can implement their own checks for when to set this variable)
- load the boot.img into the fastboot buffer area
(MMC load is the only method currently supported)
- use the header information to extract each of the sections into their
respective memory locations (defined by the platform)
- by defining CONFIG_CMD_BOOTAI_IGNORE_HDR_ADDR, u-boot will *NOT* use the
memory locations specified in the boot header, and will instead use locations
defined by the platform.
- on the sections are extracted, jump to the standard bootm processing which
completes the boot.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
distro_bootcmd: add support for android bootimg (via CONFIG_CMD_BOOTAI)

Signed-off-by: Michael Scott <michael.scott@linaro.org>
tegra-common-post: enable support for android bootimg load (via CONFIG_CMD_BOOTAI)

Signed-off-by: Michael Scott <michael.scott@linaro.org>
board: nvidia: check bits 30/31 of pmc_scratch0 for reboot-recovery/bootloader

if bit 31 is set at pmc_scratch0, the device was rebooted for recovery-mode
in this case set the "recovery" environment to "1"

if bit 30 is set at pmc_scratch0, the device was rebooted for bootloader-mode
in this case we enter fastboot mode

Signed-off-by: Michael Scott <michael.scott@linaro.org>
fastboot: tegra124: Add tegra support for fastboot reboot additions

Set correct bits in scratch0 when using "fastboot reboot-bootloader" and
"fastboot reboot-recovery"

Signed-off-by: Michael Scott <michael.scott@linaro.org>
fastboot: add "fastboot oem" command support

Add code stub to handle "fastboot oem __" command

Signed-off-by: Michael Scott <michael.scott@linaro.org>
fastboot: tegra124: add support for "fastboot oem recovery" command

This sets bit 31 of pmc_scratch0 for a reboot into recovery
(Tegra specific)

Signed-off-by: Michael Scott <michael.scott@linaro.org>
fastboot: if enabled use bootai for "fastboot boot" command

Signed-off-by: Michael Scott <michael.scott@linaro.org>
jetson-tk1 config changes

enable fastboot and fastboot buffer location / size
enable fastboot mmc flash device 0
enable bootai and android image suppot
ignore boot.img memory locations
set additional cmdline parameters

Signed-off-by: Michael Scott <michael.scott@linaro.org>