diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2019-04-05 13:08:31 +0200 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2019-04-17 10:43:17 +0200 |
commit | 4df614c4ab18ba14892dfa82b88c28203096e951 (patch) | |
tree | 0e175c63d915ed522897f962e1dda97cc932c67d /drivers/phy | |
parent | phy: core: Add *release* phy_ops invoked when the consumer relinquishes PHY (diff) | |
download | linux-4df614c4ab18ba14892dfa82b88c28203096e951.tar.xz linux-4df614c4ab18ba14892dfa82b88c28203096e951.zip |
phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking reset callback
PHY drivers may try to access PHY registers in the ->reset() callback.
Invoke phy_pm_runtime_get_sync() before invoking the ->reset() callback
so that the PHY drivers don't have to enable clocks by themselves before
accessing PHY registers.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/phy-core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index b9a4ebf35dd3..c147ba843f0b 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -384,10 +384,16 @@ int phy_reset(struct phy *phy) if (!phy || !phy->ops->reset) return 0; + ret = phy_pm_runtime_get_sync(phy); + if (ret < 0 && ret != -ENOTSUPP) + return ret; + mutex_lock(&phy->mutex); ret = phy->ops->reset(phy); mutex_unlock(&phy->mutex); + phy_pm_runtime_put(phy); + return ret; } EXPORT_SYMBOL_GPL(phy_reset); |