summaryrefslogtreecommitdiff
path: root/drivers/usb (follow)
Commit message (Collapse)AuthorAge
...
* | | | usb: gadget: gsi: Decrement USB gadget pm usage count on cable disconnectMayank Rana2016-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently USB GSI function driver increments USB gadget device's pm usage count on set_alt() and decrements on USB bus suspend or USB cable disconnect case. Current code is not decrementing this usage count when sm_state is STATE_INITIALIZED and USB cable is disconnected (i.e. event EVT_DISCONNECTED posted). Fix this issue by decrementing USB gadget device's pm usage count by addding check for event EVT_DISCONNECTED when sm_state is STATE_INITIALIZED. CRs-Fixed: 1003242 Change-Id: I4d6c9ce254f4c4139313dfd33da6c8745f34a1d3 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: gadget: f_gsi: Call ipa_usb_init_teth_prot() from gsi_bindHemant Kumar2016-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently ipa_usb_init_teth_prot() is called before gsi_bind() gets called as a result of usb_add_function() call. gsi_bind() is polulating ipa_init_params which is passed to ipa_usb_init_teth_prot(). Since usb_add_function() is getting called later after gsi_bind_config() returns, ipa_init_params remains unpopulated and results into ipa_usb_init_teth_prot() returning failure. Fix this issue by moving the call to gsi_bind(). This also matches to ipa_usb_deinit_teth_prot() call in gsi_unbind(). CRs-Fixed: 1013830 Change-Id: I824d3fa62e2736962680ae1c883b9a2916346331 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: dwc3: Fix dep name handling upon ep disableHemant Kumar2016-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dep name needs to be updated only for non-gsi endpoints since gsi endpoints are statically assigned. Due to merge from previous kernel dep name is updated twice upon ep disable. This is causing gsi ep names to get modified resulting into failure in finding the original gsi ep name upon function bind. Hence update the dep name only once at the end of ep disable and skip it for gsi eps. CRs-Fixed: 1013830 Change-Id: Iea9282cc8fb4f13d066d25c63ccb1da1881c0a8a Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: gadget: f_gsi: Use gsi ep ops to disable endpointHemant Kumar2016-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gsi driver does not call the gadget API usb_ep_enable() instead uses gsi ep operation call back to enable gsi ep. As a result ep->enabled flag remains clear. Later function driver calls usb_ep_disble() API from gadget framework and ep disable operation gets skipped. This causes start transfer command to fail next time when gsi ep gets enabled. Fix this issue by calling gsi ep disable operation instead of calling gadget API. CRs-Fixed: 1013830 Change-Id: I06570dec368b430321ec196a5e4338f657c43b42 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: dwc3: Add support for gsi endpoint disable operationHemant Kumar2016-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gsi driver does not call the gadget API usb_ep_enable() instead uses gsi ep operation call back to enable gsi ep. As a result ep->enabled flag remains clear. Later function driver calls usb_ep_disble() API from gadget framework and ep disable operation gets skipped. Fix this by adding gsi ep operation for ep disable. This makes the enable and disable ep operations both handled by gsi ep ops. CRs-Fixed: 1013830 Change-Id: I5caa9a839b9fdd144af0a59a7c605777f7a3a659 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: gadget: rndis: Add packet filter handling for hw accelerated pathHemant Kumar2016-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Call flow control API when RNDIS packet filter control message is received. This allows to call the registered flow control call back from rndis clients supporting hw accelerated path. CRs-Fixed: 1013824 Change-Id: I87793e31d4db10acf1103127a2d1ad942d253c67 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: gadget: composite: Handle OS descriptor request properlyHemant Kumar2016-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case w_index or w_value of an OS descriptor does not match for a device or an interface, value remains set to -EOPNOTSUPP. This is assigned to an unsigned request length and becomes a large integer value. When driver tries to allocate a buffer of this large integer value DMA allocator complaints for out of SW-IOMMU space. Hence check this variable for negative value and return without queuing ep0 request. CRs-Fixed: 1013316 Change-Id: I705d0d54fb17ca3042533f0106f91912215bd52a Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: gadget: composite: Fix double free memory bugHemant Kumar2016-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configfs_dev_cleanup function can double free os_desc and buffer when called from different context. For example, this can be called from composite_unbind() and when composite_bind() fails. Fix this issue by setting request and buffer pointer to NULL after kfree. CRs-Fixed: 1013316 Change-Id: I6e87289627b23fc368f990fc7962854eeb3fbbc1 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: pd: Add sysfs entriesJack Pham2016-05-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add sysfs attributes that will live under /sys/class/usbpd/usbpd0 which will give state information such as: - received PDOs from the peer source - whether an explicit contract is established - selecting a new PDO (thereby sending a Request message) - current and supported power, data roles Change-Id: I5c3cf9a0239c0274709a1771e4fda8c6f5baaa77 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | usb: pd: Add Protocol layer and Policy EngineJack Pham2016-05-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds protocol layer handling as well as the policy engine state machine. Change-Id: I5323f82192960d1fd7d3a20baf040d6d80c06be5 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | usb: pd: Add QPNP Power Delivery PHY driverHemant Kumar2016-05-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QPNP PD PHY resides in the PMIC and handles USB Power Delivery data transmission and reception over the CC lines. This driver communicates to this device over SPMI or I2C buses. Introduce APIs that upper layers will use to implement the protocol layer and policy engine. Change-Id: I75dec23c297fd5e07d14741e6627b473012b7a01 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | usb: pd: Add initial support for USB Power DeliveryJack Pham2016-05-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add PD policy engine driver. This driver will interact with the charger/Type-C module via power_supply framework, and in turn notify the USB controller on when to begin/end data operation using extcon. For this initial patch this driver is simply acting as a pass-through between Type-C connection states and relaying them as USB/USB_HOST notifications. Change-Id: Ieba8e68761beef83a572b75b6b5f3b7ab7802e9e Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | usb: gadget: f_diag: Update serial_number with dload_cookieMayank Rana2016-05-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB DIAG function driver updates dload_cookie with USB PID and serial number to avoid port-hopping for DIAG port with bootloader. Now composite_driver doesn't get updated strings as android.c is deprecated and configfs is used. Hence use composite device based strings to find required serial number. CRs-Fixed: 1010715 Change-Id: I076928436a8b1b4d1c3ee7e48db9b3314ec1fc05 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | dwc3: Enable and disable core IRQ from dwc3 suspend/resume onlyMayank Rana2016-04-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dwc3 core IRQ's depth (disable depth) is going out of sync due to disabling it from dwc3's state machine when there are multiple time USB composition switch is being performed before USB cable connect. Linux IRQ framework doesn't decrement disable depth count with enable_irq() when IRQ is enabled previously but it does increment disable depth every time disable_irq() is called. This results into dwc3 core IRQ to remain disable causing USB enumeration failure as unknown device due to USB controller driver is not seeing any of RESET and CONNECT DONE interrupt although USB controller has posted those events into event buffer. Fix this issue by making sure that USB core IRQ is disabled by default, and enable/disable it from dwc3 suspend/resume only. Change-Id: I665b15f6b5aca7d63e9ced29ec94b09524ae91be Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: dwc3: Request dwc3 irq in driver probeHemant Kumar2016-04-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | request_irq() for dwc irq is called in dwc3_gadget_start() when msm-dwc3 is in suspended state because usb cable is not connected. dwc3 resume happens upon USB connect, it enables already enabled irq. This result into unbalanced enable irq warning. Fix this by moving request_irq to dwc3_probe(). CRs-Fixed: 999124 Change-Id: I61ec085778fe43b87de18a84829ea3f5280c451c Signed-off-by: Hemant Kumar <hemantk@codeaurora.org> Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | dwc3-msm: Don't perform bus voting from dwc3 driver probeMayank Rana2016-04-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently dwc3 driver's probe is doing bus voting. This voting remains until USB cable is connected and disconnected. Due to this voting, XOSD is not happening. Fix this issue by removing voting from driver's probe context and let USB's suspend and resume take care of bus unvoting and voting respectively. CRs-Fixed: 1007183 Change-Id: I34f7cbf2aa10b63712e5142f908fa77ae195f5b1 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: gadget: f_gsi: Add free_func call backHemant Kumar2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without free_func call back config causes NULL pointer dereference. CRs-Fixed: 1003784 Change-Id: Idb7717315da20fa3331303136d7ba1d05696f063 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: gadget: f_gsi: Fix bug in handling control transferHemant Kumar2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Driver is overriding the ep0 request context with gsi driver context even if it does not intend to handle the setup completion. This is causing flood of warnings when composite_setup_complete() is type casting the function driver context as cdev and failing to match ep0 request pointer with cdev->req. Hence only override context when driver is overriding the complete call back. CRs-Fixed: 1003784 Change-Id: I176671ae09f17d920643eeeec8262a6f97856712 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: gadget: f_gsi: Allocate dma memory using gadget device's parent deviceHemant Kumar2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use "gadget->dev.parent" instead of "&gadget->dev" in the first argument of dma_zalloc_coherent() because the parent has a udc controller's device pointer. Otherwise, iommu functions are not called in ARM environment and allocation is failing. CRs-Fixed: 1003784 Change-Id: I2ea75b533f857189856840e437a96891eea5699c Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: gadget: f_gsi: Fix bug in accessing evt queue lockHemant Kumar2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case gsi_update_function_bind_params() returns failure before initializing spin lock for event queue, gsi_bind() continues further by calling post_event() which acquires the uninitialized spin lock causing BUG. Hence check for return value of gsi_update_function_bind_params() before calling post_event(). CRs-Fixed: 1003784 Change-Id: I0fcad2467d15f311feecf3b9cee9209f7453485c Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: dwc3: Allocate fixed h/w eps for GSI endpointsDevdutt Patnaik2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support to allocate specific hardware EPs to GSI enabled endpoints. Creates EP list with names "gsi-epin" for IN and "gsi-epout" for OUT EPs that are intended for use by the GSI function driver. The EPs are reserved from the end of the EP list. CRs-Fixed: 1003784 Change-Id: I70ebce8c2717baaea38f7b6235976d8a522eb9fd Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | | usb: dwc3: Add support for GSI event buffer configurationHemant Kumar2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add additional event buffers for GSI based hardware accelerated endpoints and its related configuration. CRs-Fixed: 1003784 Change-Id: Ibedf73690040b8bd872f5621835680a66c22e265 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: dwc3: msm: Move extcon registration later in probeJack Pham2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible that the extcon notifier may be triggered soon after it is registered, but before the mdwc->dwc3 has been populated. This leads to a NULL pointer dereference in vbus_notifier. Fix this by moving the extcon_register() call later in the probe until when the the driver would be ready to handle an immediate notification. CRs-Fixed: 1003908 Change-Id: I403da246f18c25a77fa7f66e152cbcdca8c00b16 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | USB: f_fs: Use HS and SS descriptors without checking gadget speedMayank Rana2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User space function driver could always provide descriptors for all speeds irrespective of USB speed supported with USB gadget. If USB gadget is not high/super speed capable, f_fs driver doesn't parse HS or SS descriptors which results into OS descriptors processing fail due to checking against wrong offset within received descriptor buffer. Fix this issue by always processing HS and SS descriptors without checking USB gadget speed. CRs-Fixed: 1003565 Change-Id: Icb6537271ce55e44f5fc3e1ef28dd4d6810b681f Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: gadget: f_cdev: Fix recursive spin lock bugHemant Kumar2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since driver context f_cdev is not freed until the driver is unloaded, port_usb remains available to be accessed for driver operations. Hence there is no need to protect port_usb using spin lock. Hence remove un-needed spin lock/unlock from some of the APIs which prevents recursive spin lock. Also, make sure char device is destroyed before f_cdev context is freed up. Change-Id: Ib91f23c070065185da72387300304f2690d5a8b1 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | | usb: gadget: composite: Set default value of bcdUSB as 0x0200Mayank Rana2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When l1_supported is false and USB gadget max speed is high speed only, composite framework is not updating bcdUSB as 0x0200 which results into bcdUSB set as 0x00 used as part of device descriptors. This is against USB specification and also USB host may behave differently. Fix this issue by setting default value of bcdUSB as 0x0200. CRs-Fixed: 1006330 Change-Id: I8330f0609540d97f5bca78c42ed193537f497a73 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: gadget: f_diag: Fix list corruption due to diag_context freedMayank Rana2016-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While performing USB composition switch or adb is being killed, list_add corruption related crash is seen when SLUB_DEBUG is enabled. diag_function_unbind() API decrements kref count and when it becomes zero, it is calling diag_context_release() which frees diag_context. This list corruption is seen from purge_configfs_funcs() API which is trying to move function list as part of func->list. Fix this issue by releasing diag_context with free_func() instead of diag_function_unbind(). CRs-Fixed: 1002041 Change-Id: Ie49e47f2a0f26144e0107759fedc67c3af80032c Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: gadget: f_gsi: Add missing includes to compile f_gsi fileMayank Rana2016-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds required .h files to resolve below seen compilation errors. In function ‘gsi_update_function_bind_params’: error: implicit declaration of function ‘msm_ep_config’ warning: ‘enum ipa_usb_notify_event’ declared inside parameter list CRs-Fixed: 1001469 Change-Id: Ic62b4dae798726055beb778509e6b65e69f4db34 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: phy: qmp: Add support to use different voltage with core supplyMayank Rana2016-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On newer platform USB QMP PHY needs different voltage supply as core voltage. This change adds required support for the same. CRs-Fixed: 1001463 Change-Id: If100d36bade241dedf28e3cea9e07be192bdfdc2 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: phy: qusb: Update QUSB PHY power up functionality for major rev 2Mayank Rana2016-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In new platform, few set of QUSB PHY related operational registers' offset and usage is changed. This change adds QUSB PHY power up and PLL lock functionality for QUSB PHY having major revision 2. Change-Id: Id44c91481d4c184a1991768baf13adad2fae9fb3 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | dwc3: gadget: Resume controller when udc_stop is calledMayank Rana2016-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wehn adbd is closing eps, it is trying to unregister gadget and UDC. When VBUS is not present and cotroller is into low power mode. ffs_func_disable() also invokes controller's PM idle as well. This results into unclock register access when dwc3_gadget_stop() is called by unregister_gadget_item(). Fix this issue by resuming controller from dwc3_gadget_stop(). Change-Id: I469e8609bf23bee97b3f9c612401aaf92bc72a30 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | dwc3: msm: Add sysfs entry to manually set modeJack Pham2016-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases it is useful to manually force the controller into peripheral, host or disconnect mode. Add a device attribute to sysfs to do this. Reading it back will indicate the current mode. Change-Id: I77d9d2a127a2a763b93b968f1d8ccf68a649493e Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | usb: phy: qusb: Use phy_clk_scheme with ref_clk_base_addrMayank Rana2016-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently phy_clk_scheme related information (i.e. cml or cmos) is used to make decision about how to use ref_clk. On newer platform this functionality is not required. Hence tie phy_clk_scheme with availabiliity of ref_clk_base_addr and perform required ref_clk operation using phy_clk_scheme. Change-Id: If1f264e155a4411df5e037f9f28bc590e9465ac9 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: qmp: phy: Make sure QMP PHY reset write is completedMayank Rana2016-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add explicit memory barrier after programming USB3_PHY_SW_RESET register which makes sure that above write is not cached. If this register write is cached, then phy driver is timing out with checking PCS status. In some cases, L2 cache memory error is seen when that register write is flushed whereas usb phy clock is turned off. CRs-Fixed: 990963 Change-Id: Iebe8cb4034721e76fa5ea63e33304b9dc0243797 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: gadget: f_fs: Update driver to handle compat id descriptorsMayank Rana2016-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extended compat ID descriptor contains fixed-length header section and one or more function section. Function section contains five fields as: bFirstInterfaceNumber, Reserved1, compatibleID, subCompatibleID and Reserved2. Specification suggests that Reserved1 needs to be set as 0x1 but f_fs driver fails processing descriptors if Reserved1 field is 0x1. This results into USB enumeration issue due to incomplete descriptors. This issue is seen with newer adbd which is passing extended compat ID descriptors. CRs-Fixed: 994161 Change-Id: Id18261d76edd859ef078f4510dd82b8a6c1ca4bd Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: gadget: Handle disconnect correctly during composition switch.Devdutt Patnaik2016-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If cable is disconnected early during composition switch android_disable calls the gadget pullup op which on clearing run/stop bit does a pm_runtime_put_noidle on the dwc3 device. This decrements the power usage count on the dwc3 device, but the child count of the parent mdwc3 device is not decremented. Upon disconnect handling in the DWC3 state machine, pm_runtime_put_sync on mdwc3 parent returns EBUSY due to child count not being 0. As a result runtime idle does not kick in and prevents low power mode handler being invoked. Fix this by changing the pm_runtime_put_noidle call to pm_runtime_put_autosuspend on dwc3 device so that the child count for the mdwc3 parent is decremented to 0. CRs-Fixed: 980113 Change-Id: Ibb19188c4230a08bbdef72af7de066735e8c2d67 Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | | dwc3-msm: Check USB Endpoint status before queueing endless requestMayank Rana2016-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TRB Pool is allocated and de-allocated per endpoint when USB endpoint is enabled and disabled respectively. In some instance, it has been observed that usb_ep_disable() (for rmnet case, (u_bam.c) it is called from set_alt or resume context i.e. interrupt context) and usb_ep_queue() (for rmnet case, (u_bam.c) it is called from work queue context) are racing for USB endless endpoint when USB bus suspend and resume is happening quickly. It is causing NULL pointer dereference while accessing TRB pool. Fix this issue by moving check if USB endpoint is enable or not after acquiring dwc3->lock and before calling __dwc3_msm_ep_queue() which prepares endless TRB. CRs-Fixed: 986071 Change-Id: I842f6a82f3c454111ba68661cf835e86022e3e18 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: f_gsi: Send Function Suspend state to GSI EP OP for suspendDevdutt Patnaik2016-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to skip checking for link state being in U3 when we receive a Function Suspend. Pass in this information to GSI EP OP that checks if we are good to suspend channels with IPA. We skip the check for U3 if we are handling Function Suspend and check for U3 when we are handling Bus Suspend. CRs-Fixed: 966352 Change-Id: I29ee0326edbe33b02884495ddc89484bef21e7e0 Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | | usb: dwc3: Skip check for U3 when handling Function SuspendDevdutt Patnaik2016-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Skip check for U3 link state when we receive Function Suspend. Link is not in U3 when host sends Function Suspend, but will be in U3 if/when the subsequent Bus Suspend arrives. If we check for U3 in the case of Function Suspend, we will not disconnect channels with IPA as the API that checks pre-conditions for suspend will always return FALSE. The U3 check is done as usual in the case of Bus Suspend from the host. CRs-Fixed: 966352 Change-Id: Ie9ee045a096b58256d2e8814338ffe0aa3c01163 Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | | usb: f_gsi: Fix IP address assigment failure on RNDIS enable/disableDevdutt Patnaik2016-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IP address re-assignment fails when we disable and enable RNDIS adaptor from device manager. This is observed only in composite functions such as ADB + RNDIS. In "RNDIS only" compositions the issue is not observed as host typically sends a RESET when we re-enable the RNDIS adaptor. Add support in the GSI state machine to connect channels to IPA and enable GSI data path in response to PACKET FILTER message with FLOW CONTROL DISABLE option when we are in the INITIALIZED state. Previously we only treated the PACKET FILTER message as a valid input when in the CONNECT_IN_PROGRESS state. CRs-Fixed: 975930 Change-Id: I97471f128958a915001a5b49c98036076fb8c18c Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | | USB: dwc3-msm: Enable power event irq in case of host bus suspendVijayavardhan Vennapusa2016-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently MPM pin for DP line state change is not mapped to irq. Only MPM for DM line state chagne is mapped to hs_phy irq. But this results in delayed device detection in VDDmin when HS/FS devices are connected in host mode. Hence enable power event irq during host bus suspend so that MPM pin for DP line state can be also mapped for early detection of HS/FS devices during VDDmin. CRs-Fixed: 972212 Change-Id: I71d7c3c374a23b51a0489cf44410d76d5734d009 Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
* | | | usb: f_gsi: Add support for DPL suspend/resumeDevdutt Patnaik2016-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes EP configuration for DPL resume sequence. Sets correct interrupter number for DPL composition and also checks for NULL on notify EP in the resume path. CRs-Fixed: 983160 Change-Id: I7e9bf0aa839e63d8cfe801d3b81dd5f48a315575 Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | | usb: qdss: Fix compilation error with USB QDSSMayank Rana2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | compilation error seen with redefinition of usb_bam_alloc_fifos and usb_bam_free_fifos APIs. Fix this issue by adding proper check, removing usb_bam.h as part of f_qdss.h and fixing makefile. Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: phy: qmp: Remove unused devicetree property with QMP PHYMayank Rana2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removes unused devicetree property with QMP PHY as now all QMP PHY related initialization information needs to be provided through devicetree. Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: phy: qmp: Remove QMP PHY revision based phy_reg_offsetMayank Rana2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removes QMP PHY revision based phy_reg_offset from QMP PHY driver. It makes mandatory to have required QMP PHY related register offset through devicetree. It also removes different revision ID related register offset usage and requirement. Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: phy: qmp: Remove QMP PHY revision based initialization sequenceMayank Rana2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removes QMP PHY revision based initialization sequence from QMP PHY driver. It also makes mandatory to get this sequence from devicetree except if qcom,emulation is set. Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | | usb: dwc3-msm: Simplify OTG_STATE_UNDEFINED handlingJack Pham2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 48924e2fe107 ("dwc3: Reset USB controller/PHY after psy connect indication at bootup") the controller initialization path was removed from dwc3_msm_probe() and is deferred to when actually needed, which is when beginning peripheral or host mode. This was to optimize for the HVDCP charger already-connected case in which case we want to avoid performing controller initialization which can disrupt D+/D- linestate. As part of that change, the OTG_STATE_UNDEFINED state was made to be the entry point for starting controller initialization. However, apart from that, the handling is identical to B_IDLE_STATE, and therefore could be consolidated. And now that charger driver only notifies us when SDP or CDP types, but not when DCP/HVDCP are connected, the code can be simplified by removing the duplicate code between dwc3_initialize() and dwc3_msm_resume(). Change-Id: Ife749c864284864098bcbcbdbda096d05397c60e Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | usb: dwc3-msm: Fix incorrect roles with multiple instancesJack Pham2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dwc3_init_sm() uses a static boolean variable which does not play nicely when multiple instances are in use. For instance if one controller is configured in host-only mode, it would set the sm_initialized flag and can force the second controller to also see ID=0 and enter host mode even if it is a peripheral. The false ID=0 is actually caused by the init sequence never actually setting the initial inputs bit, so the state machine simply sees it as unset and proceeds to the A_IDLE case. Fix this by setting it to 1 to match the id_state=FLOAT during probe(). Furthermore, there is no longer any use case for the vbus_init completion since the state machine should only be entered upon event changes anyway. So removing that can allow us to get rid of dwc3_init_sm() entirely. Also ensure that sm_work is unconditionally flushed before processing the initial events. CRs-Fixed: 974882 Change-Id: I48e361a622bffa62ab7fa4c8d2e6719e66b90076 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | usb: dwc3: msm: Remove usb power_supplyJack Pham2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we use extcon for USB and USB_HOST cable connection notification, it is no longer required to provide the usb power_supply object in order to receive set property notifications. Going forward the usb_psy will be maintained by the charger driver(s) instead. Since supply type is now also hidden from this driver (i.e. EXTCON_USB should only be emitted in the case of SDP or CDP) handling of dedicated charger types can also be removed which simplifies the code a bit. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | | usb: dwc3: msm: add extcon supportJack Pham2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add extcon listeners for EXTCON_USB and EXTCON_USB_HOST cable types to be notified of VBUS and ID notifications respectively. Upon notification this will start the controller in either peripheral or host mode. This replaces the handling previously done in the power_supply set_property() callback for PROP_PRESENT and PROP_USB_OTG. The usb_psy will be removed in its entirety following this patch. Change-Id: I22405a0a8da21b4c373895500d8dc4c91d97bc51 Signed-off-by: Jack Pham <jackp@codeaurora.org>