File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -2638,6 +2638,8 @@ static int tsi721_probe(struct pci_dev *pdev,
26382638 if (err )
26392639 goto err_free_consistent ;
26402640
2641+ pci_set_drvdata (pdev , priv );
2642+
26412643 return 0 ;
26422644
26432645err_free_consistent :
@@ -2660,6 +2662,18 @@ static int tsi721_probe(struct pci_dev *pdev,
26602662 return err ;
26612663}
26622664
2665+ static void tsi721_shutdown (struct pci_dev * pdev )
2666+ {
2667+ struct tsi721_device * priv = pci_get_drvdata (pdev );
2668+
2669+ dev_dbg (& pdev -> dev , "RIO: %s\n" , __func__ );
2670+
2671+ tsi721_disable_ints (priv );
2672+ tsi721_dma_stop_all (priv );
2673+ pci_clear_master (pdev );
2674+ pci_disable_device (pdev );
2675+ }
2676+
26632677static const struct pci_device_id tsi721_pci_tbl [] = {
26642678 { PCI_DEVICE (PCI_VENDOR_ID_IDT , PCI_DEVICE_ID_TSI721 ) },
26652679 { 0 , } /* terminate list */
@@ -2671,6 +2685,7 @@ static struct pci_driver tsi721_driver = {
26712685 .name = "tsi721" ,
26722686 .id_table = tsi721_pci_tbl ,
26732687 .probe = tsi721_probe ,
2688+ .shutdown = tsi721_shutdown ,
26742689};
26752690
26762691static int __init tsi721_init (void )
Original file line number Diff line number Diff line change @@ -866,6 +866,9 @@ struct tsi721_device {
866866#ifdef CONFIG_RAPIDIO_DMA_ENGINE
867867extern void tsi721_bdma_handler (struct tsi721_bdma_chan * bdma_chan );
868868extern int tsi721_register_dma (struct tsi721_device * priv );
869+ extern void tsi721_dma_stop_all (struct tsi721_device * priv );
870+ #else
871+ #define tsi721_dma_stop_all (priv ) do {} while (0)
869872#endif
870873
871874#endif
Original file line number Diff line number Diff line change @@ -852,6 +852,36 @@ static int tsi721_terminate_all(struct dma_chan *dchan)
852852 return 0 ;
853853}
854854
855+ static void tsi721_dma_stop (struct tsi721_bdma_chan * bdma_chan )
856+ {
857+ if (!bdma_chan -> active )
858+ return ;
859+ spin_lock_bh (& bdma_chan -> lock );
860+ if (!tsi721_dma_is_idle (bdma_chan )) {
861+ int timeout = 100000 ;
862+
863+ /* stop the transfer in progress */
864+ iowrite32 (TSI721_DMAC_CTL_SUSP ,
865+ bdma_chan -> regs + TSI721_DMAC_CTL );
866+
867+ /* Wait until DMA channel stops */
868+ while (!tsi721_dma_is_idle (bdma_chan ) && -- timeout )
869+ udelay (1 );
870+ }
871+
872+ spin_unlock_bh (& bdma_chan -> lock );
873+ }
874+
875+ void tsi721_dma_stop_all (struct tsi721_device * priv )
876+ {
877+ int i ;
878+
879+ for (i = 0 ; i < TSI721_DMA_MAXCH ; i ++ ) {
880+ if (i != TSI721_DMACH_MAINT )
881+ tsi721_dma_stop (& priv -> bdma [i ]);
882+ }
883+ }
884+
855885int tsi721_register_dma (struct tsi721_device * priv )
856886{
857887 int i ;
You can’t perform that action at this time.
0 commit comments