From: Bjorn Helgaas <helgaas@kernel.org>
To: "Hui Ma (马慧)" <Hui.Ma@airoha.com>
Cc: "Lorenzo Bianconi" <lorenzo@kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"Ryder Lee" <Ryder.Lee@mediatek.com>,
"Jianjun Wang (王建军)" <Jianjun.Wang@mediatek.com>,
"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
"kw@linux.com" <kw@linux.com>,
"robh@kernel.org" <robh@kernel.org>,
"bhelgaas@google.com" <bhelgaas@google.com>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"lorenzo.bianconi83@gmail.com" <lorenzo.bianconi83@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"krzysztof.kozlowski+dt@linaro.org"
<krzysztof.kozlowski+dt@linaro.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"nbd@nbd.name" <nbd@nbd.name>, "dd@embedd.com" <dd@embedd.com>,
upstream <upstream@airoha.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>
Subject: Re: 回复: [PATCH v4 4/4] PCI: mediatek-gen3: Add Airoha EN7581 support
Date: Fri, 8 Nov 2024 10:33:38 -0600 [thread overview]
Message-ID: <20241108163338.GA1663274@bhelgaas> (raw)
In-Reply-To: <KL1PR03MB6350EF22DE289B293D34FD6FFF5D2@KL1PR03MB6350.apcprd03.prod.outlook.com>
On Fri, Nov 08, 2024 at 01:23:35AM +0000, Hui Ma (马慧) wrote:
> > On Thu, Nov 07, 2024 at 05:21:45PM +0100, Lorenzo Bianconi wrote:
> > > On Nov 07, Bjorn Helgaas wrote:
> > > > On Thu, Nov 07, 2024 at 08:39:43AM +0100, Lorenzo Bianconi wrote:
> > > > > > On Wed, Nov 06, 2024 at 11:40:28PM +0100, Lorenzo Bianconi wrote:
> > > > > > > > On Wed, Jul 03, 2024 at 06:12:44PM +0200, Lorenzo Bianconi wrote:
> > > > > > > > > Introduce support for Airoha EN7581 PCIe controller to
> > > > > > > > > mediatek-gen3 PCIe controller driver.
> > > > > > > > > ...
> > > >
> > > > > > > > Is this where PERST# is asserted? If so, a comment to
> > > > > > > > that effect would be helpful. Where is PERST# deasserted?
> > > > > > > > Where are the required delays before deassert done?
> > > > > > >
> > > > > > > I can add a comment in en7581_pci_enable() describing the
> > > > > > > PERST issue for EN7581. Please note we have a 250ms delay in
> > > > > > > en7581_pci_enable() after configuring REG_PCI_CONTROL register.
> > > > > > >
> > > > > > > https://github.com/torvalds/linux/blob/master/drivers/clk/cl
> > > > > > > k-en7523.c#L396
> > > > > >
> > > > > > Does that 250ms delay correspond to a PCIe mandatory delay,
> > > > > > e.g., something like PCIE_T_PVPERL_MS? I think it would be
> > > > > > nice to have the required PCI delays in this driver if
> > > > > > possible so it's easy to verify that they are all covered.
> > > > >
> > > > > IIRC I just used the delay value used in the vendor sdk. I
> > > > > do not have a strong opinion about it but I guess if we move
> > > > > it in the pcie-mediatek-gen3 driver, we will need to add it
> > > > > in each driver where this clock is used. What do you think?
> > > >
> > > > I don't know what the 250ms delay is for. If it is for a required
> > > > PCI delay, we should use the relevant standard #define for it, and
> > > > it should be in the PCI controller driver. Otherwise it's
> > > > impossible to verify that all the drivers are doing the correct delays.
> > >
> > > ack, fine to me. Do you prefer to keep 250ms after
> > > clk_bulk_prepare_enable() in mtk_pcie_en7581_power_up() or just use PCIE_T_PVPERL_MS (100)?
> > > I can check if 100ms works properly.
> >
> > It's not clear to me where the relevant events are for these chips.
> >
> > Do you have access to the PCIe CEM spec? The diagram in r6.0, sec
> > 2.2.1, is helpful. It shows the required timings for Power Stable,
> > REFCLK Stable, PERST# deassert, etc.
> >
> > Per sec 2.11.2, PERST# must be asserted for at least 100us (T_PERST),
> > PERST# must be asserted for at least 100ms after Power Stable
> > (T_PVPERL), and PERST# must be asserted for at least 100us after
> > REFCLK Stable.
> >
> > It would be helpful if we could tell by reading the source where some
> > of these critical events happen, and that the relevant delays are
> > there. For example, if PERST# is asserted/deasserted by
> > "clk_enable()" or similar, it's not at all obvious from the code, so
> > we should have a comment to that effect.
>
> >I reviewed the vendor sdk and it just do something like in clk_enable():
> >
> > ...
> > val = readl(0x88);
> > writel(val | BIT(16) | BIT(29) | BIT(26), 0x88);
> > /*wait link up*/
> > mdelay(1000);
> > ...
> >
> >@Hui.Ma: is it fine use msleep(100) (so PCIE_T_PVPERL_MS) instead
> >of msleep(1000) (so PCIE_LINK_RETRAIN_TIMEOUT_MS)?
>
> I think msleep(1000) will be safer, because some device won't
> link up with msleep(100).
Do you have details about this? I guess it only hurts mediatek, but
increasing the minimum time to bring up a PCI hierarchy by almost an
entire second is a pretty big deal.
If this delay corresponds to the required T_PVPERL delay and 100ms
isn't enough for some endpoints, those endpoints should fail with many
host controllers, not just mediatek, so I would suspect the mediatek
controller or a certain platform, not the endpoint itself.
If this corresponds to T_PVPERL and mediatek needs longer, I would
document that by using "PCIE_T_PVPERL_MS * 10" and adding a comment
about why (affected platform/device, hardware erratum, etc).
Bottom line, I don't really care what the value is, but I *would* like
to be able to read pcie-mediatek-gen3.c and see the point where PCI
power is stable, a delay of at least T_PVPERL, and where PERST# is
deasserted because that's the main timing requirement on software.
Bjorn
next prev parent reply other threads:[~2024-11-08 16:33 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 16:12 [PATCH v4 0/4] Add Airoha EN7581 PCIe support Lorenzo Bianconi
2024-07-03 16:12 ` [PATCH v4 1/4] dt-bindings: PCI: mediatek-gen3: add support for Airoha EN7581 Lorenzo Bianconi
2024-07-04 8:23 ` AngeloGioacchino Del Regno
2024-07-10 6:22 ` Jianjun Wang (王建军)
2024-07-03 16:12 ` [PATCH v4 2/4] PCI: mediatek-gen3: Add mtk_gen3_pcie_pdata data structure Lorenzo Bianconi
2024-07-10 6:26 ` Jianjun Wang (王建军)
2024-07-03 16:12 ` [PATCH v4 3/4] PCI: mediatek-gen3: Rely on reset_bulk APIs for PHY reset lines Lorenzo Bianconi
2024-07-10 6:41 ` Jianjun Wang (王建军)
2024-07-03 16:12 ` [PATCH v4 4/4] PCI: mediatek-gen3: Add Airoha EN7581 support Lorenzo Bianconi
2024-07-10 7:02 ` Jianjun Wang (王建军)
2024-11-05 21:33 ` Bjorn Helgaas
2024-11-06 23:00 ` Jim Quinlan
2024-11-06 23:40 ` Bjorn Helgaas
2024-11-06 20:32 ` Bjorn Helgaas
2024-11-06 22:40 ` Lorenzo Bianconi
2024-11-06 23:31 ` Bjorn Helgaas
2024-11-07 7:39 ` Lorenzo Bianconi
2024-11-07 15:17 ` Bjorn Helgaas
2024-11-07 16:21 ` Lorenzo Bianconi
2024-11-07 16:46 ` Bjorn Helgaas
2024-11-07 21:56 ` Lorenzo Bianconi
2024-11-08 1:23 ` 回复: " Hui Ma (马慧)
2024-11-08 16:33 ` Bjorn Helgaas [this message]
2024-11-09 9:40 ` Lorenzo Bianconi
2024-11-11 2:16 ` 回复: " Hui Ma (马慧)
2024-08-20 8:46 ` [PATCH v4 0/4] Add Airoha EN7581 PCIe support Lorenzo Bianconi
2024-08-20 14:01 ` Bjorn Helgaas
2024-09-03 13:47 ` Krzysztof Wilczyński
2024-09-03 13:45 ` Krzysztof Wilczyński
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=20241108163338.GA1663274@bhelgaas \
--to=helgaas@kernel.org \
--cc=Hui.Ma@airoha.com \
--cc=Jianjun.Wang@mediatek.com \
--cc=Ryder.Lee@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bhelgaas@google.com \
--cc=dd@embedd.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.bianconi83@gmail.com \
--cc=lorenzo@kernel.org \
--cc=lpieralisi@kernel.org \
--cc=nbd@nbd.name \
--cc=robh@kernel.org \
--cc=upstream@airoha.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).