Commit Graph

49715 Commits

Author SHA1 Message Date
Sven Schwermer 3739bf7e20 UPSTREAM: usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/
This allows to disable the USB driver model in SPL because it checks
the CONFIG_SPL_DM_USB variable for SPL builds. Nothing changes for
regular non-SPL builds.

Conflicts:
	drivers/usb/host/ehci-atmel.c
	drivers/usb/host/xhci-fsl.c

Change-Id: If6c980c620cf97c1dd131f60953c305e34dba505
Signed-off-by: Sven Schwermer <sven@svenschwermer.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit fd09c205fc57b90a782cac33449ef172575d0a8c)
2020-01-07 17:24:53 +08:00
Ramon Fried 796dd72a95 UPSTREAM: ehci: msm: Add missing platdata
platdata_auto_alloc_size was not initialized in structure.
Caused null pointer dereference when configuring device as
gadget.

Change-Id: Ia4e8b681de09fa290a1031bd43240ac2603d494b
Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 2df49234c6508052ed02602f882d3ce0332d937f)
2020-01-07 17:24:53 +08:00
Patrice Chotard 4e900a7dc3 UPSTREAM: usb: ehci-generic: Add vbus-supply regulator support
Add vbus-supply regulator support.
On some board vbus is not controlled by the phy but by
an external regulator.

Change-Id: I1d2851dd9bc1294d0e7bbeff3e6695ca1235d247
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 5c349e179db794eff99dd5d3bbac6845d173709e)
2020-01-07 17:24:53 +08:00
Ley Foon Tan a1bebf3735 UPSTREAM: usb: dwc2: Add reset ctrl to driver
Add code to reset all reset signals as in usb DT node. A reset property
is an optional feature, so only print out a warning and do not fail if a
reset property is not present.

If a reset property is discovered, then use it to deassert, thus
bringing the IP out of reset.

Change-Id: I1c8560b20900d65d628c05df20f5e6e5555bc2cf
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 88c34b8da62cfb4188ff9a59acb32f88ce9ed1b0)
2020-01-07 17:24:53 +08:00
Marek Vasut 97147d3ec1 UPSTREAM: usb: ehci: Add PHY support to ehci-pci
Add support for operating a PHY attached to ehci-pci. There are
systems where the EHCI controller is internally wired to a PCI
bus and has a PHY connected to it as well, ie. the R-Car Gen2.

Change-Id: I012fad45af6f59e0e7e2d30dd2a4da578f68bef0
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 1335e7745f77f122cf4196b8da2aa2fc5edad475)
2020-01-07 17:24:53 +08:00
Marek Vasut f5439a16d8 UPSTREAM: usb: ehci: Make the PHY handling generic
Pull out the EHCI PHY functions into the ehci-hcd.c to let other
EHCI drivers use them.

Change-Id: I5b1cbaf7acb4cee6034e891ee7aecf0ca7d50728
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit b43cdf9b3fe246a8920d2b62ee41fc1722315ef0)
2020-01-07 17:24:52 +08:00
Jean-Jacques Hiblot 807262447f UPSTREAM: usb: gadget: Add bcdDevice for the DWC3 USB Gadget Controller
Add an entry in usb_gadget_controller_number() for the DWC3 gadget
controller. Without it, it is not possible to bind the USB Ethernet driver.

Change-Id: I7d911f734aa279418cd43fa1ec9947e33236c35f
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit c73251eac199a54643ead1febde2db0b02970cc6)
2020-01-07 17:24:52 +08:00
Adam Ford b30beda2ae UPSTREAM: usb: musb-new: omap2430: Enable DM_USB and OF support
With upcoming changes that require CONFIG_BLK, this broke
USB Mass Storage on the OMAP3 boards because if CONFIG_BLK is
enabled, it assumes that DM_USB is enabled, but it wasn't yet
available on omap3 and omap4 boards.

This patch converts the OMAP2430 MUSB glue to support DM_USB and
extracts the necessary information based on the device tree.

It's based on the ti-musb driver, but there are enough significant
differences in both the architecture and device tree entires between
am33xx and OMAP3/OMAP4, that I think it makes sense to continue to
keep the separate.

