[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231018-retainer-unclip-074b81a76767@spud>
Date: Wed, 18 Oct 2023 11:53:55 +0100
From: Conor Dooley <conor@...nel.org>
To: Minda Chen <minda.chen@...rfivetech.com>
Cc: Krzysztof WilczyĆski <kw@...ux.com>,
Rob Herring <robh+dt@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Daire McNamara <daire.mcnamara@...rochip.com>,
Emil Renner Berthing <emil.renner.berthing@...onical.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-pci@...r.kernel.org,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Philipp Zabel <p.zabel@...gutronix.de>,
Mason Huo <mason.huo@...rfivetech.com>,
Leyfoon Tan <leyfoon.tan@...rfivetech.com>,
Kevin Xie <kevin.xie@...rfivetech.com>
Subject: Re: [PATCH v8 13/22] PCI: microchip: Add request_event_irq()
callback function
On Wed, Oct 11, 2023 at 07:05:05PM +0800, Minda Chen wrote:
> PolarFire implements specific interrupts besides PLDA local
> interrupt and register their interrupt symbol name.
> (Total 28
> interrupts while PLDA contain 13 local interrupts). and
> interrupt to event mapping is different.
Nit: drop the ()s & the first .
Daire would have to speak to why this is the case, but these commit
message appears to better explain why the patch is needed.
Acked-by: Conor Dooley <conor.dooley@...rochip.com>
> So add a callback function to support different IRQ register
> function.
>
> Signed-off-by: Minda Chen <minda.chen@...rfivetech.com>
> ---
> .../pci/controller/plda/pcie-microchip-host.c | 25 ++++++++++++++++---
> drivers/pci/controller/plda/pcie-plda.h | 5 ++++
> 2 files changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c
> index 1799455989ac..104332603e25 100644
> --- a/drivers/pci/controller/plda/pcie-microchip-host.c
> +++ b/drivers/pci/controller/plda/pcie-microchip-host.c
> @@ -799,6 +799,17 @@ static int mc_pcie_init_clks(struct device *dev)
> return 0;
> }
>
> +static int mc_request_event_irq(struct plda_pcie_rp *plda, int event_irq,
> + int event)
> +{
> + return devm_request_irq(plda->dev, event_irq, mc_event_handler,
> + 0, event_cause[event].sym, plda);
> +}
> +
> +static const struct plda_event mc_event = {
> + .request_event_irq = mc_request_event_irq,
nit: these spaces for alignment look pointless when there's just one
element.
Cheers,
Conor.
> +};
> +
> static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port)
> {
> struct device *dev = port->dev;
> @@ -898,7 +909,9 @@ static void mc_disable_interrupts(struct mc_pcie *port)
> writel_relaxed(GENMASK(31, 0), bridge_base_addr + ISTATUS_HOST);
> }
>
> -static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_rp *port)
> +static int plda_init_interrupts(struct platform_device *pdev,
> + struct plda_pcie_rp *port,
> + const struct plda_event *event)
> {
> struct device *dev = &pdev->dev;
> int irq;
> @@ -922,8 +935,12 @@ static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_r
> return -ENXIO;
> }
>
> - ret = devm_request_irq(dev, event_irq, mc_event_handler,
> - 0, event_cause[i].sym, port);
> + if (event->request_event_irq)
> + ret = event->request_event_irq(port, event_irq, i);
> + else
> + ret = devm_request_irq(dev, event_irq, plda_event_handler,
> + 0, NULL, port);
> +
> if (ret) {
> dev_err(dev, "failed to request IRQ %d\n", event_irq);
> return ret;
> @@ -977,7 +994,7 @@ static int mc_platform_init(struct pci_config_window *cfg)
> return ret;
>
> /* Address translation is up; safe to enable interrupts */
> - ret = plda_init_interrupts(pdev, &port->plda);
> + ret = plda_init_interrupts(pdev, &port->plda, &mc_event);
> if (ret)
> return ret;
>
> diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h
> index b439160448b1..907ad40f3188 100644
> --- a/drivers/pci/controller/plda/pcie-plda.h
> +++ b/drivers/pci/controller/plda/pcie-plda.h
> @@ -121,6 +121,11 @@ struct plda_pcie_rp {
> int num_events;
> };
>
> +struct plda_event {
> + int (*request_event_irq)(struct plda_pcie_rp *pcie,
> + int event_irq, int event);
> +};
> +
> irqreturn_t plda_event_handler(int irq, void *dev_id);
> void plda_pcie_setup_window(void __iomem *bridge_base_addr, u32 index,
> phys_addr_t axi_addr, phys_addr_t pci_addr,
> --
> 2.17.1
>
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists