summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
* usb: onboard-hub: bail out if peer hub is already probedLucas Stach2024-04-021-0/+10
| | | | | | | | | | | | | | | Many physical hub chips include multiple logical hubs to handle both USB and 2 and 3. Both logical hubs will then match the onboard hub driver, which means we'll end up with two driver instances trying to control the reset GPIO that is only present once on the physical chip. As this doesn't make sense, just bail out of the probe function when the peer-hub is already probed and can be assumed to handle power, clocks and reset resources of the chip. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Link: https://lore.barebox.org/20240327165554.894805-1-l.stach@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/bus-probe'Sascha Hauer2024-03-152-11/+44
|\
| * usb: print number of skipped OTG controllers when scanningAhmad Fatoum2024-02-292-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | I often get confused by running usb and wondering why devices behind unconfigured OTG controllers are not enumerated. Improve the user experience by printing a message when doing a USB scan while some OTG controllers are not yet configured (i.e. the otg.mode device parameter hasn't been set to "peripheral" or "host"). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240228160518.1589193-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: otg: turn global otg device into device aliasAhmad Fatoum2024-02-291-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | barebox supports manual switching of USB OTG ports to either peripheral or host via the otgX.mode={host,peripheral} device parameter. When support for configuring multiple OTG ports was added, the old singleton otg device was kept, as not to break existing scripts. Since then, barebox has gained support for device aliases, which are a light weight mechanism to resolve device names and point at a different device. This is exactly what's required here, so make use of it. Cc: Jules Maselbas <jmaselbas@zdiv.net> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240228160518.1589193-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: otg: maintain list of USB OTG controllersAhmad Fatoum2024-02-291-0/+11
| | | | | | | | | | | | | | | | | | | | | | We register devices for OTG controllers only to associate a .mode device parameter with them. Follow-up commits will need to refer to previously registered OTG controllers, so let's register a bus type for them and use it to maintain a list of controllers. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240228160518.1589193-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | block: record block device typeAhmad Fatoum2024-03-051-0/+1
| | | | | | | | | | | | | | | | | | | | Software running under EFI can query the type of a block device. For barebox to be able to report this, start assigning types to all block devices it can create. No functional change yet. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-24-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: xhci: fix reset endpoint on USB stallAhmad Fatoum2024-03-011-4/+5
|/ | | | | | | | | | | | | | | | | | usb: xhci: call dma_unmap_single in all error paths A new early exit for stalled USB was added that resets the endpoint before returning an error code to the caller. This unintentionally happened before unmapping the buffer, which is detected by CONFIG_DMA_API_DEBUG: usb2-0: Resetting EP 0... WARNING: dwc3 2f00000.usb@2f00000.of: from-device mapping 0xbdf96680+0xff: duplicate mapping Fixes: be01454be2 ("usb: xhci: reset endpoint on USB stall") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240301074400.1616644-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb-xhci'Sascha Hauer2024-02-214-120/+247
|\
| * usb: xhci: Do not panic on event timeoutsAhmad Fatoum2024-02-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports U-Boot commit 2fd7037122a920ae22377b06aa5b32651cc71f13: | Author: Hector Martin <marcan@marcan.st> | AuthorDate: Sun Oct 29 15:37:43 2023 +0900 | | usb: xhci: Do not panic on event timeouts | | Now that we always check the return value, just return NULL on timeouts. | We can still log the error since this is a problem, but it's not reason | to panic. | | Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-16-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: Recover from halted bulk endpointsAhmad Fatoum2024-02-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports U-Boot commit 9d88bd4dcf1628bf129163eb5a25c48068423601: | Author: Hector Martin <marcan@marcan.st> | AuthorDate: Sun Oct 29 15:37:41 2023 +0900 | | usb: xhci: Recover from halted bulk endpoints | | There is currently no codepath to recover from this case. In principle | we could require that the upper layer do this explicitly, but let's just | do it in xHCI when the next bulk transfer is started, since that | reasonably implies whatever caused the problem has been dealt with. | | Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-15-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: Allow context state errors when halting an endpointAhmad Fatoum2024-02-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports U-Boot commit 6f64f0ae230f9e8f68c5d9bf56ffee438fa60a6a: | Author: Hector Martin <marcan@marcan.st> | AuthorDate: Sun Oct 29 15:37:40 2023 +0900 | | usb: xhci: Allow context state errors when halting an endpoint | | There is a race where an endpoint may halt by itself while we are trying | to halt it, which results in a context state error. See xHCI 4.6.9 which | mentions this case. | | This also avoids BUGging when we attempt to stop an endpoint which was | already stopped to begin with, which is probably a bug elsewhere but | not a good reason to crash. | | Signed-off-by: Hector Martin <marcan@marcan.st> | Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-14-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: Better error handling in abort_td()Ahmad Fatoum2024-02-202-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports U-Boot commit 2526cd993272966606cb64b1898343e6963fb1d9: | Author: Hector Martin <marcan@marcan.st> | AuthorDate: Sun Oct 29 15:37:39 2023 +0900 | | usb: xhci: Better error handling in abort_td() | | If the xHC has a problem with our STOP ENDPOINT command, it is likely to | return a completion directly instead of first a transfer event for the | in-progress transfer. Handle that more gracefully. | | We still BUG() on the error code, but at least we don't end up timing | out on the event and ending up with unexpected event errors. | | Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: Guard all calls to xhci_wait_for_eventAhmad Fatoum2024-02-202-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports U-Boot commit 8d1e03f984c7467d7c8883f15dea14b2f8b4c0e2: | Author: Hector Martin <marcan@marcan.st> | AuthorDate: Sun Oct 29 15:37:38 2023 +0900 | | usb: xhci: Guard all calls to xhci_wait_for_event | | xhci_wait_for_event returns NULL on timeout, so the caller always has to | check for that. This addresses immediate explosions in this part | of the code when timeouts happen, but not the root cause for the | timeout. | | Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: Fix root hub descriptorAhmad Fatoum2024-02-202-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports U-Boot commit e330c8b83e8784d23614f80ca3f12b11ceb515d8: | Author: Mark Kettenis <kettenis@openbsd.org> | AuthorDate: Sat Jan 21 20:28:00 2023 +0100 | | usb: xhci: Fix root hub descriptor | | When a system has multiple XHCI controllers, some of the | properties described in the descriptor of the root hub (such as | the number of ports) might differ between controllers. Fix this | by switching from a single global hub descriptor to a hub | descriptor per controller. | | Signed-off-by: Mark Kettenis <kettenis@openbsd.org> and additionally marks the descriptor template const, so it's safe against future inadvertent modification. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-11-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: reset endpoint on USB stallAhmad Fatoum2024-02-201-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ports U-Boot commit d5daa02d8d9e7c403a3339db1966e8413e64e408: | Author: Stefan Agner <stefan@agner.ch> | AuthorDate: Mon Sep 27 14:42:58 2021 +0200 | | usb: xhci: reset endpoint on USB stall | | 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> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: support non-1:1 mapped xHCIAhmad Fatoum2024-02-204-53/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code so far assumed 1:1 mapped xHCI, which would apparently fail for the Raspberry Pi 4 (with its PCIe xHCI controller) and for Apple Silicon (where xHCI sits behind an IOMMU). The latter can't be fixed without having dma_alloc_coherent take a dev pointer, but the former can be fixed with existing API if we would just start using the DMA address return parameter instead of specifying DMA_ADDRESS_BROKEN, so let's do just that. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: don't use xhci_writeq for normal SDRAMAhmad Fatoum2024-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | While this shouldn't matter, it's confusing to use cpu_to_le32 for one struct field and writeq for another, so use cpu_to_leXX for both. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: Add missing xhci_readl()Ahmad Fatoum2024-02-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | xhci_readl() doesn't differ from readl(), but for uniformity, use xhci_ prefixed accessors throughout. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: Add missing endian conversions (cpu_to_leXX / leXX_to_cpu)Ahmad Fatoum2024-02-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This imports U-Boot commit 543eb12ecd91df324554b8abc8d52e965bd4922b: | Author: Stefan Roese <sr@denx.de> | AuthorDate: Tue Jul 21 10:46:02 2020 +0200 | | usb: xhci: Add missing endian conversions (cpu_to_leXX / leXX_to_cpu) | | While trying to use the U-Boot xHCI driver on the MIPS Octeon platform, | which is big endian, I noticed that the driver is missing a few endian | conversion calls. This patch adds these missing endian conversion | calls. | | Signed-off-by: Stefan Roese <sr@denx.de> This introduces no functional change for existing platforms as the barebox xHCI driver doesn't run on any big-endian CPUs. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: use macros for formatting valuesAhmad Fatoum2024-02-203-34/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | We have function-like macros for formatting various values that we stuff into the descriptors instead of manually having to mask and shift. Make use of these to make the code more concise. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: call xhci_flush_cache where appropriateAhmad Fatoum2024-02-202-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xhci_flush_cache() is a no-op in barebox, because we use dma-coherent allocations. Nevertheless, we define a stub for xhci_flush_cache, which is used should we ever want to change this behavior. The original U-Boot code doesn't use dma-coherent allocations and has run into a few cache invalidation issues. Import the xhci_flush_cache() added in the meantime. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: add various debugging printsAhmad Fatoum2024-02-202-3/+21
| | | | | | | | | | | | | | | | | | For debugging potential issues around the driver, add some debug prints. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: xhci: usb: xhci: avoid type conversion of void *Ahmad Fatoum2024-02-201-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original U-Boot commit 3fade88686e71c9acee4cbeb3ae9706bbc845608: | Author: Heinrich Schuchardt <xypron.glpk@gmx.de> | AuthorDate: Tue Sep 29 22:03:01 2020 +0200 | | usb: xhci: avoid type conversion of void * | | void * can be assigned to any pointer variable. Avoid | unnecessary conversions. | | Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> removes 8 such instances, of which only one remains in barebox. So remove that single remaining cast. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | treewide: use dev_err_probe instead of comparisons against EPROBE_DEFERAhmad Fatoum2024-02-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Drivers should not need to compare an error value against EPROBE_DEFER. We have a number of drivers doing that though to decide whether to print an error or not. This error message will be lost if the probe is deferred, so use dev_err_probe to store the error in that case. While at it, we shorten the error messages a bit. dev_err_probe will already print the string 'error' before the error code string. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219172659.3796647-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: core: replace calls to strerror with %pe format specifierAhmad Fatoum2024-02-201-3/+3
|/ | | | | | | | | | printf(), and by extension dev_err(), already has built-in support for formatting error codes, so make use of that instead of manual use of strerror(). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219172108.3780861-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: xhci: call dma_unmap_single in error pathsAhmad Fatoum2024-01-111-1/+5
| | | | | | | | | | | | | | | | | xHCI ring handling maps buffers prior to DMA and unmaps them on success, but leaves them mapped in the error case. This leads to buffers being remapped again triggering a CONFIG_DMA_API_DEBUG warning along with a stack trace: WARNING: dwc3 2f00000.usb@2f00000.of: from-device mapping 0xbdfa0000+0x800: duplicate mapping Fix this by unmapping the code in the error case too. This is ok to do, because in the first instace, DMA hasn't been enabled yet and in the others abort_td() called beforehand terminates it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240109120201.211691-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc3: of-simple: remove unmatchable compatiblesAhmad Fatoum2024-01-111-6/+0
| | | | | | | | | | Only three of the compatibles listed exist in up-to-date upstream device trees. As barebox need not worry about backwards compatibility with older device trees, remove the rest that would never be matched. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240108132721.1666173-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2023-11-273-9/+6
|\
| * drivers: pxa: don't define clk_enable/clk_disable with different prototypeAhmad Fatoum2023-11-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | Even on platforms without CCF support, clk_enable and clk_disable are defined as stubs. Defining functions with the same name can thus clash with these definitions, e.g. if <linux/clk.h> is included from a new header. Fix this by renaming the functions. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231123081427.1084418-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: dwc2: use linux/spinlock.h for stubsAhmad Fatoum2023-11-211-4/+1
| | | | | | | | | | | | | | | | | | We already have dummy definitions for common spin lock operations, so reuse them instead of defining them in the driver. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231109114838.1356467-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: gadget: initialize serialnumberMarco Felsch2023-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Windows hosts do require the serial number to be set to any ascii string to enumerate correctly. Set the serial number if provided or to "unset" if not to provide a sane default which works for both hosts. Reported-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231026144325.4172966-1-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: i.MX chipidea: Enable usbmisc driver for i.MX9Sascha Hauer2023-11-171-1/+1
| | | | | | | | | | | | | | | | The usbmisc unit on the i.MX9 is compatible to the one on i.MX8MM. Extend the #ifdef accordingly. Link: https://lore.barebox.org/20231110125800.1901232-24-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: i.MX: Move PBL USB gadget driver to arch/Sascha Hauer2023-11-133-236/+0
|/ | | | | | | | | | | | | The i.MX PBL USB gadget driver is currently selected by architecture Kconfig options. When USB gadget support is disabled then the build system doesn't descend into the directory where the driver is, leading to undefined references. We could change that and descend into the directory unconditionally, but as the driver doesn't have any dependencies to the USB gadget framework we can also move the driver to arch/arm/mach-imx/ to solve this problem. Link: https://lore.barebox.org/20231110130246.2222936-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/regmap'Sascha Hauer2023-10-271-1/+1
|\
| * treewide: switch regmap.h include to linux/regmap.hAhmad Fatoum2023-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that there are no longer any users of regmap.h in headers, let's switch all users in the source files to linux/regmap.h. That way, the only users of regmap.h whether directly or indirectly will be out-of-tree code, which will fail with an error if they are dependent on the old semantics of regmap_bulk_read and regmap_bulk_write. After a transitory period, we can then drop regmap.h. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231020071853.2826528-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: fsl_udc: lower state_complete constraintsMarco Felsch2023-10-181-1/+1
|/ | | | | | | | | | Signal state_complete if the host send more data than specified first. This may become crucial with different host usb loader tools and different host OSes. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20231017213608.3494255-4-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: return error on missing UDCAhmad Fatoum2023-07-261-0/+1
| | | | | | | | | | | | | | Recent sync with kernel added the match_existing_only member, but set it no where, leading to usb_gadget_register_driver succeeding on missing UDC. This used to be an error and we depend on it, e.g. global.usbgadget.autostart=1 is a no-op once usb_composite_probe has succeeded, but if we signal success in error cases, it can't be used to retry registration. Fixes: 14211ab8b0e1 ("usb: gadget: Update core to Linux-6.3-rc2") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230707121354.3248365-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: usbserial: prevent double freeAhmad Fatoum2023-07-261-1/+18
| | | | | | | | | | | | | | usbserial -d may be called more than once, which now results in removal of a driver that may already be removed leading to double frees. usbgadget -d doesn't suffer from this as both usb_multi_register and usb_multi_unregister keep around a global variable to check if the gadget is currently registered. Let's do likewise for usb_serial_unregister. Fixes: 14211ab8b0e1 ("usb: gadget: Update core to Linux-6.3-rc2") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230707121354.3248365-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: gadget: multi: do not double free on errorAhmad Fatoum2023-07-261-3/+1
| | | | | | | | | | | Recent sync with kernel changed usb_composite_probe to free resources on error as expected, so calling usb_composite_unregister on failed probe is now a double free. Fix that. Fixes: 14211ab8b0e1 ("usb: gadget: Update core to Linux-6.3-rc2") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230707121354.3248365-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2023-07-044-49/+72
|\
| * usb: make sure dma buffers are properly allocatedDenis Orlov2023-06-303-46/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | When we are doing dma_map/unmap we will end up clearing caches. As we can only do that with the granularity of a cache line, we must ensure that the corresponding buffers are properly aligned, as otherwise we may accidentally overwrite some data that happens to reside in the same cache line. This is exactly what dma_alloc() is for, so use that for buffers which we are going to map for dma. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20230629195718.14416-3-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: storage: fix missing calls to free()Denis Orlov2023-06-301-5/+12
| | | | | | | | | | | | | | | | | | | | Memory allocated with xzalloc() was not actually being freed in a few functions, resulting in memory leaks. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230629195718.14416-2-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: misc: onboard_hub: add support for Genesys USB3.1 hubMarco Felsch2023-06-231-0/+1
| | | | | | | | | | | | | | | | Add support for the GL3523 4-port USB3.1 hub. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230622124516.637037-1-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: dfu: Add missing get_alt callbackJules Maselbas2023-06-281-0/+15
|/ | | | | | | | | | | | | | The DFU gadget use an alternate interface number to select the partition to be worked on. Since the last update of the composite driver from Linux the get_alt callback is now necessary for gadgets that may use an alt number different than zero, which is the case for the DFU gadget. Add the missing callback. Fixes 4667c43c086 ("usb: gadget: update composite.c from Linux-6.3-rc2") Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/PAZP264MB31191088F091FE3F1B2A066BB127A@PAZP264MB3119.FRAP264.PROD.OUTLOOK.COM Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: have gpiod_ functions return and accept pointersAhmad Fatoum2023-06-231-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | The gpiod_ (GPIO descriptor) API used with Linux differs from barebox' normal GPIO API: - gpiod handles are opaque pointers and not an integer, which users have an expectation of stability for - gpiod API uses logic levels by default with separate raw API for physical level instead of physical level by default and separate API taking active level into account. The barebox gpiod_ API mimics the latter point, but still uses integers requiring ugly and arguably error prone conversions when porting kernel code. Let's improve upon that by just encoding the integer into a pointer variable for API compatibility. Later commits will switch barebox GPIO support to use actual GPIO descriptors without consulting the numeric indices, but we do this temporary switch here, so we can split up provider and consumer changes. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230622072329.1339317-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2023-06-221-5/+0
|\
| * block: parse partition table on block device registrationAhmad Fatoum2023-06-121-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every instance of block device registration is followed by an attempt to parse the partition table. Thus move partition table parsing into blockdevice_register. We do away with the warning print as it's superfluous: parse_partition_table doesn't return an error if partition table is missing and all other errors already result in an error message. Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230607120714.3083182-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/of-compat'Sascha Hauer2023-06-221-1/+2
|\ \
| * | treewide: don't mix goto labels and statements on same lineAhmad Fatoum2023-05-251-1/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | Coding style across the project is not to indent goto labels and to not mix them with code on the same line. Let's fix the few outliers that are there. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230519100120.2365970-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2023-06-226-0/+420
|\ \