Per doc/driver-model/usb-info.txt, the USB gadget stuff hasn't
migrated to DM_USB yet, so this only supports USB Host for now.

Users wanting USB Gadgets will need to disable DM_USB and leave
it the old way for now.

Change-Id: I07fd347129706d136fadd4d6aa735c5df95cb17e
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 1a35526e1d54a346e12435bee757bfe47093157d)
2020-01-07 17:24:52 +08:00
Adam Ford dbf3d7f8ed UPSTREAM: usb: musb-new: omap2430: Remove dead code
A bunch of code was encapsulated in #ifdef's whether or not
it is building or for U-Boot.  Since this code is always building
for U-Boot, this patch removes the dead code.

Change-Id: If7d6332fb5690cc64a7379304b95221e94071d09
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 10d5ed9a54c5498992ebda56383c23a42bc70438)
2020-01-07 17:24:52 +08:00
Seung-Woo Kim 56578c1b09 UPSTREAM: gadget: f_thor: fix hang-up with ctrl-c
After the commit 6aae84769a0b ("gadget: f_thor: Fix memory leaks of
usb request and its buffer"), there is hang-up with ctrl-c in some
udc. It is because req of out_ep is freed before out_ep is disabled.
Fix hang-up with ctrl-c by disabling ep before free req of the ep.

Change-Id: I39257664aa47501172a217c39727a9f1ef66bc17
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit c194bdf226030e45bcb2db3dcbb2d72e5052820a)
2020-01-07 17:24:52 +08:00
Emmanuel Vadot b56d3e0f20 UPSTREAM: usb: dwc2: Add brcm,bcm2708-usb compatible
When using CONFIG_OF_BOARD on rpi to use the dtb provided by the
RaspberryPi Fundation, the compatible string isn't the same, resulting
in not-functional usb from u-boot.

Change-Id: I1e780fe22dac4a19f099c6cf071c6be5e8eafea0
Signed-off-by: Oleksandr Tymoshenko <gonzo@FreeBSD.org>
Signed-off-by: Emmanuel Vadot <manu@freebsd.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit ff5d5cc2331033c8a6987bb644827b52484160d9)
2020-01-07 17:24:52 +08:00
Andrew Thomas 73b4df6a98 UPSTREAM: dwc2 USB controller hangs with lan78xx
This bug is the combination of dwc2 USB controller and lan78xx
USB ethernet controller, which is the combination in use on
the Raspberry Pi Model 3 B+.

When the host attempts to receive a packet, but a packet has not
arrived, the lan78xx controller responds by setting BIR
(Bulk-In Empty Response) to NAK. Unfortunately, this hangs
the USB controller and requires the USB controller to
be reset.

The fix proposed is to have the lan78xx controller respond
by setting BIR to ZLP.

Change-Id: I42751eefc9b2f449f550f129a76ab1ce4288d184
Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit af15946aa081dbcd0bec7d507a2b2db4e6b6cda5)
2020-01-07 17:24:52 +08:00
Bin Meng 4cdd770b03 UPSTREAM: usb: xhci-pci: Fix compiler warning
This fixes the following compiler warning:

  "warning: cast from pointer to integer of different size
  [-Wpointer-to-int-cast]"

Change-Id: I4e47b2bcb02dbc59ccc4f471d86bcc6d901eeec7
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 9fddf6c7dd9dca493969d4ebd5e5fc2b2e21be9c)
2020-01-07 17:24:52 +08:00
Michal Simek 391af51a35 UPSTREAM: usb: xhci: zynqmp: Fix header location
There is no reason to specify header with full soc name.
Symlink is setup automatically (arch -> arch-zynqmp)

Change-Id: I00fcdab4aafd7f4a6a32c6258bedde4af2212c6a
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit b168591c899e869dc4fcd71752cbe32c91355348)
2020-01-07 17:24:52 +08:00
Seung-Woo Kim 2ec502ebe9 UPSTREAM: gadget: f_thor: Fix memory leaks of usb request and its buffer
There are memory leaks of usb request and its buffer for ep0,
in_ep, and out ep. Fix memory leaks of usb request and its buffer.

Change-Id: Ia0d3c872c06b16057d07ff1dfd9331a7ebef588f
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 6aae84769a0be095daf94d34fdd61b12d59a7022)
2020-01-07 17:24:52 +08:00
Philipp Tomsich 54ed217144 UPSTREAM: rockchip: xhci: remove DTS parsing for PHY (which is unused)
The xhci wrapper-driver for Rockchip searches the DTS to find its
child node compatbile with 'rockchip,rk3399-usb3-phy' to retrieve the
base-address of the PHY.  However, this is currently broken (and
always has been), returning NULL.  However, the (wrongly) retrieved
base-address is never used.

We thus remove this code for now.

Change-Id: Ie62ad30b6faae8eb8f483aa9d9d43923ffee6020
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit afa314d3a37797bd88c9a379a6fa150e6829fdf9)
2020-01-07 17:24:51 +08:00
Bin Meng affcda62ec UPSTREAM: usb: xhci: Handle endianness in xhci_set_configuration()
In xhci_set_configuration(), 'Context Entries' field in the slot
context was cleared with mask LAST_CTX_MASK, but it should have
taken the endianness into consideration.

Change-Id: I5d6b94d213751151b7b8180d01e88c5ce5bf9f5a
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit e40406603fe22a5b18d7e8ac7a2eb0f2d2b13cf1)
2020-01-07 17:24:51 +08:00
Bin Meng fc48a70cf1 UPSTREAM: usb: xhci: Fix config fail of FS hub behind a HS hub with MTT
If a full speed hub connects to a high speed hub which supports MTT,
the MTT field of its slot context will be set to 1 when xHCI driver
setups an xHCI virtual device in xhci_setup_addressable_virt_dev().
Once usb core fetch its hub descriptor, and need to update the xHC's
internal data structures for the device, the HUB field of its slot
context will be set to 1 too, meanwhile MTT is also set before, this
will cause configure endpoint command fail. In the case, we should
clear MTT to 0 for full speed hub according to section 6.2.2.

This keeps in sync with Linux kernel commit:
  096b110: usb: xhci: fix config fail of FS hub behind a HS hub with MTT

Change-Id: I48538e3d150f79f9bca591b0a4527cf9c5d7a2ba
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit eaaefb066c86f08fb285e73fb8c5fbf497be6b57)
2020-01-07 17:24:51 +08:00
Bin Meng 02d2355842 UPSTREAM: usb: xhci: Initialize dev_state to 0 in the input slot context
Per xHCI spec chapter 6.2.2 table 6-7, as input, software shall
initialize the dev_state field to '0'. Though this does not seem
to cause any issue with most xHC implementations, let's do this
to conform with the spec.

Change-Id: I604a4c9edb9b88b25ba96e16d6f7013bee64df8c
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Marek Vasut <marek.vasut@gmail.com>
Tested-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit ae751b060e8cee3f9c48112898cd3e31ee6c0734)
2020-01-07 17:24:51 +08:00
Bin Meng d222f63d8e UPSTREAM: usb: xhci: Set accurate add context flags when updating hub attributes
If a USB 3.0 hub is plugged into the root port of the xHC, the xHCI
driver will issue a 'Configure Endpoint' command to the xHC for it
to update its internal data structure for this hub device. The hub
attributes are in the slot context so we need tell xHC to update the
slot context by setting the add context flags of the input control
context to only cover the slot context.

At present the add context flags is or'ed with the slot context bit,
but it should really be accurately set to the slot context, as the
variable that holds the value of the add context flags comes from
whatever was set in the last command execution, which may contain
additional contexts that 'Configure Endpoint' command should not
touch. Some xHC implementations like x86 don't complain such, but
it was observed on Renesas RCar Gen3 platform that the RCar xHC
complains with a 'TRB error' completion codes as the response.

Change-Id: I5141a85024ea60c3dbb7bde5b6a6811142ce1f8b
Reported-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Marek Vasut <marek.vasut@gmail.com>
Tested-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 793c819c6e2168110ad7cfca0349738c79d79a1f)
2020-01-07 17:24:51 +08:00
Matthias Blankertz 2e8806dedd UPSTREAM: usb: xhci-rcar: deregister before deactivating clock
During the execution of xhci_deregister xHCI registers are accessed. If
the clock is already deactivated when xhci_deregister is called this can
lead to undefined behavior. Change the order to deregister the device
before deactivating the clock.

Change-Id: I038a8b46e8ebf7733dc850aaeb2915add0fc79ce
Signed-off-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 3f484226793166c75bd56784832d4c1a84061ad5)
2020-01-07 17:24:51 +08:00
Jagan Teki a63699a614 UPSTREAM: usb: sunxi: Simplify ccm reg base code
Move struct sunxi_ccm_reg pointer to private structure
so-that accessing ccm reg base become more proper way
and avoid local initialization in each function.

Change-Id: Ic3b1456368fc6395b09a93a5535191bc78e7c0b7
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 831cc98b1f8cf81cf34185e34b2021e2766eb4d8)
2020-01-07 17:24:51 +08:00
Michal Simek e4371f1f16 UPSTREAM: usb: xhci: zynqmp: Remove support for !DM_USB
Switch to DM_USB was done and there is no need to keep !DM_USB code in
tree.

Change-Id: Ib39e8431dbad9fa330d70235bb48bfb03d942f1b
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit d067624c47bf15b9b5b716ae8be510fa1fb615a2)
2020-01-07 17:24:51 +08:00
Michal Simek 171274d78a UPSTREAM: usb: xhci: zynqmp: Add support for DM_USB
The patch is adding support for DM_USB for xhci driver.

Change-Id: I329d442af804384d5749d1559d7ffcc36362715f
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 41a3d4fda4377e971c4fbc7d0b7f335f2c4373ad)
2020-01-07 17:24:51 +08:00
Mugunthan V N 81cd885546 UPSTREAM: usb: common: add support to get maximum speed from dt
Add support to get maximum speed from dt so that usb drivers
makes use of it for DT parsing.

Change-Id: I3c809fd822813efbb5d7494c36803eb9f502e466
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
(rebase and fix errors)
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 59592b99d884f0524a29afe4a412bbed65cfc5b7)
2020-01-07 17:24:51 +08:00
Seung-Woo Kim 667c22550f UPSTREAM: gadget: f_thor: update to support more than 4GB file as thor 5.0
During file download, it only uses 32bit variable for file size and
it limits maximum file size less than 4GB. Update to support more
than 4GB file with using two 32bit variables for file size as thor
protocol 5.0.

Change-Id: If855ff85ef1984ac77d9caa6c49c99f32798121f
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 1fe9ae76b113103bcc40aa15949f9dd8aa0a06a2)
2020-01-07 17:24:50 +08:00
Seung-Woo Kim 57086a026f UPSTREAM: gadget: f_thor: fix filename overflow
The thor sender can send filename without null character and it is
used without consideration of overflow. Actually, character array
for filename is assigned with DEFINE_CACHE_ALIGN_BUFFER() and it
is bigger than size of memcpy, so there was no real overflow.
Fix filename overflow for code level integrity.

Change-Id: Ie6f2fdd29fede8f26ae72a6048204b9cc8ece3ed
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit f9e8dc0abda94869d2734843c1c14ba6f2867031)
2020-01-07 17:24:50 +08:00
Bryan O'Donoghue 43156a850e UPSTREAM: usb: composite convert __set_bit to generic_set_bit
Compiling the f_mass_storage driver for an x86 target results in a
compilation error as set_bit and clear_bit are provided by bitops.h

To address that situation we discussed on the list moving to
genetic_set_bit() instead.

Doing a quick grep for similar situations in drivers/usb shows that the
composite device is using __set_bit().

This patch switches over to generic_set_bit to maintain consistency between
the two gadget drivers.

