mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wenbin Yao (Consultant)" <quic_wenbyao@quicinc.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	Philipp Zabel <p.zabel@pengutronix.de>, <vkoul@kernel.org>,
	<kishon@kernel.org>, <dmitry.baryshkov@linaro.org>,
	<abel.vesa@linaro.org>, <quic_qianyu@quicinc.com>,
	<neil.armstrong@linaro.org>, <manivannan.sadhasivam@linaro.org>,
	<quic_devipriy@quicinc.com>, <linux-arm-msm@vger.kernel.org>,
	<linux-phy@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] phy: qcom: pcie: Determine has_nocsr_reset dynamically
Date: Thu, 13 Feb 2025 16:09:53 +0800	[thread overview]
Message-ID: <5bbd6b38-5c8d-65b2-f910-b125519bd037@quicinc.com> (raw)
In-Reply-To: <93f1f01e-e6b4-4dc2-9485-aba168c6d88c@oss.qualcomm.com>

On 2/12/2025 8:31 PM, Konrad Dybcio wrote:
> On 11.02.2025 10:53 AM, Philipp Zabel wrote:
>> On Di, 2025-02-11 at 17:42 +0800, Wenbin Yao wrote:
>>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>
>>> Decide the in-driver logic based on whether the nocsr reset is present
>>> and defer checking the appropriateness of that to dt-bindings to save
>>> on boilerplate.
>>>
>>> Reset controller APIs are fine consuming a nullptr, so no additional
>>> checks are necessary there.
>>>
>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>> Signed-off-by: Wenbin Yao <quic_wenbyao@quicinc.com>
>>> Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
>>> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>>> ---
> [...]
>
>>>   static void qmp_pcie_init_port_b(struct qmp_pcie *qmp, const struct qmp_phy_cfg_tbls *tbls)
>>> @@ -4203,11 +4196,14 @@ static int qmp_pcie_reset_init(struct qmp_pcie *qmp)
>>>   	if (ret)
>>>   		return dev_err_probe(dev, ret, "failed to get resets\n");
>>>   
>>> -	if (cfg->has_nocsr_reset) {
>>> -		qmp->nocsr_reset = devm_reset_control_get_exclusive(dev, "phy_nocsr");
>>> -		if (IS_ERR(qmp->nocsr_reset))
>>> +	qmp->nocsr_reset = devm_reset_control_get_exclusive(dev, "phy_nocsr");
>>> +	if (IS_ERR(qmp->nocsr_reset)) {
>>> +		if (PTR_ERR(qmp->nocsr_reset) == -ENOENT ||
>>> +		    PTR_ERR(qmp->nocsr_reset) == -EINVAL)
>> Why is -EINVAL ignored here?
> If the NOCSR (partial) reset is missing, we can still assert the "full" reset
> and program the hardware from the ground up. It's also needed for backwards
> dt compat as not all platforms described it when originally added.

Seems like we really can't ignore -EINVAL. If no_csr reset is missing in
dts, it will return -ENOENT, which is turned into NULL by
devm_reset_control_get_optional_exclusive. -EINVAL indicates something
wrong in args we passed to the function and the reset property that need to
be fixed.

>
>> Without this you could just use
>> devm_reset_control_get_optional_exclusive(), which already turns -
>> ENOENT into NULL. That seems to me the correct thing to do, as from
>> driver point-of-view, this reset control is optional.
> Good point, I forgot _optional_ was a thing in the reset framework
>
> Konrad

Will use devm_reset_control_get_optional_exclusive function in patch v3.

-- 
With best wishes
Wenbin

  reply	other threads:[~2025-02-13  8:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11  9:42 [PATCH v2 0/2] phy: qcom: qmp-pcie: Add PCIe PHY no_csr reset support Wenbin Yao
2025-02-11  9:42 ` [PATCH v2 1/2] phy: qcom: pcie: Determine has_nocsr_reset dynamically Wenbin Yao
2025-02-11  9:53   ` Philipp Zabel
2025-02-12 12:31     ` Konrad Dybcio
2025-02-13  8:09       ` Wenbin Yao (Consultant) [this message]
2025-02-11  9:42 ` [PATCH v2 2/2] phy: qcom: qmp-pcie: Add PHY register retention support Wenbin Yao
2025-02-12  0:13   ` Dmitry Baryshkov
2025-02-12  8:31     ` Wenbin Yao (Consultant)
2025-02-12 11:06       ` Dmitry Baryshkov
2025-02-13  8:35         ` Wenbin Yao (Consultant)
2025-02-12 11:07       ` Dmitry Baryshkov
2025-02-12 14:55         ` Konrad Dybcio

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=5bbd6b38-5c8d-65b2-f910-b125519bd037@quicinc.com \
    --to=quic_wenbyao@quicinc.com \
    --cc=abel.vesa@linaro.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=kishon@kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=neil.armstrong@linaro.org \
    --cc=p.zabel@pengutronix.de \
    --cc=quic_devipriy@quicinc.com \
    --cc=quic_qianyu@quicinc.com \
    --cc=vkoul@kernel.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

all inboxes | Powered by JetHome®