@@ -448,13 +448,11 @@ rt_err_t rt_dma_prep_single(struct rt_dma_chan *chan,
448448}
449449
450450static struct rt_dma_controller * ofw_find_dma_controller (struct rt_device * dev ,
451- const char * name )
451+ const char * name , struct rt_ofw_cell_args * args )
452452{
453453 struct rt_dma_controller * ctrl = RT_NULL ;
454454#ifdef RT_USING_OFW
455455 int index ;
456- rt_err_t err ;
457- struct rt_ofw_cell_args dma_args = {};
458456 struct rt_ofw_node * np = dev -> ofw_node , * ctrl_np ;
459457
460458 if (!np )
@@ -469,9 +467,9 @@ static struct rt_dma_controller *ofw_find_dma_controller(struct rt_device *dev,
469467 return RT_NULL ;
470468 }
471469
472- if (!rt_ofw_parse_phandle_cells (np , "dmas" , "#dma-cells" , index , & dma_args ))
470+ if (!rt_ofw_parse_phandle_cells (np , "dmas" , "#dma-cells" , index , args ))
473471 {
474- ctrl_np = dma_args . data ;
472+ ctrl_np = args -> data ;
475473
476474 if (!rt_ofw_data (ctrl_np ))
477475 {
@@ -480,22 +478,16 @@ static struct rt_dma_controller *ofw_find_dma_controller(struct rt_device *dev,
480478
481479 ctrl = rt_ofw_data (ctrl_np );
482480 rt_ofw_node_put (ctrl_np );
483-
484- if (ctrl && ctrl -> ops -> ofw_parse )
485- {
486- if ((err = ctrl -> ops -> ofw_parse (ctrl , & dma_args )))
487- {
488- ctrl = rt_err_ptr (err );
489- }
490- }
491481 }
492482#endif /* RT_USING_OFW */
493483 return ctrl ;
494484}
495485
496486struct rt_dma_chan * rt_dma_chan_request (struct rt_device * dev , const char * name )
497487{
488+ void * fw_data = RT_NULL ;
498489 struct rt_dma_chan * chan ;
490+ struct rt_ofw_cell_args dma_args ;
499491 struct rt_dma_controller * ctrl = RT_NULL ;
500492
501493 if (!dev )
@@ -505,7 +497,8 @@ struct rt_dma_chan *rt_dma_chan_request(struct rt_device *dev, const char *name)
505497
506498 if (name )
507499 {
508- ctrl = ofw_find_dma_controller (dev , name );
500+ fw_data = & dma_args ;
501+ ctrl = ofw_find_dma_controller (dev , name , & dma_args );
509502 }
510503 else
511504 {
@@ -531,7 +524,7 @@ struct rt_dma_chan *rt_dma_chan_request(struct rt_device *dev, const char *name)
531524
532525 if (ctrl -> ops -> request_chan )
533526 {
534- chan = ctrl -> ops -> request_chan (ctrl , dev );
527+ chan = ctrl -> ops -> request_chan (ctrl , dev , fw_data );
535528 }
536529 else
537530 {
0 commit comments