From: Kishon Vijay Abraham I <kishon@ti.com>
To: Rob Herring <robh+dt@kernel.org>, Roger Quadros <rogerq@ti.com>,
Kishon Vijay Abraham I <kishon@ti.com>
Cc: <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>
Subject: [PATCH v3 2/5] phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking reset callback
Date: Mon, 25 Mar 2019 13:38:12 +0530 [thread overview]
Message-ID: <20190325080815.6056-3-kishon@ti.com> (raw)
In-Reply-To: <20190325080815.6056-1-kishon@ti.com>
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>
---
drivers/phy/phy-core.c | 6 ++++++
1 file changed, 6 insertions(+)
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);
--
2.17.1
next prev parent reply other threads:[~2019-03-25 8:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 8:08 [PATCH v3 0/5] PHY: Add support for SERDES in TI's AM654 platform Kishon Vijay Abraham I
2019-03-25 8:08 ` [PATCH v3 1/5] phy: core: Add *release* phy_ops invoked when the consumer relinquishes PHY Kishon Vijay Abraham I
2019-03-25 8:08 ` Kishon Vijay Abraham I [this message]
2019-03-25 8:08 ` [PATCH v3 3/5] dt-bindings: phy: ti: Add dt binding documentation for SERDES in AM654x SoC Kishon Vijay Abraham I
2019-03-28 18:07 ` Rob Herring
2019-03-29 6:13 ` Kishon Vijay Abraham I
2019-03-25 8:08 ` [PATCH v3 4/5] phy: ti: Add a new SERDES driver for TI's " Kishon Vijay Abraham I
2019-03-25 14:05 ` Andrew F. Davis
2019-04-05 9:46 ` Kishon Vijay Abraham I
2019-03-25 8:08 ` [PATCH v3 5/5] phy: ti: am654-serdes: Support all clksel values Kishon Vijay Abraham I
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190325080815.6056-3-kishon@ti.com \
--to=kishon@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=rogerq@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome