Commit Graph

49786 Commits

Author SHA1 Message Date
Michal Suchanek 92937b1f66 UPSTREAM: usb: Add nonblock argument to submit_int_msg
This will be used to implement non-blocking keyboard polling in case of
errors.

Conflicts:
	common/usb.c
	common/usb_kbd.c
	common/usb_storage.c
	include/usb.h

Change-Id: I4a951d779e2cf9e80380f93000a87a617453fb32
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 3437121c037f502a3b0faaec97059777034a1ead)
2020-01-07 17:25:00 +08:00
Neil Armstrong 5e8c228de7 UPSTREAM: usb: xhci-dwc3: Add support for dis_u2_susphy_quirk
This quirk is necessary for the Amlogic GXL SoCs otherwise the
Port 2 PHY doesn't get out of suspend and U-Boot resets the board after:

XHCI timeout on event type 33... cannot recover.
BUG: failure at drivers/usb/host/xhci-ring.c:474/xhci_wait_for_event()!
BUG!

This quirk is also handled in the dwc3 core code, but until the
xhci-dwc3 driver uses the dwc3 core, the quirk must be handled here
to fix USB support on the Amlogic libretech-cc and libretech-ac board
when a device is only plugged in the OTG port.

Change-Id: Iba72fb52411856785b6bd6ed829e1585ba00bebe
Cc: Yuri Frolov <crashing.kernel@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Fixes: dc9cdf859e ("usb: dwc3: Add DWC3 controller driver support")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit b35b8076828d1059c1fcc648ed8c8210ebe6a3dd)
2020-01-07 17:25:00 +08:00
Marek Vasut d3b04da041 UPSTREAM: usb: r8a66597: Add optional DM VBUS regulator support
Add DM regulator support for toggling VBUS, this is useful on boards
which control the VBUS e.g. through GPIO.

Change-Id: I0f6e296d34613ada8d7e96a8ec86a4288614822c
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 769a9cd4bbd7ae9b8170b3dd6ba54b84fde59224)
2020-01-07 17:25:00 +08:00
Marek Vasut 22941b48da UPSTREAM: usb: r8a66597: Checkpatch cleanup
Fix remaining checkpatch complaints in the driver.

Change-Id: Ic58362d2e4a9a6a560ceb5c12fbfb502b814ad6f
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 8b5483015496100b3f5a790a58cc3019815654e0)
2020-01-07 17:25:00 +08:00
Marek Vasut deb45038aa UPSTREAM: usb: r8a66597: Add Kconfig entry
Add missing Kconfig entry for the R8A66597 driver.

Change-Id: I8f476bc44995b1aaf296a3b9105e8e2d42876c20
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit a3d65651d9dd1b65722c21bf739d1e9978320a47)
2020-01-07 17:25:00 +08:00
Marek Vasut 1e9a8859b7 UPSTREAM: usb: r8a66597: Convert to USB DM
Convert the R8A66597 USB driver to DM and add support for DT probing.
Drop support for legacy non-DM and non-DT probing, since there are no
platform using that.

Change-Id: Ic4a15ca6cdbea7782257b37683a62a971f4902bc
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 7f3858f90d01cca631d7c6b40301618af060acd7)
2020-01-07 17:25:00 +08:00
Marek Vasut f6833e50d9 UPSTREAM: usb: r8a66597: Remove BE support
While the USB controller can work both in LE and BE modes, there is
no user for the BE mode, so drop it. If there ever is a user for it,
it can be easily re-added back.

Change-Id: Icbafe9f751113a669c5322af618bcc27bf20ac75
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 81644e01c02967edd3da7eb6c776478a34fa7370)
2020-01-07 17:25:00 +08:00
Marek Vasut 1dc8df6a64 UPSTREAM: usb: r8a66597: Replace IO accessors
Replace in{bwl}()/out{bwl}() IO accessors with read{bwl}()/write{bwl}(),
to make the driver compile both on SH and ARM.

Change-Id: I5fc72a93b162d7473a3717a07bfdcd88fe455ec5
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 4c9a135715ad80ec10a9e642d35e3bbf1535fe56)
2020-01-07 17:25:00 +08:00
Marek Vasut 7a9643b134 UPSTREAM: usb: r8a66597: Make CONFIG_RZA_USB default
No other platforms use this r8a66597 controller but RZ/A1,
make RZ/A1 support the default and drop all the other SoC
support to remove ifdeffery.

Change-Id: I15bd3497d23c34c6cd43c849f09ec3904ec898da
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 3ff134b7f1c06f8482ef8ab296d5a89743d219db)
2020-01-07 17:25:00 +08:00
Marek Vasut 5899aea64a UPSTREAM: usb: r8a66597: Remove CONFIG_SUPERH_ON_CHIP_R8A66597
Remove CONFIG_SUPERH_ON_CHIP_R8A66597 macro, which is unused.

Change-Id: I27a8ff1b6487ebc2db6ce50fa2b034030e84f156
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 0b80f212824f632f1acb0d74fd932c05a0262fc3)
2020-01-07 17:24:59 +08:00
Ralph Siemsen 2b5fff1c93 UPSTREAM: usb: gadget: f_dfu.c: fix memory leak
dfu_prepare_function() allocates N+1 descriptor header structures,
the last one being the "DFU Functional Descriptor".

dfu_unbind() handles de-allocation, but fails to free the final
one (eg. "DFU Functional Descriptor"), leading to memory leak.

Fixed by incrementing counter, as in dfu_prepare_function().

Change-Id: I990f3874d6e3dca78036d6f30a05e765fbe38c67
Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit fe876984a428cc0058bdb536ac948397762f3c0d)
2020-01-07 17:24:59 +08:00
Heiko Schocher 384b75a5e8 UPSTREAM: usb, ohci, pci: add DM support for PCI-based OHCI USB controller
add new DM based PCI driver ohci-pci for PCI-based
OHCI USB support.

Change-Id: Ie3cb7e552e48eb100cdfc2f7807136297b5563cb
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 991e66017ccd79cf4b89a729433a9606a771bd2b)
2020-01-07 17:24:59 +08:00
Heiko Schocher 53764d8fd5 UPSTREAM: usb, ohci: add warning if none on pci found
Change-Id: I7e7a39a7d3ff257381a63a6bc07f86d1fa16a159
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit f9c7fecbeb938d9a17e31bf7c8766190752790ae)
2020-01-07 17:24:59 +08:00
Heiko Schocher 55f7a84eaa UPSTREAM: usb, ohci-hcd: set OHCI_USE_NPS if DM_PCI
set OHCI_USE_NPS if DM_PCI is enabled.

Change-Id: I75001b7d3c9efdcd448d089ee0e99019a35d9d31
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit dc4e48d845d9971d2b21f99c12f874dd06cedc0a)
2020-01-07 17:24:59 +08:00
Heiko Schocher 27242ba8ac UPSTREAM: usb, ohci: fix ohci swap register access
commit 57faca19a8 ("drivers: USB: OHCI: allow compilation for 64-bit targets")
broke ohci support for the mpc85xx based socrates board,
as it removed volatile keyword from ohci_readl/writel.

Fix this so usb works again on socrates board.

Change-Id: I558791c276aa1641dd735b825ba93f8da8ed0830
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit a5a7486e62b0aa4afa1fe1a3b30f7dd682eb1ff8)
2020-01-07 17:24:59 +08:00
Heiko Schocher da2bd437b7 UPSTREAM: usb, ohci-hdc: fix warning 'ohci_pci_ids' defined but not used
var ohci_pci_ids is only used if DM_USB is not enabled.
So define this varaible only if
!CONFIG_IS_ENABLED(DM_USB)

Change-Id: I2da8e2b51cd2f225e7b452bf5bb0179a2d1e4ee4
Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit b005d7d5f96539450e50450f12491913e135c2a9)
2020-01-07 17:24:59 +08:00
Adam Ford 3e620e502c UPSTREAM: usb: musb-new: Add support for da8xx-musb
With the recently added phy driver, this patch will enable the
musb driver on the da8xx to operate in host mode.

