APPLIED: 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: 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>
Acked-by: Stefan Roese <sr@denx.de> # for ppc4xx
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...
APPLIED: hush: fix some quoted variable expansion issues

The following shell command fails:

if test -z "$x"; then echo "zero"; else echo "non-zero"; fi

(assuming $x does not exist, it prints "non-zero" rather than "zero").

... since "$x" expands to nothing, and the argument is completely
dropped, causing too few to be passed to -z, causing cmd_test() to
error out early.

This is because when variable expansions are processed by make_string(),
the expanded results are concatenated back into a new string. However,
no quoting is applied when doing so, so any empty variables simply don't
generate any parameter when the combined string is parsed again.

Fix this by explicitly replacing quoting any argument that was originally
quoted when re-generating a string from the already-parsed argument list.

This also fixes loss of whitespace in commands such as:

setenv space " "
setenv var " 1${space}${space} 2 "
echo ">>${var}<<"

Reported-by: Russell King <linux@arm.linux.org.uk>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
v3:
* Added a few more comments.
v2:
* Save the "nonnull" value from the argument parser, and pass this to
  make_string(), so that it only quotes the values in the resultant
  string if the original value was quoted.
* Add some more unit tests to ensure that whitespace in quoted text is
  expanded and re-concatenated without loss.
* Revert accidental s/SUBSTED_VAR_SYMBOL/q/
APPLIED: unit-test: clean up evironment after Hush tests

Delete the temporary variables that are used to save unit-test results
from the environment after running the test. This prevents polluting
the environment, or growing it too much.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Simon Glass <sjg@chromium.org>
APPLIED: unit-test: make "test -e" test independent of $CWD

The unit-test for hush's "test -e" currently relies upon being run in
the U-Boot build directory, because it tests for the existence of a file
that exists in that directory.

Fix this by explicitly creating the file we use for the existence test,
and deleting it afterwards so that multiple successive unit-test
invocations succeed. This required adding an os.c function to erase
files.

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
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>