linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-pci <linux-pci@vger.kernel.org>,
	Marek Vasut <marek.vasut+renesas@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH V3] PCI: rcar: Add L1 link state fix into data abort hook
Date: Tue, 13 Oct 2020 20:32:32 +0200	[thread overview]
Message-ID: <82915d16-e873-be7e-d04f-0eba60b71f70@gmail.com> (raw)
In-Reply-To: <CAMuHMdU0xF3rMNMqn54cF7eOS8JuHDh9WFNTJi5ftq4ypHBeHg@mail.gmail.com>

On 10/12/20 9:18 AM, Geert Uytterhoeven wrote:

[...]

>> --- a/drivers/pci/controller/pcie-rcar-host.c
>> +++ b/drivers/pci/controller/pcie-rcar-host.c
> 
>> @@ -1050,4 +1072,58 @@ static struct platform_driver rcar_pcie_driver = {
>>         },
>>         .probe = rcar_pcie_probe,
>>  };
>> +
>> +#ifdef CONFIG_ARM
>> +static int rcar_pcie_aarch32_abort_handler(unsigned long addr,
>> +               unsigned int fsr, struct pt_regs *regs)
>> +{
>> +       u32 pmsr;
>> +
>> +       if (!pcie_base || !__clk_is_enabled(pcie_bus_clk))
>> +               return 1;
>> +
>> +       pmsr = readl(pcie_base + PMSR);
>> +
>> +       /*
>> +        * Test if the PCIe controller received PM_ENTER_L1 DLLP and
>> +        * the PCIe controller is not in L1 link state. If true, apply
>> +        * fix, which will put the controller into L1 link state, from
>> +        * which it can return to L0s/L0 on its own.
>> +        */
>> +       if ((pmsr & PMEL1RX) && ((pmsr & PMSTATE) != PMSTATE_L1)) {
>> +               writel(L1IATN, pcie_base + PMCTLR);
>> +               while (!(readl(pcie_base + PMSR) & L1FAEG))
>> +                       ;
>> +               writel(L1FAEG | PMEL1RX, pcie_base + PMSR);
>> +               return 0;
>> +       }
>> +
>> +       return 1;
>> +}
>> +
>> +static const struct of_device_id rcar_pcie_abort_handler_of_match[] = {
> 
> __initconst (if you intend to keep this, see below).

I do, see below.

>> +       { .compatible = "renesas,pcie-r8a7779" },
>> +       { .compatible = "renesas,pcie-r8a7790" },
>> +       { .compatible = "renesas,pcie-r8a7791" },
>> +       { .compatible = "renesas,pcie-rcar-gen2" },
>> +       {},
>> +};
>> +
>> +static int __init rcar_pcie_init(void)
>> +{
>> +       if (of_find_matching_node(NULL, rcar_pcie_abort_handler_of_match)) {
> 
> I guess it doesn't really hurt to use the existing rcar_pcie_of_match[]
> instead? It just contains two additional entries, which will never match
> in the CONFIG_ARM=y case.

Unless you try to build 32bit kernel for the R-Car3, like they do e.g.
for RPi3. So I would prefer to keep this to handle that case too.

[...]

      reply	other threads:[~2020-10-13 18:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-11 16:00 [PATCH V3] PCI: rcar: Add L1 link state fix into data abort hook marek.vasut
2020-10-12  7:18 ` Geert Uytterhoeven
2020-10-13 18:32   ` Marek Vasut [this message]

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=82915d16-e873-be7e-d04f-0eba60b71f70@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=wsa@the-dreams.de \
    --cc=yoshihiro.shimoda.uh@renesas.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).