All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manu Gautam <mgautam@codeaurora.org>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: linux-arm-msm@vger.kernel.org,
	Manu Gautam <mgautam@codeaurora.org>,
	Vivek Gautam <vivek.gautam@codeaurora.org>,
	Varadarajan Narayanan <varada@codeaurora.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Wei Yongjun <weiyongjun1@huawei.com>,
	"open list:GENERIC PHY FRAMEWORK" <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/6] phy: qcom-qmp: Enable pipe_clk before checking USB3 PHY_STATUS
Date: Fri, 16 Mar 2018 15:14:54 +0530	[thread overview]
Message-ID: <1521193500-4696-2-git-send-email-mgautam@codeaurora.org> (raw)
In-Reply-To: <1521193500-4696-1-git-send-email-mgautam@codeaurora.org>

QMP PHY for USB mode requires pipe_clk for calibration and PLL lock
to take place. This lock is output from PHY to GCC clock_ctl and then
fed back to QMP PHY and is output from PHY only after PHY is reset
and initialized, hence it can't be enabled too early in initialization
sequence.

Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index 6470c5d..73aa282 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -797,8 +797,13 @@ static int qcom_qmp_phy_poweron(struct phy *phy)
 {
 	struct qmp_phy *qphy = phy_get_drvdata(phy);
 	struct qcom_qmp *qmp = qphy->qmp;
+	const struct qmp_phy_cfg *cfg = qmp->cfg;
 	int ret;
 
+	/* Not needed for USB3 PHY as pipe_clk is enabled from phy_init */
+	if (cfg->type == PHY_TYPE_USB3)
+		return 0;
+
 	ret = clk_prepare_enable(qphy->pipe_clk);
 	if (ret)
 		dev_err(qmp->dev, "pipe_clk enable failed, err=%d\n", ret);
@@ -1008,6 +1013,19 @@ static int qcom_qmp_phy_init(struct phy *phy)
 	status = pcs + cfg->regs[QPHY_PCS_READY_STATUS];
 	mask = cfg->mask_pcs_ready;
 
+	/* USB3 PHY requires pipe_clk for PLL lock and calibration */
+	if (cfg->type == PHY_TYPE_USB3) {
+		ret = clk_prepare_enable(qphy->pipe_clk);
+		if (ret)
+			dev_err(qmp->dev, "pipe_clk enable err=%d\n", ret);
+		/*
+		 * Ignore this error as pipe_clk might take some time to get
+		 * enabled. In any case following check for PHY PLL lock would
+		 * timeout below if there is a fatal error and clock is not fed
+		 * to PHY
+		 */
+	}
+
 	ret = readl_poll_timeout(status, val, !(val & mask), 1,
 				 PHY_INIT_COMPLETE_TIMEOUT);
 	if (ret) {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: Manu Gautam <mgautam@codeaurora.org>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: linux-arm-msm@vger.kernel.org,
	Manu Gautam <mgautam@codeaurora.org>,
	Vivek Gautam <vivek.gautam@codeaurora.org>,
	Varadarajan Narayanan <varada@codeaurora.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Wei Yongjun <weiyongjun1@huawei.com>,
	linux-kernel@vger.kernel.org (open list:GENERIC PHY FRAMEWORK)
Subject: [PATCH 1/6] phy: qcom-qmp: Enable pipe_clk before checking USB3 PHY_STATUS
Date: Fri, 16 Mar 2018 15:14:54 +0530	[thread overview]
Message-ID: <1521193500-4696-2-git-send-email-mgautam@codeaurora.org> (raw)
In-Reply-To: <1521193500-4696-1-git-send-email-mgautam@codeaurora.org>

QMP PHY for USB mode requires pipe_clk for calibration and PLL lock
to take place. This lock is output from PHY to GCC clock_ctl and then
fed back to QMP PHY and is output from PHY only after PHY is reset
and initialized, hence it can't be enabled too early in initialization
sequence.

Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index 6470c5d..73aa282 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -797,8 +797,13 @@ static int qcom_qmp_phy_poweron(struct phy *phy)
 {
 	struct qmp_phy *qphy = phy_get_drvdata(phy);
 	struct qcom_qmp *qmp = qphy->qmp;
+	const struct qmp_phy_cfg *cfg = qmp->cfg;
 	int ret;
 
+	/* Not needed for USB3 PHY as pipe_clk is enabled from phy_init */
+	if (cfg->type == PHY_TYPE_USB3)
+		return 0;
+
 	ret = clk_prepare_enable(qphy->pipe_clk);
 	if (ret)
 		dev_err(qmp->dev, "pipe_clk enable failed, err=%d\n", ret);
@@ -1008,6 +1013,19 @@ static int qcom_qmp_phy_init(struct phy *phy)
 	status = pcs + cfg->regs[QPHY_PCS_READY_STATUS];
 	mask = cfg->mask_pcs_ready;
 
+	/* USB3 PHY requires pipe_clk for PLL lock and calibration */
+	if (cfg->type == PHY_TYPE_USB3) {
+		ret = clk_prepare_enable(qphy->pipe_clk);
+		if (ret)
+			dev_err(qmp->dev, "pipe_clk enable err=%d\n", ret);
+		/*
+		 * Ignore this error as pipe_clk might take some time to get
+		 * enabled. In any case following check for PHY PLL lock would
+		 * timeout below if there is a fatal error and clock is not fed
+		 * to PHY
+		 */
+	}
+
 	ret = readl_poll_timeout(status, val, !(val & mask), 1,
 				 PHY_INIT_COMPLETE_TIMEOUT);
 	if (ret) {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

       reply	other threads:[~2018-03-16  9:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1521193500-4696-1-git-send-email-mgautam@codeaurora.org>
2018-03-16  9:44 ` Manu Gautam [this message]
2018-03-16  9:44   ` [PATCH 1/6] phy: qcom-qmp: Enable pipe_clk before checking USB3 PHY_STATUS Manu Gautam
2018-03-16  9:44 ` [PATCH 2/6] phy: qcom-qusb2: Fix crash if nvmem cell not specified Manu Gautam
2018-03-16  9:44   ` Manu Gautam
2018-03-20 10:12   ` Vivek Gautam
2018-03-16  9:44 ` [PATCH 3/6] dt-bindings: phy-qcom-qmp: Update bindings for sdm845 Manu Gautam
2018-03-16  9:44   ` Manu Gautam
2018-03-18 12:52   ` Rob Herring
2018-03-16  9:44 ` [PATCH 4/6] phy: qcom-qmp: Add QMP V3 USB3 UNI PHY support " Manu Gautam
2018-03-16  9:44   ` Manu Gautam
2018-03-19 17:51   ` Evan Green
2018-03-20  6:59     ` Manu Gautam
2018-03-20 16:36       ` Evan Green
2018-03-16  9:44 ` [PATCH 5/6] dt-bindings: phy-qcom-usb2: Update bindings " Manu Gautam
2018-03-16  9:44   ` Manu Gautam
2018-03-18 12:52   ` Rob Herring
2018-03-19  4:41     ` Manu Gautam
2018-03-20 10:23   ` Vivek Gautam
2018-03-20 10:42     ` Manu Gautam
2018-03-16  9:44 ` [PATCH 6/6] phy: qcom-qusb2: Add QUSB2 PHYs support " Manu Gautam
2018-03-16  9:44   ` Manu Gautam

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=1521193500-4696-2-git-send-email-mgautam@codeaurora.org \
    --to=mgautam@codeaurora.org \
    --cc=fengguang.wu@intel.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=varada@codeaurora.org \
    --cc=vivek.gautam@codeaurora.org \
    --cc=weiyongjun1@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.