]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
usb: dwc3: gadget: implement dwc3_gadget_get_link_state
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>
Fri, 27 Apr 2012 10:35:15 +0000 (13:35 +0300)
committerFelipe Balbi <balbi@ti.com>
Wed, 5 Mar 2014 15:44:51 +0000 (09:44 -0600)
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@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/gadget.c
drivers/usb/dwc3/gadget.h

index 7f4e6dd63c00067120ab293dc893e88cfca15d0a..7d00738b4b60914ad9a4423b54b304730a0e01e9 100644 (file)
@@ -67,6 +67,22 @@ int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode)
        return 0;
 }
 
+/**
+ * dwc3_gadget_get_link_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);
+
+       return DWC3_DSTS_USBLNKST(reg);
+}
+
 /**
  * dwc3_gadget_set_link_state - Sets USB Link to a particular State
  * @dwc: pointer to our context structure
index febe1aa7b71424790c96d92852eb8ea4d4d51453..d1012447787254e4c2da4a51527edb526ba5136a 100644 (file)
@@ -86,6 +86,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
                int status);
 
 int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode);
+int dwc3_gadget_get_link_state(struct dwc3 *dwc);
 int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state);
 
 void dwc3_ep0_interrupt(struct dwc3 *dwc,