Change-Id: I31da15be4324f43429fddf31323ff9fc648425ae
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 5608331d813630120871d04847b59628ec59f7f9)
2020-01-07 17:24:59 +08:00
Mark Kettenis e16bd00f72 UPSTREAM: usb: xhci-dwc3: Add USB2 PHY configuration
Configure USB2 PHY register based on "phy_type" property and
handle all the quirks that are relevant for Rockchip RK3399 SoCs.

Change-Id: Idac50a031e8e924712fef8ad61a622f8e85f3e86
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 062790f461312f1b954ae876f85da8f6ce5fcc73)
2020-01-07 17:24:59 +08:00
Jean-Jacques Hiblot f44c88f169 UPSTREAM: usb: dwc3: Use UCLASS_NOP instead of UCLASS_MISC for the DWC3 generic glue
dwc3-generic has been broken since MISC uclass has been modified to scan DT
sub-nodes after bind.
Fixing it by a using the no-op uclass.

Change-Id: Id95c49a16951cbe8bc7e58d8a3f85a7372ffd00a
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 3b83829ed63fabe460592395571c1d8fd9b861c8)
2020-01-07 17:24:59 +08:00
Jean-Jacques Hiblot 8fff75ba3b UPSTREAM: usb: dwc3-generic: remove dm_scan_fdt_dev() from the remove() callback
There is simply no reason to do that here.

Change-Id: I4336f493dc638bd0b5dd57cbd4a934c93c5bb0ff
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit e445d46651de61fdfecf34cc2cd97d58ca6c5cf3)
2020-01-07 17:24:58 +08:00
Marek Vasut 920516c875 UPSTREAM: usb: ehci-mx6: Fix bus enumeration for DM case
The EHCI iMX6 driver is only partly converted to DT probing and
still uses a tremendous amount of hard-coded addresses. Worse,
the driver uses hard-coded SoC-model-specific base addresses, which
are derived from values protected by SoC-specific macros, hence the
driver is also compiled for a specific SoC model. Even worse, the
driver depends on specific sequential indexing of the controllers,
from which it derives offsets in the PHY and ANATOP register sets.

However, when the driver is probed from DT, the indexing is not
correct. In fact, each controller has index 0. This patch derives
the index for DT probing case from the controller base addresses,
which is not the way this should be done, however it is the least
intrusive approach, favorable this close to release.

The necessary steps to convert this driver fully to DT probing are
described inside the patch, however this should be done in the next
release and depends on iMX clock driver patches.

Change-Id: I81cef54d5e6f1bab2aef407ad053b5af3cd4e94f
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Abel Vesa <abel.vesa@nxp.com>
Cc: Adam Ford <aford173@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Ludwig Zenz <lzenz@dh-electronics.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Vagrant Cascadian <vagrant@debian.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 501547cec1f7f0438cae388a104ff60f18576c01)
2020-01-07 17:24:58 +08:00
Frieder Schrempf e7093b518a UPSTREAM: usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Add support for loading u-boot FIT images over the USB SDP protocol in
the SPL

Change-Id: I41461b58c088a10eca6e48b0d49c76944c37c3fa
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
[Various build fixes]
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Tested-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 2c72ead7387404eba16c556d2f204c52c36c27f9)
2020-01-07 17:24:58 +08:00
Patrick Delaunay ba6d0aabab UPSTREAM: usb: dwc2: allow peripheral mode for OTG configuration
Allow device mode in DWC2 driver when device tree select the dr_mode
"peripheral" or "otg".

The device mode is not allowed when dr_mode = "host" in device tree.

Change-Id: Iede854cdf940f5e1ef14a7e394087ac97998213a
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 7c654683464dc4cd89f9a8198e26336263390b57)
2020-01-07 17:24:58 +08:00
Patrick Delaunay aea37ef60f UPSTREAM: usb: dwc2: correctly handle binding for g-tx-fifo-size
Manage g-tx-fifo-size as a array as specify in the binding.

Change-Id: Ie2f0fa8eda62d762fe79072db377c1b00b23ee4c
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 7350a75b517b6162c8f832a9ead09b9e26e8068f)
2020-01-07 17:24:58 +08:00
Yinbo Zhu 7472a52faf UPSTREAM: usb: ehci: adopt 32 bit address for CONFIG_PPC
adopt 32 bit addr in fsl_esdhc for CONFIG_PPC.
So  adopt 32 bit address for CONFIG_PPC.

