From patchwork Fri Jan 2 18:10:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 425022 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A92151400F1 for ; Sat, 3 Jan 2015 05:11:12 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752197AbbABSLI (ORCPT ); Fri, 2 Jan 2015 13:11:08 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:46872 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750736AbbABSLE (ORCPT ); Fri, 2 Jan 2015 13:11:04 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t02IB2jZ001180; Fri, 2 Jan 2015 12:11:02 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t02IB2mw020218; Fri, 2 Jan 2015 12:11:02 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 2 Jan 2015 12:11:01 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t02IB0ou019627; Fri, 2 Jan 2015 12:11:01 -0600 From: Felipe Balbi To: David Miller CC: Mugunthan V N , Yegor Yefremov , Linux OMAP Mailing List , , Felipe Balbi Subject: [PATCH 3/4] net: ethernet: cpsw: split out IRQ handler Date: Fri, 2 Jan 2015 12:10:27 -0600 Message-ID: <1420222228-31949-4-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.2.0 In-Reply-To: <1420222228-31949-1-git-send-email-balbi@ti.com> References: <1420222228-31949-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now we can introduce dedicated IRQ handlers for each of the IRQ events. This helps with cleaning up a little bit of the clutter in cpsw_interrupt() while also making sure that TX IRQs will try to handle TX buffers while RX IRQs will try to handle RX buffers. Signed-off-by: Felipe Balbi --- drivers/net/ethernet/ti/cpsw.c | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 6e04128..c9081bd 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -754,18 +754,36 @@ requeue: dev_kfree_skb_any(new_skb); } -static irqreturn_t cpsw_interrupt(int irq, void *dev_id) +static irqreturn_t cpsw_dummy_interrupt(int irq, void *dev_id) { struct cpsw_priv *priv = dev_id; int value = irq - priv->irqs_table[0]; - /* NOTICE: Ending IRQ here. The trick with the 'value' variable above - * is to make sure we will always write the correct value to the EOI - * register. Namely 0 for RX_THRESH Interrupt, 1 for RX Interrupt, 2 - * for TX Interrupt and 3 for MISC Interrupt. - */ cpdma_ctlr_eoi(priv->dma, value); + return IRQ_HANDLED; +} + +static irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id) +{ + struct cpsw_priv *priv = dev_id; + + cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); + cpdma_chan_process(priv->txch, 128); + + priv = cpsw_get_slave_priv(priv, 1); + if (priv) + cpdma_chan_process(priv->txch, 128); + + return IRQ_HANDLED; +} + +static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) +{ + struct cpsw_priv *priv = dev_id; + + cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); + cpsw_intr_disable(priv); if (priv->irq_enabled == true) { cpsw_disable_irq(priv); @@ -1617,7 +1635,8 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev) cpsw_intr_disable(priv); cpdma_ctlr_int_ctrl(priv->dma, false); - cpsw_interrupt(ndev->irq, priv); + cpsw_rx_interrupt(priv->irq[1], priv); + cpsw_tx_interrupt(priv->irq[2], priv); cpdma_ctlr_int_ctrl(priv->dma, true); cpsw_intr_enable(priv); } @@ -2351,7 +2370,7 @@ static int cpsw_probe(struct platform_device *pdev) goto clean_ale_ret; priv->irqs_table[0] = irq; - ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, + ret = devm_request_irq(&pdev->dev, irq, cpsw_dummy_interrupt, 0, dev_name(&pdev->dev), priv); if (ret < 0) { dev_err(priv->dev, "error attaching irq (%d)\n", ret); @@ -2363,7 +2382,7 @@ static int cpsw_probe(struct platform_device *pdev) goto clean_ale_ret; priv->irqs_table[1] = irq; - ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, + ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt, 0, dev_name(&pdev->dev), priv); if (ret < 0) { dev_err(priv->dev, "error attaching irq (%d)\n", ret); @@ -2375,7 +2394,7 @@ static int cpsw_probe(struct platform_device *pdev) goto clean_ale_ret; priv->irqs_table[2] = irq; - ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, + ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt, 0, dev_name(&pdev->dev), priv); if (ret < 0) { dev_err(priv->dev, "error attaching irq (%d)\n", ret); @@ -2387,7 +2406,7 @@ static int cpsw_probe(struct platform_device *pdev) goto clean_ale_ret; priv->irqs_table[3] = irq; - ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, + ret = devm_request_irq(&pdev->dev, irq, cpsw_dummy_interrupt, 0, dev_name(&pdev->dev), priv); if (ret < 0) { dev_err(priv->dev, "error attaching irq (%d)\n", ret);