PCI: microchip: Add request_event_irq() callback function
As the PLDA DT binding doc (Documentation/devicetree/bindings/pci/ plda,xpressrich3-axi-common.yaml) shows, the PLDA IP contains an interrupt controller. Microchip PolarFire add some interrupts based on PLDA interrupt controller. The Microchip PolarFire PCIe additional interrupts (defined in drivers/pci/controller/plda/pcie-microchip-host.c): EVENT_PCIE_L2_EXIT EVENT_PCIE_HOTRST_EXIT EVENT_PCIE_DLUP_EXIT EVENT_SEC_TX_RAM_SEC_ERR EVENT_SEC_RX_RAM_SEC_ERR ... Both event_cause[] and mc_event_handler() contain additional interrupt symbol names; these can not be re-used. Add a new plda_event_handler() function, which implements PLDA interrupt defalt handler, and add a request_event_irq() callback function for Microchip PolarFire additional interrupts. [kwilczynski, bhelgaas: commit log] Link: https://lore.kernel.org/linux-pci/20240328091835.14797-13-minda.chen@starfivetech.com Signed-off-by: Minda Chen <minda.chen@starfivetech.com> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Conor Dooley <conor.dooley@microchip.com>
This commit is contained in:
parent
d4078c87a5
commit
6476904796
@ -642,6 +642,11 @@ static irqreturn_t mc_event_handler(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static irqreturn_t plda_event_handler(int irq, void *dev_id)
|
||||
{
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static void plda_handle_event(struct irq_desc *desc)
|
||||
{
|
||||
struct plda_pcie_rp *port = irq_desc_get_handler_data(desc);
|
||||
@ -803,6 +808,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,
|
||||
};
|
||||
|
||||
static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port)
|
||||
{
|
||||
struct device *dev = port->dev;
|
||||
@ -904,7 +920,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;
|
||||
@ -928,8 +946,13 @@ 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;
|
||||
@ -982,7 +1005,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;
|
||||
|
||||
|
@ -127,6 +127,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);
|
||||
};
|
||||
|
||||
void plda_pcie_setup_window(void __iomem *bridge_base_addr, u32 index,
|
||||
phys_addr_t axi_addr, phys_addr_t pci_addr,
|
||||
size_t size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user