diff options
author | Frank Li <frank.li@nxp.com> | 2021-02-18 16:51:08 -0600 |
---|---|---|
committer | Peter Chen <peter.chen@kernel.org> | 2021-04-12 20:19:20 +0800 |
commit | 2cf2581cd2290ccef674f1be5f7977d66702eedb (patch) | |
tree | fa20b3bab591e194ba2eb4e372b03cf3145d6568 /drivers/usb/cdns3/drd.c | |
parent | 14d34d2dbbe2d9144a65bae1549202d1717062e2 (diff) |
usb: cdns3: add power lost support for system resume
If the controller lost its power during the system suspend, we need
to do all initialiation operations.
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@kernel.org>
Diffstat (limited to 'drivers/usb/cdns3/drd.c')
-rw-r--r-- | drivers/usb/cdns3/drd.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c index fa5318ade3e1..55c73b1d8704 100644 --- a/drivers/usb/cdns3/drd.c +++ b/drivers/usb/cdns3/drd.c @@ -478,3 +478,18 @@ int cdns_drd_exit(struct cdns *cdns) return 0; } + + +/* Indicate the cdns3 core was power lost before */ +bool cdns_power_is_lost(struct cdns *cdns) +{ + if (cdns->version == CDNS3_CONTROLLER_V1) { + if (!(readl(&cdns->otg_v1_regs->simulate) & BIT(0))) + return true; + } else { + if (!(readl(&cdns->otg_v0_regs->simulate) & BIT(0))) + return true; + } + return false; +} +EXPORT_SYMBOL_GPL(cdns_power_is_lost); |