summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2012-07-26ENGR00215520-04 Mx6:USB host: USB Host1 modulizationmake shi
Disable the host wakeup and put phy to low power mode When the module be removed, and the requested pre irq should be free. Signed-off-by: make shi <b15407@freescale.com>
2012-07-25ENGR00217721-5 usb gadget random transfer failTony LIU
usb driver part - After USB driver prime a bulk transfer(whatever IN or OUT, take OUT for example) on ep1, only one dTD is primed, an USB Interrupt (bit 0 of USBSTS) will be issued, and find that endptcomplete register is 0x2 which means an OUT transfer on ep1 is completed, at this time the ep1 out queue head status is 0x1e18000, and next dtd pointer is 0x1 which means transfer is done and everything is OK, while the dTD token status is 0x2008080 which means this dTD is still active, not completed yet. - Audio SDMA and Ethernet have the similar issue - root cause is not found yet - work around: change the non-cacheable bufferable memory to non-cacheable non-bufferable memory to make this issue disappear. Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-25ENGR00217717 mfgtool firmware will crash during mfgtool runningTony LIU
- the root cause of this issue is there is no protection for the resource which will be accessed by multiple thread Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-25ENGR00217719 usb gadget msc may enumeration fail if msc storage response slowTony LIU
- communication between the usb driver and msc class driver is using raise_exception/handle_excpetion, such mechaism can only have two events(exceptions) at most, one is on processing and another is store to be executed after the current one completed. If the first one processing is very slow, and the third one occur, then the second one will be overwriten by the third one and then the second event is lost and then enumeration failed - since it is the linux community code, it is hard to change the whole frame work, currently only a work around is provided - because this issue is brought in when the first reset event, when this event occur, a lun sync will happen and it will cost much time, but in fact this lun sync is not necessary for the first reset event, the work around is to skip this lun sync. Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-25ENGR00217716 mfgtool host frequently reset bus during transferTony LIU
- the response in csw to request sense will be 1 due to UTP change some storage information - host will reset the bus if response to request sense is 1 - change the response to 0 if CONFIG_FSL_UTP is defined Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-25ENGR00215792 USB:fix gadget issue when boot kernel with USB connectedmake shi
- USB gadget disconnected when system boot kernel with USB connected. Commit 68b1c60f7f6c436340206679a18d61d9 induce the issue, call dr_discharge_line(1) to ensure no abnormal usb wakeup interrupt happen after plug out the cable. There are two cases cause dr_discharge_line(1) of fsl_otg_event() be called. One case is switch the otg mode form Host mode to Device mode. Another case is boot kernel with USB connected. The host_first_call is true when system boot kernel with USB connected, otherwise it is false. So dr_discharge_line(true) should not be called in fsl_otg_event() if host_first_call is true. - USBOH3 clock is still on after plug out the cable when boot kernel with USB connected, If the suspended bit is 0x1 and stopped is 0x0,the case is regarded as suspend connected to usb charger. USB clock will be turn on, otherwise the second suspend is processed without USB clock and it causes system hang. But system boot kernel with cable connected, suspended is 0x1 and stopped is 0x0. USB clock will be on by mistake. And stopped is cleared in dr_controller_run() when system boot kernel with USB connected. We should check the suspended and stopped bit before call dr_controller_run() to fix the issue. Signed-off-by: make shi <b15407@freescale.com>
2012-07-20ENGR00215354 MX6 USB Host:fix kernel dump when no platform_datamake shi
Kernel dump when no platform_data. PC is at hub_thread+0xdb0/0x1538 LR is at 0xbfd43400 pc : [<80311eb4>] lr : [<bfd43400>] psr: 60000013 sp : bfdbff08 ip : ba3cd500 fp : ba3cd600 r10: bfd43400 r9 : 00000000 r8 : 00000001 r7 : 00000000 r6 : 00000000 r5 : ba3cd600 r4 : 00000001 r3 : 00000000 r2 : bfd24c60 r1 : bfd43400 r0 : 00000000 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c53c7d Table: 1000404a DAC: 00000015 Process khubd (pid: 338, stack limit = 0xbfdbe2f0) Stack: (0xbfdbff08 to 0xbfdc0000) ff00: 00000101 00000000 80a01d38 8c008f40 bfdbff3c 8006612c ff20: bff8c000 bfd43400 bfd43400 ba3cd648 ba62a220 ba3cd608 bfd4349c ba62a200 ff40: 00000000 ba3cd644 ba3cd640 00000101 00000001 0000009e ba3cd500 ba62a220 ff60: 00000009 ba3cd64c bfdbff9c 800654ac ba3cd6a4 bfdbe000 00000000 bfeac3a0 ff80: 8008d700 bfdbff84 bfdbff84 00000000 01010000 00000001 bfdbffbc bff8bf48 ffa0: bfdbffcc 00000000 80311104 00000000 00000000 00000000 00000000 8008d330 ffc0: bff8bf48 00000000 00000000 00000000 00000000 00000000 bfdbffd8 bfdbffd8 ffe0: 00000000 bff8bf48 8008d2ac 80042040 00000013 80042040 00000000 00000000 [<80311eb4>] (hub_thread+0xdb0/0x1538) from [<8008d330>] (kthread+0x84/0x8c) [<8008d330>] (kthread+0x84/0x8c) from [<80042040>] (kernel_thread_exit+0x0/0x8) If no platform_data ,the pdata will be NULL.If the driver try to access the pdata->platform_set_disconnect_det,dump will occor.SO we should check the pdata is NULL before checking pdata->platform_set_disconnect_det. Signed-off-by: make shi <b15407@freescale.com>
2012-07-20ENGR00214367-2 imx6 usb charger: bind usb charger with power supplyRong Dian
Bind usb charger with power supply, and print some attributes about usb charger. Signed-off-by: Rong Dian <b38775@freescale.com>
2012-07-20ENGR00212992 usb: fix potential bug with fast plug in/out with usb chargerPeter Chen
- Move imx_usb_vbus_disconnect to work queue, and wait or cancel charger detect worker when vbus is disconnected if charger detect worker still hasn't finished. - Move pull down dp from imx_usb_vbus_disconnect to udc vbus disconnect interrupt handler, the reason is udc->gadget.speed should to be updated at that ISR. - Select POWER_SUPPLY if USB_GADGET_ARC is configured to fix the build error for manufacture tools firmware's build. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00212232-02 USB:fix otg can not work without phy power if VBUS removedmake shi
- There is no VBUS supply or not supply for USBPHY power 3p0,the USB mouse enumeration fail during the board booting with a USB mouse connected to otg port.During system booting ,some error message appear like below : "usb 1-1: device not accepting address 5, error -71 hub 1-0:1.0: unable to enumerate USB device on port 1" The otg phy power is needed during normal USB transmitting ,the otg phy power should be on before calling the usb_add_hcd. So should make sure usb_add_hcd is called after otg_set_host is called in usb_hcd_fsl_probe(). - Before switch the otg mode form Host mode to Device mode,we must call dr_discharge_line() to make sure no abnormal usb wakeup interrupt happen. - Some user case ,the BM_USBPHY_CTRL_ENHOSTDISCONDETECT bit is cleared by mistake. For example,the otg port connect a extern USB hub and a USB device connected to the USB hub.Unplug the USB device,the Hub will enter auto suspend mode,then plug in the device, hub will auto resume by the device plug in ,the BM_USBPHY_CTRL_ENHOSTDISCONDETECT bit is cleared by mistake.So the function platform_set_disconnect_det() should be called after usb_disconnect. Signed-off-by: make shi <b15407@freescale.com>
2012-07-20ENGR00212322-1: usb: add usb charger support for i.mx6xPeter Chen
- USB charger function is embedded in usb device driver, and only for i.mx6x - SDP and DCP charger are tested - Need to enable usb device function (insmod one gadget driver) to use usb charger detect function - The power supply interface for usb charger is: /sys/class/power_supply/imx_usb_charger/ Some useful entries for power supply interface: - present: whether usb charger is present or not - type: usb charger type - current_max: the max charger current for this charger - online: whether vbus is on or not Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00211329-1 Fix system dump of unhandled usb irqTony LIU
Revert "ENGR00211686 mx6 usb: system crash after suspend/resume" This reverts commit eb0fdddfc19ec5597f5973499765a5a8f5e75749. Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00210686 USB:fix unplug&plug device during suspend without wakeup enabledmake shi
For High speed device ,we need clear BM_USBPHY_CTRL_ENHOSTDISCONDETECT after suspend.For Low and full speed device, we should power on and power off the USB port to make sure USB internal state machine work well. Add a config to enable/disable this code,the code is enabled by default. Signed-off-by: make shi <b15407@freescale.com>
2012-07-20ENGR00211686 mx6 usb: system crash after suspend/resumeTony LIU
- the pre-condition of this issue is: 1. usb gadget must be probed before usb host 2. usb otg must be in host mode - the root cause of this issue is because of the issue of week 2p5, a vbus change interrupt will be issued when system enter into DSM, which will cause system exit DSM, so we have a walk aroud to disable usb vbus change interrupt when system enter into DSM. But this walk around just provent the interrupt generating, the vbus change status is still on. When usb gadget is probed, the vbus change interrupt will be enabled by its resume interface by mistake, and then continuous interrupt will be generated because usb otg is in host mode, it can't clear the vbus change status. The system have a protect mechanism that when one IRQ's handler return IRQ_NONE more than 99000 times, it will through a exception to inform such situation. That's the reason why system crash. Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00178933-1 [MX6] USB zero gadget: support USB auto remote wake up testmake shi
- add some parameters in zero.c to support USB auto remote wake up test - add zero_disconnect function to clear the test result Signed-off-by: make shi <b15407@freescale.com>
2012-07-20ENGR00172292 usb otg: enable dtds postpone free on mx6Xinyu Chen
We found this bug occurs again on mx6 when running CTS with ADB over USB. The system will hang without any log, and screen a little mess. It's proved to be a known USB IP issue: USB controller may access a wrong address for the dTD and then hang. Re enable this workaround to avoid any system unstability. Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
2012-07-20ENGR00179679 Fix usb gadget suspend issue connected to usb chargerTony LIU
- the root cause of this issue is during resume process, USB clock is not turned on for this USB charger case so that the second suspend is processed without USB clock, it cause system hang - in udc resume process, at this situation, we should exit low power mode to enable the b session valid intrrupt to close the usb clock when detach from usb charger Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00178932 USB: fix two USB otg common bug for i.MX6make shi
- Built in gadget device driver, plug in USB cable with no response, the reason is USB VBUS wakeup is not enable after OTG switch,make sure pdata->port_enables is 1 even if the pdata is otg device pdata. -Without modprobe or built in gadget device driver,after plug out the USB otg cable,will output "wait otg vbus change timeout!".The reason is we get error otgsc data after USB enter low power mode. Signed-off-by: make shi <b15407@freescale.com>
2012-07-20ENGR00177756 usb-host: quit system suspend after usb remote wakeup occursPeter Chen
If the usb remote wakeup occurs before bus(roothub) suspend, it can stop the system suspend process, the patch adds handle error message process for roothub. If the remote wakeup occurs after bus(roothub) suspend, then the suspend will go on suspending, and usb phy will fail to respond wakeup signal. This patch is suggested by: Alan Stern <stern@rowland.harvard.edu> see: http://www.spinics.net/lists/linux-usb/msg58774.html Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00177589 USB: fix two USB common bug for i.MX6Peter Chen
- Without host wakeup enable, after doing system suspend/resume, plug in usb cable(both host/device) with no response, the reason is usb wakeup is not enable after suspend resume. - clock refcount will not be 0 after usb enters low power mode,the reason is OTG ID wake up not do recover hcd. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00176299-4 usb host suspend/resume can't work randomlyTony LIU
driver part Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00176299-2 usb host suspend/resume can't work randomlyTony LIU
usb core part Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00176147-1: usb: fix some wakeup problemsPeter Chen
- Do not call hcd core adjust wakeup flag code. It may change wakeup flag, and cause port change detect(PCD) enable setting change. - For ID wakeup, it should not call host's fsl_usb_recover_hcd at ID interrupt. The coming ID switch event will resume host. - Do not need enable wakeup interrupt for host at platform driver resume routine, it may introduce unnessary wakeup interrupt during bus resume. The wakeup will be enabled again when usb host goes to controller again due to autosuspend. - When there is no gadget enabled, the otg port is still at host mode with interrupt enabled, so when male Micro-B to female A-type cable with usb device plugs in, there will be PCD interrupt before hcd core leaves suspend mode. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00176061-1 usb: otg: delete discharge vbus operation at otg driverPeter Chen
It may be useless at most of platforms, the user can enable discharge vbus if he/she wants speed up vbus lower speed during OTG switch. Besides, disable vbus interrupt during vbus change due to device <--> host mode switch. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00174734-2 usb: fix bugs that dp and dm are floating at device modePeter Chen
At i.mx6x, the data line (dp and dm) are floating at device mode, that is to say data line will be any values (0-3.6v). So if the usb wakeup is enabled, there will be a wakeup interrupt that causes usb to active mode. In order to fix this problem well, we need to do below things: - Need to discharge both dp and dm - It needs to discharge data line when we switch to device mode and usb cable is disconnected from the host, but not to disable discharge after line state is SE0, the reason is that if we do not pulldown the data line, the line state will be floating again, and possible cause the wakeup interrupt. - It needs to disable discharge data line when the usb cable connects at device mode and usb device is connected at host mode, otherwise it will affect signal quality. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00174242 usb: device: Improve discharge dp operationPeter Chen
The discharge dp function needs to be added at below situation: - USB cable is disconnected from the PC - When the usb mode switchs to device mode Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00174128-1 Revert "Remove the discharge for VBUS and DP-1"Peter Chen
As dp/dm is floating with no usb cable and switch host mode to device mode situation, it do needs this discharge dp patch But, discharge vbus doesn't be needed at suspend_irq, so keep it removing. This reverts commit 0924b71278650fa3891a8f6ea70f91242ca6e5fd. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00174124: Revert "[USB Host]change the default wakeup value of RH"Peter Chen
This patch creates two bugs at current i.mx usb framework. - The high speed device can't be recognized at the first time. - The usb device can't be recognized after system resume with usb vbus. The reason why it creates bugs that it changes (auto)suspend/resume process for usb core. This reverts commit e5c4318450e1fe7c61950214e779658c6cea0da7. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00174037-2 Add HSIC suspend/resume featureTony LIU
device part - implement reset_device interface for HSIC host Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00173378-2 usb: device: the udc stop flag should not be set at suspendPeter Chen
It should not do re-enumeration at udc resume if the vbus is on and host just sends suspend to device Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20net: remove mm.h inclusion from netdevice.hAlexey Dobriyan
Remove linux/mm.h inclusion from netdevice.h -- it's unused (I've checked manually). To prevent mm.h inclusion via other channels also extract "enum dma_data_direction" definition into separate header. This tiny piece is what gluing netdevice.h with mm.h via "netdevice.h => dmaengine.h => dma-mapping.h => scatterlist.h => mm.h". Removal of mm.h from scatterlist.h was tried and was found not feasible on most archs, so the link was cutoff earlier. Hope people are OK with tiny include file. Note, that mm_types.h is still dragged in, but it is a separate story. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-20ENGR00172476 [USB Host]change the default wakeup value of RHTony LIU
- change the default wakeup value of RH from enabled to disabled Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00171544 usb-core: usb host will be broken after system pm testPeter Chen
At i.mx6q sabrelite, there is a usb hub on board. After several suspend suspend/resume iterations, the usb host will be broken. It is IC limitation, and similar with: 574b9641d5846e58273dac6bf80fcf1ff312c5c9 Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: make shi <b15407@freescale.com>
2012-07-20ENGR00171043 gadget-audio: Kernel panic after insert g_audio at second timePeter Chen
The reason is it does not call usb_ep_disable at gadget disable routine. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00171027-3 usbcore:after plug in/out on the hub,host can't workTony LIU
This issue will happen only when suspend bit is set but phcd is not set The root cause of this issue is the IC defect. - If the suspend bit is set without phcd bit set, host controller can't resume normally - The workaround is after set suspend bit, we need set the following bit in USB PHY at once: HW_USBPHY_PWD_RXPWDRX HW_USBPHY_PWD_RXPWDDIFF HW_USBPHY_PWD_RXPWD1PT1 HW_USBPHY_PWD_RXPWDENV HW_USBPHY_PWD_TXPWDv2I HW_USBPHY_PWD_TXPWDIBIAS HW_USBPHY_PWD_TXPWDFS - Furthermore, after resume, we must clear these bits during the K state - IC has no plan to fix this issue - This issue only happen on MX6Q/MX28 core part Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00171027-2 [USB_HOST]after plug in/out on the hub,host can't workTony LIU
This issue will happen only when suspend bit is set but phcd is not set The root cause of this issue is the IC defect. - If the suspend bit is set without phcd bit set, host controller can't resume normally - The workaround is after set suspend bit, we need set the following bit in USB PHY at once: HW_USBPHY_PWD_RXPWDRX HW_USBPHY_PWD_RXPWDDIFF HW_USBPHY_PWD_RXPWD1PT1 HW_USBPHY_PWD_RXPWDENV HW_USBPHY_PWD_TXPWDv2I HW_USBPHY_PWD_TXPWDIBIAS HW_USBPHY_PWD_TXPWDFS - Furthermore, after resume, we must clear these bits during the K state - IC has no plan to fix this issue - This issue only happen on MX6Q/MX28 driver part Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00170819-1 usb-gadget: add usb audio supportPeter Chen
- Only 44.1Khz audio are supported at i.MX6q, since only 44.1Khz local playback are supported at i.MX6q. - Since there is no feedback at current usb audio framework, it may have pop noise/no sound after play some minutes. - About how to test: please refer Documentation/arm/imx/udc.txt Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00170144 [USB-Host] Fix the following USB hub issue on mx6qTony LIU
- After auto suspend, attach device to hub will cause host can't work any more - after system suspend, attach device to hub will cause host can't work any more - HSDISCONNECTDEC logic error - Set RUNSTOP in bus suspend, if no short delay, host can't work any more Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20ENGR00170530 usb-udc: Some tiny bug fixesPeter Chen
Most of them are from community - Using correct dequeue method - Fix the ISOC_XFER condition judgement - Need to wmb before prime - Fix some conditions of udc->max_ep judgement Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20usb: gadget: audio: queue wLength-sized requestsFelipe Balbi
On Audio class, the wLength field of the Setup packet, contains the data payload size of the following Data phase. Instead of harcoding values, use wLength. This also fixes a bug where Gadget driver had to receive 3 bytes, but it was queueing a ZLP. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-20usb: gadget: audio: actually support both speedsFelipe Balbi
While testing g_audio with HighSpeed UDC on a FS Hub, we had no configurations to present to the host. That's because both speeds where mutually exclusive. Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-07-20USB: gadget: section mismatch warning fixedMichal Nazarewicz
In may gadgets bind and bind like functions were in a init section as they were only run during initialisation. However, being callback functions they were referenced from structures in “normal” sections. Changing the tag from “__init” to “__ref” fixes the warnings. Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-07-20ENGR00169885-1 usb-udc: add remote wakeup supportPeter Chen
Meanwhile, fix the bug that there is no prime for GetStatus at status phase About how to test remote wakeup, please see: Documentation/arm/imx/udc.txt Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20build fix and driver fixJason Liu
Signed-off-by: Jason Liu <jason.hui@linaro.org>
2012-07-20ENGR00169661:Remove the discharge for VBUS and DPTony LIU
- VBUS discharge code should be removed from suspend_irq function - On Arik, there is a huge capacitance(C86), even discharge VBUS, the Drop of VBUS is still very slow - On Arik, the B session valid threshold is not 0.8V or 1.4V, it is about 2V~3V, so we can receive B session valid interrupt very soon - No DP discharge needed, but wait for SE0 is needed Signed-off-by: Tony LIU <junjie.liu@freescale.com>
2012-07-20usb: gadget: file_storage: fix race on unloadingYauheni Kaliuta
There is a race, reproduced rarely if you unload the module when host finishes mass storage device initialization (reading partition table and so on): fsg_unbind() code first closes lun files then waits for worker thread to finish its work, as the result the thread may operate on already closed device with an oops and backtrace: [ 484.937225] [<b00e403c>] (touch_atime+0x4/0x140) from [<b00a1498>] (generic_file_aio_read+0x678/0x6f0) [ 484.946563] [<b00a1498>] (generic_file_aio_read+0x678/0x6f0) from [<b00d08c4>] (do_sync_read+0xb0/0xf4) [ 484.955963] [<b00d08c4>] (do_sync_read+0xb0/0xf4) from [<b00d1478>] (vfs_read+0xac/0x144) [ 484.964172] [<b00d1478>] (vfs_read+0xac/0x144) from [<af24c6a8>] (fsg_setup+0x7f4/0x900 [g_file_storage]) [ 484.973785] [<af24c6a8>] (fsg_setup+0x7f4/0x900 [g_file_storage]) from [<af24da14>] (fsg_main_thread+0x85c/0x175c [g_file_storage]) [ 484.985626] [<af24da14>] (fsg_main_thread+0x85c/0x175c [g_file_storage]) from [<b0077c48>] (kthread+0x7c/0x84) [ 484.995666] [<b0077c48>] (kthread+0x7c/0x84) from [<b002f950>] (kernel_thread_exit+0x0/0x8) [ 485.004028] Code: eaffffd0 e28dd008 e8bd8df0 e92d40f7 (e591400c) Change the order in unbind: wait for the thread first, then close the files. Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@nokia.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-07-20usb: gadget: file_storage: fix race on unloadingYauheni Kaliuta
There is a race, reproduced rarely if you unload the module when host finishes mass storage device initialization (reading partition table and so on): fsg_unbind() code first closes lun files then waits for worker thread to finish its work, as the result the thread may operate on already closed device with an oops and backtrace: [ 484.937225] [<b00e403c>] (touch_atime+0x4/0x140) from [<b00a1498>] (generic_file_aio_read+0x678/0x6f0) [ 484.946563] [<b00a1498>] (generic_file_aio_read+0x678/0x6f0) from [<b00d08c4>] (do_sync_read+0xb0/0xf4) [ 484.955963] [<b00d08c4>] (do_sync_read+0xb0/0xf4) from [<b00d1478>] (vfs_read+0xac/0x144) [ 484.964172] [<b00d1478>] (vfs_read+0xac/0x144) from [<af24c6a8>] (fsg_setup+0x7f4/0x900 [g_file_storage]) [ 484.973785] [<af24c6a8>] (fsg_setup+0x7f4/0x900 [g_file_storage]) from [<af24da14>] (fsg_main_thread+0x85c/0x175c [g_file_storage]) [ 484.985626] [<af24da14>] (fsg_main_thread+0x85c/0x175c [g_file_storage]) from [<b0077c48>] (kthread+0x7c/0x84) [ 484.995666] [<b0077c48>] (kthread+0x7c/0x84) from [<b002f950>] (kernel_thread_exit+0x0/0x8) [ 485.004028] Code: eaffffd0 e28dd008 e8bd8df0 e92d40f7 (e591400c) Change the order in unbind: wait for the thread first, then close the files. Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@nokia.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-07-20ENGR00161644 usb-gadget: prime directly for status dTD of ep0Peter Chen
During the setup transfer, if prime status just after prime the data, but before the data completes, there is a potential problem: The device's qTD has NO direction bit, If the IN request(Status Stage) is added to qTD list while the OUT (Data Stage) is priming, then the IN will not prime by software, it will prime automatically by controller as OUT. We met one usb hang issue during repeat plug in/out test at i.mx6q that the data status has finished but status has never finished, it is most likely above issue. After this fix, the repeat plug in/out test passes successfully. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00162583-2 usb driver: avoid class driver access register after usb is offPeter Chen
- An well-behavior class driver should disable their endpoints after being notified disconnect with host, we use all endpoints are stopped (ep->stopped) to indicates the class driver will not visit device driver any more. the ep-stopped will be initialized as 1 for non-control endpoint it will be 0 after fsl_ep_enable, and be 1 after fsl_ep_disable. Where is a non-sleep wait routine at disconnect event for waiting all endpoints are stopped - Some controller's (like i.mx6q) DP will change from J to SE0 slowly after the cable disconnects with host, in that case there will be a wakeup interrupt after driver enables the wakeup interrupt. For i.mx6q, there is a discharge routine for DP after the disconnection. - Should not wait vbus to low during first otg switch, as the wait will be timeout when the usb cable is connecting to host. Signed-off-by: Peter Chen <peter.chen@freescale.com>
2012-07-20ENGR00161643-3 UTP : bugfixHuang Shijie
The origin code lossed one line. fix it. Signed-off-by: Huang Shijie <b32955@freescale.com>