aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-06-06Merge tag 'overflow-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linuxLinus Torvalds1-3/+2
Pull overflow updates from Kees Cook: "This adds the new overflow checking helpers and adds them to the 2-factor argument allocators. And this adds the saturating size helpers and does a treewide replacement for the struct_size() usage. Additionally this adds the overflow testing modules to make sure everything works. I'm still working on the treewide replacements for allocators with "simple" multiplied arguments: *alloc(a * b, ...) -> *alloc_array(a, b, ...) and *zalloc(a * b, ...) -> *calloc(a, b, ...) as well as the more complex cases, but that's separable from this portion of the series. I expect to have the rest sent before -rc1 closes; there are a lot of messy cases to clean up. Summary: - Introduce arithmetic overflow test helper functions (Rasmus) - Use overflow helpers in 2-factor allocators (Kees, Rasmus) - Introduce overflow test module (Rasmus, Kees) - Introduce saturating size helper functions (Matthew, Kees) - Treewide use of struct_size() for allocators (Kees)" * tag 'overflow-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: treewide: Use struct_size() for devm_kmalloc() and friends treewide: Use struct_size() for vmalloc()-family treewide: Use struct_size() for kmalloc()-family device: Use overflow helpers for devm_kmalloc() mm: Use overflow helpers in kvmalloc() mm: Use overflow helpers in kmalloc_array*() test_overflow: Add memory allocation overflow tests overflow.h: Add allocation size calculation helpers test_overflow: Report test failures test_overflow: macrofy some more, do more tests for free lib: add runtime test of check_*_overflow functions compiler.h: enable builtin overflow checkers and add fallback code
2018-06-06treewide: Use struct_size() for kmalloc()-familyKees Cook1-3/+2
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; void *entry[]; }; instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL); This patch makes the changes for kmalloc()-family (and kvmalloc()-family) uses. It was done via automatic conversion with manual review for the "CHECKME" non-standard cases noted below, using the following Coccinelle script: // pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len * // sizeof *pkey_cache->table, GFP_KERNEL); @@ identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc"; expression GFP; identifier VAR, ELEMENT; expression COUNT; @@ - alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP) + alloc(struct_size(VAR, ELEMENT, COUNT), GFP) // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL); @@ identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc"; expression GFP; identifier VAR, ELEMENT; expression COUNT; @@ - alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP) + alloc(struct_size(VAR, ELEMENT, COUNT), GFP) // Same pattern, but can't trivially locate the trailing element name, // or variable name. @@ identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc"; expression GFP; expression SOMETHING, COUNT, ELEMENT; @@ - alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP) + alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP) Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-05Merge tag 'driver-core-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-coreLinus Torvalds1-0/+1
Pull driver core updates from Greg KH: "Here is the driver core patchset for 4.18-rc1. The large chunk of these are firmware core documentation and api updates. Nothing major there, just better descriptions for others to be able to understand the firmware code better. There's also a user for a new firmware api call. Other than that, there are some minor updates for debugfs, kernfs, and the driver core itself. All of these have been in linux-next for a while with no reported issues" * tag 'driver-core-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (23 commits) driver core: hold dev's parent lock when needed driver-core: return EINVAL error instead of BUG_ON() driver core: add __printf verification to device_create_groups_vargs mm: memory_hotplug: use put_device() if device_register fail base: core: fix typo 'can by' to 'can be' debugfs: inode: debugfs_create_dir uses mode permission from parent debugfs: Re-use kstrtobool_from_user() Documentation: clarify firmware_class provenance and why we can't rename the module Documentation: remove stale firmware API reference Documentation: fix few typos and clarifications for the firmware loader ath10k: re-enable the firmware fallback mechanism for testmode ath10k: use firmware_request_nowarn() to load firmware firmware: add firmware_request_nowarn() - load firmware without warnings firmware_loader: make firmware_fallback_sysfs() print more useful firmware_loader: move kconfig FW_LOADER entries to its own file firmware_loader: replace ---help--- with help firmware_loader: enhance Kconfig documentation over FW_LOADER firmware_loader: document firmware_sysfs_fallback() firmware: rename fw_sysfs_fallback to firmware_fallback_sysfs() firmware: use () to terminate kernel-doc function names ...
2018-06-05Merge tag 'usb-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usbLinus Torvalds156-3256/+8731
Pull USB and PHY updates from Greg KH: "Here is the big USB pull request for 4.18-rc1. Lots of stuff here, the highlights are: - phy driver updates and new additions - usual set of xhci driver updates - normal set of musb updates - gadget driver updates and new controllers - typec work, it's getting closer to getting fully out of the staging portion of the tree. - lots of minor cleanups and bugfixes. All of these have been in linux-next for a while with no reported issues" * tag 'usb-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (263 commits) Revert "xhci: Reset Renesas uPD72020x USB controller for 32-bit DMA issue" xhci: Add quirk to zero 64bit registers on Renesas PCIe controllers xhci: Allow more than 32 quirks usb: xhci: force all memory allocations to node selftests: add test for USB over IP driver USB: typec: fsusb302: no need to check return value of debugfs_create_dir() USB: gadget: udc: s3c2410_udc: no need to check return value of debugfs_create functions USB: gadget: udc: renesas_usb3: no need to check return value of debugfs_create functions USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions USB: gadget: udc: gr_udc: no need to check return value of debugfs_create functions USB: gadget: udc: bcm63xx_udc: no need to check return value of debugfs_create functions USB: udc: atmel_usba_udc: no need to check return value of debugfs_create functions USB: dwc3: no need to check return value of debugfs_create functions USB: dwc2: no need to check return value of debugfs_create functions USB: core: no need to check return value of debugfs_create functions USB: chipidea: no need to check return value of debugfs_create functions USB: ehci-hcd: no need to check return value of debugfs_create functions USB: fhci-hcd: no need to check return value of debugfs_create functions USB: fotg210-hcd: no need to check return value of debugfs_create functions USB: imx21-hcd: no need to check return value of debugfs_create functions ...
2018-06-04Merge branch 'hch.procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfsLinus Torvalds5-75/+7
Pull procfs updates from Al Viro: "Christoph's proc_create_... cleanups series" * 'hch.procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (44 commits) xfs, proc: hide unused xfs procfs helpers isdn/gigaset: add back gigaset_procinfo assignment proc: update SIZEOF_PDE_INLINE_NAME for the new pde fields tty: replace ->proc_fops with ->proc_show ide: replace ->proc_fops with ->proc_show ide: remove ide_driver_proc_write isdn: replace ->proc_fops with ->proc_show atm: switch to proc_create_seq_private atm: simplify procfs code bluetooth: switch to proc_create_seq_data netfilter/x_tables: switch to proc_create_seq_private netfilter/xt_hashlimit: switch to proc_create_{seq,single}_data neigh: switch to proc_create_seq_data hostap: switch to proc_create_{seq,single}_data bonding: switch to proc_create_seq_data rtc/proc: switch to proc_create_single_data drbd: switch to proc_create_single resource: switch to proc_create_seq_data staging/rtl8192u: simplify procfs code jfs: simplify procfs code ...
2018-06-01Revert "xhci: Reset Renesas uPD72020x USB controller for 32-bit DMA issue"Marc Zyngier3-28/+0
This reverts commit 8466489ef5ba48272ba4fa4ea9f8f403306de4c7. Now that we can properly reset the uPD72020x without a hard PCI reset, let's get rid of the existing quirks. Tested-by: Domenico Andreoli <domenico.andreoli@linux.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Tested-by: Faiz Abbas <faiz_abbas@ti.com> Tested-by: Domenico Andreoli <domenico.andreoli@linux.com> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01xhci: Add quirk to zero 64bit registers on Renesas PCIe controllersMarc Zyngier3-2/+72
Some Renesas controllers get into a weird state if they are reset while programmed with 64bit addresses (they will preserve the top half of the address in internal, non visible registers). You end up with half the address coming from the kernel, and the other half coming from the firmware. Also, changing the programming leads to extra accesses even if the controller is supposed to be halted. The controller ends up with a fatal fault, and is then ripe for being properly reset. On the flip side, this is completely unsafe if the defvice isn't behind an IOMMU, so we have to make sure that this is the case. Can you say "broken"? This is an alternative method to the one introduced in 8466489ef5ba ("xhci: Reset Renesas uPD72020x USB controller for 32-bit DMA issue"), which will subsequently be removed. Tested-by: Domenico Andreoli <domenico.andreoli@linux.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Tested-by: Faiz Abbas <faiz_abbas@ti.com> Tested-by: Domenico Andreoli <domenico.andreoli@linux.com> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01xhci: Allow more than 32 quirksMarc Zyngier2-36/+36
We now have 32 different quirks, and the field that holds them is full. Let's bump it up to the next stage so that we can handle some more... The type is now an unsigned long long, which is 64bit on most architectures. We take this opportunity to change the quirks from using (1 << x) to BIT_ULL(x). Tested-by: Domenico Andreoli <domenico.andreoli@linux.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Tested-by: Faiz Abbas <faiz_abbas@ti.com> Tested-by: Domenico Andreoli <domenico.andreoli@linux.com> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01usb: xhci: force all memory allocations to nodeAdam Wallis1-19/+38
The xhci driver forces DMA memory to be node aware, however, there are several ring-related memory allocations that are not memory node aware. This patch resolves those *alloc functions to be allocated on the proper memory node. Signed-off-by: Adam Wallis <awallis@codeaurora.org> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: typec: fsusb302: no need to check return value of debugfs_create_dir()Greg Kroah-Hartman1-11/+4
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Clean up the fsusb302 driver to not care if the root directory was created, as the code should work properly either way. Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: gadget: udc: s3c2410_udc: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-13/+4
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Felipe Balbi <balbi@kernel.org> Cc: Li Yang <leoyang.li@nxp.com> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: gadget: udc: renesas_usb3: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-15/+3
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Felipe Balbi <balbi@kernel.org> Cc: Simon Horman <horms+renesas@verge.net.au> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functionsGreg Kroah-Hartman2-40/+6
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. There is also no need to keep the file dentries around at all, so remove those variables from the device structure. Cc: Daniel Mack <daniel@zonque.org> Cc: Haojian Zhuang <haojian.zhuang@gmail.com> Cc: Felipe Balbi <balbi@kernel.org> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: gadget: udc: gr_udc: no need to check return value of debugfs_create functionsGreg Kroah-Hartman2-6/+2
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. There is also no need to keep the file dentries around at all, so remove those variables from the device structure. Cc: Felipe Balbi <balbi@kernel.org> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Jaejoong Kim <climbbb.kim@gmail.com> Cc: Li Yang <leoyang.li@nxp.com> Cc: Johan Hovold <johan@kernel.org> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: gadget: udc: bcm63xx_udc: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-32/+5
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. There is also no need to keep the file dentries around at all, so remove those variables from the device structure. Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Felipe Balbi <balbi@kernel.org> Cc: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: udc: atmel_usba_udc: no need to check return value of debugfs_create functionsGreg Kroah-Hartman2-64/+11
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. There is also no need to keep the file dentries around at all, so remove those variables from the device structure. Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Felipe Balbi <balbi@kernel.org> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: dwc3: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-32/+11
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Felipe Balbi <balbi@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: dwc2: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-62/+16
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: core: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-21/+5
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Johan Hovold <johan@kernel.org> Cc: Kai-Heng Feng <kai.heng.feng@canonical.com> Cc: Peter Chen <peter.chen@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: chipidea: no need to check return value of debugfs_create functionsGreg Kroah-Hartman3-45/+17
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: ehci-hcd: no need to check return value of debugfs_create functionsGreg Kroah-Hartman2-27/+8
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: fhci-hcd: no need to check return value of debugfs_create functionsGreg Kroah-Hartman2-20/+5
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. There is also no need to keep the file dentries around at all, so remove those variables from the host controller structure. Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: fotg210-hcd: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-25/+9
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Johan Hovold <johan@kernel.org> Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@intel.com> Cc: Vasyl Gomonovych <gomonovych@gmail.com> Cc: Mariusz Skamra <mariuszx.skamra@intel.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: imx21-hcd: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-34/+10
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Cc: Johan Hovold <johan@kernel.org> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: isp116x-hcd: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-13/+4
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Olav Kongas <ok@artecdesign.ee> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: ohci: no need to check return value of debugfs_create functionsGreg Kroah-Hartman3-44/+9
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. There is also no need to keep the file dentries around at all, so remove those variables from the host controller structure. Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: uhci: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-11/+4
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: mon: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-30/+7
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. We do need to save the dentries for these files, so keep them around, but no need to check if they are "valid" or not, as the code works just as well either way. Cc: Pete Zaitcev <zaitcev@kotori.zaitcev.us> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: Fredrik Noring <noring@nocrew.org> Cc: Kate Stewart <kstewart@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: mtu3: no need to check return value of debugfs_create_dir()Greg Kroah-Hartman1-4/+0
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: musb: clean up debugfs file and directory creationGreg Kroah-Hartman4-52/+11
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Because of this, lots of init functions do not need to have return values, so this cleans up a lot of unused error handling code that never could have triggered in the past. Cc: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31USB: typec: tcpm: no need to check return value of debugfs_create_dir()Greg Kroah-Hartman1-8/+3
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Clean up the tcpm.c code to not care about this, turns out no one was even checking the return value of this function, so it didn't matter. Note, I do not think this code can be removed in a running system, as the debugfs root directory will stick around, that should be fixed someday... Revieved-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31phy: tegra: select USB_COMMONArnd Bergmann1-0/+1
A built-in PHY driver cannot link against modular USB core code: drivers/usb/phy/phy-tegra-usb.o: In function `tegra_usb_phy_probe': phy-tegra-usb.c:(.text+0x6bc): undefined reference to `usb_get_dr_mode' This uses a 'select' statement in Kconfig like we have for other such PHY drivers. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31usb: hub: Per-port setting to reduce TRSTRCY to 10 msNicolas Boichat1-1/+5
Currently, the USB hub core waits for 50 ms after enumerating the device. This was added to help "some high speed devices" to enumerate (b789696af8 "[PATCH] USB: relax usbcore reset timings"). On some devices, the time-to-active is important, so we provide a per-port option to reduce the time to what the USB specification requires: 10 ms. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31usb: hub: Per-port setting to use old enumeration schemeNicolas Boichat3-4/+33
The "old" enumeration scheme is considerably faster (it takes ~244ms instead of ~356ms to get the descriptor). It is currently only possible to use the old scheme globally (/sys/module/usbcore/parameters/old_scheme_first), which is not desirable as the new scheme was introduced to increase compatibility with more devices. However, in our case, we care about time-to-active for a specific USB device (which we make the firmware for), on a specific port (that is pogo-pin based: not a standard USB port). This new sysfs option makes it possible to use the old scheme on a single port only. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31usb: xhci: tegra: Fix runtime PM supportJon Hunter1-1/+1
Fix silly mistake when enabling runtime PM support for the Tegra XHCI driver. If runtime PM was enabled correctly for the XHCI device, then we should call pm_runtime_get_sync() to enable the device. Fixes: ee9e5f4c7825 ("usb: xhci: tegra: Add runtime PM support") Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31usb: chipidea: Fix ULPI on imx51Andrey Smirnov1-1/+2
Workaround introduced for i.MX53 in be9cae2479f48 ("usb: chipidea: imx: Fix ULPI on imx53") seems to be applicable in case of i.MX51 as well. Running latest kernel on ZII RDU1 Board (imx51-zii-rdu1.dts) exhibits a kernel frozen on PORTSC access and applying the workaround resolves the issue. Fixes: be9cae2479f4 ("usb: chipidea: imx: Fix ULPI on imx53") Cc: Peter Chen <peter.chen@nxp.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Chris Healy <cphealy@gmail.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Tested-By: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31usb: musb: remove an unused variableArnd Bergmann1-1/+0
After the only users of this variable got removed, we now get a warning about 'otg' being unused: drivers/usb/musb/da8xx.c: In function 'da8xx_musb_interrupt': drivers/usb/musb/da8xx.c:226:19: error: unused variable 'otg' [-Werror=unused-variable] Fixes: d2852f2d3e6d ("usb: musb: remove references to default_a of struct usb_otg") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31usb: dwc3: Remove DEBUG define from Qualcomm DWC3 glue driverDouglas Anderson1-1/+0
It appears that a "#define DEBUG" was left in on the recent patch landed for the Qualcomm DWC3 glue driver. Let's remove it. Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31usb: host: ohci: fix sfr kernel warning in ohci-at91 driverPrasanthi Chellakumar1-1/+1
The USB Host Controller driver 'ohci-at91.c' reads a Special Function Register - OHCI Interrupt Configuration Register (AT91_SFR_OHCIICR) for bits SUSPEND_A/B/C. These bits are defined in sama5d2 alone, so sfr register mapping is done with compatible string "atmel,sama5d2-sfr". This gives a kernel warning 'failed to find sfr node' with non sama5d2 cpus which is removed here, thus leaving it up to having a proper DTS. Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31usb: core: message: remove extra endianness conversion in usb_set_isoch_delayRuslan Bilovol1-1/+1
No need to do extra endianness conversion in usb_set_isoch_delay because it is already done in usb_control_msg() Fixes: 886ee36e7205 ("usb: core: add support for USB_REQ_SET_ISOCH_DELAY") Cc: Dmytro Panchenko <dmytro.panchenko@globallogic.com> Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Cc: stable <stable@vger.kernel.org> # v4.16+ Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31Merge tag 'usb-serial-4.18-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-nextGreg Kroah-Hartman5-121/+97
Johan writes: USB-serial updates for v4.18-rc1 Here are the USB-serial updates for 4.18-rc1, including: - support for hardware-assisted XON/XOFF output flow control for pl2303 - fix for a long-standing IXON/IXOFF mixup in ftdi_sio - blacklist of two apparently unused dwm-158 modem interfaces that confused some user space daemon (option) - add missing const to a tty helper currently used by USB serial only Included are also various clean ups. All have been in linux-next with no reported issues. Signed-off-by: Johan Hovold <johan@kernel.org>
2018-05-31driver core: hold dev's parent lock when neededMartin Liu1-0/+1
SoC have internal I/O buses that can't be proved for devices. The devices on the buses can be accessed directly without additinal configuration required. This type of bus is represented as "simple-bus". In some platforms, we name "soc" with "simple-bus" attribute and many devices are hooked under it described in DT (device tree). In commit bf74ad5bc417 ("Hold the device's parent's lock during probe and remove") to solve USB subsystem lock sequence since USB device's characteristic. Thus "soc" needs to be locked whenever a device and driver's probing happen under "soc" bus. During this period, an async driver tries to probe a device which is under the "soc" bus would be blocked until previous driver finish the probing and release "soc" lock. And the next probing under the "soc" bus need to wait for async finish. Because of that, driver's async probe for init time improvement will be shadowed. Since many devices don't have USB devices' characteristic, they actually don't need parent's lock. Thus, we introduce a lock flag in bus_type struct and driver core would lock the parent lock base on the flag. For USB, we set this flag in usb_bus_type to keep original lock behavior in driver core. Async probe could have more benefit after this patch. Signed-off-by: Martin Liu <liumartin@google.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb: xhci: tegra: Add support for managing powergatesJon Hunter1-19/+49
The Tegra XHCI controller requires that the XUSBA (for superspeed) and XUSBC (for host) power-domains are enabled. Commit 8df127456f29 ("soc/tegra: pmc: Enable XUSB partitions on boot") was added to force on these power-domains if the XHCI driver is enabled while proper power-domain support is added, to ensure the device did not hang on boot. However, rather than forcing on these power-domains in the PMC driver we can use the legacy Tegra powergate APIs to turn on these power-domains during the probe of the Tegra XHCI driver. In the near future we plan to move the Tegra XHCI driver to use the generic PM domain framework for power-domains and so to prepare for this only use the legacy Tegra powergate API if there is not PM domain associated with device (ie. dev.pm_domain is NULL). Please note that in the future the superspeed and host resets will be handled by the generic PM domain provider and so these are only these are only needed in the case where there is no generic PM domain. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb: xhci: tegra: Add runtime PM supportJon Hunter1-26/+62
Add runtime PM support to the Tegra XHCI driver and move the function calls to enable/disable the clocks, regulators and PHY into the runtime PM callbacks. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb: xhci: tegra: Prepare for adding runtime PM supportJon Hunter1-17/+17
When adding runtime PM support to the Tegra XHCI driver, it is desirable to move the function calls to enable the clocks, regulators and PHY from the tegra_xusb_probe into the runtime PM handlers. Currently, the clocks, regulators and PHY are all enabled before we call usb_create_hcd() in tegra_xusb_probe(), however, we cannot call pm_runtime_get_sync() at this point because the platform device data is not yet initialised. Fortunately, the function usb_create_hcd() can be called before we enable the clocks, regulators and PHY and so prepare for adding runtime PM support, by moving the call to usb_create_hcd() before we enable the hardware. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb-storage: Add compatibility quirk flags for G-Technologies G-DriveAlexander Kappner2-0/+18
The "G-Drive" (sold by G-Technology) external USB 3.0 drive hangs on write access under UAS and usb-storage: [ 136.079121] sd 15:0:0:0: [sdi] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 136.079144] sd 15:0:0:0: [sdi] tag#0 Sense Key : Illegal Request [current] [ 136.079152] sd 15:0:0:0: [sdi] tag#0 Add. Sense: Invalid field in cdb [ 136.079176] sd 15:0:0:0: [sdi] tag#0 CDB: Write(16) 8a 08 00 00 00 00 00 00 00 00 00 00 00 08 00 00 [ 136.079180] print_req_error: critical target error, dev sdi, sector 0 [ 136.079183] Buffer I/O error on dev sdi, logical block 0, lost sync page write [ 136.173148] EXT4-fs (sdi): mounted filesystem with ordered data mode. Opts: (null) [ 140.583998] sd 15:0:0:0: [sdi] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [ 140.584010] sd 15:0:0:0: [sdi] tag#0 Sense Key : Illegal Request [current] [ 140.584016] sd 15:0:0:0: [sdi] tag#0 Add. Sense: Invalid field in cdb [ 140.584022] sd 15:0:0:0: [sdi] tag#0 CDB: Write(16) 8a 08 00 00 00 00 e8 c4 00 18 00 00 00 08 00 00 [ 140.584025] print_req_error: critical target error, dev sdi, sector 3905159192 [ 140.584044] print_req_error: critical target error, dev sdi, sector 3905159192 [ 140.584052] Aborting journal on device sdi-8. The proposed patch adds compatibility quirks. Because the drive requires two quirks (one to work with UAS, and another to work with usb-storage), adding this under unusual_devs.h and not just unusual_uas.h so kernels compiled without UAS receive the quirk. With the patch, the drive works reliably on UAS and usb- storage. (tested on NEC Corporation uPD720200 USB 3.0 host controller). Signed-off-by: Alexander Kappner <agk@godking.net> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb-storage: Add support for FL_ALWAYS_SYNC flag in the UAS driverAlexander Kappner1-0/+6
The ALWAYS_SYNC flag is currently honored by the usb-storage driver but not UAS and is required to work around devices that become unstable upon being queried for cache. This code is taken straight from: drivers/usb/storage/scsiglue.c:284 Signed-off-by: Alexander Kappner <agk@godking.net> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@vger.kernel.org> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb: typec: wcove: Remove dependency on HW FSMHeikki Krogerus1-2/+28
The USB Type-C PHY in Intel WhiskeyCove PMIC has build-in USB Type-C state machine which we were relying on to configure the CC lines correctly. This patch removes that dependency and configures the CC line according to commands from the port manager (tcpm.c) in wcove_set_cc(). This fixes an issue where USB devices attached to the USB Type-C port do not get enumerated. When acting as source/host, the HW FSM sometimes fails to configure the PHY correctly. Fixes: 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support") Cc: stable@vger.kernel.org Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb: roles: intel_xhci: Enable runtime PMHeikki Krogerus1-1/+13
This fixes an issue where the mux does not get configured when the parent device is suspended. The registers for this mux are mapped to the parent device MMIO (usually xHCI PCI device), so in order for the driver to be able to program the registers, the parent device must be resumed. Reported-by: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> Fixes: f6fb9ec02be1 ("usb: roles: Add Intel xHCI USB role switch driver") Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-24usb: typec: fusb302: Fix debugfs issueHeikki Krogerus1-0/+1
Removing the "fusb302" debugfs directory when unloading the driver. That allows the driver to be loaded more then one time. The directory will not get actually removed until it is empty, so only after the last instance has been removed. This fixes an issue where the driver can't be re-loaded if it has been unloaded as the "fusb302" debugfs directory already exists. Fixes: 76f0c53d08b9 ("usb: typec: fusb302: Move out of staging") Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>