Re: [PATCH v2 2/2] PCI: dwc: rcar-gen4: Use .post_deinit to handle dw_pcie_ep_init() failures

Marek Vasut <[email protected]>
Newsgroups org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <[email protected]>
On 8/20/26 10:11 AM, Koichiro Den wrote:

Hello Den-san,

> On Thu, Aug 20, 2026 at 05:57:56AM +0200, Marek Vasut wrote:
>> Implement .post_deinit() callback in R-Car Gen4 struct dw_pcie_ep_ops {}
>> which asserts reset and stops the clock. This undoes start of clock and
>> deassert of reset performed in .pre_init() in case dw_pcie_ep_init() fails
>> after successful call of .pre_init() callback.
>>
>> The use of .post_deinit() callback correctly handles the clock and reset
>> stop, unlike the call of rcar_gen4_pcie_ep_deinit() in dw_pcie_ep_init()
>> which could not discern at which point the dw_pcie_ep_init() failed and
>> might have attempted to stop clock and assert reset twice, remove it.
>>
>> Since dw_pcie_ep_deinit() also invokes the .post_deinit() callback, drop
>> calls to rcar_gen4_pcie_ep_deinit() in both rcar_gen4_add_dw_pcie_ep()
>> dw_pcie_ep_init_registers() fail path and rcar_gen4_remove_dw_pcie_ep()
>> to avoid duplicate stop of clock and assert of reset, and drop no longer
>> used rcar_gen4_pcie_ep_deinit() entirely.
>>
>> Initialize PCIEDMAINTSTSEN early in rcar_gen4_pcie_ep_pre_init() to 0,
>> to make sure that edma_int bits will never be set in case of failure
> 
> I think s/will never be set/will never be left set/, because .pre_init() writes
> 0xffff before later initialization can fail, and .post_deinit() then sets it
> back to 0. Otherwise LGTM.
> 
> (Again, I did some quick tests on an S4 Spider, covering the normal path and
> several injected failure paths. I don't have V4H hardware, though.)
> Please feel free to pick either or both tags, if that helps.
> 
> Reviewed-by: Koichiro Den <[email protected]>
> Tested-by: Koichiro Den <[email protected]>

I have updated the commit message and collected the tags, thank you !

-- 
Best regards,
Marek Vasut
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.