[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <092f5cd4-ff29-4a70-82ca-6044a72d5f11@foss.st.com>
Date: Tue, 14 Jan 2025 13:10:52 +0100
From: Christian Bruel <christian.bruel@...s.st.com>
To: Bjorn Helgaas <helgaas@...nel.org>
CC: <lpieralisi@...nel.org>, <kw@...ux.com>,
<manivannan.sadhasivam@...aro.org>, <robh@...nel.org>,
<bhelgaas@...gle.com>, <krzk+dt@...nel.org>, <conor+dt@...nel.org>,
<mcoquelin.stm32@...il.com>, <alexandre.torgue@...s.st.com>,
<p.zabel@...gutronix.de>, <cassel@...nel.org>,
<quic_schintav@...cinc.com>, <fabrice.gasnier@...s.st.com>,
<linux-pci@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 4/5] PCI: stm32: Add PCIe endpoint support for
STM32MP25
On 12/5/24 18:27, Bjorn Helgaas wrote:
> On Tue, Nov 26, 2024 at 04:51:18PM +0100, Christian Bruel wrote:
>> +static void stm32_pcie_ep_init(struct dw_pcie_ep *ep)
>> +{
>> + struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
>> + struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
>> + enum pci_barno bar;
>> +
>> + for (bar = 0; bar < PCI_STD_NUM_BARS; bar++)
>> + dw_pcie_ep_reset_bar(pci, bar);
>> +
>> + /* Defer Completion Requests until link started */
>
> I asked about this before [1] but didn't finish the conversation. My
> main point is that I think "Completion Request" is a misnomer.
> There's a "Configuration Request" and a "Completion," but no such
> thing as a "Completion Request."
>
> Based on your previous response, I think this should say something
> like "respond to config requests with Request Retry Status (RRS) until
> we're prepared to handle them."
>
>> + regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
>> + STM32MP25_PCIECR_REQ_RETRY_EN,
>> + STM32MP25_PCIECR_REQ_RETRY_EN);
>> +}
>> +
>> +static int stm32_pcie_enable_link(struct dw_pcie *pci)
>> +{
>> + struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
>> + int ret;
>> +
>> + regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
>> + STM32MP25_PCIECR_LTSSM_EN,
>> + STM32MP25_PCIECR_LTSSM_EN);
>> +
>> + ret = dw_pcie_wait_for_link(pci);
>> + if (ret)
>> + return ret;
>> +
>> + regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
>> + STM32MP25_PCIECR_REQ_RETRY_EN,
>> + 0);
>
> And I assume this means the endpoint will accept config requests and
> handle them normally instead of responding with RRS.
>
> Strictly speaking this is a different condition than "the link is up"
> because the link must be up in order to even receive a config request.
> The purpose of RRS is for devices that need more initialization time
> after the link is up before they can respond to config requests.
>
> The fact that the hardware provides this bit makes me think the
> designer anticipated that the link might come up before the rest of
> the device is fully initialized.
You are correct and I am unable to reproduce a scenario where this is
still required.
Upon reviewing the history, I initially implemented this to address a
dependency issue in the original code, where enable_link was invoked
prematurely following the deassertion of PERST, as soon as the host was
ready but before the device configuration space was initialized, so host
enumeration was wrong.
Since then, the perst_irq is enabled by start_link. Consequently, the
initialization, enable_link, and enumeration sequence is now correct
This bit is useless and can be dropped
Thank you for identifying it.
Christian
>
> Bjorn
>
> [1] https://lore.kernel.org/r/20241112203846.GA1856246@bhelgaas
>
Powered by blists - more mailing lists