diff options
author | Paul Zimmerman <Paul.Zimmerman@synopsys.com> | 2012-04-27 14:35:15 +0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-03-05 19:44:51 +0400 |
commit | 911f1f88cadf4b64bad5aa4c257d72494a62f928 (patch) | |
tree | d467c24f4963c55632c759ebf3a8952e891e4472 /drivers/usb/dwc3/gadget.c | |
parent | 4cfcf876767ab845e1db0c0b2671db27b1a3586c (diff) | |
download | linux-911f1f88cadf4b64bad5aa4c257d72494a62f928.tar.xz |
usb: dwc3: gadget: implement dwc3_gadget_get_link_state
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>
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 7f4e6dd63c00..7d00738b4b60 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -68,6 +68,22 @@ int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode) } /** + * 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 * @state: the state to put link into |