Change-Id: Ibb69849ed19fa18f494807020f9a6a911692b1aa
Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
Reviewed-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit ad9f2be3348c088e7839fd3598db3b352060bff1)
2020-01-07 17:24:58 +08:00
Adam Ford 0620c8ad4c UPSTREAM: usb: ohci: ohci-da8xx: Cleanup Error handling and fix flags
Per feedback from Marek, he suggested better handling and
to enable DM_FLAG_OS_PREPARE, this patch re-orders some of
the error checking, and errors returns the error code right
away and also sets DM_FLAG_OS_PREPARE.

Change-Id: I639a5e4f6d5c89a18e722db2601cf18acb96cbb3
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 3a90b50a32b6b8a2d66dc10c19e3c15d5bd1a092)
2020-01-07 17:24:58 +08:00
Neil Armstrong 518b4f5b8d UPSTREAM: usb: dwc3: Add Meson G12A USB Glue
Adds support for Amlogic G12A USB Control Glue HW.

The Amlogic G12A SoC Family embeds 2 USB Controllers :
- a DWC3 IP configured as Host for USB2 and USB3
- a DWC2 IP configured as Peripheral USB2 Only

A glue connects these both controllers to 2 USB2 PHYs, and optionnally
to an USB3+PCIE Combo PHY shared with the PCIE controller.

The Glue configures the UTMI 8bit interfaces for the USB2 PHYs, including
routing of the OTG PHY between the DWC3 and DWC2 controllers, and
setups the on-chip OTG mode selection for this PHY.

This driver sets the OTG capable port as Host mode by default,
the switch to Device mode is to be done in a separate patch.

Change-Id: I099bb5fbda0fdd52c4d78e32f879f8324bda4c59
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit adb049abf7a209629c7b5e4bc673a0d802c616c2)
2020-01-07 17:24:58 +08:00
Adam Ford dff9f0f7f0 UPSTREAM: usb: ohci: ohci-da8xx: Enable da850-ohci driver with DM support
This patch reuses some former code for the hawkboard, combines it
with some some similar DM_USB compatible code for the OHCI driver,
and enables the use of the da850's OHCI controller with DM_USB
compatibility.

Change-Id: I86a1fdf6bf2163deae6b6f8c09fcb0ea53b73067
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 9da5474389c784474274d8e1d1d04fab924d3c39)
2020-01-07 17:24:58 +08:00
Adam Ford 200d235e49 UPSTREAM: usb: ohci: Re-enable commented out delay
There is a delay function that was commented out.  This patch
re-enables it, because it will be needed for da850 ohci support.

Change-Id: Ibfbe2844807ac13501cc17a297c724791e1eac52
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit e0b0af666a81f166397e3aebd26e9401ae48c97d)
2020-01-07 17:24:58 +08:00
Lukasz Majewski 0163d8d8bf UPSTREAM: USB: DM: Convert i.MX5 ehci code to driver model
This commit converts i.MX5's EHCI USB host driver to driver model (DM_USB).
It is a straightforward conversion (to reuse as much code as possible),
based on ehci-mx6.c code.

Change-Id: I14727c670f5ecf78f2caaab56f04d8be578a91fb
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 22988766da6fe200b6947b8181ddbde663643248)
2020-01-07 17:24:57 +08:00
Fabrice Gasnier 24b360da41 UPSTREAM: usb: dwc2: fix gadget disconnect
This fixes a disconnect issue detected with fastboot command, when using
dwc2 driver.
- On u-boot side:
uboot>$ fastboot 0
- On USB host PC side, few seconds after
PC>$ fastboot reboot # Get stuck, uboot target never reboots

By enabling DEBUG_ISR logs, the bus suspend interrupt is seen before the
PC command has been issued. When the USB bus suspend occurs, there's a HACK
that disables the fastboot (composite driver). Here is the call stack
upon USB bus suspend:
- dwc2_handle_usb_suspend_intr()
  - dev->driver->disconnect()
    - composite_disconnect()
      - reset_config()
        - f->disable()
          - fastboot_disable()
            - usb_ep_disable(f_fb->out_ep);
            - usb_ep_disable(f_fb->in_ep);
            .. other disable calls.

