Skip to content

Commit 6476904

Browse files
mindachen1987bjorn-helgaas
authored andcommitted
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/[email protected] Signed-off-by: Minda Chen <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Conor Dooley <[email protected]>
1 parent d4078c8 commit 6476904

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

drivers/pci/controller/plda/pcie-microchip-host.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,11 @@ static irqreturn_t mc_event_handler(int irq, void *dev_id)
642642
return IRQ_HANDLED;
643643
}
644644

645+
static irqreturn_t plda_event_handler(int irq, void *dev_id)
646+
{
647+
return IRQ_HANDLED;
648+
}
649+
645650
static void plda_handle_event(struct irq_desc *desc)
646651
{
647652
struct plda_pcie_rp *port = irq_desc_get_handler_data(desc);
@@ -803,6 +808,17 @@ static int mc_pcie_init_clks(struct device *dev)
803808
return 0;
804809
}
805810

811+
static int mc_request_event_irq(struct plda_pcie_rp *plda, int event_irq,
812+
int event)
813+
{
814+
return devm_request_irq(plda->dev, event_irq, mc_event_handler,
815+
0, event_cause[event].sym, plda);
816+
}
817+
818+
static const struct plda_event mc_event = {
819+
.request_event_irq = mc_request_event_irq,
820+
};
821+
806822
static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port)
807823
{
808824
struct device *dev = port->dev;
@@ -904,7 +920,9 @@ static void mc_disable_interrupts(struct mc_pcie *port)
904920
writel_relaxed(GENMASK(31, 0), bridge_base_addr + ISTATUS_HOST);
905921
}
906922

907-
static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_rp *port)
923+
static int plda_init_interrupts(struct platform_device *pdev,
924+
struct plda_pcie_rp *port,
925+
const struct plda_event *event)
908926
{
909927
struct device *dev = &pdev->dev;
910928
int irq;
@@ -928,8 +946,13 @@ static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_r
928946
return -ENXIO;
929947
}
930948

931-
ret = devm_request_irq(dev, event_irq, mc_event_handler,
932-
0, event_cause[i].sym, port);
949+
if (event->request_event_irq)
950+
ret = event->request_event_irq(port, event_irq, i);
951+
else
952+
ret = devm_request_irq(dev, event_irq,
953+
plda_event_handler,
954+
0, NULL, port);
955+
933956
if (ret) {
934957
dev_err(dev, "failed to request IRQ %d\n", event_irq);
935958
return ret;
@@ -982,7 +1005,7 @@ static int mc_platform_init(struct pci_config_window *cfg)
9821005
return ret;
9831006

9841007
/* Address translation is up; safe to enable interrupts */
985-
ret = plda_init_interrupts(pdev, &port->plda);
1008+
ret = plda_init_interrupts(pdev, &port->plda, &mc_event);
9861009
if (ret)
9871010
return ret;
9881011

drivers/pci/controller/plda/pcie-plda.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ struct plda_pcie_rp {
127127
int num_events;
128128
};
129129

130+
struct plda_event {
131+
int (*request_event_irq)(struct plda_pcie_rp *pcie,
132+
int event_irq, int event);
133+
};
134+
130135
void plda_pcie_setup_window(void __iomem *bridge_base_addr, u32 index,
131136
phys_addr_t axi_addr, phys_addr_t pci_addr,
132137
size_t size);

0 commit comments

Comments
 (0)