Re: [PATCH 04/11] usb: dwc3: gadget: implement dwc3_gadget_get_link_state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 26, 2014 at 12:10:09AM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 02/25/2014 10:40 PM, Felipe Balbi wrote:
> 
> >From: Paul Zimmerman <Paul.Zimmerman@xxxxxxxxxxxx>
> 
> >This function will be used during hibernation to get
> >the current link state. It will be needed at least
> >for Hibernation support.
> 
> >Signed-off-by: Paul Zimmerman <paulz@xxxxxxxxxxxx>
> >Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> >---
> >  drivers/usb/dwc3/gadget.c | 36 ++++++++++++++++++++++++++++++++++++
> >  drivers/usb/dwc3/gadget.h |  1 +
> >  2 files changed, 37 insertions(+)
> 
> >diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> >index 31b13c2..ff10161 100644
> >--- a/drivers/usb/dwc3/gadget.c
> >+++ b/drivers/usb/dwc3/gadget.c
> >@@ -68,6 +68,42 @@ int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode)
> >  }
> >
> >  /**
> >+ * dwc3_gadget_get_lik_state - Gets current state of USB Link
> >+ * @dwc: pointer to our context structure
> >+ *
> >+ * Caller should take care of locking. This function will
> >+ * return the link state on success (>= 0) or -ETIMEDOUT.
> >+ */
> >+int dwc3_gadget_get_link_state(struct dwc3 *dwc)
> >+{
> >+	u32		reg;
> >+
> >+	reg = dwc3_readl(dwc->regs, DWC3_DSTS);
> >+
> >+	/*
> >+	 * Wait until device controller is ready.
> >+	 * (This only applied to 1.94a and later
> >+	 * RTL releases)
> >+	 */
> >+	if (dwc->revision >= DWC3_REVISION_194A) {
> >+		int	retries = 10000;
> >+
> >+		do {
> >+			reg = dwc3_readl(dwc->regs, DWC3_DSTS);
> >+			if (!(reg & DWC3_DSTS_DCNRD))
> >+				break;
> >+
> >+			if (!retries)
> 
>    Hm, I doubt this will ever be true. This check would be meaningful
> after the loop...

good catch, I'll update the patch.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux