From: Evan Green <evgreen@chromium.org>
To: Andy Gross <andy.gross@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Kishon Vijay Abraham I <kishon@ti.com>
Cc: Can Guo <cang@codeaurora.org>,
Douglas Anderson <dianders@chromium.org>,
Asutosh Das <asutoshd@codeaurora.org>,
Stephen Boyd <swboyd@chromium.org>,
Vivek Gautam <vivek.gautam@codeaurora.org>,
Evan Green <evgreen@chromium.org>,
Jeffrey Hugo <jhugo@codeaurora.org>,
linux-kernel@vger.kernel.org,
Manu Gautam <mgautam@codeaurora.org>
Subject: [PATCH v2 7/9] phy: qcom-qmp: Utilize UFS reset controller
Date: Wed, 23 Jan 2019 14:11:35 -0800 [thread overview]
Message-ID: <20190123221137.41722-8-evgreen@chromium.org> (raw)
In-Reply-To: <20190123221137.41722-1-evgreen@chromium.org>
Request the newly minted reset controller from the Qualcomm UFS
controller, and use it to toggle the PHY reset line from within
the PHY. This will allow us to merge the two phases of UFS PHY
initialization.
Signed-off-by: Evan Green <evgreen@chromium.org>
---
Note: this change is dependent on the previous changes, including
the DT changes, in order to expose the reset controller from UFS.
Changes in v2:
- Use devm_* to get the reset (Stephen)
- Clear ufs_reset on error getting it
- Remove needless error print (Stephen)
drivers/phy/qualcomm/phy-qcom-qmp.c | 44 +++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index daf751500232f..721af5706fbb1 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -849,6 +849,9 @@ struct qmp_phy_cfg {
/* true, if PCS block has no separate SW_RESET register */
bool no_pcs_sw_reset;
+
+ /* true if the PHY has a UFS reset control to toggle */
+ bool has_ufsphy_reset;
};
/**
@@ -897,6 +900,7 @@ struct qmp_phy {
* @init_count: phy common block initialization count
* @phy_initialized: indicate if PHY has been initialized
* @mode: current PHY mode
+ * @ufs_reset: optional UFS PHY reset handle
*/
struct qcom_qmp {
struct device *dev;
@@ -914,6 +918,8 @@ struct qcom_qmp {
int init_count;
bool phy_initialized;
enum phy_mode mode;
+
+ struct reset_control *ufs_reset;
};
static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val)
@@ -1144,6 +1150,8 @@ static const struct qmp_phy_cfg sdm845_ufsphy_cfg = {
.is_dual_lane_phy = true,
.no_pcs_sw_reset = true,
+
+ .has_ufsphy_reset = true,
};
static const struct qmp_phy_cfg msm8998_usb3phy_cfg = {
@@ -1314,6 +1322,9 @@ static int qcom_qmp_phy_com_exit(struct qcom_qmp *qmp)
return 0;
}
+ if (qmp->ufs_reset)
+ reset_control_assert(qmp->ufs_reset);
+
if (cfg->has_phy_com_ctrl) {
qphy_setbits(serdes, cfg->regs[QPHY_COM_START_CONTROL],
SERDES_START | PCS_START);
@@ -1351,6 +1362,33 @@ static int qcom_qmp_phy_init(struct phy *phy)
dev_vdbg(qmp->dev, "Initializing QMP phy\n");
+ if (cfg->has_ufsphy_reset) {
+ /*
+ * Get UFS reset, which is delayed until now to avoid a
+ * circular dependency where UFS needs its PHY, but the PHY
+ * needs this UFS reset.
+ */
+ if (!qmp->ufs_reset) {
+ qmp->ufs_reset =
+ devm_reset_control_get_exclusive(qmp->dev,
+ "ufsphy");
+
+ if (IS_ERR(qmp->ufs_reset)) {
+ dev_err(qmp->dev,
+ "failed to get UFS reset: %d\n",
+ PTR_ERR(qmp->ufs_reset));
+
+ ret = PTR_ERR(qmp->ufs_reset);
+ qmp->ufs_reset = NULL;
+ return ret;
+ }
+ }
+
+ ret = reset_control_assert(qmp->ufs_reset);
+ if (ret)
+ goto err_lane_rst;
+ }
+
ret = qcom_qmp_phy_com_init(qphy);
if (ret)
return ret;
@@ -1384,6 +1422,12 @@ static int qcom_qmp_phy_init(struct phy *phy)
qcom_qmp_phy_configure(pcs, cfg->regs, cfg->pcs_tbl, cfg->pcs_tbl_num);
+ if (qmp->ufs_reset) {
+ ret = reset_control_deassert(qmp->ufs_reset);
+ if (ret)
+ goto err_lane_rst;
+ }
+
/*
* UFS PHY requires the deassert of software reset before serdes start.
* For UFS PHYs that do not have software reset control bits, defer
--
2.18.1
next prev parent reply other threads:[~2019-01-23 22:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 22:11 [PATCH v2 0/9] phy: qcom-ufs: Enable regulators to be off in suspend Evan Green
2019-01-23 22:11 ` [PATCH v2 1/9] dt-bindings: ufs: Add #reset-cells for Qualcomm controllers Evan Green
2019-01-30 18:56 ` Rob Herring
2019-02-01 17:41 ` Stephen Boyd
2019-01-23 22:11 ` [PATCH v2 2/9] dt-bindings: phy-qcom-qmp: Add UFS PHY reset Evan Green
2019-02-01 17:41 ` Stephen Boyd
2019-01-23 22:11 ` [PATCH v2 3/9] dt-bindings: phy: qcom-ufs: Add resets property Evan Green
2019-02-01 17:41 ` Stephen Boyd
2019-01-23 22:11 ` [PATCH v2 4/9] arm64: dts: sdm845: Add UFS PHY reset Evan Green
2019-01-23 22:11 ` [PATCH v2 5/9] arm64: dts: msm8996: Add UFS PHY reset controller Evan Green
2019-01-23 22:11 ` [PATCH v2 6/9] scsi: ufs: qcom: Expose the reset controller for PHY Evan Green
2019-02-01 17:56 ` Stephen Boyd
2019-02-05 17:59 ` Evan Green
2019-01-23 22:11 ` Evan Green [this message]
2019-02-01 18:00 ` [PATCH v2 7/9] phy: qcom-qmp: Utilize UFS reset controller Stephen Boyd
2019-02-05 18:00 ` Evan Green
2019-01-23 22:11 ` [PATCH v2 8/9] phy: qcom-qmp: Move UFS phy to phy_poweron/off Evan Green
2019-01-23 22:11 ` [PATCH v2 9/9] phy: qcom-ufs: Refactor all init steps into phy_poweron Evan Green
2019-02-01 18:43 ` Stephen Boyd
2019-02-05 18:00 ` Evan Green
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=20190123221137.41722-8-evgreen@chromium.org \
--to=evgreen@chromium.org \
--cc=andy.gross@linaro.org \
--cc=asutoshd@codeaurora.org \
--cc=cang@codeaurora.org \
--cc=dianders@chromium.org \
--cc=jhugo@codeaurora.org \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgautam@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=swboyd@chromium.org \
--cc=vivek.gautam@codeaurora.org \
/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