Lines Matching refs:hsotg
56 static const char *dwc2_op_state_str(struct dwc2_hsotg *hsotg) in dwc2_op_state_str() argument
58 switch (hsotg->op_state) { in dwc2_op_state_str()
81 static void dwc2_handle_usb_port_intr(struct dwc2_hsotg *hsotg) in dwc2_handle_usb_port_intr() argument
83 u32 hprt0 = readl(hsotg->regs + HPRT0); in dwc2_handle_usb_port_intr()
87 writel(hprt0, hsotg->regs + HPRT0); in dwc2_handle_usb_port_intr()
91 writel(GINTSTS_PRTINT, hsotg->regs + GINTSTS); in dwc2_handle_usb_port_intr()
99 static void dwc2_handle_mode_mismatch_intr(struct dwc2_hsotg *hsotg) in dwc2_handle_mode_mismatch_intr() argument
101 dev_warn(hsotg->dev, "Mode Mismatch Interrupt: currently in %s mode\n", in dwc2_handle_mode_mismatch_intr()
102 dwc2_is_host_mode(hsotg) ? "Host" : "Device"); in dwc2_handle_mode_mismatch_intr()
105 writel(GINTSTS_MODEMIS, hsotg->regs + GINTSTS); in dwc2_handle_mode_mismatch_intr()
114 static void dwc2_handle_otg_intr(struct dwc2_hsotg *hsotg) in dwc2_handle_otg_intr() argument
120 gotgint = readl(hsotg->regs + GOTGINT); in dwc2_handle_otg_intr()
121 gotgctl = readl(hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
122 dev_dbg(hsotg->dev, "++OTG Interrupt gotgint=%0x [%s]\n", gotgint, in dwc2_handle_otg_intr()
123 dwc2_op_state_str(hsotg)); in dwc2_handle_otg_intr()
126 dev_dbg(hsotg->dev, in dwc2_handle_otg_intr()
128 dwc2_op_state_str(hsotg)); in dwc2_handle_otg_intr()
129 gotgctl = readl(hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
131 if (dwc2_is_device_mode(hsotg)) in dwc2_handle_otg_intr()
132 s3c_hsotg_disconnect(hsotg); in dwc2_handle_otg_intr()
134 if (hsotg->op_state == OTG_STATE_B_HOST) { in dwc2_handle_otg_intr()
135 hsotg->op_state = OTG_STATE_B_PERIPHERAL; in dwc2_handle_otg_intr()
142 dev_dbg(hsotg->dev, "Session End Detected\n"); in dwc2_handle_otg_intr()
143 dev_err(hsotg->dev, in dwc2_handle_otg_intr()
152 hsotg->lx_state = DWC2_L0; in dwc2_handle_otg_intr()
155 gotgctl = readl(hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
157 writel(gotgctl, hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
161 dev_dbg(hsotg->dev, in dwc2_handle_otg_intr()
163 gotgctl = readl(hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
165 if (hsotg->core_params->phy_type == in dwc2_handle_otg_intr()
167 && hsotg->core_params->i2c_enable > 0) { in dwc2_handle_otg_intr()
168 hsotg->srp_success = 1; in dwc2_handle_otg_intr()
171 gotgctl = readl(hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
173 writel(gotgctl, hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
183 gotgctl = readl(hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
188 if (hsotg->hw_params.snpsid >= DWC2_CORE_REV_3_00a) in dwc2_handle_otg_intr()
191 if (dwc2_is_host_mode(hsotg)) { in dwc2_handle_otg_intr()
192 hsotg->op_state = OTG_STATE_B_HOST; in dwc2_handle_otg_intr()
203 gintmsk = readl(hsotg->regs + GINTMSK); in dwc2_handle_otg_intr()
205 writel(gintmsk, hsotg->regs + GINTMSK); in dwc2_handle_otg_intr()
211 spin_unlock(&hsotg->lock); in dwc2_handle_otg_intr()
214 dwc2_hcd_start(hsotg); in dwc2_handle_otg_intr()
215 spin_lock(&hsotg->lock); in dwc2_handle_otg_intr()
216 hsotg->op_state = OTG_STATE_B_HOST; in dwc2_handle_otg_intr()
219 gotgctl = readl(hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
221 writel(gotgctl, hsotg->regs + GOTGCTL); in dwc2_handle_otg_intr()
222 dev_dbg(hsotg->dev, "HNP Failed\n"); in dwc2_handle_otg_intr()
223 dev_err(hsotg->dev, in dwc2_handle_otg_intr()
235 dev_dbg(hsotg->dev, in dwc2_handle_otg_intr()
237 (dwc2_is_host_mode(hsotg) ? "Host" : "Device")); in dwc2_handle_otg_intr()
238 if (dwc2_is_device_mode(hsotg)) { in dwc2_handle_otg_intr()
239 dev_dbg(hsotg->dev, "a_suspend->a_peripheral (%d)\n", in dwc2_handle_otg_intr()
240 hsotg->op_state); in dwc2_handle_otg_intr()
241 spin_unlock(&hsotg->lock); in dwc2_handle_otg_intr()
242 dwc2_hcd_disconnect(hsotg); in dwc2_handle_otg_intr()
243 spin_lock(&hsotg->lock); in dwc2_handle_otg_intr()
244 hsotg->op_state = OTG_STATE_A_PERIPHERAL; in dwc2_handle_otg_intr()
247 gintmsk = readl(hsotg->regs + GINTMSK); in dwc2_handle_otg_intr()
249 writel(gintmsk, hsotg->regs + GINTMSK); in dwc2_handle_otg_intr()
250 spin_unlock(&hsotg->lock); in dwc2_handle_otg_intr()
251 dwc2_hcd_start(hsotg); in dwc2_handle_otg_intr()
252 spin_lock(&hsotg->lock); in dwc2_handle_otg_intr()
253 hsotg->op_state = OTG_STATE_A_HOST; in dwc2_handle_otg_intr()
258 dev_dbg(hsotg->dev, in dwc2_handle_otg_intr()
261 dev_dbg(hsotg->dev, " ++OTG Interrupt: Debounce Done++\n"); in dwc2_handle_otg_intr()
264 writel(gotgint, hsotg->regs + GOTGINT); in dwc2_handle_otg_intr()
277 static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg) in dwc2_handle_conn_id_status_change_intr() argument
279 u32 gintmsk = readl(hsotg->regs + GINTMSK); in dwc2_handle_conn_id_status_change_intr()
283 writel(gintmsk, hsotg->regs + GINTMSK); in dwc2_handle_conn_id_status_change_intr()
285 dev_dbg(hsotg->dev, " ++Connector ID Status Change Interrupt++ (%s)\n", in dwc2_handle_conn_id_status_change_intr()
286 dwc2_is_host_mode(hsotg) ? "Host" : "Device"); in dwc2_handle_conn_id_status_change_intr()
293 if (hsotg->wq_otg) { in dwc2_handle_conn_id_status_change_intr()
294 spin_unlock(&hsotg->lock); in dwc2_handle_conn_id_status_change_intr()
295 queue_work(hsotg->wq_otg, &hsotg->wf_otg); in dwc2_handle_conn_id_status_change_intr()
296 spin_lock(&hsotg->lock); in dwc2_handle_conn_id_status_change_intr()
300 writel(GINTSTS_CONIDSTSCHNG, hsotg->regs + GINTSTS); in dwc2_handle_conn_id_status_change_intr()
314 static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) in dwc2_handle_session_req_intr() argument
316 dev_dbg(hsotg->dev, "++Session Request Interrupt++\n"); in dwc2_handle_session_req_intr()
319 writel(GINTSTS_SESSREQINT, hsotg->regs + GINTSTS); in dwc2_handle_session_req_intr()
324 if (dwc2_is_device_mode(hsotg)) in dwc2_handle_session_req_intr()
325 s3c_hsotg_disconnect(hsotg); in dwc2_handle_session_req_intr()
335 static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) in dwc2_handle_wakeup_detected_intr() argument
337 dev_dbg(hsotg->dev, "++Resume or Remote Wakeup Detected Interrupt++\n"); in dwc2_handle_wakeup_detected_intr()
338 dev_dbg(hsotg->dev, "%s lxstate = %d\n", __func__, hsotg->lx_state); in dwc2_handle_wakeup_detected_intr()
340 if (dwc2_is_device_mode(hsotg)) { in dwc2_handle_wakeup_detected_intr()
341 dev_dbg(hsotg->dev, "DSTS=0x%0x\n", readl(hsotg->regs + DSTS)); in dwc2_handle_wakeup_detected_intr()
342 if (hsotg->lx_state == DWC2_L2) { in dwc2_handle_wakeup_detected_intr()
343 u32 dctl = readl(hsotg->regs + DCTL); in dwc2_handle_wakeup_detected_intr()
347 writel(dctl, hsotg->regs + DCTL); in dwc2_handle_wakeup_detected_intr()
350 hsotg->lx_state = DWC2_L0; in dwc2_handle_wakeup_detected_intr()
352 if (hsotg->lx_state != DWC2_L1) { in dwc2_handle_wakeup_detected_intr()
353 u32 pcgcctl = readl(hsotg->regs + PCGCTL); in dwc2_handle_wakeup_detected_intr()
357 writel(pcgcctl, hsotg->regs + PCGCTL); in dwc2_handle_wakeup_detected_intr()
358 mod_timer(&hsotg->wkp_timer, in dwc2_handle_wakeup_detected_intr()
362 hsotg->lx_state = DWC2_L0; in dwc2_handle_wakeup_detected_intr()
367 writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS); in dwc2_handle_wakeup_detected_intr()
374 static void dwc2_handle_disconnect_intr(struct dwc2_hsotg *hsotg) in dwc2_handle_disconnect_intr() argument
376 dev_dbg(hsotg->dev, "++Disconnect Detected Interrupt++ (%s) %s\n", in dwc2_handle_disconnect_intr()
377 dwc2_is_host_mode(hsotg) ? "Host" : "Device", in dwc2_handle_disconnect_intr()
378 dwc2_op_state_str(hsotg)); in dwc2_handle_disconnect_intr()
380 if (hsotg->op_state == OTG_STATE_A_HOST) in dwc2_handle_disconnect_intr()
381 dwc2_hcd_disconnect(hsotg); in dwc2_handle_disconnect_intr()
384 hsotg->lx_state = DWC2_L3; in dwc2_handle_disconnect_intr()
386 writel(GINTSTS_DISCONNINT, hsotg->regs + GINTSTS); in dwc2_handle_disconnect_intr()
397 static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) in dwc2_handle_usb_suspend_intr() argument
401 dev_dbg(hsotg->dev, "USB SUSPEND\n"); in dwc2_handle_usb_suspend_intr()
403 if (dwc2_is_device_mode(hsotg)) { in dwc2_handle_usb_suspend_intr()
408 dsts = readl(hsotg->regs + DSTS); in dwc2_handle_usb_suspend_intr()
409 dev_dbg(hsotg->dev, "DSTS=0x%0x\n", dsts); in dwc2_handle_usb_suspend_intr()
410 dev_dbg(hsotg->dev, in dwc2_handle_usb_suspend_intr()
413 hsotg->hw_params.power_optimized); in dwc2_handle_usb_suspend_intr()
415 if (hsotg->op_state == OTG_STATE_A_PERIPHERAL) { in dwc2_handle_usb_suspend_intr()
416 dev_dbg(hsotg->dev, "a_peripheral->a_host\n"); in dwc2_handle_usb_suspend_intr()
419 spin_unlock(&hsotg->lock); in dwc2_handle_usb_suspend_intr()
420 dwc2_hcd_start(hsotg); in dwc2_handle_usb_suspend_intr()
421 spin_lock(&hsotg->lock); in dwc2_handle_usb_suspend_intr()
422 hsotg->op_state = OTG_STATE_A_HOST; in dwc2_handle_usb_suspend_intr()
427 hsotg->lx_state = DWC2_L2; in dwc2_handle_usb_suspend_intr()
430 writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS); in dwc2_handle_usb_suspend_intr()
441 static u32 dwc2_read_common_intr(struct dwc2_hsotg *hsotg) in dwc2_read_common_intr() argument
448 gintsts = readl(hsotg->regs + GINTSTS); in dwc2_read_common_intr()
449 gintmsk = readl(hsotg->regs + GINTMSK); in dwc2_read_common_intr()
450 gahbcfg = readl(hsotg->regs + GAHBCFG); in dwc2_read_common_intr()
454 dev_dbg(hsotg->dev, "gintsts=%08x gintmsk=%08x\n", in dwc2_read_common_intr()
478 struct dwc2_hsotg *hsotg = dev; in dwc2_handle_common_intr() local
482 spin_lock(&hsotg->lock); in dwc2_handle_common_intr()
484 if (!dwc2_is_controller_alive(hsotg)) { in dwc2_handle_common_intr()
485 dev_warn(hsotg->dev, "Controller is dead\n"); in dwc2_handle_common_intr()
489 gintsts = dwc2_read_common_intr(hsotg); in dwc2_handle_common_intr()
494 dwc2_handle_mode_mismatch_intr(hsotg); in dwc2_handle_common_intr()
496 dwc2_handle_otg_intr(hsotg); in dwc2_handle_common_intr()
498 dwc2_handle_conn_id_status_change_intr(hsotg); in dwc2_handle_common_intr()
500 dwc2_handle_disconnect_intr(hsotg); in dwc2_handle_common_intr()
502 dwc2_handle_session_req_intr(hsotg); in dwc2_handle_common_intr()
504 dwc2_handle_wakeup_detected_intr(hsotg); in dwc2_handle_common_intr()
506 dwc2_handle_usb_suspend_intr(hsotg); in dwc2_handle_common_intr()
513 if (dwc2_is_device_mode(hsotg)) { in dwc2_handle_common_intr()
514 dev_dbg(hsotg->dev, in dwc2_handle_common_intr()
516 dwc2_handle_usb_port_intr(hsotg); in dwc2_handle_common_intr()
522 spin_unlock(&hsotg->lock); in dwc2_handle_common_intr()