From: Nazim Amirul Enable TX/RX channel interrupt registration for MAC that interrupts CPU through shared peripheral interrupt (SPI). Per-channel interrupts and interrupt-names are registered as follows, e.g. 4 TX and 4 RX channels: interrupts = , , , , , , , ; interrupt-names = "dma_tx0", "dma_tx1", "dma_tx2", "dma_tx3", "dma_rx0", "dma_rx1", "dma_rx2", "dma_rx3"; Signed-off-by: Nazim Amirul --- Changes in v3: - Add net-next tree prefix to subject line. - Fix variable declarations to follow Reverse Christmas Tree order. Changes in v2: - Use -ENXIO to detect when interrupt name is not present, and return any other negative error code to the caller. --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 5cae2aa72906..9039e207ddbd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -732,6 +732,9 @@ static int stmmac_pltfr_get_irq_array(struct platform_device *pdev, int stmmac_get_platform_resources(struct platform_device *pdev, struct stmmac_resources *stmmac_res) { + char irq_name[9]; + int ret; + int irq; + int i; memset(stmmac_res, 0, sizeof(*stmmac_res)); @@ -767,6 +770,30 @@ int stmmac_get_platform_resources(struct platform_device *pdev, dev_info(&pdev->dev, "IRQ sfty not found\n"); } + /* For RX Channel */ + for (i = 0; i < MTL_MAX_RX_QUEUES; i++) { + snprintf(irq_name, sizeof(irq_name), "dma_rx%i", i); + irq = platform_get_irq_byname_optional(pdev, irq_name); + if (irq == -ENXIO) + break; + else if (irq < 0) + return irq; + + stmmac_res->rx_irq[i] = irq; + } + + /* For TX Channel */ + for (i = 0; i < MTL_MAX_TX_QUEUES; i++) { + snprintf(irq_name, sizeof(irq_name), "dma_tx%i", i); + irq = platform_get_irq_byname_optional(pdev, irq_name); + if (irq == -ENXIO) + break; + else if (irq < 0) + return irq; + + stmmac_res->tx_irq[i] = irq; + } + stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(stmmac_res->addr)) -- 2.43.7