linux-phy.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <mani@kernel.org>
To: Qiang Yu <quic_qianyu@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	"Wenbin Yao (Consultant)" <quic_wenbyao@quicinc.com>,
	vkoul@kernel.org, kishon@kernel.org, p.zabel@pengutronix.de,
	abel.vesa@linaro.org, neil.armstrong@linaro.org,
	manivannan.sadhasivam@linaro.org, quic_devipriy@quicinc.com,
	konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org,
	linux-phy@lists.infradead.org
Subject: Re: [PATCH 2/2] phy: qcom: qmp-pcie: Add PHY register retention support
Date: Fri, 24 Jan 2025 12:38:29 +0530	[thread overview]
Message-ID: <20250124070829.oar3hlkshkpam57d@thinkpad> (raw)
In-Reply-To: <188a9efd-718e-4ac5-b89a-29f2713e1dba@quicinc.com>

+ Mayank (with whom I discussed this topic internally)

On Fri, Jan 24, 2025 at 02:22:01PM +0800, Qiang Yu wrote:
> 
> On 1/22/2025 5:43 PM, Dmitry Baryshkov wrote:
> > On Wed, Jan 22, 2025 at 03:17:39PM +0800, Wenbin Yao (Consultant) wrote:
> > > On 1/21/2025 6:36 PM, Dmitry Baryshkov wrote:
> > > > On Tue, 21 Jan 2025 at 11:43, Wenbin Yao <quic_wenbyao@quicinc.com> wrote:
> > > > > From: Qiang Yu <quic_qianyu@quicinc.com>
> > > > > 
> > > > > Currently, BCR reset and PHY register setting are mandatory for every port
> > > > > before link training. However, some QCOM PCIe PHYs support no_csr reset.
> > > > > Different than BCR reset that is used to reset entire PHY including
> > > > > hardware and register, once no_csr reset is toggled, only PHY hardware will
> > > > > be reset but PHY registers will be retained,
> > > > I'm sorry, I can't parse this.
> > > The difference between no_csr reset and bcr reset is that no_csr reset
> > > doesn't reset the phy registers. If a phy is enabled in UEFI, its registers
> > > are programed. After Linux boot up, the registers will not be reset but
> > > keep the value programmed by UEFI if we only do no_csr reset, so we can
> > > skip phy setting.
> > Please fix capitalization of the abbreviations (PHY, BCR) and add
> > similar text to the commit message.
> > 
> > > > > which means PHY setting can
> > > > > be skipped during PHY init if PCIe link was enabled in booltloader and only
> > > > > no_csr is toggled after that.
> > > > > 
> > > > > Hence, determine whether the PHY has been enabled in bootloader by
> > > > > verifying QPHY_START_CTRL register. If it is programmed and no_csr reset is
> > > > > present, skip BCR reset and PHY register setting, so that PCIe link can be
> > > > > established with no_csr reset only.
> > > > This doesn't tell us why we want to do so. The general rule is not to
> > > > depend on the bootloaders at all. The reason is pretty simple: it is
> > > > hard to update bootloaders, while it is relatively easy to update the
> > > > kernel. If the hardware team issues any kind of changes to the
> > > > programming tables, the kernel will get them earlier than the
> > > > bootloader.
> > > With this change, we don't need to upstream phy setting for all phys
> > > support no_csr reset, this will save a great deal of efforts and simplify
> > > the phy driver. Our goal is to remove proprietary PCIe firmware operations
> > > from kernel. PHY is just the start and will be followed by controller,
> > > clocks, regulators, etc. If program table need to be changed, the place to
> > > do that will be UEFI.
> > Well, that sounds like a very bad idea. Please don't do that. Linux
> > kernel drivers should not depend on the UEFI or a bootloader. Unless
> > there is a good reason for that, Linux should continue to be able to
> > reset and program the PCIe PHY (as well as all other hw blocks).
> I'm wondering if it's really necessary for Linux to be able to program the
> PHY. Perhaps Linux should only care about common aspects defined by the
> PCIe spec like bus scanning, BAR space allocation, and functions provided
> by other PCIe capabilities. As for the specific operations that are
> different on various platforms, it might be more appropriate for the
> firmware to take care of them. This way, the responsibilities can be more
> clearly divided, and the driver could potentially be
> more streamlined.
> 

It is not necessary in an ideal world, but what we have seen is Qcom releasing
updated PHY init sequence after upstreaming the initial PHY driver support. In
that case, the devices with old firmware will become outdated unless the fw is
updated (which is not straightforward compared to updating the kernel).

But, I do like this idea of reusing the PHY init sequence in the kernel. Though
we cannot just do it for all platforms. Maybe we can enable it on platforms like
compute starting from X1E and see how it goes? Just to minimize the impact if it
didn't go well.

> On the other hand, since the no_csr reset can retain register values,
> maybe we should still make full use of it, even if we don't want to
> rely on UEFI. For example, during runtime suspend/resume
> (the D3cold -> D0 cycle)

D3Cold during runtime suspend in bizarre.

>, when re-initializing the PHY, same PHY
> settings will be programmed again. This is a bit redundant.
> 

Hmm, what would happen if the CX collapse happens during system suspend? Will
the PHY registers be retained?

- Mani

-- 
மணிவண்ணன் சதாசிவம்

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2025-01-24  7:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21  9:41 [PATCH 0/2] phy: qcom: qmp-pcie: Add PCIe PHY no_csr reset support Wenbin Yao
2025-01-21  9:41 ` [PATCH 1/2] phy: qcom: pcie: Determine has_nocsr_reset dynamically Wenbin Yao
2025-01-21  9:55   ` Abel Vesa
2025-01-24  7:10   ` Manivannan Sadhasivam
2025-01-21  9:41 ` [PATCH 2/2] phy: qcom: qmp-pcie: Add PHY register retention support Wenbin Yao
2025-01-21 10:36   ` Dmitry Baryshkov
2025-01-22  7:17     ` Wenbin Yao (Consultant)
2025-01-22  9:43       ` Dmitry Baryshkov
2025-01-24  6:22         ` Qiang Yu
2025-01-24  7:08           ` Manivannan Sadhasivam [this message]
2025-01-25 13:10             ` Konrad Dybcio
2025-01-29  8:29               ` neil.armstrong
2025-01-29 11:29                 ` Konrad Dybcio
2025-01-29 13:41                   ` neil.armstrong
2025-01-29 13:55                     ` Konrad Dybcio
2025-01-29 14:19                       ` neil.armstrong
2025-02-08  2:24                         ` 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=20250124070829.oar3hlkshkpam57d@thinkpad \
    --to=mani@kernel.org \
    --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-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=quic_wenbyao@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;
as well as URLs for NNTP newsgroup(s).