diff options
| author | Esben Haabendal <esben@geanix.com> | 2019-04-30 03:17:58 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-05-01 14:33:30 -0400 |
| commit | 7e97a194aca03c6ff86f84e46e196f5c9ed5c32c (patch) | |
| tree | dfed285b7a785eca6bed68eb41fb9563d7de859e /drivers/net/ethernet | |
| parent | 901d14ab5584753a72116a53fbc4fa67832ad1a5 (diff) | |
net: ll_temac: Allow configuration of IRQ coalescing
This allows custom setup of IRQ coalescing for platforms using legacy
platform_device. The irq timeout and count parameters can be used for
tuning cpu load vs. latency.
I have maintained the 0x00000400 bit in TX_CHNL_CTRL. It is specified as
unused in the documentation I have available. It does not make any
difference in the hardware I have available, so it is left in to not risk
breaking other platforms where it might be used.
Signed-off-by: Esben Haabendal <esben@geanix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
| -rw-r--r-- | drivers/net/ethernet/xilinx/ll_temac.h | 4 | ||||
| -rw-r--r-- | drivers/net/ethernet/xilinx/ll_temac_main.c | 40 |
2 files changed, 32 insertions, 12 deletions
diff --git a/drivers/net/ethernet/xilinx/ll_temac.h b/drivers/net/ethernet/xilinx/ll_temac.h index 990f9ed151b2..1aeda084b8f1 100644 --- a/drivers/net/ethernet/xilinx/ll_temac.h +++ b/drivers/net/ethernet/xilinx/ll_temac.h | |||
| @@ -375,6 +375,10 @@ struct temac_local { | |||
| 375 | int tx_bd_next; | 375 | int tx_bd_next; |
| 376 | int tx_bd_tail; | 376 | int tx_bd_tail; |
| 377 | int rx_bd_ci; | 377 | int rx_bd_ci; |
| 378 | |||
| 379 | /* DMA channel control setup */ | ||
| 380 | u32 tx_chnl_ctrl; | ||
| 381 | u32 rx_chnl_ctrl; | ||
| 378 | }; | 382 | }; |
| 379 | 383 | ||
| 380 | /* Wrappers for temac_ior()/temac_iow() function pointers above */ | 384 | /* Wrappers for temac_ior()/temac_iow() function pointers above */ |
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index fec8e4c22944..bccef30bf64e 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c | |||
| @@ -304,18 +304,15 @@ static int temac_dma_bd_init(struct net_device *ndev) | |||
| 304 | lp->rx_bd_v[i].app0 = cpu_to_be32(STS_CTRL_APP0_IRQONEND); | 304 | lp->rx_bd_v[i].app0 = cpu_to_be32(STS_CTRL_APP0_IRQONEND); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | lp->dma_out(lp, TX_CHNL_CTRL, 0x10220400 | | 307 | /* Configure DMA channel (irq setup) */ |
| 308 | CHNL_CTRL_IRQ_EN | | 308 | lp->dma_out(lp, TX_CHNL_CTRL, lp->tx_chnl_ctrl | |
| 309 | CHNL_CTRL_IRQ_DLY_EN | | 309 | 0x00000400 | // Use 1 Bit Wide Counters. Currently Not Used! |
| 310 | CHNL_CTRL_IRQ_COAL_EN); | 310 | CHNL_CTRL_IRQ_EN | CHNL_CTRL_IRQ_ERR_EN | |
| 311 | /* 0x10220483 */ | 311 | CHNL_CTRL_IRQ_DLY_EN | CHNL_CTRL_IRQ_COAL_EN); |
| 312 | /* 0x00100483 */ | 312 | lp->dma_out(lp, RX_CHNL_CTRL, lp->rx_chnl_ctrl | |
| 313 | lp->dma_out(lp, RX_CHNL_CTRL, 0xff070000 | | 313 | CHNL_CTRL_IRQ_IOE | |
| 314 | CHNL_CTRL_IRQ_EN | | 314 | CHNL_CTRL_IRQ_EN | CHNL_CTRL_IRQ_ERR_EN | |
| 315 | CHNL_CTRL_IRQ_DLY_EN | | 315 | CHNL_CTRL_IRQ_DLY_EN | CHNL_CTRL_IRQ_COAL_EN); |
| 316 | CHNL_CTRL_IRQ_COAL_EN | | ||
| 317 | CHNL_CTRL_IRQ_IOE); | ||
| 318 | /* 0xff010283 */ | ||
| 319 | 316 | ||
| 320 | lp->dma_out(lp, RX_CURDESC_PTR, lp->rx_bd_p); | 317 | lp->dma_out(lp, RX_CURDESC_PTR, lp->rx_bd_p); |
| 321 | lp->dma_out(lp, RX_TAILDESC_PTR, | 318 | lp->dma_out(lp, RX_TAILDESC_PTR, |
| @@ -1191,6 +1188,13 @@ static int temac_probe(struct platform_device *pdev) | |||
| 1191 | lp->rx_irq = irq_of_parse_and_map(dma_np, 0); | 1188 | lp->rx_irq = irq_of_parse_and_map(dma_np, 0); |
| 1192 | lp->tx_irq = irq_of_parse_and_map(dma_np, 1); | 1189 | lp->tx_irq = irq_of_parse_and_map(dma_np, 1); |
| 1193 | 1190 | ||
| 1191 | /* Use defaults for IRQ delay/coalescing setup. These | ||
| 1192 | * are configuration values, so does not belong in | ||
| 1193 | * device-tree. | ||
| 1194 | */ | ||
| 1195 | lp->tx_chnl_ctrl = 0x10220000; | ||
| 1196 | lp->rx_chnl_ctrl = 0xff070000; | ||
| 1197 | |||
| 1194 | /* Finished with the DMA node; drop the reference */ | 1198 | /* Finished with the DMA node; drop the reference */ |
| 1195 | of_node_put(dma_np); | 1199 | of_node_put(dma_np); |
| 1196 | } else if (pdata) { | 1200 | } else if (pdata) { |
| @@ -1214,6 +1218,18 @@ static int temac_probe(struct platform_device *pdev) | |||
| 1214 | /* Get DMA RX and TX interrupts */ | 1218 | /* Get DMA RX and TX interrupts */ |
| 1215 | lp->rx_irq = platform_get_irq(pdev, 0); | 1219 | lp->rx_irq = platform_get_irq(pdev, 0); |
| 1216 | lp->tx_irq = platform_get_irq(pdev, 1); | 1220 | lp->tx_irq = platform_get_irq(pdev, 1); |
| 1221 | |||
| 1222 | /* IRQ delay/coalescing setup */ | ||
| 1223 | if (pdata->tx_irq_timeout || pdata->tx_irq_count) | ||
| 1224 | lp->tx_chnl_ctrl = (pdata->tx_irq_timeout << 24) | | ||
| 1225 | (pdata->tx_irq_count << 16); | ||
| 1226 | else | ||
| 1227 | lp->tx_chnl_ctrl = 0x10220000; | ||
| 1228 | if (pdata->rx_irq_timeout || pdata->rx_irq_count) | ||
| 1229 | lp->rx_chnl_ctrl = (pdata->rx_irq_timeout << 24) | | ||
| 1230 | (pdata->rx_irq_count << 16); | ||
| 1231 | else | ||
| 1232 | lp->rx_chnl_ctrl = 0xff070000; | ||
| 1217 | } | 1233 | } |
| 1218 | 1234 | ||
| 1219 | /* Error handle returned DMA RX and TX interrupts */ | 1235 | /* Error handle returned DMA RX and TX interrupts */ |
