From: Wenrui Li <wenrui.li@rock-chips.com>
To: Marc Zyngier <marc.zyngier@arm.com>,
Shawn Lin <shawn.lin@rock-chips.com>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: Heiko Stuebner <heiko@sntech.de>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, Doug Anderson <dianders@chromium.org>,
linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-kernel@vger.kernel.org,
Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>
Subject: Re: [PATCH 2/2] pci: Add PCIe driver for Rockchip Soc
Date: Wed, 1 Jun 2016 10:56:53 +0800 [thread overview]
Message-ID: <574E4EF5.7040005@rock-chips.com> (raw)
In-Reply-To: <57483CAA.8000005@arm.com>
Hi:
On 2016/5/27 20:25, Marc Zyngier Wrote:
> [+Lorenzo]
>
> On 20/05/16 11:29, Shawn Lin wrote:
>> RK3399 has a PCIe controller which can be used as Root Complex.
>> This driver supports a PCIe controller as Root Complex mode.
>>
[....]
>> +static int rockchip_pcie_init_irq_domain(struct rockchip_pcie_port *pp)
>> +{
>> + struct device *dev = pp->dev;
>> + struct device_node *node = dev->of_node;
>> + struct device_node *pcie_intc_node = of_get_next_child(node, NULL);
>
> That's really ugly, as it depends on the layout of your DT.
>
>> +
>> + if (!pcie_intc_node) {
>> + dev_err(dev, "No PCIe Intc node found\n");
>> + return PTR_ERR(pcie_intc_node);
>> + }
>> + pp->irq_domain = irq_domain_add_linear(pcie_intc_node, 4,
>> + &intx_domain_ops, pp);
>
> Why can't you just register your host controller as the interrupt
> controller? You don't need an intermediate node for that.
OK, the child node is really no need here, we will use the host
controller as interrupt controller next patch. Thanks!
>
>> + if (!pp->irq_domain) {
>> + dev_err(dev, "Failed to get a INTx IRQ domain\n");
>> + return PTR_ERR(pp->irq_domain);
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static irqreturn_t rockchip_pcie_subsys_irq_handler(int irq, void *arg)
>> +{
>> + struct rockchip_pcie_port *pp = arg;
>> + u32 reg;
>> + u32 sub_reg;
>> +
>> + reg = pcie_read(pp, PCIE_CLIENT_INT_STATUS);
>> + if (reg & LOC_INT) {
>> + dev_dbg(pp->dev, "local interrupt recived\n");
>> + sub_reg = pcie_read(pp, PCIE_CORE_INT_STATUS);
>> + if (sub_reg & PRFPE)
>> + dev_dbg(pp->dev, "Parity error detected while reading from the PNP Receive FIFO RAM\n");
>> +
>> + if (sub_reg & CRFPE)
>> + dev_dbg(pp->dev, "Parity error detected while reading from the Completion Receive FIFO RAM\n");
>> +
>> + if (sub_reg & RRPE)
>> + dev_dbg(pp->dev, "Parity error detected while reading from Replay Buffer RAM\n");
>> +
>> + if (sub_reg & PRFO)
>> + dev_dbg(pp->dev, "Overflow occurred in the PNP Receive FIFO\n");
>> +
>> + if (sub_reg & CRFO)
>> + dev_dbg(pp->dev, "Overflow occurred in the Completion Receive FIFO\n");
>> +
>> + if (sub_reg & RT)
>> + dev_dbg(pp->dev, "Replay timer timed out\n");
>> +
>> + if (sub_reg & RTR)
>> + dev_dbg(pp->dev, "Replay timer rolled over after 4 transmissions of the same TLP\n");
>> +
>> + if (sub_reg & PE)
>> + dev_dbg(pp->dev, "Phy error detected on receive side\n");
>> +
>> + if (sub_reg & MTR)
>> + dev_dbg(pp->dev, "Malformed TLP received from the link\n");
>> +
>> + if (sub_reg & UCR)
>> + dev_dbg(pp->dev, "Malformed TLP received from the link\n");
>> +
>> + if (sub_reg & FCE)
>> + dev_dbg(pp->dev, "An error was observed in the flow control advertisements from the other side\n");
>> +
>> + if (sub_reg & CT)
>> + dev_dbg(pp->dev, "A request timed out waiting for completion\n");
>> +
>> + if (sub_reg & UTC)
>> + dev_dbg(pp->dev, "Unmapped TC error\n");
>> +
>> + if (sub_reg & MMVC)
>> + dev_dbg(pp->dev, "MSI mask register changes\n");
>> +
>> + pcie_write(pp, sub_reg, PCIE_CORE_INT_STATUS);
>> + }
>> +
>> + pcie_write(pp, reg, PCIE_CLIENT_INT_STATUS);
>> +
>> + return IRQ_HANDLED;
>> +}
[....]
>> +static irqreturn_t rockchip_pcie_legacy_int_handler(int irq, void *arg)
>> +{
>> + struct rockchip_pcie_port *pp = arg;
>> + u32 reg;
>> +
>> + reg = pcie_read(pp, PCIE_CLIENT_INT_STATUS);
>> + reg = (reg & ROCKCHIP_PCIE_RPIFR1_INTR_MASK) >>
>> + ROCKCHIP_PCIE_RPIFR1_INTR_SHIFT;
>> + generic_handle_irq(irq_find_mapping(pp->irq_domain, ffs(reg)));
>
> NAK. What you have here is a chained interrupt controller, please
> implement it as such.
Your mean is use handle_nested_irq instead of generic_handle_irq here?
But, I found all other pci host controller drivers use this api.
>
>> +
>> + pcie_write(pp, reg, PCIE_CLIENT_INT_STATUS);
>> + return IRQ_HANDLED;
>> +}
>> +
[...]
>> +static struct platform_driver rockchip_pcie_driver = {
>> + .driver = {
>> + .name = "rockchip-pcie",
>> + .of_match_table = rockchip_pcie_of_match,
>> + .suppress_bind_attrs = true,
>> + },
>> + .probe = rockchip_pcie_probe,
>> + .remove = rockchip_pcie_remove,
>> +};
>> +module_platform_driver(rockchip_pcie_driver);
>> +
>> +MODULE_AUTHOR("Rockchip Inc");
>> +MODULE_DESCRIPTION("Rockchip AXI PCIe driver");
>> +MODULE_LICENSE("GPL v2");
>>
>
> This definitely requires some rework for both the interrupt and MSI
> parts. I'll leave Lorenzo to comment on the PCI side of things.
>
> Thanks,
>
> M.
>
Best Regards,
Li
next prev parent reply other threads:[~2016-06-01 2:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-20 10:28 [PATCH 0/2] Add Rockchip PCIe RC controller support Shawn Lin
2016-05-20 10:29 ` [PATCH 1/2] Documentation: add binding description of Rockchip PCIe controller Shawn Lin
2016-05-20 11:20 ` Heiko Stuebner
2016-05-21 3:55 ` Shawn Lin
2016-05-23 19:53 ` Heiko Stuebner
2016-05-24 1:42 ` Shawn Lin
2016-05-30 11:08 ` Marc Zyngier
[not found] ` <c6fa65a1-58bd-520a-42a1-d6edf576840a@kernel-upstream.org>
2016-05-31 10:09 ` Marc Zyngier
2016-05-20 10:29 ` [PATCH 2/2] pci: Add PCIe driver for Rockchip Soc Shawn Lin
2016-05-20 21:13 ` Heiko Stuebner
2016-05-23 0:48 ` Shawn Lin
2016-05-23 3:27 ` Shawn Lin
2016-05-23 15:15 ` Bharat Kumar Gogada
2016-05-24 1:28 ` Shawn Lin
2016-05-24 13:03 ` Arnd Bergmann
2016-05-27 6:48 ` Wenrui Li
2016-05-27 7:13 ` Bharat Kumar Gogada
2016-05-27 10:31 ` Wenrui Li
2016-06-01 8:24 ` Arnd Bergmann
2016-06-01 9:57 ` Shawn Lin
2016-06-01 12:24 ` Arnd Bergmann
2016-05-26 19:00 ` [2/2] " Rajat Jain
2016-05-27 12:25 ` [PATCH 2/2] " Marc Zyngier
2016-06-01 2:56 ` Wenrui Li [this message]
2016-06-01 8:34 ` Marc Zyngier
2016-06-03 8:55 ` Lorenzo Pieralisi
2016-06-03 9:01 ` Marc Zyngier
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=574E4EF5.7040005@rock-chips.com \
--to=wenrui.li@rock-chips.com \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=robh+dt@kernel.org \
--cc=shawn.lin@rock-chips.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