diff options
author | Olof Johansson <olof@lixom.net> | 2007-05-08 01:47:26 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-05-08 01:47:53 -0400 |
commit | 1b0335ea30bf85eecffd21be64b7653407d6259a (patch) | |
tree | 60bc4617065cd4db1c05984b7e2bae913bae7b39 /drivers/net/pasemi_mac.c | |
parent | 771f7404a9deca902594823d616cd7a84f827982 (diff) |
pasemi_mac: Abstract and fix up interrupt restart routines
Abstract out (and fix up) the interrupt restart routines, making
sure we start out in a consistent state.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/pasemi_mac.c')
-rw-r--r-- | drivers/net/pasemi_mac.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index c7995d77ccfc..73e79f35a428 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -362,6 +362,42 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev) | |||
362 | mac->rx->next_to_fill += count; | 362 | mac->rx->next_to_fill += count; |
363 | } | 363 | } |
364 | 364 | ||
365 | static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac) | ||
366 | { | ||
367 | unsigned int reg, stat; | ||
368 | /* Re-enable packet count interrupts: finally | ||
369 | * ack the packet count interrupt we got in rx_intr. | ||
370 | */ | ||
371 | |||
372 | pci_read_config_dword(mac->iob_pdev, | ||
373 | PAS_IOB_DMA_RXCH_STAT(mac->dma_rxch), | ||
374 | &stat); | ||
375 | |||
376 | reg = PAS_IOB_DMA_RXCH_RESET_PCNT(stat & PAS_IOB_DMA_RXCH_STAT_CNTDEL_M) | ||
377 | | PAS_IOB_DMA_RXCH_RESET_PINTC; | ||
378 | |||
379 | pci_write_config_dword(mac->iob_pdev, | ||
380 | PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), | ||
381 | reg); | ||
382 | } | ||
383 | |||
384 | static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac) | ||
385 | { | ||
386 | unsigned int reg, stat; | ||
387 | |||
388 | /* Re-enable packet count interrupts */ | ||
389 | pci_read_config_dword(mac->iob_pdev, | ||
390 | PAS_IOB_DMA_TXCH_STAT(mac->dma_txch), &stat); | ||
391 | |||
392 | reg = PAS_IOB_DMA_TXCH_RESET_PCNT(stat & PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) | ||
393 | | PAS_IOB_DMA_TXCH_RESET_PINTC; | ||
394 | |||
395 | pci_write_config_dword(mac->iob_pdev, | ||
396 | PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg); | ||
397 | } | ||
398 | |||
399 | |||
400 | |||
365 | static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | 401 | static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) |
366 | { | 402 | { |
367 | unsigned int i; | 403 | unsigned int i; |
@@ -559,6 +595,10 @@ static int pasemi_mac_open(struct net_device *dev) | |||
559 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch), | 595 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch), |
560 | PAS_IOB_DMA_RXCH_CFG_CNTTH(30)); | 596 | PAS_IOB_DMA_RXCH_CFG_CNTTH(30)); |
561 | 597 | ||
598 | /* Clear out any residual packet count state from firmware */ | ||
599 | pasemi_mac_restart_rx_intr(mac); | ||
600 | pasemi_mac_restart_tx_intr(mac); | ||
601 | |||
562 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, | 602 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, |
563 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000)); | 603 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000)); |
564 | 604 | ||
@@ -835,9 +875,7 @@ static int pasemi_mac_poll(struct net_device *dev, int *budget) | |||
835 | /* all done, no more packets present */ | 875 | /* all done, no more packets present */ |
836 | netif_rx_complete(dev); | 876 | netif_rx_complete(dev); |
837 | 877 | ||
838 | /* re-enable receive interrupts */ | 878 | pasemi_mac_restart_rx_intr(mac); |
839 | pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_COM_TIMEOUTCFG, | ||
840 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(1000000)); | ||
841 | return 0; | 879 | return 0; |
842 | } else { | 880 | } else { |
843 | /* used up our quantum, so reschedule */ | 881 | /* used up our quantum, so reschedule */ |