Commit 84ea9c0a authored by Grygorii Strashko's avatar Grygorii Strashko Committed by David S. Miller

net: ethernet: ti: cpsw: enable cpts irq

The CPSW misc IRQ need be enabled for CPTS event_pend IRQs processing. This
patch adds corresponding support to CPSW driver.
Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b78aba49
...@@ -1569,6 +1569,12 @@ static int cpsw_probe(struct platform_device *pdev) ...@@ -1569,6 +1569,12 @@ static int cpsw_probe(struct platform_device *pdev)
return irq; return irq;
cpsw->irqs_table[1] = irq; cpsw->irqs_table[1] = irq;
/* get misc irq*/
irq = platform_get_irq(pdev, 3);
if (irq <= 0)
return irq;
cpsw->misc_irq = irq;
/* /*
* This may be required here for child devices. * This may be required here for child devices.
*/ */
...@@ -1703,6 +1709,21 @@ static int cpsw_probe(struct platform_device *pdev) ...@@ -1703,6 +1709,21 @@ static int cpsw_probe(struct platform_device *pdev)
goto clean_unregister_netdev_ret; goto clean_unregister_netdev_ret;
} }
if (!cpsw->cpts)
goto skip_cpts;
ret = devm_request_irq(&pdev->dev, cpsw->misc_irq, cpsw_misc_interrupt,
0, dev_name(&pdev->dev), cpsw);
if (ret < 0) {
dev_err(dev, "error attaching misc irq (%d)\n", ret);
goto clean_unregister_netdev_ret;
}
/* Enable misc CPTS evnt_pend IRQ */
cpts_set_irqpoll(cpsw->cpts, false);
writel(0x10, &cpsw->wr_regs->misc_en);
skip_cpts:
cpsw_notice(priv, probe, cpsw_notice(priv, probe,
"initialized device (regs %pa, irq %d, pool size %d)\n", "initialized device (regs %pa, irq %d, pool size %d)\n",
&ss_res->start, cpsw->irqs_table[0], descs_pool_size); &ss_res->start, cpsw->irqs_table[0], descs_pool_size);
......
...@@ -1896,6 +1896,11 @@ static int cpsw_probe(struct platform_device *pdev) ...@@ -1896,6 +1896,11 @@ static int cpsw_probe(struct platform_device *pdev)
return irq; return irq;
cpsw->irqs_table[1] = irq; cpsw->irqs_table[1] = irq;
irq = platform_get_irq_byname(pdev, "misc");
if (irq <= 0)
return irq;
cpsw->misc_irq = irq;
platform_set_drvdata(pdev, cpsw); platform_set_drvdata(pdev, cpsw);
/* This may be required here for child devices. */ /* This may be required here for child devices. */
pm_runtime_enable(dev); pm_runtime_enable(dev);
...@@ -1975,6 +1980,21 @@ static int cpsw_probe(struct platform_device *pdev) ...@@ -1975,6 +1980,21 @@ static int cpsw_probe(struct platform_device *pdev)
goto clean_unregister_netdev; goto clean_unregister_netdev;
} }
if (!cpsw->cpts)
goto skip_cpts;
ret = devm_request_irq(dev, cpsw->misc_irq, cpsw_misc_interrupt,
0, dev_name(&pdev->dev), cpsw);
if (ret < 0) {
dev_err(dev, "error attaching misc irq (%d)\n", ret);
goto clean_unregister_netdev;
}
/* Enable misc CPTS evnt_pend IRQ */
cpts_set_irqpoll(cpsw->cpts, false);
writel(0x10, &cpsw->wr_regs->misc_en);
skip_cpts:
ret = cpsw_register_notifiers(cpsw); ret = cpsw_register_notifiers(cpsw);
if (ret) if (ret)
goto clean_unregister_netdev; goto clean_unregister_netdev;
......
...@@ -114,6 +114,18 @@ irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) ...@@ -114,6 +114,18 @@ irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
irqreturn_t cpsw_misc_interrupt(int irq, void *dev_id)
{
struct cpsw_common *cpsw = dev_id;
writel(0, &cpsw->wr_regs->misc_en);
cpdma_ctlr_eoi(cpsw->dma, CPDMA_EOI_MISC);
cpts_misc_interrupt(cpsw->cpts);
writel(0x10, &cpsw->wr_regs->misc_en);
return IRQ_HANDLED;
}
int cpsw_tx_mq_poll(struct napi_struct *napi_tx, int budget) int cpsw_tx_mq_poll(struct napi_struct *napi_tx, int budget)
{ {
struct cpsw_common *cpsw = napi_to_cpsw(napi_tx); struct cpsw_common *cpsw = napi_to_cpsw(napi_tx);
......
...@@ -350,6 +350,7 @@ struct cpsw_common { ...@@ -350,6 +350,7 @@ struct cpsw_common {
bool rx_irq_disabled; bool rx_irq_disabled;
bool tx_irq_disabled; bool tx_irq_disabled;
u32 irqs_table[IRQ_NUM]; u32 irqs_table[IRQ_NUM];
int misc_irq;
struct cpts *cpts; struct cpts *cpts;
struct devlink *devlink; struct devlink *devlink;
int rx_ch_num, tx_ch_num; int rx_ch_num, tx_ch_num;
...@@ -442,6 +443,7 @@ int cpsw_run_xdp(struct cpsw_priv *priv, int ch, struct xdp_buff *xdp, ...@@ -442,6 +443,7 @@ int cpsw_run_xdp(struct cpsw_priv *priv, int ch, struct xdp_buff *xdp,
struct page *page, int port); struct page *page, int port);
irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id); irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id);
irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id); irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id);
irqreturn_t cpsw_misc_interrupt(int irq, void *dev_id);
int cpsw_tx_mq_poll(struct napi_struct *napi_tx, int budget); int cpsw_tx_mq_poll(struct napi_struct *napi_tx, int budget);
int cpsw_tx_poll(struct napi_struct *napi_tx, int budget); int cpsw_tx_poll(struct napi_struct *napi_tx, int budget);
int cpsw_rx_mq_poll(struct napi_struct *napi_rx, int budget); int cpsw_rx_mq_poll(struct napi_struct *napi_rx, int budget);
......
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