summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
...
| * usb: imx: fix overcurrent polarity handling on i.MX7Michael Grzeschik2021-02-041-3/+3
| | | | | | | | | | | | | | | | The reference manual says the overcurrent polarity is changed to low with the bit set. We fix that according to the description. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: host: ehci: remove duplicated usb_host_detect() callsAhmad Fatoum2021-02-016-56/+0
| | | | | | | | | | | | | | | | With the last patch adding a fallback detect, we no longer need the duplication in the host controller drivers. Drop them. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: add fallback ->detect method for USB host driversAhmad Fatoum2021-02-011-0/+14
| | | | | | | | | | | | | | | | | | | | We already maintain a list of USB host controllers, so we can use that to implement a generic detect callback. Currently, all drivers define their own, which uses driver-specific means to arrive at the struct usb_host and then call usb_host_detect(). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2021-02-221-20/+43
|\ \
| * | usb: otg: Add support to register more than one otg devJules Maselbas2021-02-181-20/+43
| |/ | | | | | | | | | | | | | | | | This allow each otg controller to register one otg device for host/peripheral mode switch. The first otg device registered "otg0" will also be aliased by "otg" for compatibility. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/ext4'Sascha Hauer2021-02-221-12/+13
|\ \
| * | usb: storage: support USB disks up to 2TiB of sizeAhmad Fatoum2021-02-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SCSI Read Capacity (10) only supports up to 0xFFFF_FFFF sectors at most, which at 512 bytes per sector equals a disk size of 2 TiB. Due to barebox block layer limits, however, the barebox mass storage driver doesn't address sectors that need more than 31 bits to describe. These block layer limits were removed in a previous commit, so make the USB driver use the full 32 bit to support 512-byte sector USB disks up to 2 TiB of size. Disks that are larger than that must either implement SCSI Read Capacity (16) to support up to 16 Exabytes or increase the sector size beyond 512 bytes. This commit doesn't do that as I don't have the suitable hardware to test. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | block: use 64-bit types for sector offset and count on all platformsAhmad Fatoum2021-02-181-9/+9
| |/ | | | | | | | | | | | | | | | | | | | | barebox' use of int for the sector offset puts an upper bound of 1TB on the size of supported block devices, which is already exceeded by common place USB mass storage. Increasing the sizes involved to 64 bit like Linux does won't magically add missing driver support, but it gives us at least a fighting chance. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: dfu: Wrap fs operation in workqueueJules Maselbas2021-02-161-129/+246
| | | | | | | | | | | | | | File system operation shouldn't be executed in a poller. Use a workqueue to delay filesystem operation to command context. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: dfu: Rework print messagesJules Maselbas2021-02-161-5/+6
| | | | | | | | | | | | | | Replace printf with pr_err and debug with pr_debug. Defines "dfu :" as a prefix for formatted prints. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: gadget: dfu: Use func_to_dfuJules Maselbas2021-02-101-2/+2
|/ | | | | | | Replace the uses of container_of with func_to_dfu when available. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: swap order of phy_init and phy_power_on to what Linux doesAhmad Fatoum2021-01-061-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux doesn't seem to enforce a fixed order between phy_init and phy_power_on. The Linux dwc2 driver does power_on and then phy_init, which is the inverse of what barebox is currently doing. The PHYs normally used with dwc2 are written with this in mind. For example, our stm32-usbphyc driver fails to disable: ERROR: stm32-usbphyc 5a006000.usbphyc@5a006000.of: PLL not reset ERROR: phy1: phy exit failed --> -5 Because Linux does exit -> power_off, but barebox does power_off -> exit. Issue was raised upstream: https://lore.kernel.org/lkml/6cd01e79-fdc0-3bd4-32b5-a85142533f8a@pengutronix.de/T/#t Until this is settled, swap the order to follow what Linux does. This is suboptimal, because it means controller drivers have different order of the operations and that you can't combine arbitrary PHYs and controllers, but it seems unlikely we will support combinations that aren't supported by Linux in the first place anyway. Cc: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: add support to force gadget modeMichael Grzeschik2021-01-061-0/+144
| | | | | | | | | | | In case the driver is to be run in peripheral mode rather than otg, it needs to be forced in hardware to the selected mode. This patch adds support to set and clear that hardware override. The functions are mostly copied from linux. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Tested-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: update the dr_mode on set_mode callbackMichael Grzeschik2021-01-061-0/+6
| | | | | | | | | | The dwc2 dr_mode can be configured with otg.mode in otg mode. Currently the mode will not be set with the users decision. This patch fixes this by overwriting the mode with the one set by set_mode callback. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Tested-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: add reset controller dependency for probe via oftreeMichael Grzeschik2021-01-061-0/+5
| | | | | | | | | | The dwc2 controller is connected to one reset controller which needs to be triggered before it is able to operate. This patch adds the referenced reset controller in the devicetree to be used. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Tested-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: add clk dependency for probe via oftreeMichael Grzeschik2021-01-062-2/+18
| | | | | | | | | | The dwc2 controller at least needs one core clock which needs to be enabled before it is able to address the core registers. This patch adds the referenced clock in the devicetree to be used. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Tested-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: cleanup on error for deferred probingMichael Grzeschik2021-01-061-3/+4
| | | | | | | | | The driver needs to cleanup the resources if an error occurred. Otherwise, on deferred probing, it will fail to take the resources for a second time. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Tested-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: Rename dwc2_core_snpsid to dwc2_check_core_versionJules Maselbas2020-12-163-5/+3
| | | | | | | | The name dwc2_check_core_version is the one used on Linux, make it this way. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: Fix dr_mode check in dwc2_get_dr_modeJules Maselbas2020-12-162-8/+8
| | | | | | | | | | In Linux, configs CONFIG_USB_DWC2_HOST and CONFIG_USB_DWC2_GADGET are respectively for host only and gadget only support, they are mutually exclusive. However this is not the case in barebox, they are independent options. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: Remove unnecessary functions declarationJules Maselbas2020-12-162-8/+4
| | | | | | | Theses functions are only used in dwc2/core.c make them static. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: dwc2: Add support for optional usb phyJules Maselbas2020-12-163-0/+28
| | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-12-112-14/+36
|\
| * usb: host: ehci: fix mismatch in format stringAhmad Fatoum2020-12-071-1/+1
| | | | | | | | | | | | | | | | sz is of type size_t. Use the appropriate format string specifier for printing it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: fastboot: Fix error pathSascha Hauer2020-11-171-13/+35
| | | | | | | | | | | | | | fastboot_bind() can fail in multiple ways. Roll back things already done in the error path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2020-12-112-0/+8
|\ \
| * | usb: imx: get power pin polarity from DTLucas Stach2020-11-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | There is a documented DT property to set the power pin polarity, parse it. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: imx: add support for setting power pin polarity on i.MX6/7Lucas Stach2020-11-241-0/+5
| |/ | | | | | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / usb: gadget: fastboot: fix no longer accurate help textAhmad Fatoum2020-11-231-1/+1
|/ | | | | | | | Since 38d7ba55da26 ("fastboot: rename usbgadget.fastboot_* variables to fastboot.*"), the variables are named differently. Amend the help text. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: Fix initial max packet sizeSascha Hauer2020-10-271-3/+5
| | | | | | | | | In case the USB device is a full speed device we have to set dev->epmaxpacketin[0] and dev->epmaxpacketout[0] before doing a get_descriptor_len() because otherwise it's unset during that call. Fixes: 6d1d95a386 ("usb: factor out a usb_setup_descriptor() function") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/percent_pe' into masterSascha Hauer2020-10-142-4/+3
|\
| * treewide: replace strerror(-PTR_ERR(errno)) with %pe format specifierAhmad Fatoum2020-09-291-3/+2
| | | | | | | | | | | | | | | | | | Using %pe instead of PTR_ERR has the benefit of being less verbose and less error-prone (no negation necessary) while potentially reducing code size. Make use of it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * vsprintf: retire strerrorp in favor of %peAhmad Fatoum2020-09-291-1/+1
| | | | | | | | | | | | | | | | | | strerrorp() is only used along with printf. We now have a format specifier for printing error pointers directly, so use that and remove strerrorp. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc' into masterSascha Hauer2020-10-145-16/+27
|\ \
| * | usb: dwc2: Uninitialize host and device on removeJules Maselbas2020-10-094-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | Device gadget must be properly uninitialized on poweroff however host system might not detect barebox's usb gadget has beeing disconnected. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | USB: musb: host: fix mismatched format specifier in dev_dbg()Ahmad Fatoum2020-09-281-2/+2
| |/ | | | | | | | | | | | | | | Unadorned 0 is an int, but is printed used %zu. As it's just an interger literal, just hardcode it into the string. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/driver-macro' into masterSascha Hauer2020-10-143-17/+3
|\ \
| * | treewide: Use driver macroSascha Hauer2020-09-293-17/+3
| |/ | | | | | | | | | | | | We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / USB: musb: remove dead storesAhmad Fatoum2020-10-021-4/+3
|/ | | | | | | | | | Reading the interrupt registers has a side-effect, so their value need not be used for anythig. Storing it into a variable never read obfuscates this however. Cast to (void) for clarity. Reported-by: clang-analyzer-10 Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net' into masterSascha Hauer2020-09-252-14/+52
|\
| * usb: fastboot: execute commands in command contextSascha Hauer2020-08-191-7/+45
| | | | | | | | | | | | | | Long lived commands which also use other resources shouldn't be executed in a poller. Use a workqeue to delay the work to command context. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fastboot: init list head in commonSascha Hauer2020-08-191-2/+0
| | | | | | | | | | | | | | The list of variables can be initialized in common code, no need to do the in the different implementations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: Add a slice to usb host controllersSascha Hauer2020-08-191-5/+7
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: dwc3-of-simple: Use clk_bulk APISascha Hauer2020-09-241-48/+10
| | | | | | | | | | | | | | | | | | | | Use clk_bulk_get_all() to retrieve all clocks rather than open code this. Also actually enable the clocks, previously they had been disabled in the error path, but never enabled before. Also this fixes a memory corruption: The driver populated an array of clks, but only allocated space for a single entry. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | usb: dwc3: Whitespace cleanupSascha Hauer2020-09-231-3/+3
| | | | | | | | | | | | Replace spaces with tabs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/usb-dwc2' into masterSascha Hauer2020-08-1916-1914/+6308
|\ \
| * | usb: dwc2: Use register_otg_deviceJules Maselbas2020-08-142-5/+28
| | | | | | | | | | | | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: dwc2: Add gadget driverJules Maselbas2020-08-148-0/+2825
| | | | | | | | | | | | | | | | | | | | | This driver is comes from Linux (~ 5.1-rc6) and only support buffer DMA. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: dwc2: Add structure for gadget driverJules Maselbas2020-08-141-0/+55
| | | | | | | | | | | | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: dwc2: Add function to flush tx fifoJules Maselbas2020-08-142-0/+34
| | | | | | | | | | | | | | | Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: dwc2: host: Rewrite dwc2_hc_initJules Maselbas2020-08-141-20/+27
| | | | | | | | | | | | | | | | | | | | | | | | Removed the uses of a table to convert the usb endpoint type for the controller. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>