aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)AuthorFilesLines
2014-06-30usb: gadget: net2280: Add support for PLX USB338XRicardo Ribalda Delgado3-98/+1152
This patch adds support for the PLX USB3380 and USB3382. This driver is based on the driver from the manufacturer. Since USB338X is register compatible with NET2280, I thought that it would be better to include this hardware into net2280 driver. Manufacturer's driver only supported the USB33X, did not follow the Kernel Style and contain some trivial errors. This patch has tried to address this issues. This patch has only been tested on USB338x hardware, but the merge has been done trying to not affect the behaviour of NET2280. Tested-by: Alan Stern <[email protected]> Signed-off-by: Ricardo Ribalda Delgado <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: delete __init marker for probePeter Chen1-2/+2
The probe function may be probed deferal and called after .init section has freed. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: fusb300_udc: delete __init marker for probePeter Chen1-1/+1
The probe function may be probed deferal and called after .init section has freed. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: m66592-udc: delete __init marker for probePeter Chen1-1/+1
The probe function may be probed deferal and called after .init section has freed. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: lpc32xx: delete __init marker for probePeter Chen1-1/+1
The probe function may be probed deferal and called after .init section has freed. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: fsl_udc_core: delete __init marker for probePeter Chen1-3/+3
The probe function may be probed deferal and called after .init section has freed. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: atmel_usba_udc: delete __init marker for probePeter Chen1-1/+1
The probe function may be probed deferal and called after .init section has freed. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: dwc3: add support for USB 2.0-only core configurationPaul Zimmerman2-0/+20
Newer DWC3 controllers can be built for USB 2.0-only mode, where most of the USB 3.0 circuitry is left out. To support this mode, the driver must limit the speed programmed into the DCFG register to Hi-Speed or lower. Reads and writes to the PIPECTL register are left as-is, since they should be no-ops in USB 2.0-only mode. Calls to phy_init() etc. for the USB3 phy are also left as-is, since the no-op USB3 phy should be used for USB 2.0-only mode controllers. Signed-off-by: Paul Zimmerman <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: musb: dsps: Call usb_phy(_shutdown/_init) during musb_platform_reset()George Cherian1-1/+5
For DSPS platform usb_phy_vbus(_off/_on) are NOPs. So during musb_platform_reset() call usb_phy(_shutdown/_init) Signed-off-by: George Cherian <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: Use kmemdup instead of kmalloc + memcpyBenoit Taine2-5/+2
This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: musb: musb_host.c: Cleaning up uninitialized variablesRickard Strandqvist1-1/+1
There is a risk that the variable will be used without being initialized. This was largely found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: musb: backfin: Introduce the use of the managed version of kzallocHimangi Saraogi1-12/+8
This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. Also, a label is done away with and err2 and err3 renamed. The following Coccinelle semantic patch was used for making the change: @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e, e1, e2; @@ probefn(struct platform_device *pdev, ...) { <+... - e = kzalloc(e1, e2) + e = devm_kzalloc(&pdev->dev, e1, e2) ... ?-kfree(e); ...+> } @rem depends on prb@ identifier platform.removefn; expression e; @@ removefn(...) { <... - kfree(e); ...> } Signed-off-by: Himangi Saraogi <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: musb: tusb6010: Introduce the use of the managed version of kzallocHimangi Saraogi1-11/+5
This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. Also, the unnecesary labels are removed and linux/device.h is added to make sure the devm_*() routine declarations are unambiguously available. The following Coccinelle semantic patch was used for making the change: @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e, e1, e2; @@ probefn(struct platform_device *pdev, ...) { <+... - e = kzalloc(e1, e2) + e = devm_kzalloc(&pdev->dev, e1, e2) ... ?-kfree(e); ...+> } @rem depends on prb@ identifier platform.removefn; expression e; @@ removefn(...) { <... - kfree(e); ...> } Signed-off-by: Himangi Saraogi <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: musb: davinci: use devm_ functions.Himangi Saraogi1-14/+6
This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. Also, a label is done away with and clk_get is replaced by it corresponding devm version and the clk_puts are done away with. The labels are renamed to make them ordered. The following Coccinelle semantic patch was used for making the change: @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e, e1, e2; @@ probefn(struct platform_device *pdev, ...) { <+... - e = kzalloc(e1, e2) + e = devm_kzalloc(&pdev->dev, e1, e2) ... ?-kfree(e); ...+> } @rem depends on prb@ identifier platform.removefn; expression e; @@ removefn(...) { <... - kfree(e); ...> } Signed-off-by: Himangi Saraogi <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: phy: phy-gpio-vbus-usb: use devm_ functionsHimangi Saraogi1-32/+13
The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_irq, devm_gpio_request, devm_regulator_get etc. for data that is allocated in the probe function of a platform device and is only freed in the remove function. The corresponding free functions are removed and the labels are done away with. Signed-off-by: Himangi Saraogi <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: dwc3: Keeping 'resource' related code togetherVivek Gautam1-19/+25
Putting together the code related to getting the 'IORESOURCE_MEM' and assigning the same to dwc->xhci_resources, for increasing the readability. Signed-off-by: Vivek Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: fsl_qe_udc: Introduce use of managed version of kzallocHimangi Saraogi1-12/+7
This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. Also, the unnecesary labels are removed and some labels are renamed to preserve ordering. The following Coccinelle semantic patch was used for making the change: @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, }; @prb@ identifier platform.probefn, pdev; expression e, e1, e2; @@ probefn(struct platform_device *pdev, ...) { <+... - e = kzalloc(e1, e2) + e = devm_kzalloc(&pdev->dev, e1, e2) ... ?-kfree(e); ...+> } @rem depends on prb@ identifier platform.removefn; expression e; @@ removefn(...) { <... - kfree(e); ...> } Signed-off-by: Himangi Saraogi <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: remove now unused clean_up and clean_up3 label.Ben Dooks1-3/+2
With the devm additions, the clean_up and clean_up3 are now not needed or used. Change clean_up3 and make everything use clean_up2 and just remove clean_up. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: use devm_request_irq() to get device irqBen Dooks1-4/+2
Use the devm_request_irq() call to get the interrupt for the device and have it automatically free on exit. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: use devm_clk_get() to get clockBen Dooks1-7/+3
Change to using the devm_clk_get() to get the clock and have it automatically freed on exit. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: cleanup error pathBen Dooks1-7/+3
With the updates for devm, the cleanup path no longer needs to check for NULL device state, so remove it and return directly if the irq resource missing Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: handle sudmac registers with devm_ioremap_resource()Ben Dooks1-12/+3
Change the sudmac register handling in the devm_ioremap_resource to use the devm variant. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: use devm_kzalloc() to allocate driver stateBen Dooks1-7/+3
Update driver to use devm_kzalloc() to make tracking of resources easier. Also remove the exit point via cleanup as there's no cleanup necessary from this point now. As a note, also removes the error print as the allocation calls produce errors if they do not return memory. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: keep dev as reference to &pdev->devBen Dooks1-8/+8
Remove usages of &pdev->dev in the driver probe function with just dev to make the references to it easier to write. Convert all the current users of it to use it. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: r8a66597-udc: use devm_ioremap_resource() for registersBen Dooks1-15/+3
trivial patch removing boilerplate clode. Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: lpc32xx_udc: Make of_device_id array constJingoo Han1-1/+1
Make of_device_id array const, because all OF functions handle it as const. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: gr_udc: Make of_device_id array constJingoo Han1-1/+1
Make of_device_id array const, because all OF functions handle it as const. Acked-by: Andreas Larsson <[email protected]> Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: phy: tegra: Make of_device_id array constJingoo Han1-1/+1
Make of_device_id array const, because all OF functions handle it as const. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: phy: msm: Make of_device_id array constJingoo Han1-1/+1
Make of_device_id array const, because all OF functions handle it as const. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: musb: ux500: use devm_ functionsHimangi Saraogi1-18/+10
This patch introduces the use of managed interfaces for clk_get and kzalloc and removes the corresponding free function calls in the probe and remove functions. Signed-off-by: Himangi Saraogi <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: gadget: pxa25x_udc: use devm_ functionsHimangi Saraogi1-51/+22
This patch introduces the use of devm_request_irq, devm_gpio_request, devm_clk_get etc. instead of the corresponding unmanaged interfaces. The calls to the functions like free_irq to free the allocated resources are removed as they are no longer required. Some labels in the probe function are also done away with and the name of the label err_gpio_pullup is changed to make it less specific to the context. Signed-off-by: Himangi Saraogi <[email protected]> Acked-by: Julia Lawall <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-30usb: musb: dsps: coding style cleanupLothar Waßmann1-4/+12
There is no reason for the register accessor functions not to adhere to the CodingStyle rules. Signed-off-by: Lothar Waßmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-27Merge tag 'usb-serial-3.16-rc3' of ↵Greg Kroah-Hartman2-8/+25
git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus Johan writes: USB-serial fixes for v3.16-rc3 Here are some USB-serial updates for v3.16-rc3 that fix a reported NULL-pointer dereference and add some new device IDs. Included is also two changes to MAINTAINERS dropping individual maintainership for two small sub-drivers and updating an email address. Signed-off-by: Johan Hovold <[email protected]>
2014-06-27usb: musb: Ensure that cppi41 timer gets armed on premature DMA TX irqThomas Gleixner1-1/+1
Some TI chips raise the DMA complete interrupt before the actual transfer has been completed. The code tries to busy wait for a few microseconds and if that fails it arms an hrtimer to recheck. So far so good, but that has the following issue: CPU 0 CPU1 start_next_transfer(RQ1); DMA interrupt if (premature_irq(RQ1)) if (!hrtimer_active(timer)) hrtimer_start(timer); hrtimer expires timer->state = CALLBACK_RUNNING; timer->fn() cppi41_recheck_tx_req() complete_request(RQ1); if (requests_pending()) start_next_transfer(RQ2); DMA interrupt if (premature_irq(RQ2)) if (!hrtimer_active(timer)) hrtimer_start(timer); timer->state = INACTIVE; The premature interrupt of request2 on CPU1 does not arm the timer and therefor the request completion never happens because it checks for !hrtimer_active(). hrtimer_active() evaluates: timer->state != HRTIMER_STATE_INACTIVE which of course evaluates to true in the above case as timer->state is CALLBACK_RUNNING. That's clearly documented: * A timer is active, when it is enqueued into the rbtree or the * callback function is running or it's in the state of being migrated * to another cpu. But that's not what the code wants to check. The code wants to check whether the timer is queued, i.e. whether its armed and waiting for expiry. We have a helper function for this: hrtimer_is_queued(). This evaluates: timer->state & HRTIMER_STATE_QUEUED So in the above case this evaluates to false and therefor forces the DMA interrupt on CPU1 to call hrtimer_start(). Use hrtimer_is_queued() instead of hrtimer_active() and evrything is good. Reported-by: Torben Hohn <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Signed-off-by: Felipe Balbi <[email protected]>
2014-06-27usb: gadget: gr_udc: Fix check for invalid number of microframesAndreas Larsson1-2/+3
The value 0x3 (not 0x11) in the field for additional transaction/microframe is reserved and should not be let through. Be clear in the error message about what value caused the error return. Reported-by: David Binderman <[email protected]> Signed-off-by: Andreas Larsson <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-27usb: musb: Fix panic upon musb_am335x module removalEzequiel Garcia1-17/+6
At probe time, the musb_am335x driver register its childs by calling of_platform_populate(), which registers all childs in the devicetree hierarchy recursively. On the other side, the driver's remove() function uses of_device_unregister() to remove each child of musb_am335x's. However, when musb_dsps is loaded, its devices are attached to the musb_am335x device as musb_am335x childs. Hence, musb_am335x remove() will attempt to unregister the devices registered by musb_dsps, which produces a kernel panic. In other words, the childs in the "struct device" hierarchy are not the same as the childs in the "devicetree" hierarchy. Ideally, we should enforce the removal of the devices registered by musb_am335x *only*, instead of all its child devices. However, because of the recursive nature of of_platform_populate, this doesn't seem possible. Therefore, as the only solution at hand, this commit disables musb_am335x driver removal capability, preventing it from being ever removed. This was originally suggested by Sebastian Siewior: https://www.mail-archive.com/[email protected]/msg104946.html And for reference, here's the panic upon module removal: musb-hdrc musb-hdrc.0.auto: remove, state 4 usb usb1: USB disconnect, device number 1 musb-hdrc musb-hdrc.0.auto: USB bus 1 deregistered Unable to handle kernel NULL pointer dereference at virtual address 0000008c pgd = de11c000 [0000008c] *pgd=9e174831, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] ARM Modules linked in: musb_am335x(-) musb_dsps musb_hdrc usbcore usb_common CPU: 0 PID: 623 Comm: modprobe Not tainted 3.15.0-rc4-00001-g24efd13 #69 task: de1b7500 ti: de122000 task.ti: de122000 PC is at am335x_shutdown+0x10/0x28 LR is at am335x_shutdown+0xc/0x28 pc : [<c0327798>] lr : [<c0327794>] psr: a0000013 sp : de123df8 ip : 00000004 fp : 00028f00 r10: 00000000 r9 : de122000 r8 : c000e6c4 r7 : de0e3c10 r6 : de0e3800 r5 : de624010 r4 : de1ec750 r3 : de0e3810 r2 : 00000000 r1 : 00000001 r0 : 00000000 Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 10c5387d Table: 9e11c019 DAC: 00000015 Process modprobe (pid: 623, stack limit = 0xde122240) Stack: (0xde123df8 to 0xde124000) 3de0: de0e3810 bf054488 3e00: bf05444c de624010 60000013 bf043650 000012fc de624010 de0e3810 bf043a20 3e20: de0e3810 bf04b240 c0635b88 c02ca37c c02ca364 c02c8db0 de1b7500 de0e3844 3e40: de0e3810 c02c8e28 c0635b88 de02824c de0e3810 c02c884c de0e3800 de0e3810 3e60: de0e3818 c02c5b20 bf05417c de0e3800 de0e3800 c0635b88 de0f2410 c02ca838 3e80: bf05417c de0e3800 bf055438 c02ca8cc de0e3c10 bf054194 de0e3c10 c02ca37c 3ea0: c02ca364 c02c8db0 de1b7500 de0e3c44 de0e3c10 c02c8e28 c0635b88 de02824c 3ec0: de0e3c10 c02c884c de0e3c10 de0e3c10 de0e3c18 c02c5b20 de0e3c10 de0e3c10 3ee0: 00000000 bf059000 a0000013 c02c5bc0 00000000 bf05900c de0e3c10 c02c5c48 3f00: de0dd0c0 de1ec970 de0f2410 bf05929c de0f2444 bf05902c de0f2410 c02ca37c 3f20: c02ca364 c02c8db0 bf05929c de0f2410 bf05929c c02c94c8 bf05929c 00000000 3f40: 00000800 c02c8ab4 bf0592e0 c007fc40 c00dd820 6273756d 336d615f 00783533 3f60: c064a0ac de1b7500 de122000 de1b7500 c000e590 00000001 c000e6c4 c0060160 3f80: 00028e70 00028e70 00028ea4 00000081 60000010 00028e70 00028e70 00028ea4 3fa0: 00000081 c000e500 00028e70 00028e70 00028ea4 00000800 becb59f8 00027608 3fc0: 00028e70 00028e70 00028ea4 00000081 00000001 00000001 00000000 00028f00 3fe0: b6e6b6f0 becb59d4 000160e8 b6e6b6fc 60000010 00028ea4 00000000 00000000 [<c0327798>] (am335x_shutdown) from [<bf054488>] (dsps_musb_exit+0x3c/0x4c [musb_dsps]) [<bf054488>] (dsps_musb_exit [musb_dsps]) from [<bf043650>] (musb_shutdown+0x80/0x90 [musb_hdrc]) [<bf043650>] (musb_shutdown [musb_hdrc]) from [<bf043a20>] (musb_remove+0x24/0x68 [musb_hdrc]) [<bf043a20>] (musb_remove [musb_hdrc]) from [<c02ca37c>] (platform_drv_remove+0x18/0x1c) [<c02ca37c>] (platform_drv_remove) from [<c02c8db0>] (__device_release_driver+0x70/0xc8) [<c02c8db0>] (__device_release_driver) from [<c02c8e28>] (device_release_driver+0x20/0x2c) [<c02c8e28>] (device_release_driver) from [<c02c884c>] (bus_remove_device+0xdc/0x10c) [<c02c884c>] (bus_remove_device) from [<c02c5b20>] (device_del+0x104/0x198) [<c02c5b20>] (device_del) from [<c02ca838>] (platform_device_del+0x14/0x9c) [<c02ca838>] (platform_device_del) from [<c02ca8cc>] (platform_device_unregister+0xc/0x20) [<c02ca8cc>] (platform_device_unregister) from [<bf054194>] (dsps_remove+0x18/0x38 [musb_dsps]) [<bf054194>] (dsps_remove [musb_dsps]) from [<c02ca37c>] (platform_drv_remove+0x18/0x1c) [<c02ca37c>] (platform_drv_remove) from [<c02c8db0>] (__device_release_driver+0x70/0xc8) [<c02c8db0>] (__device_release_driver) from [<c02c8e28>] (device_release_driver+0x20/0x2c) [<c02c8e28>] (device_release_driver) from [<c02c884c>] (bus_remove_device+0xdc/0x10c) [<c02c884c>] (bus_remove_device) from [<c02c5b20>] (device_del+0x104/0x198) [<c02c5b20>] (device_del) from [<c02c5bc0>] (device_unregister+0xc/0x20) [<c02c5bc0>] (device_unregister) from [<bf05900c>] (of_remove_populated_child+0xc/0x14 [musb_am335x]) [<bf05900c>] (of_remove_populated_child [musb_am335x]) from [<c02c5c48>] (device_for_each_child+0x44/0x70) [<c02c5c48>] (device_for_each_child) from [<bf05902c>] (am335x_child_remove+0x18/0x30 [musb_am335x]) [<bf05902c>] (am335x_child_remove [musb_am335x]) from [<c02ca37c>] (platform_drv_remove+0x18/0x1c) [<c02ca37c>] (platform_drv_remove) from [<c02c8db0>] (__device_release_driver+0x70/0xc8) [<c02c8db0>] (__device_release_driver) from [<c02c94c8>] (driver_detach+0xb4/0xb8) [<c02c94c8>] (driver_detach) from [<c02c8ab4>] (bus_remove_driver+0x4c/0xa0) [<c02c8ab4>] (bus_remove_driver) from [<c007fc40>] (SyS_delete_module+0x128/0x1cc) [<c007fc40>] (SyS_delete_module) from [<c000e500>] (ret_fast_syscall+0x0/0x48) Fixes: 97238b35d5bb ("usb: musb: dsps: use proper child nodes") Cc: <[email protected]> # v3.12+ Acked-by: George Cherian <[email protected]> Signed-off-by: Ezequiel Garcia <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-24usb: xhci: Correct last context entry calculation for Configure EndpointJulius Werner1-33/+18
The current XHCI driver recalculates the Context Entries field in the Slot Context on every add_endpoint() and drop_endpoint() call. In the case of drop_endpoint(), it seems to assume that the add_flags will always contain every endpoint for the new configuration, which is not necessarily correct if you don't make assumptions about how the USB core uses the add_endpoint/drop_endpoint interface (add_flags only contains endpoints that are new additions in the new configuration). Furthermore, EP0_FLAG is not consistently set in add_flags throughout the lifetime of a device. This means that when all endpoints are dropped, the Context Entries field can be set to 0 (which is invalid and may cause a Parameter Error) or -1 (which is interpreted as 31 and causes the driver to keep using the old, incorrect value). The only surefire way to set this field right is to also take all existing endpoints into account, and to force the value to 1 (meaning only EP0 is active) if no other endpoint is found. This patch implements that as a single step in the final check_bandwidth() call and removes the intermediary calculations from add_endpoint() and drop_endpoint(). Signed-off-by: Julius Werner <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-06-24xhci: Fix runtime suspended xhci from blocking system suspend.Wang, Yu1-3/+7
The system suspend flow as following: 1, Freeze all user processes and kenrel threads. 2, Try to suspend all devices. 2.1, If pci device is in RPM suspended state, then pci driver will try to resume it to RPM active state in the prepare stage. 2.2, xhci_resume function calls usb_hcd_resume_root_hub to queue two workqueue items to resume usb2&usb3 roothub devices. 2.3, Call suspend callbacks of devices. 2.3.1, All suspend callbacks of all hcd's children, including roothub devices are called. 2.3.2, Finally, hcd_pci_suspend callback is called. Due to workqueue threads were already frozen in step 1, the workqueue items can't be scheduled, and the roothub devices can't be resumed in this flow. The HCD_FLAG_WAKEUP_PENDING flag which is set in usb_hcd_resume_root_hub won't be cleared. Finally, hcd_pci_suspend will return -EBUSY, and system suspend fails. The reason why this issue doesn't show up very often is due to that choose_wakeup will be called in step 2.3.1. In step 2.3.1, if udev->do_remote_wakeup is not equal to device_may_wakeup(&udev->dev), then udev will resume to RPM active for changing the wakeup settings. This has been a lucky hit which hides this issue. For some special xHCI controllers which have no USB2 port, then roothub will not match hub driver due to probe failed. Then its do_remote_wakeup will be set to zero, and we won't be as lucky. xhci driver doesn't need to resume roothub devices everytime like in the above case. It's only needed when there are pending event TRBs. This patch should be back-ported to kernels as old as 3.2, that contains the commit f69e3120df82391a0ee8118e0a156239a06b2afb "USB: XHCI: resume root hubs when the controller resumes" Cc: [email protected] # 3.2 Signed-off-by: Wang, Yu <[email protected]> Acked-by: Alan Stern <[email protected]> [use readl() instead of removed xhci_readl(), reword commit message -Mathias] Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-06-24xhci: clear root port wake on bits if controller isn't wake-up capableLu Baolu1-1/+4
When xHCI PCI host is suspended, if do_wakeup is false in xhci_pci_suspend, xhci_bus_suspend needs to clear all root port wake on bits. Otherwise some Intel platforms may get a spurious wakeup, even if PCI PME# is disabled. This patch should be back-ported to kernels as old as 2.6.37, that contains the commit 9777e3ce907d4cb5a513902a87ecd03b52499569 "USB: xHCI: bus power management implementation". Cc: [email protected] # 2.6.37 Signed-off-by: Lu Baolu <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-06-24xhci: correct burst count field for isoc transfers on 1.0 xhci hostsMathias Nyman1-1/+1
The transfer burst count (TBC) field in xhci 1.0 hosts should be set to the number of bursts needed to transfer all packets in a isoc TD. Supported values are 0-2 (1 to 3 bursts per service interval). Formula for TBC calculation is given in xhci spec section 4.11.2.3: TBC = roundup( Transfer Descriptor Packet Count / Max Burst Size +1 ) - 1 This patch should be applied to stable kernels since 3.0 that contain the commit 5cd43e33b9519143f06f507dd7cbee6b7a621885 "xhci 1.0: Set transfer burst count field." Cc: [email protected] # 3.0 Suggested-by: ShiChun Ma <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-06-24xhci: Use correct SLOT ID when handling a reset device commandMathias Nyman1-2/+5
Command completion events normally include command completion status, SLOT_ID, and a pointer to the original command. Reset device command completion SLOT_ID may be zero according to xhci specs 4.6.11. VIA controllers set the SLOT_ID to zero, triggering a WARN_ON in the command completion handler. Use the SLOT ID found from the original command instead. This patch should be applied to stable kernels since 3.13 that contain the commit 20e7acb13ff48fbc884d5918c3697c27de63922a "xhci: use completion event's slot id rather than dig it out of command" Cc: [email protected] # 3.13 Reported-by: Saran Neti <[email protected]> Tested-by: Saran Neti <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-06-24Merge tag 'fixes-for-v3.16-rc2' of ↵Greg Kroah-Hartman12-35/+68
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus usb: fixes for v3.16-rc2 dwc3-omap won't crash anymore on module removal and suspend/resume won't kill xHCI interrupts. MUSB got a fix to handle Babble condition only in host mode, how it should be. The f_fs function driver got a fix for a NULL pointer dereference. Renesas gadget got a fix for Status stage handling. Signed-of-by: Felipe Balbi <[email protected]>
2014-06-23usb: option: add/modify Olivetti Olicard modemsBjørn Mork1-6/+16
Adding a couple of Olivetti modems and blacklisting the net function on a couple which are already supported. Reported-by: Lars Melin <[email protected]> Cc: <[email protected]> Signed-off-by: Bjørn Mork <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2014-06-23USB: ftdi_sio: fix null deref at port probeJohan Hovold1-2/+5
Fix NULL-pointer dereference when probing an interface with no endpoints. These devices have two bulk endpoints per interface, but this avoids crashing the kernel if a user forces a non-FTDI device to be probed. Note that the iterator variable was made unsigned in order to avoid a maybe-uninitialized compiler warning for ep_desc after the loop. Fixes: 895f28badce9 ("USB: ftdi_sio: fix hi-speed device packet size calculation") Reported-by: Mike Remski <[email protected]> Tested-by: Mike Remski <[email protected]> Cc: <[email protected]> # 2.6.31 Signed-off-by: Johan Hovold <[email protected]>
2014-06-23USB: option: add device ID for SpeedUp SU9800 usb 3g modemOliver Neukum1-0/+4
Reported by Alif Mubarak Ahmad: This device vendor and product id is 1c9e:9800 It is working as serial interface with generic usbserial driver. I thought it is more suitable to use usbserial option driver, which has better capability distinguishing between modem serial interface and micro sd storage interface. [ johan: style changes ] Signed-off-by: Oliver Neukum <[email protected]> Tested-by: Alif Mubarak Ahmad <[email protected]> Cc: <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2014-06-19usb: musb: core: Handle Babble condition only in HOST modeGeorge Cherian1-1/+1
BABBLE and RESET share the same interrupt. The interrupt is considered to be RESET if MUSB is in peripheral mode and as a BABBLE if MUSB is in HOST mode. Handle babble condition iff MUSB is in HOST mode. Fixes: ca88fc2ef0d7 (usb: musb: add a work_struct to recover from babble errors) Tested-by: Tony Lindgren <[email protected]> Signed-off-by: George Cherian <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-19usb: gadget: gadgetfs: correct dev stateMarcus Nutzinger1-1/+6
This reverts commit 1826e9b1 (usb: gadget: gadgetfs: use after free in dev_release()) and places the call to put_dev() after setting the state. If this is not the final call to dev_release() and the state is not reset to STATE_DEV_DISABLED and hence all further open() calls to the gadgetfs ep0 device will fail with EBUSY. Signed-off-by: Marcus Nutzinger <[email protected]> Reviewed-by: Christoph Muellner <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-19usb: gadget: OS descriptors: provide interface directory namesAndrzej Pietrasiewicz3-3/+7
Function's interface directories need to be created when the function directory is created, but interface numbers are not known until the gadget is ready and bound to udc, so we cannot use numbers as part of interface directory names. Let the client decide what names to use. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-19usb: gadget: OS descriptors configfs cleanupAndrzej Pietrasiewicz1-16/+16
A number of variables serve a generic purpose of handling "compatible id" and "subcompatible id", but the names suggest they are for rndis only. Rename to reflect variables' purpose. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-06-19usb: gadget: f_fs: fix NULL pointer dereference when there are no stringsMichal Nazarewicz1-5/+7
If the descriptors do not need any strings and user space sends empty set of strings, the ffs->stringtabs field remains NULL. Thus *ffs->stringtabs in functionfs_bind leads to a NULL pointer dereferenece. The bug was introduced by commit [fd7c9a007f: “use usb_string_ids_n()”]. While at it, remove double initialisation of lang local variable in that function. ffs->strings_count does not need to be checked in any way since in the above scenario it will remain zero and usb_string_ids_n() is a no-operation when colled with 0 argument. Cc: <[email protected]> # v2.6.36+ Signed-off-by: Michal Nazarewicz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>