Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73597f6e authored by Can Guo's avatar Can Guo
Browse files

phy: qcom-ufs: remove failure when rx/tx_iface_clk are absent



Since in future UFS Phy's the tx_iface_clk and rx_iface_clk
are no longer exist, we should not fail when their initialization
fail, but rather just report with debug message.

Change-Id: I87e4deca632d4d4ee9e35a03f2fc9c22987255b3
Signed-off-by: default avatarYaniv Gardi <ygardi@codeaurora.org>
[cang@codeaurora.org: resolved trivial merge conflicts]
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent a27ae1c7
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2013-2015, Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2019, Linux Foundation. All rights reserved.
 */

#include "phy-qcom-ufs-i.h"
@@ -184,16 +184,24 @@ int ufs_qcom_phy_init_clks(struct ufs_qcom_phy *phy_common)
	if (of_device_is_compatible(phy_common->dev->of_node,
				"qcom,msm8996-ufs-phy-qmp-14nm"))
		goto skip_txrx_clk;

	/*
	 * tx_iface_clk does not exist in newer version of ufs-phy HW,
	 * so don't return error if it is not found
	 */
	err = ufs_qcom_phy_clk_get(phy_common->dev, "tx_iface_clk",
				   &phy_common->tx_iface_clk);
	if (err)
		goto out;

		dev_dbg(phy_common->dev, "%s: failed to get tx_iface_clk\n",
			__func__);
	/*
	 * rx_iface_clk does not exist in newer version of ufs-phy HW,
	 * so don't return error if it is not found
	 */
	err = ufs_qcom_phy_clk_get(phy_common->dev, "rx_iface_clk",
				   &phy_common->rx_iface_clk);
	if (err)
		goto out;
		dev_dbg(phy_common->dev, "%s: failed to get rx_iface_clk\n",
			__func__);

skip_txrx_clk:
	err = ufs_qcom_phy_clk_get(phy_common->dev, "ref_clk_src",
@@ -445,6 +453,9 @@ static int ufs_qcom_phy_enable_iface_clk(struct ufs_qcom_phy *phy)
	if (phy->is_iface_clk_enabled)
		goto out;

	if (!phy->tx_iface_clk)
		goto out;

	ret = clk_prepare_enable(phy->tx_iface_clk);
	if (ret) {
		dev_err(phy->dev, "%s: tx_iface_clk enable failed %d\n",
@@ -467,6 +478,9 @@ static int ufs_qcom_phy_enable_iface_clk(struct ufs_qcom_phy *phy)
/* Turn OFF M-PHY RMMI interface clocks */
static void ufs_qcom_phy_disable_iface_clk(struct ufs_qcom_phy *phy)
{
	if (!phy->tx_iface_clk)
		return;

	if (phy->is_iface_clk_enabled) {
		clk_disable_unprepare(phy->tx_iface_clk);
		clk_disable_unprepare(phy->rx_iface_clk);