mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	usb: dwc2: Add exit clock gating from wakeup interrupt
Added exit from clock gating mode when wakeup interrupt is detected. To exit from the clock gating in device mode "dwc2_gadget_exit_clock_gating()" function is used with rem_wakeup parameter 0. To exit clock gating in host mode "dwc2_host_exit_clock_gating()" with rem_wakeup parameter 1. Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> Signed-off-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com> Link: https://lore.kernel.org/r/20210413073630.EF2CEA0094@mailhost.synopsys.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
		
							parent
							
								
									cbe1e903e5
								
							
						
					
					
						commit
						5d240efddc
					
				
					 1 changed files with 22 additions and 11 deletions
				
			
		| 
						 | 
					@ -415,17 +415,24 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
 | 
				
			||||||
	if (dwc2_is_device_mode(hsotg)) {
 | 
						if (dwc2_is_device_mode(hsotg)) {
 | 
				
			||||||
		dev_dbg(hsotg->dev, "DSTS=0x%0x\n",
 | 
							dev_dbg(hsotg->dev, "DSTS=0x%0x\n",
 | 
				
			||||||
			dwc2_readl(hsotg, DSTS));
 | 
								dwc2_readl(hsotg, DSTS));
 | 
				
			||||||
		if (hsotg->lx_state == DWC2_L2 && hsotg->in_ppd) {
 | 
							if (hsotg->lx_state == DWC2_L2) {
 | 
				
			||||||
			u32 dctl = dwc2_readl(hsotg, DCTL);
 | 
								if (hsotg->in_ppd) {
 | 
				
			||||||
			/* Clear Remote Wakeup Signaling */
 | 
									u32 dctl = dwc2_readl(hsotg, DCTL);
 | 
				
			||||||
			dctl &= ~DCTL_RMTWKUPSIG;
 | 
									/* Clear Remote Wakeup Signaling */
 | 
				
			||||||
			dwc2_writel(hsotg, dctl, DCTL);
 | 
									dctl &= ~DCTL_RMTWKUPSIG;
 | 
				
			||||||
			ret = dwc2_exit_partial_power_down(hsotg, 1,
 | 
									dwc2_writel(hsotg, dctl, DCTL);
 | 
				
			||||||
							   true);
 | 
									ret = dwc2_exit_partial_power_down(hsotg, 1,
 | 
				
			||||||
			if (ret)
 | 
													   true);
 | 
				
			||||||
				dev_err(hsotg->dev,
 | 
									if (ret)
 | 
				
			||||||
					"exit partial_power_down failed\n");
 | 
										dev_err(hsotg->dev,
 | 
				
			||||||
			call_gadget(hsotg, resume);
 | 
											"exit partial_power_down failed\n");
 | 
				
			||||||
 | 
									call_gadget(hsotg, resume);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/* Exit gadget mode clock gating. */
 | 
				
			||||||
 | 
								if (hsotg->params.power_down ==
 | 
				
			||||||
 | 
								    DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended)
 | 
				
			||||||
 | 
									dwc2_gadget_exit_clock_gating(hsotg, 0);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			/* Change to L0 state */
 | 
								/* Change to L0 state */
 | 
				
			||||||
			hsotg->lx_state = DWC2_L0;
 | 
								hsotg->lx_state = DWC2_L0;
 | 
				
			||||||
| 
						 | 
					@ -440,6 +447,10 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
 | 
				
			||||||
						"exit partial_power_down failed\n");
 | 
											"exit partial_power_down failed\n");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (hsotg->params.power_down ==
 | 
				
			||||||
 | 
								    DWC2_POWER_DOWN_PARAM_NONE && hsotg->bus_suspended)
 | 
				
			||||||
 | 
									dwc2_host_exit_clock_gating(hsotg, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
			 * If we've got this quirk then the PHY is stuck upon
 | 
								 * If we've got this quirk then the PHY is stuck upon
 | 
				
			||||||
			 * wakeup.  Assert reset.  This will propagate out and
 | 
								 * wakeup.  Assert reset.  This will propagate out and
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue