summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/nvme'Sascha Hauer2019-03-071-6/+1
|\
| * drivers: Make use of device_pci_driver()Andrey Smirnov2019-02-181-6/+1
| | | | | | | | | | | | | | Replace all of the generic PCI boilerplate with device_pci_driver(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx8-usb'Sascha Hauer2019-03-0714-228/+3861
|\ \
| * | usb: usb251xb: add usb data lane port swap featureAndrey Smirnov2019-02-221-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Port of Linux patch https://patchwork.kernel.org/patch/10766235/ The HW can swap the USB differential-pair (D+/D-) for each port separately. So the USB signals can be re-aligned with a misplaced USB connector on the PCB. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Richard Leitner <richard.leitner@skidata.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: Port Microchip USB251x USB hub driver from LinuxAndrey Smirnov2019-02-225-0/+695
| | | | | | | | | | | | | | | | | | | | | | | | Port Microchip USB251x USB hub driver from Linux. Needed by ZII's i.MX8MQ boards. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: Import DWC3 USB controller driver from LinuxAndrey Smirnov2019-02-229-0/+2783
| | | | | | | | | | | | | | | | | | | | | | | | | | | Import DWC3 USB controller driver from Linux. This is a bare minimum port of the code needed to support USB host functionality on i.MX8MQ. No other use-case is explicitly supported. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Make use of lo_hi_readq/writeq()Andrey Smirnov2019-02-221-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | Make use of lo_hi_readq/writeq() to implement xhci_read/write_64() helpers, same as it is done in the Linux kernel. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Simplify route string building loopAndrey Smirnov2019-02-221-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | Simplify route string building loop by avoiding checking top_dev->parent->descriptor->bDeviceClass twice. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Initialize TRT flag for xHCI >= 1.0Andrey Smirnov2019-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Initialize TRT flag for xHCI >= 1.0, not just == 1.0. This is what Linux xHCI driver does. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Check usb_pipein(pipe) only once in xhci_submit_normal()Andrey Smirnov2019-02-221-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | Simplfy xhci_submit_normal()'s logic a bit by using helper variables and making sure that usb_pipein(pipe) is only called once. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Drop 'dma' field from struct xhci_hcdAndrey Smirnov2019-02-222-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Drop 'dma' field from struct xhci_hcd since it is not really used anywhere. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Simplify TRB initialization codeAndrey Smirnov2019-02-221-50/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current TRB initialization code in xHCI driver is: a) Somewhat inconsistent in endianness correctness: LE is insured in some places whereas in some places it isn't b) Somewhat inconsistent in how DMA buffer address is being written: some places utilize xhci_write_64, whereas others just assing cmd_trb field directly c) A bit wasetful since in a number of codepaths where TRB is used it is memset to zero first only to have 80+% of its fields changed to something else right after. To fix all of the above introduce xhci_init_event_cmd_trb(), that will initialize all of the fileds to desired values only once as well as taking care of endianness. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Convert xhci_submit_control() to use dma_map_single()Andrey Smirnov2019-02-221-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Convert xhci_submit_control() to use dma_(un)map_single(). These functions both allow us to handle potential physical/virtual address differences as well as allowing to drop a number of typecasts. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Convert xhci_submit_normal() to use dma_map_single()Andrey Smirnov2019-02-221-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Convert xhci_submit_normal() to use dma_(un)map_single(). These functions both allow us to handle potential physical/virtual address differences as well as allowing to drop a number of typecasts. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Don't try to DMA sync if buffer is NULLAndrey Smirnov2019-02-221-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Driver's .submit_control() callback can and will be called with buffer set to NULL (and length set to 0), so we need to make sure that we don't try to DMA sync the buffer in that case. Add appropriate gurads to make sure that doesn't happen. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Always wait for "Response Data" completionAndrey Smirnov2019-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Xhci_submit_control() submits TRB_DATA with TRB_IOC flag regardless of the vlaue of req->requesttype, so we shouldn't gate waiting for the event that will result from it with "req->requesttype & USB_DIR_IN". Failing to do this will result in unstable USB performance and will eventually cause the controller to fail completely. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Add support for 64-byte context sizeAndrey Smirnov2019-02-222-81/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xHCI spec allows for various context to be either 32 or 64 bytes in size, so we can't rely on struct definitions to correctly reflect data layout. Port varios context accessors from Linux kernel and convert the rest of the code to use them in order to be able to support both context sizes. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Drop pointless bitwise orAndrey Smirnov2019-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | On_hs_hub is a boolean, not a bitfiled, so usage of bitwise or is unnecessary. Replace it with a regular assignement operator. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Make sure to initialize xhci->rings_listAndrey Smirnov2019-02-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Make sure to initialize xhci->rings_list, otherwise any use of the driver will result in a crash. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Cast ~XHCI_IRQS to u32Andrey Smirnov2019-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | Cast ~XHCI_IRQS to u32 to avoid getting a warning on 64-bit builds. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Do not zero out DMA coherent memoryAndrey Smirnov2019-02-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Memory returned by dma_alloc_coherent() should already be zeroed out, so there's no need to do this explicitly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: xhci-hcd: Tabify the fileAndrey Smirnov2019-02-221-68/+68
| |/ | | | | | | | | | | | | | | Replace occasional all-whiltespace indentation with tabs for consistency. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / usb: imx: Do not disable VBUS on ehci_register()'s successAndrey Smirnov2019-02-271-3/+3
|/ | | | | | | | | | | | | Original code was written to exit early on ehci_register()'s success. As a part of e3eb0c729b, however, it was modified to to early exit on failure instead. This resulted in VBUS being erroneously disabled after EHCI controller was added, thus breaking USB on some i.MX boards (confirmed on ZII's RDU2). Fixes: e3eb0c729b ("usb: host: ehci: add ehci_unregister()") Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Vivien Didelot <vivien.didelot@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-01-151-5/+0
|\
| * usbgadget: dfu: remove useless break in the switch statementLadislav Michl2019-01-101-5/+0
| | | | | | | | | | Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/fastboot'Sascha Hauer2019-01-151-83/+153
|\ \ | |/ |/|
| * usb: gadget: fastboot: print fastboot messages also to the logsSascha Hauer2018-12-071-2/+5
| | | | | | | | | | | | | | It's nice to also see on the barebox side what is going on with fastboot, so print the messages to the logs also. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: fastboot: simplify rebootSascha Hauer2018-12-071-7/+1
| | | | | | | | | | | | | | | | Now that we end the fastboot session when shutting down barebox we can call restart_machine() directly and not in the completion callback of the answer request. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: fastboot: be more informative on bootingSascha Hauer2018-12-071-9/+7
| | | | | | | | | | | | | | | | | | We used to end the fastboot session once we received the boot command. Now that we end the session during shutdown we can do better: We can end the session once we actually shutdown, or more importantly in the case of an error. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: fastboot: tell host that we are going to shutdownSascha Hauer2018-12-071-0/+43
| | | | | | | | | | | | | | | | | | Some commands like booting a kernel will trigger a shutdown of barebox, but the host will never notice and timeout later. Be more friendly and tell the host we are going to shutdown and end the current fastboot session. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: fastboot: remove unnecessary context settingSascha Hauer2018-12-071-1/+0
| | | | | | | | | | | | | | | | | | Instead of setting the context for in_req we have set the context for out_req twice. This didn't trigger an error because we haven't used the context. So instead of fixing it we can equally well just remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: fastboot: drop unnecessary global variableSascha Hauer2018-12-071-9/+5
| | | | | | | | | | | | | | Polling for the status of a request does not require a global variable. We can poll for the status directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: fastboot: pass message type as enumSascha Hauer2018-12-071-58/+95
| | | | | | | | | | | | | | | | We used to pass the message type ("INFO", "FAIL", "OKAY") as strings to fastboot_tx_print(). Change this to a enum type. This allows fastboot_tx_print() to react on the message type in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-12-072-4/+2
|\ \
| * | usb: musb: Add missing includesSascha Hauer2018-11-192-4/+2
| |/ | | | | | | | | | | | | | | | | phy-am335x.c and phy-am335x-control.c both implement functions that they do not include the header file providing the prototype for. Add the missing include and remove the duplicate definition of struct phy_control. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: musb: fix possible out of bounds accessOleksij Rempel2018-11-211-1/+6
| | | | | | | | | | | | | | | | Either the condition 'epnum>=((u8)16)' is redundant or the array 'musb->endpoints[16]' is accessed at index 16, which is out of bounds. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: at91_udc: remove useless NULL checkOleksij Rempel2018-11-211-2/+1
|/ | | | | | | | if _ep or ep is NULL, we would get at least in two places before this test a NULL pointer dereference. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2018-11-0910-175/+162
|\
| * usbgadget: autostart: add DFU supportLadislav Michl2018-10-293-104/+3
| | | | | | | | | | | | | | | | | | | | | | Use global variable dfu_function to autostart DFU. As similar code is used to start multifunction gadget using command, move common code to common/usbgadget.c and consolidate it. It turned out that '-s' option of usbgadget command does nothing, so remove its help text and make it function as '-a'. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: set maxpacket_limitLadislav Michl2018-10-293-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gadget update to 3.15 imported Linux patch e117e742d310 ("usb: gadget: add "maxpacket_limit" field to struct usb_ep"): This patch adds "maxpacket_limit" to struct usb_ep. This field contains maximum value of maxpacket supported by driver, and is set in driver probe. This value should be used by autoconfig() function, because value of field "maxpacket" is set to value from endpoint descriptor when endpoint becomes enabled. So when autoconfig() function will be called again for this endpoint, "maxpacket" value will contain wMaxPacketSize from descriptior instead of maximum packet size for this endpoint. For this reason this patch adds new field "maxpacket_limit" which contains value of maximum packet size (which defines maximum endpoint capabilities). This value is used in ep_matches() function used by autoconfig(). Value of "maxpacket_limit" should be set in UDC driver probe function, using usb_ep_set_maxpacket_limit() function, defined in gadget.h. This function set choosen value to both "maxpacket_limit" and "maxpacket" fields. However said update didn't bring in all driver changes. Do it now. Fixes: 2776d53d7ac8 ("USB: gadget: Update to 3.15") Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: fsl_udc: pass controller instance to unregisterSascha Hauer2018-10-292-13/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | ci_udc_unregister() used to unregister "the controller". Since we may register multiple chipidea devices we called ci_udc_unregister() for each of them. This led to messages like: ERROR: imx-usb 53f80000.usb: gadget not registered. Fix this by returning the registered controller. This allows us to call ci_udc_unregister() only when we actually registered one before. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: imx: unregister ehci controller on device removalSascha Hauer2018-10-291-0/+5
| | | | | | | | | | | | | | | | ehci does DMA and hence must be properly quiesced before we leave barebox. Call ehci_unregister() on device removal when we previously registered a ehci controller. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: host: ehci-atmel: unregister host on device removeSascha Hauer2018-10-291-1/+5
| | | | | | | | | | | | | | The ehci code does DMA and really must be properly stopped when we leave barebox, so call ehci_unregister on device removal. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: host: ehci: do not use dev->privSascha Hauer2018-10-293-6/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | An ehci can be registered with ehci_register which is passed a struct device_d *. In that case the priv pointer may already be used by the caller, so we must not use it in the ehci code. At least for the Atmel ehci driver this fixes a bug, here dev->priv is set two times to different values. Since we need dev->priv in the ehci code to get the controller in ehci_detect() we can no longer implement that without the help of the caller, hence we eport ehci_detect() and epect it to be called by the code which registers a ehci host. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: host: ehci: add ehci_unregister()Sascha Hauer2018-10-293-8/+36
| | | | | | | | | | | | | | | | | | ehci_register() allocates data and registers a ehci host. Add ehci_unregister() to properly halt the controller and to free the memory again.. To do so, change ehci_register() to return the ehci host rather than an error code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: Add usb_unregister_host()Sascha Hauer2018-10-261-0/+5
| | | | | | | | | | | | | | | | We have usb_register_host() which puts a new host on the list of hosts we should also have the opposite which removes the host from the list again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: host: ehci: rename ehci_priv to ehci_hostSascha Hauer2018-10-261-21/+21
| | | | | | | | | | | | | | As we are going to export the structure as a cookie to others rename it to ehci_host. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: fsl_udc: Drop using global variableSascha Hauer2018-10-261-17/+22
| | | | | | | | | | | | | | No need to use the global udc_controller variable when we are provided an usb_gadget. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-093-5/+6
|\ \
| * | drivers: Introduce dev_set_name()Andrey Smirnov2018-10-183-5/+6
| |/ | | | | | | | | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>