When the resume interrupt happens, everything has been disabled, then
nothing happens. fastboot command gets stuck on HOST side.

Remove original HACK, that disconnects the composite driver upon
USB bus suspend. Implement disconnect detection instead:
- check GINTSTS OTG interrupt
- read GOTGINT register
- check GOTGINT, SesEndDet bit (e.g. session end)
This is inspired by what is implemented currently in Linux dwc2 driver.

Change-Id: I061bf19a7be2c85fdde3490ef792f18612de9c56
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 7fd9f31c6bd13609da61b985cf8f5f65ebebd913)
2020-01-07 17:24:57 +08:00
Patrick Delaunay db704406b3 UPSTREAM: stm32mp1: add stusb1600 support for DK1 and DK2 board
The DK1 and DK2 boards use the USB Type-C controller STUSB1600.
This patch updates:
- the device tree to add the I2C node in the DT
- the board stm32mp1 to probe this I2C device and use this controller
  to check cable detection.
- the DWC2 driver to support a new dt property
  "u-boot,force-b-session-valid" which forces B session and
  device mode; it is a workaround because the VBUS sensing and
  ID detection isn't available with stusb1600.

Conflicts:
	arch/arm/dts/stm32mp157-pinctrl.dtsi
	arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
	arch/arm/dts/stm32mp157a-dk1.dts
	board/st/stm32mp1/stm32mp1.c

Change-Id: I73b62dce9c3e0661e6d2463b87389229cd3559a7
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
(cherry picked from commit 6fe7dd3327d552bacf4266d7f1ed074bf98ffb92)
2020-01-07 17:24:57 +08:00
Patrick Delaunay acd7aca8c0 UPSTREAM: usb: dwc2: add support for STM32MP1
Add compatible "st,stm32mp1-hsotg" and associated driver data to manage
the usb33d-supply and the ST specific register for VBus sensing.

Change-Id: If60971ebf415cb708b04af38c7b61d5321a13181
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 931e9d7aa7228867eec7e33fd45718e6018cc96d)
2020-01-07 17:24:57 +08:00
Patrice Chotard 6187c34651 UPSTREAM: usb: dwc2_udc_otg: Add tx_fifo_sz array support
All TX fifo size can be different, add tx_fifo_sz_array[]
into dwc2_plat_otg_data to be able to set them.

tx_fifo_sz_array[] is 17 Bytes long and can contains max 16
tx fifo size (synopsys IP supports max 16 IN endpoints).
First entry of tx_fifo_sz_array[] is the number of valid
fifo size the array contains.

In case of tx_fifo_sz_array[] doesn't contains the same
number of element than max hardware endpoint, display
a warning message.

Compatibility with board which doesn't use tx_fifo_sz_array[]
(Rockchip rk322x/rk3128/rv1108/rk3288/rk3036) is kept.

Change-Id: If32954770f9571a1bb18376239ef9cff9a721178
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 763bb106f66c147b7d0c3046dbba66a07d7a9dd2)
2020-01-07 17:24:57 +08:00
Patrick Delaunay 38b0d5741a UPSTREAM: usb: dwc2_udc_otg: Read MAX_HW_ENDPOINT from HWCFG4 register
Some DWC2 ip variant doesn't use 16 hardware endpoint as hardcoded
in the driver. Bits INEps [29:26] of HWCFG4 register allows to get
this information.

Change-Id: I22f88ef7ee2749cce3c93f5c8a455a1de165b9dd
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 5bd97e80730bdda59656ca927d67d62fb2a4ecb6)
2020-01-07 17:24:57 +08:00
Patrick Delaunay 3015f8bebd UPSTREAM: usb: dwc2: Add function for session B check
Add a new function to check the session B validity, to be use to check
cable connection.

Change-Id: I914d7353e926df26787261c99f07e5c58dbf24ff
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 2d76160f049c42087011cfa0e6e878aa2ed6b406)
2020-01-07 17:24:57 +08:00
Patrick Delaunay 5c4beedb87 UPSTREAM: usb: dwc2: Add force-b-session-valid support
Handle "force-b-session-valid" property from DT.

