Lines Matching +full:hnp +full:- +full:disable
1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
3 * core_intr.c - DesignWare HS OTG Controller common interrupt handling
5 * Copyright (C) 2004-2013 Synopsys, Inc.
16 #include <linux/dma-mapping.h>
29 switch (hsotg->op_state) { in dwc2_op_state_str()
46 * dwc2_handle_usb_port_intr - handles OTG PRTINT interrupts.
63 * dwc2_handle_mode_mismatch_intr() - Logs a mode mismatch warning message
72 dev_warn(hsotg->dev, "Mode Mismatch Interrupt: currently in %s mode\n", in dwc2_handle_mode_mismatch_intr()
77 * dwc2_handle_otg_intr() - Handles the OTG Interrupts. It reads the OTG
90 dev_dbg(hsotg->dev, "++OTG Interrupt gotgint=%0x [%s]\n", gotgint, in dwc2_handle_otg_intr()
94 dev_dbg(hsotg->dev, in dwc2_handle_otg_intr()
102 if (hsotg->op_state == OTG_STATE_B_HOST) { in dwc2_handle_otg_intr()
103 hsotg->op_state = OTG_STATE_B_PERIPHERAL; in dwc2_handle_otg_intr()
106 * If not B_HOST and Device HNP still set, HNP did in dwc2_handle_otg_intr()
110 dev_dbg(hsotg->dev, "Session End Detected\n"); in dwc2_handle_otg_intr()
111 dev_err(hsotg->dev, in dwc2_handle_otg_intr()
116 * If Session End Detected the B-Cable has been in dwc2_handle_otg_intr()
120 hsotg->lx_state = DWC2_L0; in dwc2_handle_otg_intr()
129 dev_dbg(hsotg->dev, in dwc2_handle_otg_intr()
133 if (hsotg->params.phy_type == DWC2_PHY_TYPE_PARAM_FS && in dwc2_handle_otg_intr()
134 hsotg->params.i2c_enable) { in dwc2_handle_otg_intr()
135 hsotg->srp_success = 1; in dwc2_handle_otg_intr()
147 * Print statements during the HNP interrupt handling in dwc2_handle_otg_intr()
152 * WA for 3.00a- HW is not setting cur_mode, even sometimes in dwc2_handle_otg_intr()
155 if (hsotg->hw_params.snpsid >= DWC2_CORE_REV_3_00a) in dwc2_handle_otg_intr()
159 hsotg->op_state = OTG_STATE_B_HOST; in dwc2_handle_otg_intr()
161 * Need to disable SOF interrupt immediately. in dwc2_handle_otg_intr()
178 spin_unlock(&hsotg->lock); in dwc2_handle_otg_intr()
182 spin_lock(&hsotg->lock); in dwc2_handle_otg_intr()
183 hsotg->op_state = OTG_STATE_B_HOST; in dwc2_handle_otg_intr()
189 dev_dbg(hsotg->dev, "HNP Failed\n"); in dwc2_handle_otg_intr()
190 dev_err(hsotg->dev, in dwc2_handle_otg_intr()
202 dev_dbg(hsotg->dev, in dwc2_handle_otg_intr()
206 dev_dbg(hsotg->dev, "a_suspend->a_peripheral (%d)\n", in dwc2_handle_otg_intr()
207 hsotg->op_state); in dwc2_handle_otg_intr()
208 spin_unlock(&hsotg->lock); in dwc2_handle_otg_intr()
210 spin_lock(&hsotg->lock); in dwc2_handle_otg_intr()
211 hsotg->op_state = OTG_STATE_A_PERIPHERAL; in dwc2_handle_otg_intr()
213 /* Need to disable SOF interrupt immediately */ in dwc2_handle_otg_intr()
217 spin_unlock(&hsotg->lock); in dwc2_handle_otg_intr()
219 spin_lock(&hsotg->lock); in dwc2_handle_otg_intr()
220 hsotg->op_state = OTG_STATE_A_HOST; in dwc2_handle_otg_intr()
225 dev_dbg(hsotg->dev, in dwc2_handle_otg_intr()
226 " ++OTG Interrupt: A-Device Timeout Change++\n"); in dwc2_handle_otg_intr()
228 dev_dbg(hsotg->dev, " ++OTG Interrupt: Debounce Done++\n"); in dwc2_handle_otg_intr()
235 * dwc2_handle_conn_id_status_change_intr() - Handles the Connector ID Status
251 /* Need to disable SOF interrupt immediately */ in dwc2_handle_conn_id_status_change_intr()
256 dev_dbg(hsotg->dev, " ++Connector ID Status Change Interrupt++ (%s)\n", in dwc2_handle_conn_id_status_change_intr()
262 if (hsotg->wq_otg) in dwc2_handle_conn_id_status_change_intr()
263 queue_work(hsotg->wq_otg, &hsotg->wf_otg); in dwc2_handle_conn_id_status_change_intr()
267 * dwc2_handle_session_req_intr() - This interrupt indicates that a device is
285 dev_dbg(hsotg->dev, "Session request interrupt - lx_state=%d\n", in dwc2_handle_session_req_intr()
286 hsotg->lx_state); in dwc2_handle_session_req_intr()
289 if (hsotg->lx_state == DWC2_L2) { in dwc2_handle_session_req_intr()
290 if (hsotg->in_ppd) { in dwc2_handle_session_req_intr()
294 dev_err(hsotg->dev, in dwc2_handle_session_req_intr()
299 if (hsotg->params.power_down == in dwc2_handle_session_req_intr()
300 DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended) in dwc2_handle_session_req_intr()
320 * dwc2_wakeup_from_lpm_l1 - Exit the device from LPM L1 state
330 if (hsotg->lx_state != DWC2_L1) { in dwc2_wakeup_from_lpm_l1()
331 dev_err(hsotg->dev, "Core isn't in DWC2_L1 state\n"); in dwc2_wakeup_from_lpm_l1()
337 dev_dbg(hsotg->dev, "Exit from L1 state\n"); in dwc2_wakeup_from_lpm_l1()
353 dev_err(hsotg->dev, "Failed to exit L1 sleep state in 200us.\n"); in dwc2_wakeup_from_lpm_l1()
359 dev_err(hsotg->dev, "Host side LPM is not supported.\n"); in dwc2_wakeup_from_lpm_l1()
364 hsotg->lx_state = DWC2_L0; in dwc2_wakeup_from_lpm_l1()
384 dev_dbg(hsotg->dev, "++Resume or Remote Wakeup Detected Interrupt++\n"); in dwc2_handle_wakeup_detected_intr()
385 dev_dbg(hsotg->dev, "%s lxstate = %d\n", __func__, hsotg->lx_state); in dwc2_handle_wakeup_detected_intr()
387 if (hsotg->lx_state == DWC2_L1) { in dwc2_handle_wakeup_detected_intr()
393 dev_dbg(hsotg->dev, "DSTS=0x%0x\n", in dwc2_handle_wakeup_detected_intr()
395 if (hsotg->lx_state == DWC2_L2) { in dwc2_handle_wakeup_detected_intr()
396 if (hsotg->in_ppd) { in dwc2_handle_wakeup_detected_intr()
404 dev_err(hsotg->dev, in dwc2_handle_wakeup_detected_intr()
410 if (hsotg->params.power_down == in dwc2_handle_wakeup_detected_intr()
411 DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended) in dwc2_handle_wakeup_detected_intr()
415 hsotg->lx_state = DWC2_L0; in dwc2_handle_wakeup_detected_intr()
418 if (hsotg->lx_state == DWC2_L2) { in dwc2_handle_wakeup_detected_intr()
419 if (hsotg->in_ppd) { in dwc2_handle_wakeup_detected_intr()
423 dev_err(hsotg->dev, in dwc2_handle_wakeup_detected_intr()
427 if (hsotg->params.power_down == in dwc2_handle_wakeup_detected_intr()
428 DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended) in dwc2_handle_wakeup_detected_intr()
434 * eventually we'll re-enumerate the device. Not great in dwc2_handle_wakeup_detected_intr()
439 if (hsotg->reset_phy_on_wake) in dwc2_handle_wakeup_detected_intr()
442 mod_timer(&hsotg->wkp_timer, in dwc2_handle_wakeup_detected_intr()
446 hsotg->lx_state = DWC2_L0; in dwc2_handle_wakeup_detected_intr()
459 dev_dbg(hsotg->dev, "++Disconnect Detected Interrupt++ (%s) %s\n", in dwc2_handle_disconnect_intr()
463 if (hsotg->op_state == OTG_STATE_A_HOST) in dwc2_handle_disconnect_intr()
470 * For HNP the USB Suspend interrupt signals the change from "a_peripheral"
483 dev_dbg(hsotg->dev, "USB SUSPEND\n"); in dwc2_handle_usb_suspend_intr()
491 dev_dbg(hsotg->dev, "%s: DSTS=0x%0x\n", __func__, dsts); in dwc2_handle_usb_suspend_intr()
492 dev_dbg(hsotg->dev, in dwc2_handle_usb_suspend_intr()
495 hsotg->hw_params.power_optimized, in dwc2_handle_usb_suspend_intr()
496 hsotg->hw_params.hibernation); in dwc2_handle_usb_suspend_intr()
500 dev_dbg(hsotg->dev, in dwc2_handle_usb_suspend_intr()
505 switch (hsotg->params.power_down) { in dwc2_handle_usb_suspend_intr()
509 dev_err(hsotg->dev, in dwc2_handle_usb_suspend_intr()
515 if (!IS_ERR_OR_NULL(hsotg->uphy)) in dwc2_handle_usb_suspend_intr()
516 usb_phy_set_suspend(hsotg->uphy, true); in dwc2_handle_usb_suspend_intr()
521 dev_err(hsotg->dev, in dwc2_handle_usb_suspend_intr()
529 if (!hsotg->params.no_clock_gating) in dwc2_handle_usb_suspend_intr()
537 hsotg->lx_state = DWC2_L2; in dwc2_handle_usb_suspend_intr()
543 if (hsotg->op_state == OTG_STATE_A_PERIPHERAL) { in dwc2_handle_usb_suspend_intr()
544 dev_dbg(hsotg->dev, "a_peripheral->a_host\n"); in dwc2_handle_usb_suspend_intr()
547 hsotg->lx_state = DWC2_L2; in dwc2_handle_usb_suspend_intr()
549 spin_unlock(&hsotg->lock); in dwc2_handle_usb_suspend_intr()
551 spin_lock(&hsotg->lock); in dwc2_handle_usb_suspend_intr()
552 hsotg->op_state = OTG_STATE_A_HOST; in dwc2_handle_usb_suspend_intr()
558 * dwc2_handle_lpm_intr - GINTSTS_LPMTRANRCVD Interrupt handler
578 dev_err(hsotg->dev, "Unexpected LPM interrupt\n"); in dwc2_handle_lpm_intr()
589 dev_dbg(hsotg->dev, "HIRD_THRES_EN = %d\n", hird_thres_en); in dwc2_handle_lpm_intr()
592 dev_dbg(hsotg->dev, "L1 with utmi_l1_suspend_n\n"); in dwc2_handle_lpm_intr()
594 dev_dbg(hsotg->dev, "L1 with utmi_sleep_n\n"); in dwc2_handle_lpm_intr()
596 dev_dbg(hsotg->dev, "Entering Sleep with L1 Gating\n"); in dwc2_handle_lpm_intr()
611 hsotg->lx_state = DWC2_L1; in dwc2_handle_lpm_intr()
612 dev_dbg(hsotg->dev, in dwc2_handle_lpm_intr()
643 dev_dbg(hsotg->dev, "gintsts=%08x gintmsk=%08x\n", in dwc2_read_common_intr()
653 * dwc_handle_gpwrdn_disc_det() - Handles the gpwrdn disconnect detect.
664 /* Switch-on voltage to the core */ in dwc_handle_gpwrdn_disc_det()
676 /* Disable Power Down Clamp */ in dwc_handle_gpwrdn_disc_det()
688 /* Disable PMU interrupt */ in dwc_handle_gpwrdn_disc_det()
693 /* De-assert Wakeup Logic */ in dwc_handle_gpwrdn_disc_det()
698 hsotg->hibernated = 0; in dwc_handle_gpwrdn_disc_det()
699 hsotg->bus_suspended = 0; in dwc_handle_gpwrdn_disc_det()
702 hsotg->op_state = OTG_STATE_B_PERIPHERAL; in dwc_handle_gpwrdn_disc_det()
708 hsotg->op_state = OTG_STATE_A_HOST; in dwc_handle_gpwrdn_disc_det()
733 dev_dbg(hsotg->dev, in dwc2_handle_gpwrdn_intr()
739 dev_dbg(hsotg->dev, "%s: GPWRDN_DISCONN_DET\n", __func__); in dwc2_handle_gpwrdn_intr()
747 dev_dbg(hsotg->dev, "%s: GPWRDN_LNSTSCHG\n", __func__); in dwc2_handle_gpwrdn_intr()
748 if (hsotg->hw_params.hibernation && in dwc2_handle_gpwrdn_intr()
749 hsotg->hibernated) { in dwc2_handle_gpwrdn_intr()
753 dev_err(hsotg->dev, in dwc2_handle_gpwrdn_intr()
759 dev_err(hsotg->dev, in dwc2_handle_gpwrdn_intr()
765 dev_dbg(hsotg->dev, "%s: GPWRDN_RST_DET\n", __func__); in dwc2_handle_gpwrdn_intr()
769 dev_err(hsotg->dev, in dwc2_handle_gpwrdn_intr()
774 dev_dbg(hsotg->dev, "%s: GPWRDN_STS_CHGINT\n", __func__); in dwc2_handle_gpwrdn_intr()
792 * - Mode Mismatch Interrupt
793 * - OTG Interrupt
794 * - Connector ID Status Change Interrupt
795 * - Disconnect Interrupt
796 * - Session Request Interrupt
797 * - Resume / Remote Wakeup Detected Interrupt
798 * - Suspend Interrupt
806 spin_lock(&hsotg->lock); in dwc2_handle_common_intr()
809 dev_warn(hsotg->dev, "Controller is dead\n"); in dwc2_handle_common_intr()
815 hsotg->frame_number = (dwc2_readl(hsotg, DSTS) in dwc2_handle_common_intr()
818 hsotg->frame_number = (dwc2_readl(hsotg, HFNUM) in dwc2_handle_common_intr()
826 if (hsotg->hibernated) { in dwc2_handle_common_intr()
852 * Port Enable/Disable in dwc2_handle_common_intr()
855 dev_dbg(hsotg->dev, in dwc2_handle_common_intr()
856 " --Port interrupt received in Device mode--\n"); in dwc2_handle_common_intr()
863 spin_unlock(&hsotg->lock); in dwc2_handle_common_intr()