summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/dwc3-msm.c (follow)
Commit message (Collapse)AuthorAge
...
| * usb: dwc3: Use clock API to control the memory power statesHemant Kumar2016-08-10
| | | | | | | | | | | | | | | | | | | | GDSC driver is removing control for USB memory power states. DWC driver need to explicitly call clk_set_flag() API to turn off both memory core and periphery upon vbus off. When core clock is turned on both of them will be turn on automatically. Change-Id: I7e442daf51c6ece39b8fe5cc8a38d3405163c9b5 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | Merge "usb: pd: Only request current amount for explicit contract"Linux Build Service Account2016-08-13
|\ \
| * | usb: dwc3-msm: Remove call to set POWER_SUPPLY_PROP_ONLINEJack Pham2016-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The charger drivers now handle setting of this property without input from USB gadget other than the negotiated current draw amount (set via POWER_SUPPLY_PROP_CURRENT_MAX). Remove setting of POWER_SUPPLY_PROP_ONLINE which helps simplify the dwc3_msm_gadget_vbus_draw() function a bit. Change-Id: I2c5ec90cc8c45019ad75056b6feb7e6319f85514 Signed-off-by: Jack Pham <jackp@codeaurora.org>
| * | usb: dwc3-msm: Do dwc3_msm_gadget_vbus_draw() in sleepable contextJack Pham2016-08-10
| |/ | | | | | | | | | | | | | | | | | | | | | | The gadget mode notification to draw a specific current may occur in context with interrupts disabled, however the charger driver's implementation of power_supply_set_property() for POWER_SUPPLY_CURRENT_MAX currently uses a mutex. Since sleeping is disallowed in this case, instead schedule a work function to do the call. Change-Id: I810ad8c102124ce22de72d83b6df58c8fc991251 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* / USB: dwc3-msm: Add support for setting specific frequency for core clockVijayavardhan Vennapusa2016-08-08
|/ | | | | | | | Add support for setting USB core clock to particular frequency so that core clock frequency can be passed through dts property. Change-Id: If9ff41037d22d7be7f09c9468e8d4cc92280a28e Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
* usb: dwc3: Update VBUS status with USB controllerMayank Rana2016-07-29
| | | | | | | | | | | | | | | It is required to update VBUS status to USB controller using qscratch registers HS_PHY_CTRL and SS_PHY_CTRL interfacing high-speed and super-speed PHYs. This change perfoms same from USB controller's glue driver on starting and stopping peripheral mode based on supported USB speed with USB gadget. It also updates devicetree documentation explicitly mentioning required register sets. CRs-Fixed: 1046503 Change-Id: I92df87c0e2ff54dd7ee513d277cc075eab561019 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* Merge "usb: phy: Make cfg_ahb_clk optional"Linux Build Service Account2016-07-27
|\
| * usb: dwc3: Make cfg_ahb_clk optionalHemant Kumar2016-07-26
| | | | | | | | | | | | | | | | | | dwc3 USB driver is not required to not manage gcc_usb_phy_cfg_ahb2phy_clk clock. It will stay always ON except when in XO-shutdown. RPM will manage this clock. Change-Id: Icc33e63a52b3c5ce83ef2fc56d68eae20278cac0 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | Merge "ARM: dts: msm: Update QUSB PHY device node compatible property on ↵Linux Build Service Account2016-07-27
|\ \ | | | | | | | | | msmcobalt"
| * | usb: dwc3: Determine connection speed for HS PHYDevdutt Patnaik2016-07-20
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | DP/DM linestate is needed by the QUSB2 PHY driver to configure the polarity of DP/DM transition triggers for exiting low power mode. This was previously available via the QUSB2PHY_PORT_UTMI_STATUS PHY register which is now deprecated. In order to correctly determine the interrupt polarity we need to pass the current operating speed to the QUSB2 PHY driver. The PHY driver uses mode, speed and cable connection status to determine the linestate and configure interrupt polarities for wake up. Add logic to determine operating speed for host and device mode cases. Change-Id: Iaede1269f514a314bd9717a33100f748e7753b2a Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* / usb: dwc3: Fix bug in ep disable operationHemant Kumar2016-07-13
|/ | | | | | | | | | | | | | __dwc3_gadget_ep_disable API doing memset 0 with size set to DWC3_TRB_NUM. Number of TRBs allocated for gsi endpoints are less than DWC3_TRB_NUM. This results in to memory corruption. Fix this bug by introducing num_trbs member in dwc3_ep structure to save number of trbs allocated in a dma pool upon dma pool creation. Ep disable operation will use num_trbs of a dwc3_ep to perform memset 0. Change-Id: I94b5865ca22b4e1fde0d2cd8dcb218906327a916 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* usb: dwc3: Fix extcon notification for non-type-c usb cableHemant Kumar2016-06-07
| | | | | | | | | | | | | In case of non-type-c usb cable extcon cable state for EXTCON_USB_CC returns error and driver bails out. This causes usb enumeration failure. Hence set the typec_orientation to ORIENTATION_NONE and continue with usb enumeration. In case of super speed mode with type-c usb cable even if extcon cable state return error for EXTCON_USB_CC then also usb device will get enumerated falling back to high speed mode. Change-Id: Ibc0b0506b2090f4c090d649f6e3ae7d42b102c93 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* usb: dwc3: Add support handle type-c plug orientationHemant Kumar2016-05-25
| | | | | | | | | | Register callbacks for plug orientations in order to cache the current plug orientation reported by extcon. This allows super speed phy driver to configure the appropriate lane upon phy initialization. Change-Id: I906005680b4cc90cc38dc3d403beebf7aa515ad7 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>
* 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>
* 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: 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: 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>
* 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>
* 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: 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: 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: 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>
* usb: Remove DPDM pulsing functionalityMayank Rana2016-03-23
| | | | | | | This change removes DP DM pulsing functionality related support from QUSB PHY driver as it is not required. Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* usb: dwc3-msm: Allow compilation when USB_GADGET=nJack Pham2016-03-22
| | | | | | | | Fix link errors when USB_GADGET=n which causes dwc3/gadget.c not to be built. These symbols are only used in the msm_ep_config/ unconfig functions so we can conditionally compile them. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* usb: dwc3-msm: Remove POST_INIT notificationJack Pham2016-03-22
| | | | | | This notification for this event is no longer used, so remove it. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* usb: dwc3: Add support to suspend SS phyJack Pham2016-03-22
| | | | | | | | | | | | Upstream commit 636e2a2caeafcb1b55b6799b29fe436039819eb9 (usb: dwc3: gadget: drop dwc3 manual phy control) removed the support to suspend the PHYs since the recent controller versions can do that automatically. But MSM targets, still do not have the latest controller and hence adding back the functionality to suspend/resume SS phy. Change-Id: I02a7ae8daf194a645f3582480f5a6b7d504b32ec Signed-off-by: Jack Pham <jackp@codeaurora.org>
* usb: dwc3-msm: Remove pmic_id_irqJack Pham2016-03-22
| | | | | | irq_read_line() is no longer supported. Signed-off-by: Jack Pham <jackp@codeaurora.org>
* usb: dwc3-msm: Adapt to new power_supply interfaceJack Pham2016-03-22
| | | | | | | | | | [devm_]power_supply_register() was updated to receive power_supply_desc and power_supply_config parameters and returns a created power_supply object. Update dwc3-msm.c to conform. Also replace calls to custom power_supply_set_* functions with direct calls to power_supply_set_property(). Signed-off-by: Jack Pham <jackp@codeaurora.org>
* usb: dwc3-msm: Compilation fixups for 4.4Jack Pham2016-03-22
| | | | | | | | | | | This patch includes a couple of fixups to compile against recent kernels: - replace CONFIG_PM_RUNTIME with CONFIG_PM - replace of_usb_get_dr_mode() with usb_get_dr_mode(). As a result it needs to be called after of_find_device_by_node() Signed-off-by: Jack Pham <jackp@codeaurora.org>
* usb: dwc3: msm: Add snapshot of DWC3 MSM driversJack Pham2016-03-22
Add dwc3-msm.c and associated driver files. Note these are based on the downstream implementation and will coexist (for the time being) with dwc3-qcom glue driver until they can eventually be merged. This snapshot is taken as of msm-3.18 commit a3883c356869 (Merge "input: touchscreen: correct condition checks in ITE tech touch driver") Signed-off-by: Jack Pham <jackp@codeaurora.org>