77#include <linux/bitfield.h>
88#include <linux/bitops.h>
99#include <linux/dmaengine.h>
10+ #include <linux/dma-mapping.h>
1011#include <linux/module.h>
1112#include <linux/mod_devicetable.h>
12- #include <linux/dma-map-ops.h>
1313#include <linux/platform_device.h>
1414#include <linux/platform_data/amd_qdma.h>
1515#include <linux/regmap.h>
@@ -496,18 +496,9 @@ static int qdma_device_verify(struct qdma_device *qdev)
496496
497497static int qdma_device_setup (struct qdma_device * qdev )
498498{
499- struct device * dev = & qdev -> pdev -> dev ;
500499 u32 ring_sz = QDMA_DEFAULT_RING_SIZE ;
501500 int ret = 0 ;
502501
503- while (dev && get_dma_ops (dev ))
504- dev = dev -> parent ;
505- if (!dev ) {
506- qdma_err (qdev , "dma device not found" );
507- return - EINVAL ;
508- }
509- set_dma_ops (& qdev -> pdev -> dev , get_dma_ops (dev ));
510-
511502 ret = qdma_setup_fmap_context (qdev );
512503 if (ret ) {
513504 qdma_err (qdev , "Failed setup fmap context" );
@@ -552,11 +543,12 @@ static void qdma_free_queue_resources(struct dma_chan *chan)
552543{
553544 struct qdma_queue * queue = to_qdma_queue (chan );
554545 struct qdma_device * qdev = queue -> qdev ;
555- struct device * dev = qdev -> dma_dev . dev ;
546+ struct qdma_platdata * pdata ;
556547
557548 qdma_clear_queue_context (queue );
558549 vchan_free_chan_resources (& queue -> vchan );
559- dma_free_coherent (dev , queue -> ring_size * QDMA_MM_DESC_SIZE ,
550+ pdata = dev_get_platdata (& qdev -> pdev -> dev );
551+ dma_free_coherent (pdata -> dma_dev , queue -> ring_size * QDMA_MM_DESC_SIZE ,
560552 queue -> desc_base , queue -> dma_desc_base );
561553}
562554
@@ -569,15 +561,17 @@ static int qdma_alloc_queue_resources(struct dma_chan *chan)
569561 struct qdma_queue * queue = to_qdma_queue (chan );
570562 struct qdma_device * qdev = queue -> qdev ;
571563 struct qdma_ctxt_sw_desc desc ;
564+ struct qdma_platdata * pdata ;
572565 size_t size ;
573566 int ret ;
574567
575568 ret = qdma_clear_queue_context (queue );
576569 if (ret )
577570 return ret ;
578571
572+ pdata = dev_get_platdata (& qdev -> pdev -> dev );
579573 size = queue -> ring_size * QDMA_MM_DESC_SIZE ;
580- queue -> desc_base = dma_alloc_coherent (qdev -> dma_dev . dev , size ,
574+ queue -> desc_base = dma_alloc_coherent (pdata -> dma_dev , size ,
581575 & queue -> dma_desc_base ,
582576 GFP_KERNEL );
583577 if (!queue -> desc_base ) {
@@ -592,7 +586,7 @@ static int qdma_alloc_queue_resources(struct dma_chan *chan)
592586 if (ret ) {
593587 qdma_err (qdev , "Failed to setup SW desc ctxt for %s" ,
594588 chan -> name );
595- dma_free_coherent (qdev -> dma_dev . dev , size , queue -> desc_base ,
589+ dma_free_coherent (pdata -> dma_dev , size , queue -> desc_base ,
596590 queue -> dma_desc_base );
597591 return ret ;
598592 }
@@ -952,8 +946,9 @@ static int qdma_init_error_irq(struct qdma_device *qdev)
952946
953947static int qdmam_alloc_qintr_rings (struct qdma_device * qdev )
954948{
955- u32 ctxt [ QDMA_CTXT_REGMAP_LEN ] ;
949+ struct qdma_platdata * pdata = dev_get_platdata ( & qdev -> pdev -> dev ) ;
956950 struct device * dev = & qdev -> pdev -> dev ;
951+ u32 ctxt [QDMA_CTXT_REGMAP_LEN ];
957952 struct qdma_intr_ring * ring ;
958953 struct qdma_ctxt_intr intr_ctxt ;
959954 u32 vector ;
@@ -973,7 +968,8 @@ static int qdmam_alloc_qintr_rings(struct qdma_device *qdev)
973968 ring -> msix_id = qdev -> err_irq_idx + i + 1 ;
974969 ring -> ridx = i ;
975970 ring -> color = 1 ;
976- ring -> base = dmam_alloc_coherent (dev , QDMA_INTR_RING_SIZE ,
971+ ring -> base = dmam_alloc_coherent (pdata -> dma_dev ,
972+ QDMA_INTR_RING_SIZE ,
977973 & ring -> dev_base , GFP_KERNEL );
978974 if (!ring -> base ) {
979975 qdma_err (qdev , "Failed to alloc intr ring %d" , i );
0 commit comments