# Re: \[PATCH AUTOSEL 5.14 12/32\] PCI: rcar: Add L1 link state fix into data abort hook

- From: Marek Vasut \<hidden\>
- Date: 2021-09-11 16:05:42 
- List: stable
- Page: https://ratatoskr.run/stable/2021/09/1504284
- Thread: https://ratatoskr.run/stable/2021/09/1504079/t.md

```text
On 9/11/21 3:11 PM, Sasha Levin wrote:
> From: Marek Vasut <marek.vasut+renesas@gmail.com>
>
> [ Upstream commit a115b1bd3af0c2963e72f6e47143724c59251be6 ]
>
> When the link is in L1, hardware should return it to L0
> automatically whenever a transaction targets a component on the
> other end of the link (PCIe r5.0, sec 5.2).
>
> The R-Car PCIe controller doesn't handle this transition correctly.
> If the link is not in L0, an MMIO transaction targeting a downstream
> device fails, and the controller reports an ARM imprecise external
> abort.
>
> Work around this by hooking the abort handler so the driver can
> detect this situation and help the hardware complete the link state
> transition.
>
> When the R-Car controller receives a PM_ENTER_L1 DLLP from the
> downstream component, it sets PMEL1RX bit in PMSR register, but then
> the controller enters some sort of in-between state.  A subsequent
> MMIO transaction will fail, resulting in the external abort.  The
> abort handler detects this condition and completes the link state
> transition by setting the L1IATN bit in PMCTLR and waiting for the
> link state transition to complete.

You will also need the following patch, otherwise the build will fail on configurations without COMMON_CLK (none where this driver is used, but happened on one of the build bots). I'm waiting for PCIe maintainers to pick it up:
https://patchwork.kernel.org/project/linux-pci/patch/20210907144512.5238-1-marek.vasut@gmail.com/
```