Change-Id: I5a0bf871506257b449897cb67732fef430704134
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 0fdd0bc621f060fcf60fd4ba48a2a32f338ffeac)
2020-01-07 17:24:57 +08:00
Patrick Delaunay b486dd9ec4 UPSTREAM: usb: dwc2: force reset assert before to probe the driver
Reset the hardware to be sure of the device state.

Change-Id: Ia86b8b929d6f5316820464a8dbfadbadd7e9d3dc
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit c2c74f97afff9351077f2236ab6fa5638de9bd86)
2020-01-07 17:24:57 +08:00
Patrick Delaunay 1b9a1ae680 UPSTREAM: usb: dwc2: convert driver to DM_USB_GADGET
Minimal conversion to driver model by using the uclass
UCLASS_USB_GADGET_GENERIC based on:
- reset uclass
- clock uclass
- generic uclass.

Change-Id: Id366ea00cb1126d14cb8cef2a9e86b86df6cd612
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit c791c8431c34da803fdac4a308999879a6a33834)
2020-01-07 17:24:56 +08:00
Patrick Delaunay a0c39c0746 UPSTREAM: usb: dwc2: remove unused variable regs_otg
Remove the global regs_otg variable.

Change-Id: Iea128368e3b6593cf15d2e2bd31dfe03c445ad32
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit a812d77617749eeaddfa8b9796b9a2eece1ad2f5)
2020-01-07 17:24:56 +08:00
Marcel Ziswiler 2522005341 UPSTREAM: configs: move CONFIG_USB_EHCI_VF to Kconfig
Move CONFIG_USB_EHCI_VF to drivers/usb/host/Kconfig and update the one
and only user thereof being colibri_vf.

Change-Id: I69228893cb776f077e68a80ee236aeed6e7c2d26
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 20df4b570d164675da17bf23998e51271f5a79a3)
2020-01-07 17:24:56 +08:00
Adam Ford 0457b2cd59 UPSTREAM: usb: ehci-mx6: Use common code to extract dr_mode
There exists code in drivers/common/common.c to read the dr_mode
from the device tree.  This patch converts this driver to use that
function to initialize the driver.

Change-Id: Id4cc8e5a61f63bef9813e83b4183253caccedd1a
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 69535b33bc1fce43dcc10b646cf44db81cffa131)
2020-01-07 17:24:56 +08:00
Ismael Luceno Cortes 79e8eddfb9 UPSTREAM: usb: host: Print device name when scanning
Drop the counter, it has no meaning other than being the order in which
the interface is found; the name assigned to the USB host controller
interface is a better indicator.

Example of the original output:
> USB0:   USB EHCI 1.10
> scanning bus 0 for devices... 2 USB Device(s) found
>        scanning usb for storage devices... 1 Storage Device(s) found

Patched output:
> Bus usb@ee080100: USB EHCI 1.10
> scanning bus usb@ee080100 for devices... 2 USB Device(s) found
>        scanning usb for storage devices... 1 Storage Device(s) found

Change-Id: I4d009cd00a03018c4fec2f9ba573e35010f6328f
Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 89aea23abb971fa89b7a96c02024b63d0b918a78)
2020-01-07 17:24:56 +08:00
Jean-Jacques Hiblot 95dc2be99c UPSTREAM: usb: udc-uclass: Fixed problem when no alias is defined in DT
commit 801f1fa442 "dm: usb: udc: Use SEQ_ALIAS to index the USB gadget
ports" changed the way the udevice if found. It uses the alias to find
a udevice for a given USB port number. In the commit log it was stated
that if no alias is provided, the bind order will be used instead. However
it doesn't work. Fixing this by adding a call to uclass_get_device() if
uclass_get_device_by_seq() fails.

Change-Id: Ib2304c5ecd5d46089c3273ca3ecaa3f9eb5399f8
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Tested-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit e81d9de531fb4c7f14344736bd7568c954e64e14)
2020-01-07 17:24:56 +08:00
Abel Vesa 8a4a81a148 UPSTREAM: usb: ehci-mx6: Make regulator DM_REGULATOR dependent
Do the regulator related work only if the build has the DM_REGULATOR.

