From: Kishon Vijay Abraham I <kishon@ti.com>
To: Kishon Vijay Abraham I <kishon@ti.com>, Rob Herring <robh+dt@kernel.org>
Cc: Sekhar Nori <nsekhar@ti.com>, Roger Quadros <rogerq@ti.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: [PATCH 1/3] phy: core: Invoke pm_runtime_get_*/pm_runtime_put_* before invoking reset callback
Date: Mon, 21 Jan 2019 12:18:11 +0530 [thread overview]
Message-ID: <20190121064813.18444-2-kishon@ti.com> (raw)
In-Reply-To: <20190121064813.18444-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 19b05e824ee4..bf3a1fc18117 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-01-21 6:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 6:48 [PATCH 0/3] PHY: Add support for SERDES in TI's AM654 platform Kishon Vijay Abraham I
2019-01-21 6:48 ` Kishon Vijay Abraham I [this message]
2019-01-21 6:48 ` [PATCH 2/3] dt-bindings: phy: ti: Add dt binding documentation for SERDES in AM654x SoC Kishon Vijay Abraham I
2019-01-21 9:55 ` Roger Quadros
2019-01-21 10:47 ` Kishon Vijay Abraham I
2019-01-21 11:22 ` Roger Quadros
2019-01-21 11:49 ` Kishon Vijay Abraham I
2019-02-07 9:39 ` Kishon Vijay Abraham I
2019-01-21 6:48 ` [PATCH 3/3] phy: ti: Add a new SERDES driver for TI's " Kishon Vijay Abraham I
2019-01-21 9:47 ` Roger Quadros
2019-01-21 11:11 ` Kishon Vijay Abraham I
2019-01-23 12:19 ` 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=20190121064813.18444-2-kishon@ti.com \
--to=kishon@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsekhar@ti.com \
--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;
as well as URLs for NNTP newsgroup(s).