APPLIED: disk: get_device_and_partition() return value fixes

When no valid partitions are found, guarantee that we return -1. This
most likely already happens, since the most recent get_partition_info()
will have returned an error. However, it's best to be explicit.

Remove an unnecessary assignment of ret=0 in the success case; this value
is over-written with the processed partition ID later.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_efi: remove indent level from loop

Simplify the partition printing loop in print_part_efi() to bail out
early when the first invalid partition is found, rather than indenting
the whole body of the loop. This simplifies later patches.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_efi: re-order partition list printf, change case

The partition name is a long variable-length string. Move it last on
the line to ensure consistent layout and that the entries align with
the "header" line. Also, surround it in quotes, so if it's empty, it's
obvious that something is still being printed.

Also, change the case of the LBA numbers; lower-case looks nicer in my
opinion, and will be more consistent with the UUID printing that is
added later in this series.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_efi: print partition UUIDs

When printing the partition table, print the partition type UUID and the
individual partition UUID. Do this unconditionally, since partition UUIDs
are useful.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_efi: add new partition attribute definitions

Add no_block_io_protocol and legacy_bios_bootable attribute definitions.
These are sourced from UEFI Spec 2.3, page 105, table 19. Credits to the
libparted source for the specification pointer.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_efi: print raw partition attributes

When printing the EFI partition table, print the raw attributes. Convert
struct gpt_entry_attributes to a union to allow raw access.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_efi: set bootable flag in partition objects

A partition is considered bootable if it either has the "legacy BIOS
bootable" flag set, or if the partition type UUID matches the standard
"system" type.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_dos: checkpatch cleanups

Minor cleanups required so later patches don't trigger checkpatch.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_dos: align partition table prints

When printing the partition table, make sure data aligns with the column
headers. Change format of partition number field to %3d to match
part_efi.c.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: disk: part_dos: print partition UUID in partition list

This information may be useful to compare against command "part uuid",
or if you want to manually paste the information into the kernel
command-line.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: ARM: tegra: define CONFIG_SYS_BOOTMAPSZ

This define indicates the size of the memory region where it is safe
to place data passed to the Linux kernel (ATAGs, DTB, initrd). The
value needs to be:

a) Less than or equal to RAM size.
b) Small enough that the area is not within the kernel's highmem region,
   since the kernel cannot access ATAGs/DTB/initrd from highmem.
c) Large enough to hold the kernel+DTB+initrd.

256M seems large enough for (c) in most circumstances, and small enough
to satisfy (a) and (b) across any possible Tegra board. Note that the
user can override this value via environment variable "bootm_mapsize"
if needed.

The advantage of defining BOOTMAPSZ is that we no longer need to define
variable fdt_high in the default environment. Previously, we defined
this to prevent the DTB from being relocated to the very end of RAM,
which on most Tegra systems is within highmem, and hence which would
cause boot failures. A user can still define this variable themselves
if they want the FDT to be either left in-place wherever loaded, or
copied to some other specific location. Similarly, there should no
longer be a strict requirement for the user to define initrd_high if
using an initrd.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: ARM: tegra: use standard variables to define load addresses

Currently, Tegra's default environment uses non-standard variables to define
where boot scripts should load the kernel, FDT, and initrd. This change both
changes the variable names to match those described in U-Boot's README, and
shuffles their values around a little so that the values make a little more
sense; see comments in the patch for rationale behind the values chosen.

Note that this patch does remove the old non-standard variable "fdt_load" from
the default environment, so this patch requires people to change their boot
scripts.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
APPLIED: ARM: tegra: Harmony: enable ULPI USB port

The ULPI port is routed onto pins on the mini PCI Express connector. A
standard breakout board may be used to access the port.

* Add required DT entries to configure the ULPI port.
* Setup up the ULPI pinmux in the board code.
* Enable multiple USB controller and ULPI support in the board config.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: ARM: tegra: Seaboard: enable multiple USB ports

The device tree already contains the required configuration for both the
USB1 and USB3 ports. Enable the required configuration options to enable
both these ports, which in turn allows the USB1 port to be used.

Note that on a true Seaboard, this port is typically used as a device
port hosting Tegra's USB recovery protocol. However, on the Springbank
derivative, this port is the only external USB port, so we enable it as
a host port so that USB peripherals may be used. Enabling this port in
U-Boot as a host port doesn't prevent the port from reverting to a
device port when the CPU is reset into recovery mode.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
APPLIED: ARM: tegra: Whistler: remove unused USB alias

Port USB1 on Whistler is intended as a device port for USB recovery.
Whistler's DT currently contains an alias for this USB port, even though
Whistler's config doesn't enable multiple USB controllers, so the alias
is unused. Remove the unused alias for consistency for now. Similar,
explicitly disable the port in the device tree too.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: fix u-boot.lds for -ffunction-sections/-fdata-sections

When -ffunction-sections or -fdata-section are used, symbols are placed
into sections such as .data.eserial1_device and .bss.serial_current.
Update the linker script to explicitly include these. Without this
change (at least with my gcc-4.5.3 built using crosstool-ng), I see that
the sections do end up being included, but __bss_end__ gets set to the
same value as __bss_start.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: combine duplicate Makefile rules

The rules to generate u-boot-{no,}dtb-tegra.bin were almost identical.
Combine them into a single paremeterized rule. This will allow the next
patch to edit a single rule, rather than being cut/paste twice.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: check for SPL size overflow in makefile

If the SPL extends beyond CONFIG_SYS_TEXT_BASE, then it will likely
corrupt the main U-Boot binary during execution, causing the main U-Boot
binary to fail. Check for this situation during the build to avoid
extremely annoying and hard-to-find bugs. Note that checking the size of
u-boot-spl.bin is not enough, since BSS size doesn't affect the size of
u-boot-spl.bin.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: increase CONFIG_SYS_TEXT_BASE

The SPL has grown. Increase CONFIG_SYS_TEXT_BASE so SPL's BSS does not
overlap the main U-Boot.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
HACK: make SPL work on Tegra

Tegra's SPL was cut/paste from some other SPL, and hence wasn't updated
when the serial rework went in, and was broken. At least part of the root
cause is that BSS isn't being cleared, although clearing BSS doesn't
actually solve the problem(s). By explicitly calling serial_initialize(),
we hack around (at least part of) the breakage and make it work. The
correct long-term solution is to rework Tegra's SPL so it doesn't
duplicate all the regular SPL code. But, this minimal fix gets things
working for now, until Allen Martin reworks Tegra SPL.

Signed-off-by: Stephen Warren <swarren@nvidia.com>