Commit c03abd84 authored by Felipe Balbi's avatar Felipe Balbi Committed by David S. Miller

net: ethernet: cpsw: don't requests IRQs we don't use

CPSW never uses RX_THRESHOLD or MISC interrupts. In
fact, they are always kept masked in their appropriate
IRQ Enable register.

Instead of allocating an IRQ that never fires, it's best
to remove that code altogether and let future patches
implement it if anybody needs those.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5087b915
...@@ -761,17 +761,25 @@ static void cpsw_rx_handler(void *token, int len, int status) ...@@ -761,17 +761,25 @@ static void cpsw_rx_handler(void *token, int len, int status)
dev_kfree_skb_any(new_skb); dev_kfree_skb_any(new_skb);
} }
static irqreturn_t cpsw_interrupt(int irq, void *dev_id) static irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id)
{ {
struct cpsw_priv *priv = 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 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
* is to make sure we will always write the correct value to the EOI cpdma_chan_process(priv->txch, 128);
* register. Namely 0 for RX_THRESH Interrupt, 1 for RX Interrupt, 2
* for TX Interrupt and 3 for MISC Interrupt. priv = cpsw_get_slave_priv(priv, 1);
*/ if (priv)
cpdma_ctlr_eoi(priv->dma, value); 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); cpsw_intr_disable(priv);
if (priv->irq_enabled == true) { if (priv->irq_enabled == true) {
...@@ -1624,7 +1632,8 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev) ...@@ -1624,7 +1632,8 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev)
cpsw_intr_disable(priv); cpsw_intr_disable(priv);
cpdma_ctlr_int_ctrl(priv->dma, false); cpdma_ctlr_int_ctrl(priv->dma, false);
cpsw_interrupt(ndev->irq, priv); cpsw_rx_interrupt(priv->irq[0], priv);
cpsw_tx_interrupt(priv->irq[1], priv);
cpdma_ctlr_int_ctrl(priv->dma, true); cpdma_ctlr_int_ctrl(priv->dma, true);
cpsw_intr_enable(priv); cpsw_intr_enable(priv);
} }
...@@ -2346,62 +2355,47 @@ static int cpsw_probe(struct platform_device *pdev) ...@@ -2346,62 +2355,47 @@ static int cpsw_probe(struct platform_device *pdev)
goto clean_dma_ret; goto clean_dma_ret;
} }
ndev->irq = platform_get_irq(pdev, 0); ndev->irq = platform_get_irq(pdev, 1);
if (ndev->irq < 0) { if (ndev->irq < 0) {
dev_err(priv->dev, "error getting irq resource\n"); dev_err(priv->dev, "error getting irq resource\n");
ret = -ENOENT; ret = -ENOENT;
goto clean_ale_ret; goto clean_ale_ret;
} }
irq = platform_get_irq(pdev, 0); /* Grab RX and TX IRQs. Note that we also have RX_THRESHOLD and
if (irq < 0) * MISC IRQs which are always kept disabled with this driver so
goto clean_ale_ret; * we will not request them.
*
priv->irqs_table[0] = irq; * If anyone wants to implement support for those, make sure to
ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt, * first request and append them to irqs_table array.
0, dev_name(&pdev->dev), priv); */
if (ret < 0) {
dev_err(priv->dev, "error attaching irq (%d)\n", ret);
goto clean_ale_ret;
}
/* RX IRQ */
irq = platform_get_irq(pdev, 1); irq = platform_get_irq(pdev, 1);
if (irq < 0) if (irq < 0)
goto clean_ale_ret; goto clean_ale_ret;
priv->irqs_table[1] = irq; priv->irqs_table[0] = 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); 0, dev_name(&pdev->dev), priv);
if (ret < 0) { if (ret < 0) {
dev_err(priv->dev, "error attaching irq (%d)\n", ret); dev_err(priv->dev, "error attaching irq (%d)\n", ret);
goto clean_ale_ret; goto clean_ale_ret;
} }
/* TX IRQ */
irq = platform_get_irq(pdev, 2); irq = platform_get_irq(pdev, 2);
if (irq < 0) if (irq < 0)
goto clean_ale_ret; goto clean_ale_ret;
priv->irqs_table[2] = irq; priv->irqs_table[1] = 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);
goto clean_ale_ret;
}
irq = platform_get_irq(pdev, 3);
if (irq < 0)
goto clean_ale_ret;
priv->irqs_table[3] = irq;
ret = devm_request_irq(&pdev->dev, irq, cpsw_interrupt,
0, dev_name(&pdev->dev), priv); 0, dev_name(&pdev->dev), priv);
if (ret < 0) { if (ret < 0) {
dev_err(priv->dev, "error attaching irq (%d)\n", ret); dev_err(priv->dev, "error attaching irq (%d)\n", ret);
goto clean_ale_ret; goto clean_ale_ret;
} }
priv->num_irqs = 2;
priv->num_irqs = 4;
ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment