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>
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>
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: tegra: TrimSlice: add support for USB1 port

FIXME: This doesn't work; check Compulab's downstream U-Boot for the
startup timing workaround they have...

TrimSlice's USB1 port has two purposes; it either acts as a device port
hosting Tegra's USB recovery protocol, or acts as a host port connected
to the internal USB->SATA bridge chip, which may in turn be connected to
an SSD or HDD. Add the appropriate device tree and board configuration
options to enable this port as a host port, and route the port to the
SATA bridge using the VBUS GPIO.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
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>
disk: initialize name/part fields when returning a whole disk

When get_device_and_partition() finds a disk without a partition table,
under some conditions, it "returns" a disk_partition_t that describes
the entire raw disk. Make sure to initialize all fields in the partition
descriptor in that case.

The value chosen for name is just some arbitrary descriptive string.

The value chosen for info matches the check at the end of
get_device_and_partition(). However, it's probably not that important;
it's not obvious that the value is really used.

Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
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>
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>
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>
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>
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>
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>
disk: part_dos: checkpatch cleanups

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

Signed-off-by: Stephen Warren <swarren@nvidia.com>
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>
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>
part: add partition number to disk_partition_t

The FAT filesystem code knows which partition ID it is operating on.
Currently, this is passed to fat_register_device() as a parameter.
In order to convert FAT to the more standardized fat_set_blk_dev(), the
information needs to come from somewhere else, and the partition
definition structure is the logical place.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
---
v3: Set info->part in get_device_and_partition() when returning "whole
    disk" partition.
v2: No change.
FAT: make use of disk_partition_t.part

This removes the standalone cur_part_nr variable, opening the way to
replacing fat_register_device() with fat_set_blk_dev().

Note that when get_partition_info() fails and we use the entire disk,
the correct partition number is 0 (whole disk) not 1 (first partition),
so that change is also made here.

An alternative to this (and the previous) patch might be to simply
remove the partition number from the printf(). I don't know how attached
people are to it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
---
v3: No change.
v2: No change.
FAT: initialize all fields in cur_part_info, simplify init

cur_part_info.{name,type} are strings. So, we don't need to memset()
the entire thing, just put the NULL-termination in the first byte.

Add missing initialization of the bootable and uuid fields.

None of these fields are actually used by fat.c. However, since it
stores the entire disk_partition_t, we should make sure that all fields
are valid.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
---
v3: New patch.
FAT: implement fat_set_blk_dev(), convert cmd_fat.c

This makes the FAT filesystem API more consistent with other block-based
filesystems. If in the future standard multi-filesystem commands such as
"ls" or "load" are implemented, having FAT work the same way as other
filesystems will be necessary.

Convert cmd_fat.c to the new API, so the code looks more like other files
implementing the same commands for other filesystems.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
---
v3: Rebase on new fat.c cleanup patch.
v2: Fix inverted test of get_partition_info() result in fat_register_device().
fs: delete unused Makefile

fs/Makefile is unused. The top-level Makefile sets LIBS-y += fs/xxx and
hence causes make to directly descend two directory levels into each
individual filesystem, and it never descends into fs/ itself.

So, delete this useless file.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
---
v2: No change.