summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/misc'Sascha Hauer2020-02-181-1/+1
|\
| * gadget: f_fastboot: Fix memory leakChristian Eggers2020-01-271-1/+1
| | | | | | | | | | | | | | | | bootm_data::os_file is not required to be a copied string. It isn't freed anywhere. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: fsl_udc: remove unnessary argumentSascha Hauer2020-02-131-8/+7
|/ | | | | | | fsl_build_dtd() returns the length of the dTD, but it is never used. Remove the length argument from the function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rpi'Sascha Hauer2020-01-155-8/+1924
|\
| * usb: Add dwc2 host driverSascha Hauer2019-12-204-0/+1914
| | | | | | | | | | | | | | This adds a driver for the dwc2 controller in host mode. The driver is taken from U-Boot-2019.10 and tested on a Raspberry Pi 3. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: Forward error code from usb_set_configurationSascha Hauer2019-12-201-4/+6
| | | | | | | | | | | | | | Instead of returning -1 forward the error code and take the opportunity to print the error string. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: Make timeout unit clearSascha Hauer2019-12-201-4/+4
| | | | | | | | | | | | | | The usb_*_msg() functions take a timeout parameter. Make clear which unit is expected by adding a _ms suffix to the variable name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: ehci: Do not use memset on dma coherent memorySascha Hauer2020-01-141-3/+12
|/ | | | | | | | | | | memset is an optimized operation that at least on ARM64 may only be called on cached memory, see 32e8842c40 ("ARM: lib64: Make string functions aware of MMU configuration"). To avoid crashes in the ehci driver we no longer call memset on memory allocated with dma_alloc_coherent(), but use a simple memzero32 function instead. Reported-by: Elmar Albert <EAlbert@data-modul.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2019-12-1010-121/+110
|\
| * usb: musb: use usb_register_otg_device()Sascha Hauer2019-11-212-37/+8
| | | | | | | | | | | | | | We now have usb_register_otg_device() to register an "otg" device. Use it and drop the custom code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: i.MX: Use usb_register_otg_device()Sascha Hauer2019-11-212-73/+13
| | | | | | | | | | | | | | We now have usb_register_otg_device() to register an "otg" device. Use it and drop the custom code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: dwc3: register otg deviceSascha Hauer2019-11-213-4/+12
| | | | | | | | | | | | | | When the role in the device tree is specified as "otg" then register a otg device in barebox so that the user can configure the desired mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: Add function to register otg devSascha Hauer2019-11-213-1/+74
| | | | | | | | | | | | | | | | We have two drivers in the tree which register an "otg" device to configure the host/peripheral switching. Before introducing a third driver create a common function for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: dwc3: remove unnecessary warningSascha Hauer2019-11-211-6/+3
| | | | | | | | | | | | | | | | | | The dwc3 driver warns when the value written to DWC3_GFLADJ happens to be same as already read from the register. This always happens when the driver was previously running when started 2nd stage from another barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/randfixes'Sascha Hauer2019-12-102-0/+3
|\ \
| * | usb: dwc3: dual role mode needs gadget supportLucas Stach2019-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Obviously the mode where both host and gadget mode are available also needs to depend on the Barebox gadget support. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: usb251xb: depend on OFDEVICELucas Stach2019-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The usb2551x driver gets all its configuration info from the DT, so there is no point in allowing this driver to be build when probing from DT isn't enabled. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: dwc3: depend on OFDEVICELucas Stach2019-12-021-0/+1
| |/ | | | | | | | | | | | | | | | | | | The DWC3 driver uses some functions which are only available when Barebox is built with OFDEVICE support. Since there is no platform without DT support suing DWC3 we can reasonably depend on this config option. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-12-101-1/+1
|\ \ | |/ |/|
| * usb: gadget: fastboot: fix typoRoland Hieber2019-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to Wikipedia[1]: [The indefinite article] "an" is used before words starting with a vowel sound, regardless of whether the word begins with a vowel letter. This avoids the glottal stop (momentary silent pause) that would otherwise be required between a and a following vowel sound. "UBI" is pronounced like "you-bee-eye" or "youbee", so it starts with a consonant sound, therefore the correct indefinite article is "a". [1]: https://en.wikipedia.org/w/index.php?title=English_articles&oldid=928781459#Distinction_between_a_and_an Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: dwc3: Remove wrong error messagesSascha Hauer2019-11-141-2/+0
|/ | | | | | | When phy_get() returns -ENOSYS or -ENODEV it means we can go without phy. Do not print an error message in this case. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: storage: Increase retries for usb_stor_transport()Robert Karszniewicz2019-11-041-3/+4
| | | | | | | | | | This should make writing and reading more reliable. Also: - change loop condition to make "retries" semantically correct - add a debug message in case of fatal failure Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2019-10-171-25/+159
|\
| * usb: Change power-on / scanning timeout handlingPrimoz Fiser2019-10-021-19/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change USB port scanning procedure and timeout handling in the following ways: 1) The power-on delay in usb_hub_power_on() is now reduced to a value of max(100ms, "hub->desc.bPwrOn2PwrGood * 2"). The code does not wait using mdelay, instead usb_hub_power_on() will wait before querying the device in the scanning loop later. The total connection timeout for this hub, which is (1 second + hub->desc.bPwrOn2PwrGood * 2) is calculated and will be used in the following per-port scanning loop as the timeout to detect active USB devices on this hub. 2) Don't delay the minimum delay (for power to stabilize) in usb_hub_power_on(). Instead skip querying these devices in the scanning loop usb_scan_port() until the delay time is reached. 3) The ports are now scanned in a quasi parallel way. The current code did wait for each (unconnected) port to reach its timeout and only then continue with the next port. This patch now changes this to scan all ports of all USB hubs quasi simultaneously. For this, all ports are added to a scanning list in usb_hub_configure_ports(). The list is later scanned in usb_device_list_scan() until all ports are ready by either a) reaching the connection timeout (calculated earlier), or by b) detecting a USB device. This results in a faster USB scan time as the recursive scanning of USB hubs connected to the hub that's currently being scanned will start earlier. 4) Ports with overcurrent detection will get scanned multiple times if OC condition is detected (PORT_OVERCURRENT_MAX_SCAN_COUNT). Without patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 10344ms With patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 4529ms Delta: ~6 seconds Signed-off-by: Primoz Fiser <primoz.fiser@norik.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: usb_hub_port_connect_change(): Remove unnecessary delaysPrimoz Fiser2019-10-021-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove two mdelay(200) calls from usb_hub_port_connect_change() before and after calling hub_port_reset(). These delays don't seem to be necessary since hub_port_reset() already incorporates delays on its own. Without patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 16355ms With patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 10344ms Delta: ~6 seconds Signed-off-by: Primoz Fiser <primoz.fiser@norik.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: hub_port_reset(): Speedup hub reset handlingPrimoz Fiser2019-10-021-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Start with a short USB hub reset delay of 20ms. This can be enough for some configurations. Switch to longer reset delay only if the short delay hasn't been long enough. This USB hub reset handling strategy is also used in the Linux kernel USB hub driver, function hub_port_reset(). Without patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 21750ms With patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 16355ms Delta: ~5.5 seconds Signed-off-by: Primoz Fiser <primoz.fiser@norik.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-10-171-2/+2
|\ \
| * | USB: gadget: ACM: don't announce V.25ter supportAhmad Fatoum2019-10-141-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | barebox currently announces support for ITU V.25ter AT commands, but doesn't handle them specially when they arrive. Instead they are passed as is to the sole barebox input console, where it may interfere with valid user input. This is especially annoying as ModemManager probes ttyACM devices that announce their AT command support. So even when not using the ttyACM device at all, the other UART ports are affected. Fix this by ceasing to announce USB_CDC_ACM_PROTO_AT_V25TER as function protocol. After applying this patch, I can't see any spurious AT or ~x~ symbols on the console anymore. Cc: <bst@pengutronix.de> Cc: <jlu@pengutronix.de> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/layerscape'Sascha Hauer2019-10-1710-23/+5149
|\ \
| * | usb: gadget: composite: conditionally dequeue setup requestsSascha Hauer2019-09-171-3/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is an adoption of Kernel commit a7c12eaf2 ("usb: gadget: composite: conditionally dequeue os_desc and setup requests"). Basically we only want to dequeue ep0 requests when they are actually queued. Drivers like dwc3 warn when unqueued requests are being tried to unqueued. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: dwc3: add support for gadget modeSteffen Trumtrar2019-09-178-20/+5094
| | | | | | | | | | | | | | | | | | | | | | | | Expand the DWC3 usb core with gadget support. Patches imported and adopted from Linux v5.2. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: gadget: add usb_gadget_udc_reset functionSteffen Trumtrar2019-09-171-0/+15
| |/ | | | | | | | | | | | | Add a function to notify the udc core, that a bus reset occured. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/bfin'Sascha Hauer2019-10-176-284/+2
|\ \
| * | USB: remove blackfin supportSascha Hauer2019-09-126-284/+2
| |/ | | | | | | | | | | | | The blackfin architecture has been removed from barebox. Remove the blackfin specifics in the USB drivers as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: at91_udc: don't depend on !ARCH_SAMA5D4Ahmad Fatoum2019-10-141-1/+0
| | | | | | | | | | | | | | | | | | | | The negative depends rules out using UDC for some targets of a multi-image barebox while still supporting SAMA5D4. We don't (yet) have such a configuration, but seeing as there is little to gain by restricting the selection, drop it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: at91: delete no-longer needed #ifdef guardsAhmad Fatoum2019-10-141-6/+0
|/ | | | | | | | | c16bcbc644 ("ARM: at91: remove unused defines") removed conflicting definitions from the headers, so we can include the headers and code that uses them unconditionally now. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: fsl_udc: remove always-true null pointer checksAhmad Fatoum2019-08-301-8/+1
| | | | | | | | struct fsl_ep's name member can never be NULL because it is a character array. Remove these superfluous null pointer checks. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-07-122-8/+4
|\
| * f_fastboot: remove only image from bootm variablesRouven Czerwinski2019-07-041-1/+1
| | | | | | | | | | | | | | Remove only the bootm.image variable which will be set by fastboot. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: usb251xb: fix optional reset gpio requestMarco Felsch2019-06-171-5/+1
| | | | | | | | | | | | | | | | | | | | | | Linux requests the reset gpio optional by using devm_gpiod_get_optional(). We need to do this here too because the reset can be a global shared reset line e.g. board por. We haven't such a helper so just drop the final else path. Fixes: 937fa50d9c ("usb: Port Microchip USB251x USB hub driver from Linux") Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: remove stale mentions of CONFIG_OF in commentsAhmad Fatoum2019-06-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | barebox doesn't define a CONFIG_OF kconfig option, but CONFIG_OFTREE for the device tree handling and CONFIG_OFDEVICE for probing devices out of the device tree. Replace comment mentions of CONFIG_OF with mentions of either as appropriate. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: imx-usb-phy: select syscon driverSascha Hauer2019-07-111-0/+1
|/ | | | | | | | | Since b904eca92f we depend on syscon once the "fsl,anatop" property is found. select MFD_SYSCON to make sure it is available. Fixes: b904eca92f ("usb: imx-usb-phy: Disable charger detect during initialization") Cc: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb-phy'Sascha Hauer2019-06-112-26/+62
|\
| * usb: imx-usb-phy: Disable charger detect during initializationAndrey Smirnov2019-05-271-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I can't find any erratas this is in refernce to, but apparently external changer detector needs to be disabled to prevent poor USB data signal quality. The problem manifest itself as a intermittent USB transfer corruption that happens to some device under and only under specific circumstances. In my case the failure was observed with Transcent SD/micro-SD card reader (05e3:0745 Genesys Logic, Inc. Logilink CR0012) when connected directly to front panel USB of ZII RDU2 board (the problem would go away if device was conntecte via a hub/USB-analyzer/male-female type A extender cable). Note that this fix is present in Linux kernel as well as some abandoned Barebox code removed in the next patch. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: imx-usb-phy: Use stmp_reset_block() to reset PHYAndrey Smirnov2019-05-272-10/+6
| | | | | | | | | | | | | | | | | | Upstream kernel driver uses stmp_reset_block() to reset the PHY, so convert the code to do so as well to save some code and sync both drivers. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: imx-usb-phy: Wrap lines to silence checkpatchAndrey Smirnov2019-05-211-2/+4
| | | | | | | | | | | | | | | | Those two line are the only thing that checkpatch is complaining about. Wrap them to slince it. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: imx-usb-phy: Import register definitions from Linux driverAndrey Smirnov2019-05-211-17/+18
| | | | | | | | | | | | | | | | Import register definitions from Linux driver to simplify comparing/sharing code a bit. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/usb-ehci'Sascha Hauer2019-06-112-187/+242
|\ \
| * | usb: host: ehci: Allocate only NUM_QH queue heads for qh_listAndrey Smirnov2019-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | Use NUM_QH, not NUM_TD to specify allocation size. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ush: host: ehci: Simplify QH initialization in ehci_submit_async()Andrey Smirnov2019-05-231-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use a fixed circular list for asynchronous schedule that never changes, so if we drop an explicit memset() that zeros out an entire struct and replace it with code initializine all of the fields explicitly, we can set QH list once in ehci_init() and never touch it again. While at it move qt_altnext initialization to ehci_init() as well since we never change that field either. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>