summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
...
| * | 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>
* | Merge branch 'for-next/mtd'Sascha Hauer2018-11-091-1/+4
|\ \
| * | USB: gadget: prevent unnecessary warning messageSascha Hauer2018-10-261-1/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | The USB gadget autostart code issues a warning when no otg device exists: Cannot set parameter otg.mode: No such device This is unnecessary since there may be no otg device at all, but only a gadget device. Drop that warning by checking if there is a otg device first. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-11-091-2/+2
|\ \
| * | usb: ulpi: Make locally used functions staticSascha Hauer2018-10-231-2/+2
| |/ | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: at91: remove mach/io.hSascha Hauer2018-11-061-1/+1
| | | | | | | | | | | | | | Remove at91_sys_read() and at91_sys_write() since these are no longer used. This makes mach/io.h empty so remove that aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: at91: Add SoC namespace to matrix definesSascha Hauer2018-11-051-6/+13
| | | | | | | | | | | | | | Add SoC namespace to matrix define so we have one source less of conflicting defines. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: fastboot: remove unused variableSascha Hauer2018-10-301-1/+0
|/ | | | | | ep is unused, remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubifs'Sascha Hauer2018-10-091-1/+1
|\
| * Add linux/slab.hSascha Hauer2018-10-081-1/+1
| | | | | | | | | | | | | | | | | | Move stuff we already have in include/linux/barebox-wrapper.h that really belongs to include/linux/slab.h to there. Also add kmem_cache_* functions. UBIFS uses them in there own implementation, so we have to remove it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2018-10-091-6/+17
|\ \
| * | usb: gadget: fastboot: fix downloading files of wMaxPacketSize bytesSascha Hauer2018-10-021-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | File transfers with sizes of exact multiples of wMaxPacketSize up to EP_BUFFER_SIZE do not work. For a typical scenario that would be files of 512, 1024 ... 3584 bytes. This happens because we unconditionally put EP_BUFFER_SIZE into the initial request length. For non wMaxPacketSize aligned lengths this works well because the transfer is completed with a short packet. For wMaxPacketSize aligned lengths there is no short packet though, so the transfer never completes. Instead we have to put the file size into the initial request length. Some controllers like the DWC3 do not work when the request length is not aligned to wMaxPacketSize, so we align up to wMaxPacketSize like done in U-Boot. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Gavin Schenk <g.schenk@eckelmann.de> Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
| * | usb: gadget: fastboot: detect device if not presentSascha Hauer2018-09-181-0/+5
| |/ | | | | | | | | | | | | | | When a device file is not present when the fastboot gadget is created then try to detect it before we fail. It may be that we want to write to a device that we haven't used before. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bbu: Add "handler" parameter to barebox_update()Andrey Smirnov2018-10-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Add "handler" parameter to barebox_update() and remove the code that was respondible for header lookup before. With this change finding appropriate handler is caller's responsibility, which makes it possible to implement custom handler lookup/existence check, chache it, and then re-use it without calling handler_find_by_* functions for the second time. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bbu: Expose bbu_find_handler_by_*() functionsAndrey Smirnov2018-10-081-1/+1
|/ | | | | | | | | | | | Expose bbu_find_handler_by_device() and bbu_find_handler_by_name() as public functions and convert the only user of barebox_update_handler_exists() to use the former function instead. With this done, barebox_update_handler_exists() is no longer used anywhere in the code and can be removed. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: host: hub: Adjust device speed after every port resetAndrey Smirnov2018-08-293-20/+19
| | | | | | | | | | | | | | | | | | | | | To account for the possibility of a device coming out of second reset operating at different speed compared to first, move the code that stores device speed to be a part of hub_port_reset(). This way any speed change happening as a result of port reset could be accounted for. The above behaviour was observed on i.MX51 ZII RDU1, on USBH2 port connected to SMSC2660 USB Hub/SD card reader. For reasons unclear, first reset would put it into Full Speed mode whereas second would result in switch to High Speed. Artifically disabling second reset would result in the device operating at Full Speed. Not doing second speed adjustement on that board result would result in un-processed control transfer and failure to execute usb_set_address(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: host: hub: rename function argumentSascha Hauer2018-08-292-12/+12
| | | | | | | | Rename struct usb_device *dev function argument to usb_port_reset() to "hub" as the next patch will add another struct usb_device * argument to that function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* USB: host: hub: Make sure to remove dangling pointersAndrey Smirnov2018-08-291-0/+1
| | | | | | | | | | | | | When the call to usb_new_device() in usb_hub_port_connect_change() fails and corresponding USB device is freed with usb_free_device(), we need to make sure that the pointer to it stored in dev->children[port] is removed as well, lest we risk usage-after-free. This issue was observed when working with a device for which usb_set_address() would fail and trying to do "usb" right afterwards. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: allow to actually enable sparse fastboot supportUwe Kleine-König2018-08-081-3/+3
| | | | | | | | | | | | | | | When sparse support was (intended to be) made optional it was effectively unconditionally disabled because IS_ENABLED(USB_GADGET_FASTBOOT_SPARSE) always evaluates to 0. To actually make use of the introduced kconfig symbol the CONFIG_ prefix must not be skipped. Fixes: f4b5d3eeb607 ("usb: gadget: fastboot: Make sparse support optional") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Tested-by: Gavin Schenk <g.schenk@eckelmann.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: imx: implement support for limiting host to full speedNikita Yushchenko2018-06-263-0/+49
| | | | | | | | | | | | | | | | | | This is needed when host is known to not work properly in high speed mode. In linux, chipidea driver supports 'maximum-speed' device tree property. When that is set to "full-speed", driver sets PFSC bit in PORTSC register, which disallows use of high speed mode. This patch implements same support for barebox. Important technical detail is that PFSC bit is cleared by port reset, thus setting it has to be done in ehci->init() callback which is called after ehci_reset(). Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: fastboot: fix barebox update without using bufferMichael Grzeschik2018-05-171-1/+1
| | | | | | | | | | | | Commit e5098495 "usb: gadget: fastboot: Add option to download to a buffer" breaks the use of temporary files for fastboot barebox_update. In the patch the ".imagefile = FASTBOOT_TMPFILE" allocation gets removed, but data.imagefile is still used. This leads to an NULL pointer dereference. We fix it by using sourcefile instead. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>