APPLIED: ARM: rpi_b: set $fdtfile in default environment

U-Boot names the Raspberry Pi board rpi_b. This means that the common
expression for DTB filename ${soc}-${board}.dtb expands to
bcm2835-rpi_b.dtb. However, the DTB generated by the Linux kernel is
bcm2835-rpi-b.dtb. Set $fdtfile in U-Boot's environment so that scripts
look for the correct DTB filename.

An alternative would be to rename the U-Boot board to rpi-b. However,
that change would be far more invasive, and end up affecting users (i.e
they'd have to change their U-Boot build commands).

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
APPLIED: ARM: bcm2835: config.mk isn't needed

The entries in config.mk were needed so that U-Boot could be built
with an old version of the Raspberry Pi Foundation's toolchain. Without
them, the build would error out with:

...-ld: error: .../libgcc.a(_bswapsi2.o) uses VFP register arguments,
u-boot does not

However, none of the 3 toolchains in the latest version of their
tools.git, nor the Ubuntu/Linaro ARM compilers in at least Ubuntu Quantal
or Saucy, need these options set in order to compile a working U-Boot.
Hence, remove the options for simplicity.

Reported-by: Tom Rini <trini@ti.com>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
pxe: allow compilation when !defined(CONFIG_CMD_NET)

pxe.c provides both the "pxe" command which relies on a network, and the
"sysboot" command which doesn't. Fix the file to compile when network
support isn't enabled. This is useful e.g. on the Raspberry Pi which has
no network support yet, but will soon support the sysboot command.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
v2: No change.

This patch doesn't appear to depend on anything much, but is needed by
the rest of this series. Given the dependencies in the rest of this
series, either (a) this one patch can be applied to u-boot/master, and
then u-boot/arm can merge that in before the rest of the series, or (b)
u-boot/master can be merged into u-boot-arm/master, then this whole
series applied there.
ARM: rpi_b: convert to use distro defaults

Modify the rpi_b board to include the "distro defaults" header, so that
all the config options distros expect are enabled. Remove any #defines
that enable the same options from the rpi_b.h.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
v2: No change.

Patches 2/4 and 4/4 depend on various patches in u-boot/master, so that
will need to be merged into u-boot-arm/master if this series gets applied
there. In particular, "config: add config_distro_defaults.h" and various
patches before that are required.
ARM: rpi_b: load /uEnv.txt from MMC at startup

The Pi has no flash to store an environment in the usual fashion. However,
the user may wish to customize the environment. We know that the SD card
must be present, since that's where the boot ROM has loaded U-Boot from.
So, load uEnv.txt from there early during boot. This allows the user to
e.g. customize boot_targets, in order to automatically select network
boot.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
v2: No change.
ARM: rpi_b: rework boot scripts, enable sysboot

Rework rpi_b's bootcmd (and sub-commands) to match Tegra's bootcmd as
much as possible. This will aid in a future patch which will create a
common header e.g. config_distro_bootcmd.h.

While at it, enable booting from extlinux.conf using the sysboot command.

The iteration and componentization currently makes a little more sense
for Tegra than RPi, but I'd still like to keep the two as similar as
possible. USB and networking support is coming to the RPi in due course,
and it'll all make more sense then anyway.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
v3:
* Look for extlinux.conf in ${prefix}extlinux/ instead of ${prefix}
v2:
* Replace ; in the middle of echo'd text in boot scripts.
* Add missing space between commands in boot scripts.
ARM: bcm2835: fix mbox POWER_STATE_RESP_ON value

Typo: The correct value is 1 not 2.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
usb: create common header virtual root hub descriptors

Many USB host controller drivers contain almost identical copies of the
same virtual root hub descriptors. Put these into a common file to avoid
duplication.

Note that there were some very minor differences between the descriptors
in the various files, such as:

- USB 1.0 vs. USB 1.1
- Manufacturer/Device ID
- Max packet size
- String content

I assume these aren't relevant.

Cc: Thomas Lange <thomas@corelatus.se>
Cc: Shinya Kuribayashi <skuribay@pobox.com>
Cc: Gary Jennejohn <garyj@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Eric Millbrandt <emillbrandt@coldhaus.com>
Cc: Pierre Aubert <p.aubert@staubli.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Cc: Denis Peter <d.peter@mpl.ch>
Cc: Rodolfo Giometti <giometti@linux.it>
Cc: Zhang Wei <wei.zhang@freescale.com>
Cc: Mateusz Zalega <m.zalega@samsung.com>
Cc: Remy Bohmer <linux@bohmer.net>
Cc: Markus Klotzbuecher <mk@denx.de>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Gary Jennejohn <garyj@denx.de>
Cc: C Nauman <cnauman@diagraph.com>
Cc: David Müller <d.mueller@elsoft.ch>
Cc: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Thomas Abraham <t-abraham@ti.com>
Cc: Tom Rini <trini@ti.com>
Cc: Andrew Murray <amurray@embedded-bits.co.uk>
Cc: Matej Frančeškin <matej.franceskin@comtrade.com>
Cc: Cliff Cai <cliff.cai@analog.com>
Cc: Bryan Wu <cooloney@gmail.com>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
Repost: Marek asked me to resend this Cc to the maintainers of the various
edited files. If you're CC'd, could you please check that the minor
differences in the descriptor content between the new header and your
driver isn't going to be an issue. It's pretty unclear who the maintainer
is for many of the files, so I've had to cast a fairly wide net...
usb: add driver for Synopsis DWC2 USB IP block

This is the USB host controller used on the Raspbery Pi.

swarren changelog:
* Fixed prototype of usb_lowlevel_init() to match upstream change.
* Fixed a number of unused variable warnings.
* Replaced license headers with SPDX tags.
* Renamed files DWC -> DWC2 to make it clear which HW it's for.
* Many hundreds of checkpatch fixes.

Signed-off-by: Oleksandr Tymoshenko <gonzo@bluezbox.com>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
I've fixed all the checkpatch errors. There are hundreds of warnings left.
Still, I figured it was a good idea to post the patch for review of any
other aspects.
fixup dwc2: s/printf/puts/ where possible

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
fixup dwc2: use DEFINE_ALIGN_BUFFER rather than open-coded alignment

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
fixup dwc2: use mdelay rather than udelay for large delays

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
fixup dwc2: use errno.h constants

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
fixup dwc2: #define some magic constants

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
fixup dwc2: use <usbroothubdes.h>

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
ARM: rpi_b: enable USB features in config

* Enable USB HW driver
* Don't disable USB-related commands any more
* Add USB-related support to bootcmd

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
fixup rpi_b: enable USB features in config

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
ARM: rpi_b: query internal MAC address from firmware

The built-in SMSC 95xx chip doesn't know its own MAC address. Instead,
we must query it from the VC firmware; it's probably encoded in fuses
on the BCM2835.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
LOCAL: ARM: rpi_b: add script to chain-load U-Boot over DHCP/TFTP

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>