Change-Id: I2716277c00dd9309d2fe57e4aa68c18ada82ef1a
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 31dd8efeb661c8dbffff9175a09cf2bab090906a)
2020-01-07 17:24:50 +08:00
Bryan O'Donoghue aa10d76eac UPSTREAM: usb: f_mass_storage: Fix set_bit and clear_bit usage
Compiling the f_mass_storage driver for an x86 target results in a
compilation error as set_bit and clear_bit are provided by bitops.h

Looking at the provenance of the current u-boot code and the git change
history in the kernel, it looks like we have a local copy of set_bit and
clear_bit as a hold-over from porting the Linux driver into u-boot.

These days __set_bit and __clear_bit are optionally provided by an arch and
can be used as inputs to generic_bit_set and generic_bit_clear.

This patch switches over to generic_set_bit and generic_clear_bit to
accommodate.

Tested on i.MX WaRP7 and Intel Edison

Change-Id: Ic7a56f08dcd5782a963a935df8217f5fdb605ee2
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 5ac73f6879327beef45bc58484f1f09c2f0cb37c)
2020-01-07 17:24:50 +08:00
Neil Armstrong 0afa4b6c53 UPSTREAM: clk: add sandbox test for bulk API
This patch adds the bulk clock API tests for the sandbox test suite.

It's very similar to the main test but only uses the _bulk() API and
checks if the clocks are correctly enabled/disabled.

Change-Id: Ibfd7ea033e9a1c2ca76d88be8ca562a660f30448
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 65388d0dc5a36fc86718ffcdf08ac5671ae27b5d)
2020-01-07 17:24:50 +08:00
Neil Armstrong 977da8af08 UPSTREAM: clk: Add get/enable/disable/release for a bulk of clocks
This patch adds a "bulk" API to the clock API in order to get/enable/disable
/release a group of clocks associated with a device.

This bulk API will avoid adding a copy of the same code to manage
a group of clocks in drivers.

Conflicts:
	drivers/clk/clk-uclass.c

Change-Id: I7f992b206662bf5f931a835d98b3e3cd0f4347f1
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit a855be87da49ba750e83ecc526235fe33099f76e)
2020-01-07 17:24:50 +08:00
Neil Armstrong 2a2b09e3d9 UPSTREAM: reset: fix bulk API when DM_RESET is disabled
In the commit "reset: Add get/assert/deassert/release for bulk of reset signals"
the disabled reset_release_bulk() and reset_get_bulk() used the wrong
struct clk_bulk instead of struct reset_ctl_bulk.

Change-Id: Id98f7a6f6f4d5f2fca88f71b6254ca3795888d85
Fixes: 0c28233903b5 ("reset: Add get/assert/deassert/release for bulk of reset signals")
Reported-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 1dd181ff2b3009405d12ad0b3782176490da2446)
2020-01-07 17:24:50 +08:00
Neil Armstrong f7a4178d8b UPSTREAM: reset: add sandbox test for bulk API
This patch adds the bulk reset API tests for the sandbox test suite.

Unlike the main test, it also check the "other" reset signal using the bulk API
and checks if the resets are correctly asserted/deasserted.

To allow the bulk API to work, and avoid changing the DT, the number of resets
of the sandbox reset controller has been bumped to 101 for the "other" reset
line to be valid.

Change-Id: Iac62a1c6ee5637695f7d0dd77b35f047eca641a9
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 91f5f8b73ccba5bf591912fe6e8c500a7d51eb93)
2020-01-07 17:24:50 +08:00
Neil Armstrong d794029665 UPSTREAM: reset: Add get/assert/deassert/release for bulk of reset signals
This patch adds a "bulk" API to the reset API in order to get/deassert/
assert/release a group of reset signals associated with a device.

This bulk API will avoid adding a copy of the same code to manage
a group of reset signals in drivers.

Change-Id: Iabad4ac36791622b6560cff8aafc6bfbc4c9bde3
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 0c28233903b5af9a7f41b3200993cfa197b35719)
2020-01-07 17:24:50 +08:00
Heinrich Schuchardt 75b27a42f1 UPSTREAM: usb: f_mass_storage: simplify logical expression
An unsigned int is always >= 0.

Change-Id: Iba5723469069b0155bcaca876071e32679a0437d
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 48cdfa2f8177dbdfc77c365c0f3f918ceadbe484)
2020-01-07 17:24:50 +08:00
Heinrich Schuchardt dd2dbc2675 UPSTREAM: usb: gadget: remove duplicate assignment.
We should not make the same assignement twice.

Change-Id: Ic68e484297b575ff965b3dc21a9a2d7ce06bc08c
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit fa9da8ee60a7387b9e9b0358bd73ef5dbc73736c)
2020-01-07 17:24:49 +08:00
Alex Kiernan 310695f3d2 UPSTREAM: spl: disk: usb: Add dependencies to sprintf/strto*
If SPL serial support is disabled nothing brings in sprintf, snprintf
or simple_strtoul:

  env/built-in.o: In function `regex_callback':
  env/attr.c:128: undefined reference to `sprintf'
  disk/built-in.o: In function `blk_get_device_by_str':
  disk/part.c:386: undefined reference to `simple_strtoul'
  disk/part.c:395: undefined reference to `simple_strtoul'
  disk/built-in.o: In function `blk_get_device_part_str':
  disk/part.c:522: undefined reference to `simple_strtoul'
  disk/built-in.o: In function `part_set_generic_name':
  disk/part.c:704: undefined reference to `sprintf'
  drivers/built-in.o: In function `init_peripheral_ep':
  drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf'
  drivers/built-in.o: In function `musb_core_init':
  drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf'

Add those dependencies here.

Change-Id: I3512dc53bc93a556aee250d98d1a5977d9e2a537
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit ab9e12f651d9211aa0d3c9b9e579c38bd8704054)
2020-01-07 17:24:49 +08:00
Christophe Kerello 088d8eb9be UPSTREAM: usb: gadget: composite: fix NULL pointer when a non standard request is received
In case usb configuration is unknown (cdev->config == NULL), non standard
request should not be processed.
Remove also the cdev->config check below which will never happen.

This issue was seen using ums feature.

Change-Id: I6930deeceadf0eff8e4bfbfb6fdfb254d47a4c83
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit d57ed4d9f2cb6abc9438104f321b4fe3bc829d57)
2020-01-07 17:24:49 +08:00
Neil Armstrong 3056fcd356 UPSTREAM: usb: host: dwc3: fix phys init
When no PHYs are declared in the dwc3 node, the phy init fails.
This patch checks if the "phys" property is presend and reports
the error returned by dev_count_phandle_with_args().

This patchs also fixes the styles issues added in last commit.

This patch should fix the DWC3 support on the UniPhier SoC family.

Change-Id: I59c50f81dfd695a2a8047ed13c1af21af64b044b
Fixes: 7c839ea70c49 ("usb: host: dwc3: Add support for multiple PHYs")
Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 003659bda94a1444ebdfefea3f0928f8e90f9d8f)
2020-01-07 17:24:49 +08:00
Neil Armstrong 2aad62fa1b UPSTREAM: usb: dwc3-of-simple: fix error check of clk_get_bulk when disabled
The disabled clk API returns -ENOSYS unlike the reset API returning -ENOTSUPP.

Change-Id: I4473e78c1ebc5c945515694b4041b22a48f36d34
Fixes: ca7fdc8b1267 ("usb: host: Add simple of glue driver for DWC3 USB Controllers integration")
Reported-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 38276090ee7fda6b31cac638d8c5f4fb61f57b0b)
2020-01-07 17:24:49 +08:00
Jean-Jacques Hiblot dc229bd7f9 UPSTREAM: usb: dwc3-of-simple: Add support for DRA7/AM57 platforms.
Add the compatibility with "ti,dwc3" and enable it by default if DM_USB
is enabled.

Change-Id: Ic0a89dad93c6ec22102a0475b802da80e76fbb09
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit cc73ba97c008e96df5799dc37acbb04344fb3ac6)
2020-01-07 17:24:49 +08:00
Jean-Jacques Hiblot 9c0fd9e684 UPSTREAM: usb: dwc3-of-simple: Fix dependencies
This simple glue layer does not require CONFIG_MISC, but it does require
CONFIG_DM_USB.

Change-Id: I02e2b228cd259f4ee25bcdcb501f92e7ecbb9242
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 103774b71cc0e510f890f639f9c3a65ad9d005c9)
2020-01-07 17:24:49 +08:00
Neil Armstrong 3cdbc0574b UPSTREAM: usb: host: dwc3: Add support for multiple PHYs
DWC3 Ips can have more than 1 PHY for USB2 and 1 PHY for USB3, add support
for a generic number of PHYs and adapt the code to handle a generic
number of PHYs.

Change-Id: Iaea6c612c8b4c8b2bc0e03303e45371db5630c35
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 7c839ea70c4991e8d4c322e074359ac5e155d59d)
2020-01-07 17:24:49 +08:00
Neil Armstrong 8e0c702beb UPSTREAM: usb: host: Add simple of glue driver for DWC3 USB Controllers integration
This is a port of the dwc3-of-simple driver from Linux to enable/deassert
clock and resets of a simple DWC3 Controller HW glue.

Change-Id: I9fa64dcd401e3946a1924ef249b64f419f76fe0c
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit ca7fdc8b1267ad0189060c853502761086c8d74a)
2020-01-07 17:24:49 +08:00
Alex Kiernan 9781b677e0 UPSTREAM: usb: gadget: USB_ETHER requires network support
In order to compile the USB Ethernet gadget support we require that NET
is enabled, add that dependency here.

Conflicts:
	drivers/usb/gadget/Kconfig

Change-Id: I776612d3d67944646400ec9ca220652cb040803f
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
(cherry picked from commit a18d1064db93490422b968bac1a9e10387a34cfc)
2020-01-07 17:24:49 +08:00
Patrice Chotard 071d6bebbd UPSTREAM: usb: dwc2: Replace printf, pr_err by dev_info, dev_err
Replace printf() call by dev_info() and pr_err() by dev_err()

Change-Id: I841f5ef56885e225d4903aad92b3f83b724a8e30
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit ac6c796c3f5c7b7594cf4ecede8cd8fb8d2611ba)
2020-01-07 17:24:48 +08:00
Christophe Kerello 8d1c811e5c UPSTREAM: usb: dwc2: increase timeout in wait_for_chhltd
This patch increases timeout to 2s.
It was seen on 2 USB devices (Verbatim STORE N GO 070B4AED0FB22358 and
USB DISK 2.0 9000729BA41DDF40) that the request sense command takes
between 1.3s and and 1.5s.

Change-Id: I3e241e2c731298cf238b31deea2785a08c012b73
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit c2e4c8656978302ff2846a655fb87c658220c4e0)
2020-01-07 17:24:48 +08:00
Patrice Chotard f7dd21876b UPSTREAM: usb: ohci-generic: replace pr_err() by dev_err()
As we get access to struct udevice, use dev_err() instead
of pr_err().

Conflicts:
	drivers/usb/host/ohci-generic.c

Change-Id: Iead8650006d027d32910cd3dae24d934326f578f
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
(cherry picked from commit 6048d42fa7a2b97913db9a033675bf267fb4e030)
2020-01-07 17:24:48 +08:00
Patrice Chotard 8a1be4739b UPSTREAM: usb: ohci-generic: factorize PHY operation
Factorize PHY get/init/poweron and PHY poweroff/exit operations
into separate function, it simplify the error path.

Change-Id: I191c2690754972d689d6e4bbed0f5582a7f64a27
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit cab4d48a939537ab10e00429fc774825b743ed10)
2020-01-07 17:24:48 +08:00
Patrice Chotard 324810fcc3 UPSTREAM: usb: ohci-generic: handle phy power on/off
Add generic_phy_power_on() and generic_phy_power_off()
calls to switch ON/OFF phy during probe and remove functions.

Change-Id: Iea4dcb865e7c23c016e23601b20c77933258da87
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 633e1ec6bf7131d3c8fecbb4adcc96e17925a015)
2020-01-07 17:24:48 +08:00