Change-Id: If11178f890f6084633565fd6d36bfb6f3834293c
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 921208ebca6f109990359b3089b5f416b269b07b)
2020-01-07 17:24:56 +08:00
Jean-Jacques Hiblot b1c323b178 UPSTREAM: usb: ether: call _usb_eth_halt() if initialization fails
If the host does not respond in time, the initialization fails. However
the usb ether driver will still be registered. This will make
usb_gadget_probe_driver() fail the next time the initialization is
attempted because it cannot find an available UDC.

Fixing this by calling _usb_eth_halt() when the init fails.

Change-Id: Id61795e444e12265657a8a070f48b35d4a9ca280
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 1c1464c2b19f1b96885040b8adc9cf5ba3c7b32d)
2020-01-07 17:24:56 +08:00
Andrew F. Davis 09b32b41f2 UPSTREAM: spl: Kconfig: Drop the _SUPPORT postfix from SPL_DFU
The symbol CONFIG_SPL_DFU_SUPPORT in SPL build has the same
meaning as CONFIG_DFU in regular U-Boot. Drop the _SUPPORT
to allow for cleaner use in code.

Conflicts:
	arch/arm/mach-zynqmp/spl.c
	common/Makefile
	common/spl/Kconfig
	common/spl/spl_ram.c

Change-Id: I93f09d5953284d511df135e6e71c03c0552719a2
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
(cherry picked from commit 6536ca4d6676bf38e50784298e713edc30b9cde9)
2020-01-07 17:24:56 +08:00
Jagan Teki 6baf2cc3b2 UPSTREAM: usb: host: Drop [e-o]hci-sunxi drivers
Now Allwinner platform is all set to use Generic USB
controller drivers, so remove the legacy sunxi drivers.

Conflicts:
	drivers/usb/host/ehci-sunxi.c
	drivers/usb/host/ohci-sunxi.c
	scripts/config_whitelist.txt

Change-Id: I68dec1660d92dce8833d5a05584694d7b7c4ab36
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
(cherry picked from commit 543049ab590620a91b37fa0296edd3bcddd0eba2)
2020-01-07 17:24:56 +08:00
Jean-Jacques Hiblot 9e4d054014 UPSTREAM: dm: usb: gadget: Fix boot breakage on sunxi platforms
Fixes commit 013116243950 ("dm: usb: create a new UCLASS ID for USB gadget
devices")

The UCLASS_DRIVER for id UCLASS_USB_GADGET_GENERIC needs to be declared
even for platforms that do not enable DM_USB_GADGET. Otherwise the driver
for their usb peripheral controller fails to bind.

Change-Id: Ide6104f24be321d05d399b03a9fc38663f44a2d1
Reported-by: Priit Laes <plaes@plaes.org>
Reported-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Tested-by: Priit Laes <plaes@plaes.org>
Acked-by: Jagan Teki <jagan@openedev.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit b3c518a88278619b1e109de114c450237d03e032)
2020-01-07 17:24:55 +08:00
Jean-Jacques Hiblot eccca8a35d UPSTREAM: Kconfig: rename CONFIG_SPL_USB_GADGET as CONFIG_SPL_USB_GADGET
The SPL option for USB gadget should be named after the option for u-boot
(CONFIG_USB_GADGET)

Conflicts:
	arch/arm/mach-imx/mx6/Kconfig
	arch/arm/mach-imx/spl.c
	configs/am335x_boneblack_vboot_defconfig
	configs/am335x_evm_usbspl_defconfig
	configs/am43xx_evm_defconfig
	configs/am43xx_hs_evm_defconfig
	configs/imx6q_logic_defconfig
	configs/mx6memcal_defconfig
	configs/mx6sabresd_defconfig
	configs/pico-hobbit-imx6ul_defconfig
	configs/pico-hobbit-imx7d_defconfig
	configs/pico-imx6ul_defconfig
	configs/pico-imx7d_defconfig
	configs/pico-pi-imx6ul_defconfig
	configs/pico-pi-imx7d_defconfig
	drivers/Makefile

Change-Id: I51305422f13cb7d743274f82c531000c0f93c144
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit f811e9763f4b6f6f5e3fe9c2fa30d2b6c62d289e)
2020-01-07 17:24:55 +08:00