From: Varadarajan Narayanan <varada@codeaurora.org>
To: bhelgaas@google.com, robh+dt@kernel.org, mark.rutland@arm.com,
svarbanov@mm-sol.com, kishon@ti.com, sboyd@codeaurora.org,
vivek.gautam@codeaurora.org, fengguang.wu@intel.com,
weiyongjun1@huawei.com, linux-pci@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Cc: Varadarajan Narayanan <varada@codeaurora.org>
Subject: [PATCH v4 3/7] phy: qcom-qmp: Fix phy pipe clock name
Date: Fri, 21 Jul 2017 17:06:13 +0530 [thread overview]
Message-ID: <1500636977-11934-4-git-send-email-varada@codeaurora.org> (raw)
In-Reply-To: <1500636977-11934-1-git-send-email-varada@codeaurora.org>
Presently, the phy pipe clock's name is assumed to be either
usb3_phy_pipe_clk_src or pcie_XX_pipe_clk_src (where XX is the
phy lane's number). However, this will not work if an SoC has
more than one instance of the phy. Hence, instead of assuming
the name of the clock, fetch it from the DT.
Signed-off-by: Varadarajan Narayanan <varada@codeaurora.org>
---
drivers/phy/qualcomm/phy-qcom-qmp.c | 45 +++++++++++++++++++++++--------------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index 78ca628..b046866 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -925,20 +925,13 @@ static int qcom_qmp_phy_clk_init(struct device *dev)
* clk | +-------+ | +-----+
* +---------------+
*/
-static int phy_pipe_clk_register(struct qcom_qmp *qmp, int id)
+static int phy_pipe_clk_register(struct qcom_qmp *qmp, const char *clk_name)
{
- char name[24];
struct clk_fixed_rate *fixed;
struct clk_init_data init = { };
- switch (qmp->cfg->type) {
- case PHY_TYPE_USB3:
- snprintf(name, sizeof(name), "usb3_phy_pipe_clk_src");
- break;
- case PHY_TYPE_PCIE:
- snprintf(name, sizeof(name), "pcie_%d_pipe_clk_src", id);
- break;
- default:
+ if ((qmp->cfg->type != PHY_TYPE_USB3) &&
+ (qmp->cfg->type != PHY_TYPE_PCIE)) {
/* not all phys register pipe clocks, so return success */
return 0;
}
@@ -947,7 +940,7 @@ static int phy_pipe_clk_register(struct qcom_qmp *qmp, int id)
if (!fixed)
return -ENOMEM;
- init.name = name;
+ init.name = clk_name;
init.ops = &clk_fixed_rate_ops;
/* controllers using QMP phys use 125MHz pipe clock interface */
@@ -1110,6 +1103,8 @@ static int qcom_qmp_phy_probe(struct platform_device *pdev)
id = 0;
for_each_available_child_of_node(dev->of_node, child) {
+ const char *clk_name;
+
/* Create per-lane phy */
ret = qcom_qmp_phy_create(dev, child, id);
if (ret) {
@@ -1119,15 +1114,31 @@ static int qcom_qmp_phy_probe(struct platform_device *pdev)
}
/*
- * Register the pipe clock provided by phy.
- * See function description to see details of this pipe clock.
+ * This property is mandatory only for PCIe/USB phys.
+ * For other phy types don't return failure.
*/
- ret = phy_pipe_clk_register(qmp, id);
- if (ret) {
- dev_err(qmp->dev,
- "failed to register pipe clock source\n");
+ ret = of_property_read_string(child, "clock-output-names",
+ &clk_name);
+ if (ret && (qmp->cfg->type == PHY_TYPE_PCIE ||
+ qmp->cfg->type == PHY_TYPE_USB3)) {
+ dev_err(dev,
+ "failed to get clock-output-names for lane%d phy, %d\n",
+ id, ret);
return ret;
}
+
+ if (!ret) {
+ /*
+ * Register the pipe clock provided by phy. See function
+ * description to see details of this pipe clock.
+ */
+ ret = phy_pipe_clk_register(qmp, clk_name);
+ if (ret) {
+ dev_err(qmp->dev,
+ "failed to register pipe clock source\n");
+ return ret;
+ }
+ }
id++;
}
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2017-07-21 11:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 11:36 [PATCH v4 0/7] Add support for IPQ8074 PCIe phy and controller Varadarajan Narayanan
2017-07-21 11:36 ` [PATCH v4 1/7] dt-bindings: phy: qmp: Add output-clock-names Varadarajan Narayanan
2017-07-21 11:36 ` [PATCH v4 2/7] dt-bindings: phy: qmp: Add support for QMP phy in IPQ8074 Varadarajan Narayanan
2017-07-26 15:03 ` Vivek Gautam
2017-07-21 11:36 ` Varadarajan Narayanan [this message]
2017-07-26 15:29 ` [PATCH v4 3/7] phy: qcom-qmp: Fix phy pipe clock name Vivek Gautam
2017-07-21 11:36 ` [PATCH v4 4/7] phy: qcom-qmp: Add support for IPQ8074 Varadarajan Narayanan
[not found] ` <1500636977-11934-5-git-send-email-varada-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-07-26 15:31 ` Vivek Gautam
2017-07-21 11:36 ` [PATCH v4 5/7] PCI: dwc: qcom: Use block IP version for operations Varadarajan Narayanan
2017-07-21 11:36 ` [PATCH v4 6/7] dt-bindings: pci: qcom: Add support for IPQ8074 Varadarajan Narayanan
2017-07-21 11:36 ` [PATCH v4 7/7] PCI: dwc: qcom: Add support for IPQ8074 PCIe controller Varadarajan Narayanan
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=1500636977-11934-4-git-send-email-varada@codeaurora.org \
--to=varada@codeaurora.org \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=fengguang.wu@intel.com \
--cc=kishon@ti.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@codeaurora.org \
--cc=svarbanov@mm-sol.com \
--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 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).