diff mbox

[v2,01/10] phy: qcom-ufs: remove failure when rx/tx_iface_clk are absent

Message ID 1476800897-19898-2-git-send-email-vivek.gautam@codeaurora.org (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Vivek Gautam Oct. 18, 2016, 2:28 p.m. UTC
From: Yaniv Gardi <ygardi@codeaurora.org>

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.

Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
---

No change since v1.

 drivers/phy/phy-qcom-ufs.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

subhashj@codeaurora.org Oct. 18, 2016, 6:38 p.m. UTC | #1
On 2016-10-18 07:28, Vivek Gautam wrote:
> From: Yaniv Gardi <ygardi@codeaurora.org>
> 
> 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.

You may also want to update the device tree binding (documentation) to 
update these as optional properties.

> 
> Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> ---
> 
> No change since v1.
> 
>  drivers/phy/phy-qcom-ufs.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
> index 107cb57..183ec04 100644
> --- a/drivers/phy/phy-qcom-ufs.c
> +++ b/drivers/phy/phy-qcom-ufs.c
> @@ -186,16 +186,27 @@ ufs_qcom_phy_init_clks(struct phy *generic_phy,
>  		       struct ufs_qcom_phy *phy_common)
>  {
>  	int err;
> +	struct ufs_qcom_phy *phy = get_ufs_qcom_phy(generic_phy);
> 
>  	err = ufs_qcom_phy_clk_get(generic_phy, "tx_iface_clk",
>  				   &phy_common->tx_iface_clk);
> +	/*
> +	 * tx_iface_clk does not exist in newer version of ufs-phy HW,
> +	 * so don't return error if it is not found
> +	 */
>  	if (err)
> -		goto out;
> +		dev_dbg(phy->dev, "%s: failed to get tx_iface_clk\n",
> +			__func__);
> 
>  	err = ufs_qcom_phy_clk_get(generic_phy, "rx_iface_clk",
>  				   &phy_common->rx_iface_clk);
> +	/*
> +	 * rx_iface_clk does not exist in newer version of ufs-phy HW,
> +	 * so don't return error if it is not found
> +	 */
>  	if (err)
> -		goto out;
> +		dev_dbg(phy->dev, "%s: failed to get rx_iface_clk\n",
> +			__func__);
> 
>  	err = ufs_qcom_phy_clk_get(generic_phy, "ref_clk_src",
>  				   &phy_common->ref_clk_src);
Stephen Boyd Oct. 18, 2016, 9:18 p.m. UTC | #2
On 10/18/2016 07:28 AM, Vivek Gautam wrote:
> From: Yaniv Gardi <ygardi@codeaurora.org>
>
> 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.
>
> Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> ---

Shouldn't we have a different compatible string on future UFS phys so
that we know which number of clks and what clks are required? That's how
we typically handle clk configurations changing. Making them optional
should really only be needed when they're really optional, i.e. things
will work fine if they're there or not.
Vivek Gautam Oct. 19, 2016, 5:20 p.m. UTC | #3
Hi,


On Wed, Oct 19, 2016 at 2:48 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 10/18/2016 07:28 AM, Vivek Gautam wrote:
>> From: Yaniv Gardi <ygardi@codeaurora.org>
>>
>> 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.
>>
>> Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
>> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
>> ---
>
> Shouldn't we have a different compatible string on future UFS phys so
> that we know which number of clks and what clks are required? That's how
> we typically handle clk configurations changing. Making them optional
> should really only be needed when they're really optional, i.e. things
> will work fine if they're there or not.

Correct. It makes sense to have different compatible strings for different
versions.
I will gather more information about previous versions that required
this clock, and update as suggested.


Regards
Vivek
Vivek Gautam Oct. 29, 2016, 8:21 p.m. UTC | #4
Hi,


On Wed, Oct 19, 2016 at 10:50 PM, Vivek Gautam
<vivek.gautam@codeaurora.org> wrote:
> Hi,
>
>
> On Wed, Oct 19, 2016 at 2:48 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
>> On 10/18/2016 07:28 AM, Vivek Gautam wrote:
>>> From: Yaniv Gardi <ygardi@codeaurora.org>
>>>
>>> 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.
>>>
>>> Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
>>> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
>>> ---
>>
>> Shouldn't we have a different compatible string on future UFS phys so
>> that we know which number of clks and what clks are required? That's how
>> we typically handle clk configurations changing. Making them optional
>> should really only be needed when they're really optional, i.e. things
>> will work fine if they're there or not.
>
> Correct. It makes sense to have different compatible strings for different
> versions.
> I will gather more information about previous versions that required
> this clock, and update as suggested.

The tx/rx_face clocks are not available on some of the recent chips,
such as msm8996. Older chips with this 14nm ufs phy had handles
for tx/rx_iface clocks.
So, i will add new compatible string for msm8996 -
"qcom,msm8996-ufs-phy-qmp-14nm"
This can be used with chips further on that are going to use the same ufs phy.


Regards
Vivek
diff mbox

Patch

diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index 107cb57..183ec04 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -186,16 +186,27 @@  ufs_qcom_phy_init_clks(struct phy *generic_phy,
 		       struct ufs_qcom_phy *phy_common)
 {
 	int err;
+	struct ufs_qcom_phy *phy = get_ufs_qcom_phy(generic_phy);
 
 	err = ufs_qcom_phy_clk_get(generic_phy, "tx_iface_clk",
 				   &phy_common->tx_iface_clk);
+	/*
+	 * tx_iface_clk does not exist in newer version of ufs-phy HW,
+	 * so don't return error if it is not found
+	 */
 	if (err)
-		goto out;
+		dev_dbg(phy->dev, "%s: failed to get tx_iface_clk\n",
+			__func__);
 
 	err = ufs_qcom_phy_clk_get(generic_phy, "rx_iface_clk",
 				   &phy_common->rx_iface_clk);
+	/*
+	 * rx_iface_clk does not exist in newer version of ufs-phy HW,
+	 * so don't return error if it is not found
+	 */
 	if (err)
-		goto out;
+		dev_dbg(phy->dev, "%s: failed to get rx_iface_clk\n",
+			__func__);
 
 	err = ufs_qcom_phy_clk_get(generic_phy, "ref_clk_src",
 				   &phy_common->ref_clk_src);