summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2
Commit message (Collapse)AuthorAgeFilesLines
...
| * usb: dwc2: gadget: add reset flag in init functionGregory Herrero2015-01-303-15/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a flag to request physical reset of the controller when s3c_hsotg_core_init_disconnected is called. During the usb reset, controller must not be fully reconfigured and resetted. Else this leads to shorter chirp-k duration during enumeration. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: gadget: add unaligned buffers supportMian Yousaf Kaukab2015-01-302-1/+63
| | | | | | | | | | | | | | | | | | | | When using DMA, dwc2 requires buffers to be 4 bytes aligned. Use bounce buffers if they are not. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: gadget: remove hardcoded if (0) and if (1) checksMian Yousaf Kaukab2015-01-301-13/+1
| | | | | | | | | | | | | | | | | | Remove dead code as well. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: gadget: fix a typo in commentGregory Herrero2015-01-301-1/+1
| | | | | | | | | | | | | | | | | | s3c_hsotg_process_req_feature comments was not correct Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: gadget: add TEST_MODE feature supportGregory Herrero2015-01-302-7/+186
| | | | | | | | | | | | | | | | | | | | | | | | Handle SET_FEATURE TEST_MODE request sent by the host. Slightly rework FEATURE request handling to allow parsing other request types than Endpoint. Also add a debugfs to change test mode value from user space. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: gadget: fix clear halt feature handlingGregory Herrero2015-01-301-7/+13
| | | | | | | | | | | | | | | | | | | | | | When clearing HALT on an endpoint, req->complete of in progress requests must be called with locks off. New request should only be started if there is not already a pending request on the endpoint. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: host: resume root hub on remote wakeupGregory Herrero2015-01-301-2/+4
| | | | | | | | | | | | | | | | | | When a remote wakeup happens during bus_suspend, hcd needs to resume its root hub. Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: hcd: use HUB_CHAR_*Sergei Shtylyov2015-01-191-1/+3
| | | | | | | | | | | | | | | | Fix using the bare number to set the 'wHubCharacteristics' field of the Hub Descriptor while the values are #define'd in <linux/usb/ch11.h>. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * Revert "usb: dwc2: add bus suspend/resume for dwc2"Paul Zimmerman2015-01-191-77/+11
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0cf884e819e05437287a668b9bfcc198bab6329c. Even after applying the follow-on patch at https://patchwork.kernel.org/patch/5325111 there are still problems with device connect on the Altera SOCFPGA platform at least. One possible fix would be to add a whitelist to enable suspend/resume on platforms where it does work correctly. Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * Merge tag 'v3.19-rc5' into nextFelipe Balbi2015-01-191-1/+5
| |\ | | | | | | | | | | | | | | | | | | | | | Linux 3.19-rc5 Conflicts: drivers/usb/dwc2/gadget.c drivers/usb/gadget/udc/bdc/bdc_ep.c
| * | usb: dwc2: gadget: report disconnection after resetMian Yousaf Kaukab2015-01-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If usb bus is reset without a physical disconnection, all endpoints will remain open. Call s3c_hsotg_disconnect() from reset handler to report a disconnect to gadget framework. hsotg->connected is checked in s3c_hsotg_disconnect() before processing disconnect. In some cases, USBRst is seen before EnumDone and after it as well. So move setting of hsotg->connected to set-address to avoid reporting extra disconnection in this case. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: force gadget initialization in dev modeGregory Herrero2015-01-121-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When booting with id pin grounded, dwc2 default to host mode. Thus, force device mode prior initializing gadget part. Else fifo init will fail since fifo values are not correct in host mode. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: add vbus_draw supportGregory Herrero2015-01-121-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This callback informs the driver about the total amount of current it is allowed to draw. Share this information with the phy so that current limits can be set for charging for example. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: fix pullup handlingGregory Herrero2015-01-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gadget must be informed about disconnection when pullup is removed. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: reset fifo_map when initializing fifosGregory Herrero2015-01-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After all endpoints are disabled, fifo_map should have reached 0. Its a bug if if didn't, so warn about it and reset it to 0 so that driver can continue using all the fifos. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: fix fifo allocation leakMian Yousaf Kaukab2015-01-121-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When selecting different alt setting, s3c_hsotg_ep_enable can be called with fifo already allocated. Allocate fifo again only if required and after deallocating the previous fifo. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: pick smallest acceptable fifoMian Yousaf Kaukab2015-01-121-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current algorithm picks the first fifo which is equal to or greater than the required size. This can result in bigger fifos assigned to endpoints with smaller maxps. Change the algorithm to pick the smallest fifo which is greater than or equal to the required size. Moreover, only use signed variables when required. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: rename sent_zlp to send_zlpMian Yousaf Kaukab2015-01-122-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This flag is set before sending the zlp. So use present tense instead of the past tense. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: add vbus_session supportGregory Herrero2015-01-121-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable phy driver to report vbus session. This allows us to remove D+ pullup when vbus is not present. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: don't block after fifo flush timeoutGregory Herrero2015-01-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Can't stay in the loop forever. Break it after timeout. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: dont warn if endpoint is not enabledMian Yousaf Kaukab2015-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning is probably good but it has false positives in both dma and non-dma cases. So its not very helpful in either. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: fix zero length packet transfersMian Yousaf Kaukab2015-01-121-29/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to programming guide, zero length packet should be programmed on its own and should not be counted in DIEPTSIZ.PktCnt with other packets. For ep0, this is the zlp for DATA IN stage (if required) and not for the STATUS stage. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: manage ep0 state in softwareMian Yousaf Kaukab2015-01-122-80/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Manage ep0 state in software to add handling of status OUT stage. Just toggling hsotg->setup in s3c_hsotg_handle_outdone leaves it in wrong state in 2-stage control transfers. Moreover, ensure that for setup-packet s3c_hsotg_handle_outdone is called either from SetupDone or OutDone but not both. Dwc2 ip v3.00a generates both SetupDone and OutDone on setup packets. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: kill requests after disabling epMian Yousaf Kaukab2015-01-121-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kill_all_requests() can flush the fifo. Call it after disabling the endpoint. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: consider all tx fifosMian Yousaf Kaukab2015-01-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When matching tx fifo to endpoint, consider all fifos instead of hard limiting to 8 Moreover, print error in case no fifo could be found. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: fix debug loop limitsMian Yousaf Kaukab2015-01-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < 15 check doesn't show debug information for endpoint 15. It is possible to have less than 15 endpoints so use limit provided by hardware configuration. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: remove unused members from hsotg_reqMian Yousaf Kaukab2015-01-121-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | These members are only occupying space. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: configure fifos from device treeGregory Herrero2015-01-122-28/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As fifo size can vary between SOCs, add possibility to configure them from device tree. Fifo sizes used by the legacy driver will be used If they are not provided by the device tree. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Reviewed-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: check interrupts for all endpointsMian Yousaf Kaukab2015-01-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code does not check endpoint 15 interrupt. Use number of endpoint configured in hardware instead of the hardcoded value. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: add bi-directional endpoint supportMian Yousaf Kaukab2015-01-122-119/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GHWCFG1 provides hardware configuration of each endpoint. Use it to configure the endpoints instead of assuming all even endpoint are OUT and all odd endpoints are IN. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: add device tree property to enable dmaGregory Herrero2015-01-122-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add an of specific function to parse device node properties. * Enable dma usage only if device tree property 'g_use_dma' is present. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: don't erase gahbcfg register when enabling dmaGregory Herrero2015-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Do a read-modify-write instead of only setting DMAEn bit. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: write correct value in ahbcfg registerGregory Herrero2015-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HBstLen is GAHBCFG[4:1]. Use GAHBCFG_HBSTLEN_SHIFT to write burst- length at correct position. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: fix error path in dwc2_gadget_initMian Yousaf Kaukab2015-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the error path, s3c_hsotg_phy_disable should be called after a call to s3c_hsotg_phy_enable is made. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: don't embed ep0 buffersMian Yousaf Kaukab2015-01-122-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using DMA, data of the previous setup packet can be read back from cache because ep0 and ctrl buffers are embedded in struct s3c_hsotg. Allocate buffers instead of embedding them. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Reviewed-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: don't process XferCompl on setup packetMian Yousaf Kaukab2015-01-122-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only process DOEPINT.XferCompl on data packet as DOEPINTn.SetUp can occur with or without DOEPINT.XferCompl. When DOEPINT.SetUp occurs with DOEPINT.XferCompl, only DOEPINT.SetUp needs to be handled. Moreover, ignore DOEPINT.XferCompl when it occurs with DOEPINT.StupPktRcvd as driver needs to wait for DOEPINT.SetUp to continue. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: mask fifo empty irq with dmaMian Yousaf Kaukab2015-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using DMA, keep fifo empty interrupt disabled. Otherwise core is flooded by interrupts. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: gadget: register gadget handle to the phyGregory Herrero2015-01-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bind peripheral controller to the phy on udc_start. Unbind on udc_stop. Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | drivers: usb: dwc2: remove 'force' parameter from kill_all_requests()Robert Baldyga2015-01-121-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes in simpler way the bug described in [1] and [2]. It looks like DWC2 is the only UDC driver that doesn't force usb requests to complete in ep_disable() function. This causes described problem, because we have no guarantee that all requests will be completed before unbind of usb function. To fix this problem we force all requests of disabled endpoint to complete. Also currently running request is not handled. This allowed to simplify code of kill_all_requests() function, because 'force' parameter is always set to true, so we don't need it anymore. In s3c_hsotg_rx_data() we change function used to print message when active request is NULL from dev_warn() to dev_dbg(), because such situation is harmless for driver and now it can take place during normal endpoint disabling. [1] https://lkml.org/lkml/2014/12/9/283 [2] https://lkml.org/lkml/2014/12/12/360 Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: platform: add generic PHY framework supportYunzhi Li2015-01-122-23/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | Get PHY parameters from devicetree and power off usb PHY during system suspend. Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Yunzhi Li <lyz@rock-chips.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * | usb: dwc2: Fixed a few typos in commentsMickael Maison2015-01-123-3/+3
| | | | | | | | | | | | | | | | | | | | | Fixed 3 typos in comments Signed-off-by: Mickael Maison <mickael.maison@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* | | Merge 3.19-rc7 into usb-nextGreg Kroah-Hartman2015-02-021-3/+3
|\ \ \ | | | | | | | | | | | | | | | | | | | | We want the USB fixes in here to make merges easier. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | usb: dwc2: call dwc2_is_controller_alive() under spinlockRobert Baldyga2015-01-191-3/+3
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the following problem: data transmission in direction IN break unless the GSNPSID register access is done with spinlock held. This issue occurs at least in Exynos4412 SoC, probably in many SoC's from Exynos familly. The problem is described here: https://lkml.org/lkml/2014/12/22/185 And there is linux mailing list discussion: https://lkml.org/lkml/2015/1/14/17 Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* / | dwc2: hcd: use HUB_CHAR_*Sergei Shtylyov2015-01-251-1/+3
|/ / | | | | | | | | | | | | | | Fix using the bare number to set the 'wHubCharacteristics' field of the Hub Descriptor while the values are #define'd in <linux/usb/ch11.h>. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* / usb: dwc2: gadget: kill requests with 'force' in s3c_hsotg_udc_stop()Robert Baldyga2014-12-221-3/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes us sure that all requests are completed before we unbind gadget. There are assumptions in gadget API that all requests have to be completed and leak of complete can break some usb function drivers. For example unbind of ECM function can cause NULL pointer dereference: [ 26.396595] configfs-gadget gadget: unbind function 'cdc_ethernet'/e79c4c00 [ 26.414999] Unable to handle kernel NULL pointer dereference at virtual address 00000000 (...) [ 26.452223] PC is at ecm_unbind+0x6c/0x9c [ 26.456209] LR is at ecm_unbind+0x68/0x9c (...) [ 26.603696] [<c033fdb4>] (ecm_unbind) from [<c033661c>] (purge_configs_funcs+0x94/0xd8) [ 26.611674] [<c033661c>] (purge_configs_funcs) from [<c0336674>] (configfs_composite_unbind+0x14/0x34) [ 26.620961] [<c0336674>] (configfs_composite_unbind) from [<c0337124>] (usb_gadget_remove_driver+0x68/0x9c) [ 26.630683] [<c0337124>] (usb_gadget_remove_driver) from [<c03376c8>] (usb_gadget_unregister_driver+0x64/0x94) [ 26.640664] [<c03376c8>] (usb_gadget_unregister_driver) from [<c0336be8>] (unregister_gadget+0x20/0x3c) [ 26.650038] [<c0336be8>] (unregister_gadget) from [<c0336c84>] (gadget_dev_desc_UDC_store+0x80/0xb8) [ 26.659152] [<c0336c84>] (gadget_dev_desc_UDC_store) from [<c0335120>] (gadget_info_attr_store+0x1c/0x28) [ 26.668703] [<c0335120>] (gadget_info_attr_store) from [<c012135c>] (configfs_write_file+0xe8/0x148) [ 26.677818] [<c012135c>] (configfs_write_file) from [<c00c8dd4>] (vfs_write+0xb0/0x1a0) [ 26.685801] [<c00c8dd4>] (vfs_write) from [<c00c91b8>] (SyS_write+0x44/0x84) [ 26.692834] [<c00c91b8>] (SyS_write) from [<c000e560>] (ret_fast_syscall+0x0/0x30) [ 26.700381] Code: e30409f8 e34c0069 eb07b88d e59430a8 (e5930000) [ 26.706485] ---[ end trace f62a082b323838a2 ]--- It's because in some cases request is still running on endpoint during unbind and kill_all_requests() called from s3c_hsotg_udc_stop() function doesn't cause call of complete() of request. Missing complete() call causes ecm->notify_req equals NULL in ecm_unbind() function, and this is reason of this bug. Similar breaks can be observed in another usb function drivers. This patch fixes this bug forcing usb request completion in when s3c_hsotg_ep_disable() is called from s3c_hsotg_udc_stop(). Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* Merge tag 'usb-for-v3.19' of ↵Greg Kroah-Hartman2014-11-2510-375/+491
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v3.19 merge window This time, a very pull request with 216 non-merge commits. Most of the commits contained here are sparse or coccinelle fixes ranging from missing 'static' to returning 0 in case of errors. More importantly, we have the removal the now unnecessary 'driver' argument to ->udc_stop(). DWC2 learned about Dual-Role builds. Users of this IP can now have a single driver built for host and device roles. DWC3 got support for two new HW platforms: Exynos7 and AMD. The Broadcom USB 3.0 Device Controller IP is now supported and so is PLX USB338x, which means DWC3 has lost is badge as the only USB 3.0 peripheral IP supported on Linux. Thanks for Tony Lindgren's work, we can now have a distro-like kernel where all MUSB glue layers can be built into the same kernel (statically or dynamically linked) and it'll work in PIO (DMA will come probably on v3.20). Other than these, the usual set of cleanups and non-critical fixes. Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: remove early return on clock queryDinh Nguyen2014-11-251-3/+7
| | | | | | | | | | | | | | | | | | Since we have assigned clk=NULL, which is a valid clk, we should not be returning when a clock node is not provide. Instead, we should return only when we cannot enable the clock. Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: Fix build warning when CONFIG_PM_SLEEP=nFabio Estevam2014-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Building with bcm2835_defconfig, which has CONFIG_PM_SLEEP=n causes the following build warning: drivers/usb/dwc2/platform.c:227:12: warning: 'dwc2_suspend' defined but not used [-Wunused-function] drivers/usb/dwc2/platform.c:237:12: warning: 'dwc2_resume' defined but not used [-Wunused-function] Annotate these functions with '__maybe_unused' to prevent the warnings. Reported-by: Olof's autobuilder <build@lixom.net> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: gadget: rework suspend/resume code to correctly restore gadget stateMarek Szyprowski2014-11-212-18/+24
| | | | | | | | | | | | | | | | | | | | Suspend/resume code assumed that the gadget was always started and enabled to connect to usb bus. This means that the actual state of the gadget (started/stopped or connected/disconnected) was not correctly preserved on suspend/resume cycle. This patch fixes this issue. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
| * usb: dwc2: gadget: add mutex to serialize init/deinit callsMarek Szyprowski2014-11-213-0/+22
| | | | | | | | | | | | | | | | | | | | | | This patch adds mutex, which protects initialization and deinitialization procedures against suspend/resume methods. This mutex will be needed by the updated suspend/resume calls, which tracks gadget state. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>