summaryrefslogtreecommitdiffstats
path: root/drivers/usb
Commit message (Collapse)AuthorAgeFilesLines
* usb: fix improper return value when kzalloc failsPan Bian2016-11-291-0/+1
| | | | | | | | | | | | The comment says function wa_nep_queue() should return 0 if ok, and <0 errno code on error. However, its implementation always returns 0, even if the call to kzalloc() fails. As a result, the return value may be inconsistent with the execution status, which may mislead the callers. This patch fixes the bug, returning -ENOMEM when the call to kzalloc() fails. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: return correct errno on failuresPan Bian2016-11-291-0/+1
| | | | | | | | | | | | | | In function __wa_xfer_setup_segs(), variable result takes the return value. Its value should be a negative errno on failures. Because result may be reassigned in a loop, and its value is guaranteed to be not less than 0 during the following repeats of the loop. So when the call to kmalloc() or usb_alloc_urb() fails in the loop, the value of variable result may be 0 (indicates no error), which is inconsistent with the execution status. This patch fixes the bug, initializing variable result with -ENOMEM in the loop. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: return correct errno code when krealloc failsPan Bian2016-11-291-0/+1
| | | | | | | | | | | | | | In function wusb_dev_sec_add(), variable result takes the return value. Its value should be negative on failures. When function krealloc() is called, an earlier check of variable result guarantees that the value of result must not be less than "sizeof(*secd)", and result is not reassigned when krealloc() returns a NULL pointer. As a result, a positive value may be returned, which makes it impossible for the caller of wusb_dev_sec_add() to detect the error. This patch fixes the bug by assigning -ENOMEM to result when krealloc() returns NULL. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* USB: EHCI: ehci-w90x900: remove unuseful functionsManjunath Goudar2016-11-291-22/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | The ehci_w90x900_probe function is not doing anything other than calling usb_w90x900_probe function so ehci_w90x900_probe function is unuseful that is why removed ehci_w90x900_probe functions and renamed usb_w90x900_probe function to ehci_w90x900_probe for proper naming. The ehci_w90x900_remove function is also not doing anything other than calling usb_w90x900_remove that is why removed ehci_w90x900_remove function and renamed usb_w90x900_remove to ehci_w90x900_remove for proper naming. This also removes warning of checkpatch.pl script. Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* usb: ohci: s3c2410: allow probing from device treeSergio Prado2016-11-291-0/+8
| | | | | | | | | Allows configuring Samsung's s3c2410 USB OHCI controller using a devicetree. Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* USB: ohci: da8xx: Resume the entire host controllerAxel Haslam2016-11-291-2/+1Star
| | | | | | | | | | | | | | | | | The da8xx ohci controller is not working after suspend and resume. This is because only the root hub is being resumed. Balance the ohci_suspend of the suspend path with an ohci_resume in the resume path so that we resume the entire controller, and not just the root hub. Also, while we are here, remove setting device power_state, as this is no longer needed and scheduled for removal Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* USB: ohci: da8xx: Allow probing from DTAxel Haslam2016-11-291-0/+8
| | | | | | | | This adds the compatible string to the ohci driver to be able to probe from DT Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* USB: ohci: da8xx: Allow a regulator to handle VBUSAxel Haslam2016-11-291-3/+93
| | | | | | | | | | | | | | | Using a regulator to handle VBUS will eliminate the need for platform data and callbacks, and make the driver more generic allowing different types of regulators to handle VBUS. The regulator equivalents to the platform callbacks are: set_power -> regulator_enable/regulator_disable get_power -> regulator_is_enabled get_oci -> regulator_get_error_flags ocic_notify -> regulator event notification Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* USB: ohci: da8xx: Add wrappers for platform callbacksAxel Haslam2016-11-291-23/+102
| | | | | | | | | | | | | | To migrate to a DT based boot, we will remove the use of platform callbacks, in favor of using the regulator framework to handle vbus and over current. In preparation to use a regulator instead of callbacks, move the platform data callbacks into separate functions. This provides well defined place to for the regulator API to coexist with the platform callbacks before all users are converted. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* USB: ohci: da8xx: use ohci priv data instead of globalsAxel Haslam2016-11-291-30/+43
| | | | | | | | | | | | | | Instead of global variables, use the extra_priv_size of the ohci driver. We cannot yet move the ocic mask because this is used on the interrupt handler which is registered through platform data and does not have an hcd pointer. This will be moved on a later patch. Tested-by: David Lechner <david@lechnology.com> Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge tag 'usb-ci-v4.10-rc1' of ↵Greg Kroah-Hartman2016-11-285-23/+86
|\ | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: - Adding ULPI PHY support for imx53 - Properly mark little endian descriptors for udc
| * usb: chipidea: imx: Disable internal 60Mhz clock with ULPI PHYFabien Lahoudere2016-11-141-0/+11
| | | | | | | | | | | | | | | | | | The internal 60Mhz clock for host2 and host3 are useless in ULPI phy mode, so we disable it when configuring ULPI PHY node for those host. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk> Signed-off-by: Peter Chen <peter.chen@nxp.com>
| * usb: chipidea: imx: configure imx for ULPI phyFabien Lahoudere2016-11-143-14/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to use ULPI phy with usb host 2 and 3, we need to configure controller register to enable ULPI features. Each USB controller have different behaviour, so in order to avoid to have several "swicth(data->index)" and lock/unlock, we prefer to get the index switch and then test for features if they exist for this index. This patch also remove useless test of reg and val. Those two values cannot be NULL. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk> Signed-off-by: Peter Chen <peter.chen@nxp.com>
| * usb: chipidea: Properly mark little endian descriptorsStephen Boyd2016-11-142-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The DMA descriptors are little endian, and we do a pretty good job of handling them with the proper le32_to_cpu() markings, but we don't actually mark them as __le32. This means checkers like sparse can't easily find new bugs. Let's mark the members of structures properly and fix the few places where we're missing conversions. Cc: Peter Chen <peter.chen@nxp.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> Signed-off-by: Peter Chen <peter.chen@nxp.com>
* | Merge 4.9-rc7 into usb-nextGreg Kroah-Hartman2016-11-2813-73/+227
|\ \ | | | | | | | | | | | | | | | We want the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * \ Merge tag 'usb-serial-4.9-rc6' of ↵Greg Kroah-Hartman2016-11-183-0/+9
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus Johan writes: USB-serial fixes for v4.9-rc6 Here are a couple of new device ids. Signed-off-by: Johan Hovold <johan@kernel.org>
| | * | USB: serial: cp210x: add ID for the Zone DPMXPaul Jakma2016-11-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BRIM Brothers Zone DPMX is a bicycle powermeter. This ID is for the USB serial interface in its charging dock for the control pods, via which some settings for the pods can be modified. Signed-off-by: Paul Jakma <paul@jakma.org> Cc: Barry Redmond <barry@brimbrothers.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org>
| | * | USB: serial: ftdi_sio: add support for TI CC3200 LaunchPadDoug Brown2016-11-072-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the TI CC3200 LaunchPad board, which uses a custom USB vendor ID and product ID. Channel A is used for JTAG, and channel B is used for a UART. Signed-off-by: Doug Brown <doug@schmorgal.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org>
| * | | Merge tag 'fixes-for-v4.9-rc6' of ↵Greg Kroah-Hartman2016-11-181-4/+4
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus Felipe writes: usb: fixes for v4.9-rc5 One single fix for FunctionFS to make sure we're checking ffs_func_req_match()'s return code correctly.
| | * | | usb: gadget: f_fs: fix wrong parenthesis in ffs_func_req_match()Felix Hädicke2016-11-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Properly check the return code of ffs_func_revmap_intf() and ffs_func_revmap_ep() for a non-negative value. Instead of checking the return code, the comparison was performed for the last parameter of the function calls, because of wrong parenthesis. This also fixes the following static checker warning: drivers/usb/gadget/function/f_fs.c:3152 ffs_func_req_match() warn: always true condition '(((creq->wIndex)) >= 0) => (0-u16max >= 0)' Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felix Hädicke <felixhaedicke@web.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
| * | | | usb: musb: Drop pointless PM runtime code for dsps glueTony Lindgren2016-11-171-20/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This already gets done automatically by PM runtime and we have a separate autosuspend timeout in musb_core.c. Reviewed-by: Johan Hovold <johan@kernel.org> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: musb: Add missing pm_runtime_disable and drop 2430 PM timeoutTony Lindgren2016-11-171-6/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are missing pm_runtime_disable() in 2430 glue layer. Further, we only need to enable PM runtime and disable it on exit. With musb_core.c doing PM, the glue layer as a parent will always be active when musb_core.c is active. This fixes host enumeration issues with some devices as reported by Ladislav Michl <ladis@linux-mips.org>. And holding an RPM reference while deregistering the child would lead to a crash in omap2430_runtime_suspend() which dereferences the now freed child's driver data on put as pointed out by Johan Hovold <johan@kernel.org>: Unable to handle kernel paging request at virtual address 6b6b6f17 ... [<c05453d4>] (omap2430_runtime_suspend) from [<c0481410>] (pm_generic_runtime_suspend+0x3c/0x48) [<c0481410>] (pm_generic_runtime_suspend) from [<c0121028>] (_od_runtime_suspend+0x1c/0x30) [<c0121028>] (_od_runtime_suspend) from [<c04833b0>] (__rpm_callback+0x3c/0x70) [<c04833b0>] (__rpm_callback) from [<c0483414>] (rpm_callback+0x30/0x90) [<c0483414>] (rpm_callback) from [<c0483984>] (rpm_suspend+0x118/0x6b4) [<c0483984>] (rpm_suspend) from [<c04840f4>] (rpm_idle+0x104/0x440) [<c04840f4>] (rpm_idle) from [<c04844ac>] (__pm_runtime_idle+0x7c/0xb0) [<c04844ac>] (__pm_runtime_idle) from [<c0545458>] (omap2430_remove+0x38/0x58) [<c0545458>] (omap2430_remove) from [<c047b2bc>] (platform_drv_remove+0x34/0x4c) Note that if changes are needed to the autosuspend timeout, it should be done in musb_core.c. Reported-by: Ladislav Michl <ladis@linux-mips.org> Fixes: 87326e858448 ("usb: musb: Remove extra PM runtime calls from 2430 glue layer") Tested-by: Ladislav Michl <ladis@linux-mips.org> Reviewed-by: Johan Hovold <johan@kernel.org> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: musb: Fix PM for hub disconnectTony Lindgren2016-11-174-18/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With a USB hub disconnected, devctl can be 0x19 for about a second on am335x and will stay forever on at least omap3. And we get no further interrupts when devctl session bit clears. This keeps PM runtime active. Let's fix the issue by polling devctl until the session bit clears or times out. We can do this by making musb->irq_work into delayed_work. And with the polling implemented, we can now also have the quirk for invalid VBUS it to avoid disconnecting too early while VBUS is ramping up. Fixes: 467d5c980709 ("usb: musb: Implement session bit based runtime PM for musb-core") Fixes: 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS Tested-by: Ladislav Michl <ladis@linux-mips.org> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: musb: Fix sleeping function called from invalid context for hdrc glueTony Lindgren2016-11-174-18/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS glue layer") wrongly added a call for pm_runtime_get_sync to otg_timer that runs in softirq context. That causes a "BUG: sleeping function called from invalid context" every time when polling the cable status: [<c015ebb4>] (__might_sleep) from [<c0413d60>] (__pm_runtime_resume+0x9c/0xa0) [<c0413d60>] (__pm_runtime_resume) from [<c04d0bc4>] (otg_timer+0x3c/0x254) [<c04d0bc4>] (otg_timer) from [<c0191180>] (call_timer_fn+0xfc/0x41c) [<c0191180>] (call_timer_fn) from [<c01915c0>] (expire_timers+0x120/0x210) [<c01915c0>] (expire_timers) from [<c0191acc>] (run_timer_softirq+0xa4/0xdc) [<c0191acc>] (run_timer_softirq) from [<c010168c>] (__do_softirq+0x12c/0x594) I did not notice that as I did not have CONFIG_DEBUG_ATOMIC_SLEEP enabled. And looks like also musb_gadget_queue() suffers from the same problem. Let's fix the issue by using a list of delayed work then call it on resume. Note that we want to do this only when musb core and it's parent devices are awake, and we need to make sure the DSPS glue timer is stopped as noted by Johan Hovold <johan@kernel.org>. Note that we already are re-enabling the timer with mod_timer() in dsps_musb_enable(). Later on we may be able to remove other delayed work in the musb driver and just do it from pending_resume_work. But this should be done only for delayed work that does not have other timing requirements beyond just being run on resume. Fixes: 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS glue layer") Reported-by: Johan Hovold <johan@kernel.org> Reviewed-by: Johan Hovold <johan@kernel.org> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: musb: Fix broken use of static variable for multiple instancesTony Lindgren2016-11-172-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't use static variable first for checking when musb is initialized when we have multiple musb instances like on am335x. Tested-by: Ladislav Michl <ladis@linux-mips.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | usb: chipidea: move the lock initialization to core filePeter Chen2016-11-152-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can fix below dump when the lock is accessed at host mode due to it is not initialized. [ 46.119638] INFO: trying to register non-static key. [ 46.124643] the code is fine but needs lockdep annotation. [ 46.130144] turning off the locking correctness validator. [ 46.135659] CPU: 0 PID: 690 Comm: cat Not tainted 4.9.0-rc3-00079-g4b75f1d #1210 [ 46.143075] Hardware name: Freescale i.MX6 SoloX (Device Tree) [ 46.148923] Backtrace: [ 46.151448] [<c010c460>] (dump_backtrace) from [<c010c658>] (show_stack+0x18/0x1c) [ 46.159038] r7:edf52000 [ 46.161412] r6:60000193 [ 46.163967] r5:00000000 [ 46.165035] r4:c0e25c2c [ 46.169109] [<c010c640>] (show_stack) from [<c03f58a4>] (dump_stack+0xb4/0xe8) [ 46.176362] [<c03f57f0>] (dump_stack) from [<c016d690>] (register_lock_class+0x4fc/0x56c) [ 46.184554] r10:c0e25d24 [ 46.187014] r9:edf53e70 [ 46.189569] r8:c1642444 [ 46.190637] r7:ee9da024 [ 46.193191] r6:00000000 [ 46.194258] r5:00000000 [ 46.196812] r4:00000000 [ 46.199185] r3:00000001 [ 46.203259] [<c016d194>] (register_lock_class) from [<c0171294>] (__lock_acquire+0x80/0x10f0) [ 46.211797] r10:c0e25d24 [ 46.214257] r9:edf53e70 [ 46.216813] r8:ee9da024 [ 46.217880] r7:c1642444 [ 46.220435] r6:edcd1800 [ 46.221502] r5:60000193 [ 46.224057] r4:00000000 [ 46.227953] [<c0171214>] (__lock_acquire) from [<c01726c0>] (lock_acquire+0x74/0x94) [ 46.235710] r10:00000001 [ 46.238169] r9:edf53e70 [ 46.240723] r8:edf53f80 [ 46.241790] r7:00000001 [ 46.244344] r6:00000001 [ 46.245412] r5:60000193 [ 46.247966] r4:00000000 [ 46.251866] [<c017264c>] (lock_acquire) from [<c096c8fc>] (_raw_spin_lock_irqsave+0x40/0x54) [ 46.260319] r7:ee1c6a00 [ 46.262691] r6:c062a570 [ 46.265247] r5:20000113 [ 46.266314] r4:ee9da014 [ 46.270393] [<c096c8bc>] (_raw_spin_lock_irqsave) from [<c062a570>] (ci_port_test_show+0x2c/0x70) [ 46.279280] r6:eebd2000 [ 46.281652] r5:ee9da010 [ 46.284207] r4:ee9da014 [ 46.286810] [<c062a544>] (ci_port_test_show) from [<c0248d04>] (seq_read+0x1ac/0x4f8) [ 46.294655] r9:edf53e70 [ 46.297028] r8:edf53f80 [ 46.299583] r7:ee1c6a00 [ 46.300650] r6:00000001 [ 46.303205] r5:00000000 [ 46.304273] r4:eebd2000 [ 46.306850] [<c0248b58>] (seq_read) from [<c039e864>] (full_proxy_read+0x54/0x6c) [ 46.314348] r10:00000000 [ 46.316808] r9:c0a6ad30 [ 46.319363] r8:edf53f80 [ 46.320430] r7:00020000 [ 46.322986] r6:b6de3000 [ 46.324053] r5:ee1c6a00 [ 46.326607] r4:c0248b58 [ 46.330505] [<c039e810>] (full_proxy_read) from [<c021ec98>] (__vfs_read+0x34/0x118) [ 46.338262] r9:edf52000 [ 46.340635] r8:c0107fc4 [ 46.343190] r7:00020000 [ 46.344257] r6:edf53f80 [ 46.346812] r5:c039e810 [ 46.347879] r4:ee1c6a00 [ 46.350447] [<c021ec64>] (__vfs_read) from [<c021fbd0>] (vfs_read+0x8c/0x11c) [ 46.357597] r9:edf52000 [ 46.359969] r8:c0107fc4 [ 46.362524] r7:edf53f80 [ 46.363592] r6:b6de3000 [ 46.366147] r5:ee1c6a00 [ 46.367214] r4:00020000 [ 46.369782] [<c021fb44>] (vfs_read) from [<c0220a4c>] (SyS_read+0x4c/0xa8) [ 46.376672] r8:c0107fc4 [ 46.379045] r7:00020000 [ 46.381600] r6:b6de3000 [ 46.382667] r5:ee1c6a00 [ 46.385222] r4:ee1c6a00 [ 46.387817] [<c0220a00>] (SyS_read) from [<c0107e20>] (ret_fast_syscall+0x0/0x1c) [ 46.395314] r7:00000003 [ 46.397687] r6:b6de3000 [ 46.400243] r5:00020000 [ 46.401310] r4:00020000 Cc: <stable@vger.kernel.org> Fixes: 26c696c678c4 ("USB: Chipidea: rename struct ci13xxx variables from udc to ci") Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | Fix USB CB/CBI storage devices with CONFIG_VMAP_STACK=yPetr Vandrovec2016-11-151-1/+6
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some code (all error handling) submits CDBs that are allocated on the stack. This breaks with CB/CBI code that tries to create URB directly from SCSI command buffer - which happens to be in vmalloced memory with vmalloced kernel stacks. Let's make copy of the command in usb_stor_CB_transport. Signed-off-by: Petr Vandrovec <petr@vandrovec.name> Cc: stable <stable@vger.kernel.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | usb: ohci-da8xx: rename driver to ohci-da8xxAxel Haslam2016-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The davinci ohci driver name (currently "ohci") is too generic. To be consistent with other usb dirvers, append the "-da8xx" postfix to the name. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | usb: musb: da8xx: Set phy in OTG mode by defaultAlexandre Bailon2016-11-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DA8xx OTG PHY has some issues when it is forced in host or peripheral mode. Actually, most of the time, OTG is the best mode because host or peripheral mode are only required for hardware that miss some circuitry. Init the PHY mode OTG mode by default. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | usb: musb: da8xx: Call earlier clk_prepare_enable()Alexandre Bailon2016-11-211-9/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first attempt to read a register may fail because the clock may not be enabled, and then the probe of musb driver will fail. Call clk_prepare_enable() before the first register read. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | usb: musb: da8xx: Add DT support for the DA8xx driverPetr Kulhavy2016-11-211-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver Signed-off-by: Petr Kulhavy <petr@barix.com> Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Tested-by: David Lechner <david@lechnology.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | usb: musb: core: added helper function for parsing DTPetr Kulhavy2016-11-212-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the function musb_get_mode() to get the DT property "dr_mode" Signed-off-by: Petr Kulhavy <petr@barix.com> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Tested-by: David Lechner <david@lechnology.com> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | usb: musb: omap2430: make complain on -EPROBE_DEFER dev_dbgLadislav Michl2016-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no point having this complaint to be dev_err as it is just adding noise to bootlog. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | usb: musb: omap2430: use dev_errLadislav Michl2016-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace pr_err with dev_err to print also device name. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | usb: musb: don't complain on -EPROBE_DEFER when initializing controllerLadislav Michl2016-11-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't complain on -EPROBE_DEFER when initializing controller, the driver probe will be retried later. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | musb: sunxi: Force session end on babble errors in host-modeHans de Goede2016-11-211-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sunxi musb has a bug where sometimes it will generate a babble error on device disconnect instead of a disconnect irq. When this happens the musb-controller switches from host mode to device mode (it clears MUSB_DEVCTL_SESSION and sets MUSB_DEVCTL_BDEVICE) and gets stuck in this state. Clearing this requires reporting Vbus low for 200 or more ms, but on some devices Vbus is simply always high (host-only mode, no Vbus control). This commit adds a sunxi_musb_recover() callback which makes sunxi_musb_work call phy_set_mode with the current mode, which will force end the current session. This fixes the musb controller getting stuck in this state on systems without Vbus control; and also fixes the need to unplug the usb-b -> usb-a cable to get out of this state on systems with Vbus control. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | musb: sunxi: Remove custom babble handlingHans de Goede2016-11-211-10/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The musb core already handles babble interrupts, so the sunxi glue having its own custom handling is redundant. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | USB: musb: remove obsolete resume-signalling commentsJohan Hovold2016-11-212-5/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove comments about resume signalling being stopped from GetPortStatus, something which is no longer the case. Fixes: 8ed1fb790ea2 ("usb: musb: finish suspend/reset work...") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | USB: OHCI: use dma_pool_zallocshashi bhusan2016-11-211-4/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We should use new API dma_pool_zalloc instead of dma_pool_alloc/memset. Signed-off-by: Shashi Bhusan <shashibhushan4u123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | cdc-acm: handle read pipe errorsLadislav Michl2016-11-212-10/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Read urbs are submitted back only on success, causing read pipe running out of urbs after few errors. No more characters can be read from tty device then until it is reopened and no errors are reported. Fix that by always submitting urbs back and clearing stall on -EPIPE. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | cdc-acm: remove is_int_ep from acm structureLadislav Michl2016-11-212-4/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is_int_ep is used only in acm_probe, no need to store it in device data. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | cdc-acm: store in and out pipes in acm structureLadislav Michl2016-11-212-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clearing stall needs pipe descriptor, store it in acm structure. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | cdc-acm: refactor killing urbsLadislav Michl2016-11-211-27/+16Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move urb killing code into separate function and use it instead of copying that code pattern over. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | cdc-acm: avoid interface_to_usbdev callLadislav Michl2016-11-211-6/+3Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pointer to usb_device is already stored in acm structure. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | cdc-acm: reindent log messagesLadislav Michl2016-11-211-18/+17Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use only one tab to indent dev_{(v)dbg,err} parameters. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | | Merge tag 'usb-for-v4.10' of ↵Greg Kroah-Hartman2016-11-1875-2739/+4034
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v4.10 merge window One big merge this time with a total of 166 non-merge commits. Most of the work, by far, is on dwc2 this time (68.2%) with dwc3 a far second (22.5%). The remaining 9.3% are scattered on gadget drivers. The most important changes for dwc2 are the peripheral side DMA support implemented by Synopsys folks and support for the new IOT dwc2 compatible core from Synopsys. In dwc3 land we have support for high-bandwidth, high-speed isochronous endpoints and some non-critical fixes for large scatter lists. Apart from these, we have our usual set of cleanups, non-critical fixes, etc.
| * | | | usb: gadget: serial: fix possible Oops caused by calling kthread_stop(NULL)Felix Hädicke2016-11-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add check for NULL before calling kthread_stop(). There were cases in which gserial_console_exit() was called, but the console thread was not started. This resulted in an invalid kthread_stop(NULL) call. Without this, the following Oops may occur: BUG: unable to handle kernel NULL pointer dereference at 0000000000000018 IP: [<ffffffffb3ca1166>] kthread_stop+0x16/0x110 ... CPU: 2 PID: 853 Comm: rmmod Not tainted 4.9.0-rc5 #3 Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z77 Extreme3, BIOS P1.50 07/11/2013 task: ffff880419f6a100 task.stack: ffffc90002e8c000 RIP: 0010:[<ffffffffb3ca1166>] [<ffffffffb3ca1166>] kthread_stop+0x16/0x110 RSP: 0018:ffffc90002e8fdb0 EFLAGS: 00010286 RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000000246 RDI: 0000000000000000 RBP: ffffc90002e8fdc8 R08: 0000000000000000 R09: 0000000000000001 R10: 000000000000019d R11: 000000000000001f R12: 0000000000000000 R13: ffff88041b8d8400 R14: 0000000000000001 R15: 000055fd59f5a1e0 FS: 00007f82500be700(0000) GS:ffff88042f280000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000018 CR3: 000000041bee2000 CR4: 00000000001406e0 Stack: 0000000000000000 ffffffffc0b8e720 ffff88041b8d8400 ffffc90002e8fdf0 ffffffffc0b8bb52 ffff88041a106300 0000000000000001 ffff880419fc2ea8 ffffc90002e8fe08 ffffffffc0aed749 ffffffffc0aef600 ffffc90002e8fe20 Call Trace: [<ffffffffc0b8bb52>] gserial_free_line+0x72/0xb0 [u_serial] [<ffffffffc0aed749>] acm_free_instance+0x19/0x30 [usb_f_acm] [<ffffffffc0b01b40>] usb_put_function_instance+0x20/0x30 [libcomposite] [<ffffffffc04a603b>] gs_unbind+0x3b/0x70 [g_serial] [<ffffffffc0b018d1>] __composite_unbind+0x61/0xb0 [libcomposite] [<ffffffffc0b01933>] composite_unbind+0x13/0x20 [libcomposite] [<ffffffffc08ef1ad>] usb_gadget_remove_driver+0x3d/0x90 [udc_core] [<ffffffffc08ef26e>] usb_gadget_unregister_driver+0x6e/0xc0 [udc_core] [<ffffffffc0aff6d2>] usb_composite_unregister+0x12/0x20 [libcomposite] [<ffffffffc04a6268>] cleanup+0x10/0xda8 [g_serial] [<ffffffffb3d0c0c2>] SyS_delete_module+0x192/0x270 [<ffffffffb3c032a0>] ? exit_to_usermode_loop+0x90/0xb0 [<ffffffffb4228a3b>] entry_SYSCALL_64_fastpath+0x1e/0xad Code: 89 c6 e8 6e ff ff ff 48 89 df e8 06 bd fd ff 5b 5d c3 0f 1f 00 0f 1f 44 00 00 55 48 89 e5 41 55 41 54 49 89 fc 53 0f 1f 44 00 00 <f0> 41 ff 44 24 18 4c 89 e7 e8 bc f1 ff ff 48 85 c0 48 89 c3 74 RIP [<ffffffffb3ca1166>] kthread_stop+0x16/0x110 RSP <ffffc90002e8fdb0> CR2: 0000000000000018 ---[ end trace 5b3336a407e1698c ]--- Signed-off-by: Felix Hädicke <felixhaedicke@web.de> Tested-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
| * | | | usb: dwc3: Do not set dma coherent maskArnd Bergmann2016-11-182-11/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dma mask is correctly set up by the DT probe function, no need to override it any more. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sriram Dash <sriram.dash@nxp.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
| * | | | usb: dwc3: use bus->sysdev for DMA configurationArnd Bergmann2016-11-186-43/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dma ops for dwc3 devices are not set properly. So, use a physical device sysdev, which will be inherited from parent, to set the hardware / firmware parameters like dma. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sriram Dash <sriram.dash@nxp.com> Tested-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
| * | | | usb: dwc3: ep0: avoid empty-body warningArnd Bergmann2016-11-181-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building with W=1, we get a warning about harmless empty statements: drivers/usb/dwc3/ep0.c: In function 'dwc3_ep0_handle_intf': drivers/usb/dwc3/ep0.c:491:4: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] Instead of adding empty braces which would introduce checkpatch.pl warnings, we're just removing the code which doesn't do anything and making sure we return 0 so USBCV tool is happy. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>