aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2022-06-06arm: pxa: Remove CONFIG_CPU_PXA25XTom Rini
There are no platforms that set this, remove the code. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-05-23spi: spi-uclass: Add new spi_get_bus_and_cs() implementationPatrice Chotard
Move legacy spi_get_bus_and_cs() code to _spi_get_bus_and_cs(). Add new spi_get_bus_and_cs() implementation which rely on DT for speed and mode and don't need any drv_name nor dev_name parameters. This will prepare the ground for next patch. Update all callers to use _spi_get_bus_and_cs() to keep the same behavior. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Marek Behun <marek.behun@nic.cz> Cc: Jagan Teki <jagan@amarulasolutions.com> Cc: Vignesh R <vigneshr@ti.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Ramon Fried <rfried.dev@gmail.com> Cc: Lukasz Majewski <lukma@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Roese <sr@denx.de> Cc: "Pali Rohár" <pali@kernel.org> Cc: Konstantin Porotchkin <kostap@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Pratyush Yadav <p.yadav@ti.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Anji J <anji.jagarlmudi@nxp.com> Cc: Biwen Li <biwen.li@nxp.com> Cc: Priyanka Jain <priyanka.jain@nxp.com> Cc: Chaitanya Sakinam <chaitanya.sakinam@nxp.com>
2022-05-20usb: dwc3: Fix non-usb3 configurationsJan Kiszka
Missing nodes may also be signaled via -ENODATA. We need to check for that to prevent failing in non-usb3 setups. Furthermore, dev.phy must be NULL'ed in case usb3-phy was not found. Fixes: 142d50fbce7c ("usb: dwc3: Add support for usb3-phy PHY configuration") Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2022-05-20usb: xhci-dwc3: Support role switch default roleMark Kettenis
When the device tree indicates support for role switching through the "usb-role-switch" property, take the "role-switch-default-mode" property into account when deciding which role to put the controller into. This makes USB devices work on Apple M1 systems where the device tree may include a "dr_mode" property that is set to "otg", but where we need to put the controller into "host" mode to see devices connected to the type-C ports. Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2022-05-06usb: host: ehci-generic: Remove DM_REGULATOR flagPatrice Chotard
Since commit 16cc5ad0b439 ("power: regulator: add dummy helper") regulator dummy helper are always available even if DM_REGULATOR is not set. DM_REGULATOR flag is no more needed to protect no DM core, remove it. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-05-06usb: host: ehci-generic: Make usage of clock/reset bulk() APIPatrice Chotard
Make usage of clock and reset bulk API in order to simplify the code Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-05-03pci: Add mask parameter to dm_pci_map_bar()Andrew Scull
Add a mask parameter to control the lookup of the PCI region from which the mapping can be made. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Map bars with offset and lengthAndrew Scull
Evolve dm_pci_map_bar() to include an offset and length parameter. These allow a portion of the memory to be mapped and range checks to be applied. Passing both the offset and length as zero results in the previous behaviour and this is used to migrate the previous callers. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-04-29usb: sandbox: Bounds check read from bufferAndrew Scull
The buffer is 512 bytes but read requests can be 800 bytes. Limit the request to the size of the buffer. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-29usb: sandbox: Check for string end in copy_to_unicode()Andrew Scull
When copying the string in copy_to_unicode(), check for the null terminator in each position, not just at the start, to avoid reading beyond the end of the string. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: usb: Add a bootdev driverSimon Glass
Add a bootdev driver for USB host. It can use the distro boot mechanism to locate a file, or any other available bootmeth. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-22Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usbTom Rini
2022-04-22Add support for TP-Link UE200 dongleOleksii Titov
Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Signed-off-by: Oleksii Titov <ootitov@gmail.com>
2022-04-22usb: dwc3: Add support for usb3-phy PHY configurationMichal Simek
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT lines based on description in DT. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2022-04-22usb: gadget: ci: Make various ops constAdam Ford
ci_udc_ops and ci_ep_ops do not change their operations. Mark them as const. Signed-off-by: Adam Ford <aford173@gmail.com>
2022-04-21usb: dwc3: Implement .glue_configure for i.MX8MPMarek Vasut
The i.MX8MP glue needs to be configured based on a couple of DT properties, implement .glue_configure callback to parse those DT properties and configure the glue accordingly. Tested-By: Tim Harvey <tharvey@gateworks.com> #imx8mp-venice-gw74xx Signed-off-by: Marek Vasut <marex@denx.de> Cc: Angus Ainslie <angus@akkea.ca> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Fabio Estevam <festevam@gmail.com> Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Peng Fan <peng.fan@nxp.com> Cc: Stefano Babic <sbabic@denx.de>
2022-04-21usb: dwc3: Rename .select_dr_mode to .glue_configureMarek Vasut
Rename the select_dr_mode callback to glue_configure, the callback is used for more than enforcing controller mode even on the TI chips, so change the name to a more generic one. No functional change. Tested-By: Tim Harvey <tharvey@gateworks.com> #imx8mp-venice-gw74xx Signed-off-by: Marek Vasut <marex@denx.de> Cc: Angus Ainslie <angus@akkea.ca> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Fabio Estevam <festevam@gmail.com> Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Peng Fan <peng.fan@nxp.com> Cc: Stefano Babic <sbabic@denx.de>
2022-04-08arm: Remove unused ep93xx codeTom Rini
There are no platforms for this architecture anymore, remove unused code. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-03-14usb: dwc2: handle return code of dev_read_size() in of to, plat functionWolfgang Grandegger
dev_read_size() returns -EINVAL (-22) if the property "g-tx-fifo-size" does not exist. If that's the case, we now keep the default value of 0. Signed-off-by: Wolfgang Grandegger <wg@aries-embedded.de>
2022-02-23usb: ehci-omap: Remove OMAP_EHCI_PHYx_RESET_GPIO from KconfigAdam Ford
With the omap-ehci driver now using the phy subsystem to enable and disable reset, the driver no longer needs to know which GPIO's are used, and they can be removed from Kconfig. Signed-off-by: Adam Ford <aford173@gmail.com>
2022-02-23usb: ehci-omap: Use PHY system to manage phy resetsAdam Ford
There are a few boards that use hard-coded GPIO definitions in their respective defconfig files. If the GPIO's are listed in their device trees, the nop-phy can toggle the GPIO's, so the EHCI driver does not need to know anything about the GPIO's. Add functions for getting the phys and remove the GPIO toggles since the phy will now do that. Signed-off-by: Adam Ford <aford173@gmail.com>
2022-02-23usb: ehci-omap: Make Kconfig select PHY if USB_EHCI_OMAPAdam Ford
The USB_EHCI_OMAP driver currently has a series of Kconfig options which let users specify a GPIO for the reset pin. Some devices may have only one reset, while others might have more. Since there is a nop phy driver, let's selct enable the PHY system, and imply the nop phy driver. The nop phy driver can now toggle the reset pins when putting the phy in and out of reset. If the gpio is listed under the phy, it will get toggled and the hard-coded config options specifying the GPIO numbers can eventually go away. Signed-off-by: Adam Ford <aford173@gmail.com>
2022-02-23usb: ehci-omap: Move omap_ehci_hcd_init to omap_ehci_probeAdam Ford
The OMAP3 hierarchy has the ehci node as a sub-node of the usbhshost. The usbhshost node contains an ohci and an ehci subnode. The configuration of the ehci belongs in the EHCI node and not its parent. Move it to the proper probe. usb start starting USB... Bus ehci@48064800: USB EHCI 1.00 Bus usb_otg_hs@480ab000: Port not available. scanning bus ehci@48064800 for devices... 3 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found Signed-off-by: Adam Ford <aford173@gmail.com>
2022-02-23usb: ehci-omap: Drop dead codeAdam Ford
omap_ehci_hcd_stop appears to be dead code, and omap_ehci_hcd_init is only called by the probe function, so it can be static to that function. Remove both from the header along with some additional checking for DM_USB. Signed-off-by: Adam Ford <aford173@gmail.com>
2022-02-17Merge https://source.denx.de/u-boot/custodians/u-boot-marvellTom Rini
- a37xx: pci: Cleanup and minor fix for root port check (Pali) - pci: mvebu: Ensure that root port is always on root zero bus (Pali) - kwbimage: Fix dumping DATA registers for v0 images (Pali) - kwbimage: Support for parsing extended v0 format (Pali) - a37xx: Fix code and update DTS files to upstream version (Pali) - a37xx: Fix and extend building memory map (Pali) - ddr: marvell: a38x: fix BYTE_HOMOGENEOUS_SPLIT_OUT decision (Marek) - mvebu: Optionally reset board on DDR training failure (Marek)
2022-02-17usb: ehci: ehci-marvell: Update compatible string to official DT bindingsPali Rohár
Official DT bindings use compatible string marvell,armada-3700-ehci. Update drivers and DTS files. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-02-16usb: xhci: reset endpoint on USB stallStefan Agner
There are devices which cause a USB stall when trying to read strings. Specifically Arduino Mega R3 stalls when trying to read the product string. The stall currently remains unhandled, and subsequent retries submit new transfers on a stopped endpoint which ultimately cause a crash in abort_td(): WARN halted endpoint, queueing URB anyway. XHCI control transfer timed out, aborting... Unexpected XHCI event TRB, skipping... (3affe040 00000000 13000000 02008401) BUG at drivers/usb/host/xhci-ring.c:505/abort_td()! BUG! resetting ... Linux seems to be able to recover from the stall by issuing a TRB_RESET_EP command. Introduce reset_ep() which issues a TRB_RESET_EP followed by setting the transfer ring dequeue pointer via TRB_SET_DEQ. This allows to properly recover from a USB stall error and continue communicating with the USB device. Signed-off-by: Stefan Agner <stefan@agner.ch>
2022-02-16usb: dwc3: core: stop the core when it's removedAngus Ainslie
If u-boot doesn't stop the core when it's finished with it then linux can't find it. Signed-off-by: Angus Ainslie <angus@akkea.ca>
2022-02-16usb: dwc3: dwc3-generic: check the parent nodesAngus Ainslie
The kernel devicetree has definitions for port and hub nodes as subnodes to the USB devices. These subnodes don't contain all of the data required to properly configure the dwc3. Check the parent nodes if the data is not in the port/hub node. Here's an example from the librem5 kernel dts file &usb_dwc3_0 { #address-cells = <1>; #size-cells = <0>; dr_mode = "otg"; snps,dis_u3_susphy_quirk; status = "okay"; port@0 { reg = <0>; typec_hs: endpoint { remote-endpoint = <&usb_con_hs>; }; }; port@1 { reg = <1>; typec_ss: endpoint { remote-endpoint = <&usb_con_ss>; }; }; }; &usb_dwc3_1 { dr_mode = "host"; status = "okay"; #address-cells = <1>; #size-cells = <0>; /* Microchip USB2642 */ hub@1 { compatible = "usb424,2640"; reg = <1>; #address-cells = <1>; #size-cells = <0>; mass-storage@1 { compatible = "usb424,4041"; reg = <1>; }; }; }; Signed-off-by: Angus Ainslie <angus@akkea.ca>
2022-02-11usb: gadget: ci: Avoid null pointer dereferenceMarek Vasut
The ci_req->hw_buf can be NULL, test whether it is and if so, avoid accessing it. Else, the system may crash. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Peter Chen <peter.chen@nxp.com> Cc: Li Jun <jun.li@nxp.com> Cc: Peng Fan <peng.fan@nxp.com>
2022-02-11usb: ehci-mx6: Enable OTG detection on imx8mm and imx8mnAdam Ford
The imx8mm and imx8mn appear compatible with imx7d-usb flags in the OTG driver. If the dr_mode is defined as host or peripheral, the device appears to operate correctly, however the auto host/peripheral detection results in an error. The solution isn't just adding checks for imx8mm and imx8mn to the check for imx7, because the USB clock needs to be running to read from the USBNC_PHY_STATUS_OFFSET register or it will hang. Marek requested that I not enable the clocks in ehci_usb_of_to_plat, so I modified that function to return an unknown state if the device tree does not explicitly state whether it is a host or a peripheral. When the driver probes, it looks to see if it's in the unknown state, and only then will it read the register to auto-detect. Signed-off-by: Adam Ford <aford173@gmail.com> Tested-by: Tim Harvey <tharvey@gateworks.com>
2022-01-28dfu: handle short frame result of UPLOAD in state_dfu_idlePatrick Delaunay
In DFU v1.1 specification [1] the DFU_UPLOAD (Short Frame) is handled only in dfuUPLOADIDLE state: - Figure A.1 Interface state transition diagram - the state description in chapter A.2 A.2.3 State 2 dfuIDLE on Receipt of the DFU_UPLOAD request,and bitCanUpload = 1 the Next State is dfuUPLOADIDLE A.2.10 State 9 dfuUPLOAD-IDLE When the length of the data transferred by the device in response to a DFU_UPLOAD request is less than wLength. (Short frame) the Next State is dfuIDLE In current code, when an UPLOAD is completely performed after the first request (for example with wLength=200 and data read = 9), the DFU state stay at dfuUPLOADIDLE until receiving a DFU_UPLOAD or a DFU_ABORT request even it is unnecessary as the previous DFU_UPLOAD request already reached the EOF. This patch proposes to finish the DFU uploading (don't go to dfuUPLOADIDLE) and completes the control-read operation (go to DFU_STATE_dfuIDLE) when the first UPLOAD response has a short frame as an end of file (EOF) indicator even if it is not explicitly allowed in the DFU specification but this seems logical. [1] https://www.usb.org/sites/default/files/DFU_1.1.pdf Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2022-01-27Merge tag 'dm-pull-26jan22' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-dm acpi refactoring to allow non-x86 use binman support for bintools (binary tools) minor tools improvements in preparation for FDT signing various minor fixes and improvements
2022-01-26usb: gadget: Add CDC ACM functionLoic Poulain
Add support for CDC ACM using the new UDC and gadget API. This protocol can be used for serial over USB data transfer and is widely supported by various OS (GNU/Linux, MS-Windows, OSX...). The usual purpose of such link is to access device debug console and can be useful for products not exposing regular UART to the user. A default stdio device named 'usbacm' is created, and can be used to redirect console to USB link over CDC ACM: > setenv stdin usbacm; setenv stdout usbacm Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-01-26usb: ehci: dm: Convert i.MX28 ehci code to driver modelLukasz Majewski
This commit converts i.MX28'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-mx5.c code. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-26usb: ehci: Move common mxs code to separate functions (ehci_hcd_{stop|start})Lukasz Majewski
Those functions will be re-used when the ehci MXS driver (for imx28) will be converted to also support CONFIG_DM_USB. No functional changes introduced - only cosmetic changes (u32 type) and alignment to pass checkpatch. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-26usb: ehci: Refactor the ehci_mxs_toggle_clock function to be reused with DMLukasz Majewski
This function is going to be reused with the CONFIG_DM_USB enabled in the imx28 mxs USB ehci driver. No functional changes introduced. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-26usb: Modify Kconfig of the USB_EHCI_MXS to use this driver with imx28Lukasz Majewski
The ehci-mxs driver can be also used with imx28 SoC, not only imx23. Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-25usb: Use the first available device for ehci_gadgetSean Anderson
For whatever reason, usb_setup_ehci_gadget removes and probes USB device 0. However, not all systems have a device 0. Use the first device instead. The device probed should probably have something to do with the controller (as specified by e.g. ums <controller> or fastboot <controller>). In fact, I find it odd that we probe the USB device in the first place, because this is just to set up the gadget itself. Presumably, the controller should be probed by usb_gadget_initialize somehow. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-01-20Merge https://source.denx.de/u-boot/custodians/u-boot-marvellTom Rini
- fdt_support: Add fdt_for_each_node_by_compatible() helper macro (Marek) - turris_omnia: Fixup SATA or PCIe nodes at runtime in DT blob (Pali) - pci_mvebu: Add support for Kirkwood PCIe controllers (Pali) - SPL: More verifications for kwbimage in SPL (Pali) - mvebu: Remove comphy_update_map() (Pali) - Minor misc stuff
2022-01-20SPL: Add struct spl_boot_device parameter into spl_parse_board_header()Pali Rohár
Add parameter spl_boot_device to spl_parse_board_header(), which allows the implementations to see from which device we are booting and do boot-device-specific checks of the image header. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-17drivers: musb_gadget: Save endpoint desc to usb_ep->descqianfan Zhao
Fix fastboot flash bug. If the downloading file size is equal to the partition size, "fastboot flash" can't work, at least in sunxi platform, because used an uninitalized point: ep->desc. This patch also fixed 'data abort' bug in am335x platform. Reproduce: fastboot flash loader1 spl/sunxi-spl.bin. Signed-off-by: qianfan Zhao <qianfanguijin@163.com> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2022-01-13drivers/usb/gadget/dwc2_udc_otg.c: Fix spelling of "resetting".Vagrant Cascadian
2022-01-13drivers/usb/musb/musb_udc.c: Fix spelling of "mismatch".Vagrant Cascadian
2022-01-10Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-01-08usb: gadget: dwc2_udc_otg: set ep's desc during enable/disableGary Bisson
Fastboot support has been broken on platforms using dwc2 controller since the gadget gets its max packet size from it. This patch is the equivalent of 723fd5668ff which fixed the same issue but for the chipidea controller. Fixes: 27c9141b111 ("usb: gadget: fastboot: use correct max packet size") Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2021-11-17usb: cdns3: cdns3-ti: Add compatible for AM64 SoCAswath Govindraju
Add new compatible for AM64 SoC. Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2021-11-15usb: Make USB_MUSB_PIO_ONLY selected by USB_MUSB_SUNXISamuel Dionne-Riel
This ensures the USB_MUSB_PIO_ONLY config is set to an apppropriate value from the changes enabling USB_MUSB_GADGET does. Namely, USB_MUSB_PIO_ONLY default to =y on USB_MUSB_SUNXI being y. Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
2021-11-09usb: dwc3: add layerscape supportMichael Walle
Add support for the proper dwc3 device tree binding support as specified in the offical device tree spec. Initially, add support for the LS1028A support. Other SoCs should be easy to add by just adding the corresponding compatible string. Unfortunately, the device trees of all other layerscape SoCs are not converted and uses a wrong compatible string only known in u-boot. To maintain backwards compatibility with current u-boot device trees, add the generic "fsl,layerscape-dwc3" compatible string. OTG mode is not supported yet. The dr_mode in the devicetree will either have to be set to peripheral or host. Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>