| 448 | } |
| 449 | |
| 450 | static struct rt_dma_controller *ofw_find_dma_controller(struct rt_device *dev, |
| 451 | const char *name, struct rt_ofw_cell_args *args) |
| 452 | { |
| 453 | struct rt_dma_controller *ctrl = RT_NULL; |
| 454 | #ifdef RT_USING_OFW |
| 455 | int index; |
| 456 | struct rt_ofw_node *np = dev->ofw_node, *ctrl_np; |
| 457 | |
| 458 | if (!np) |
| 459 | { |
| 460 | return RT_NULL; |
| 461 | } |
| 462 | |
| 463 | index = rt_ofw_prop_index_of_string(np, "dma-names", name); |
| 464 | |
| 465 | if (index < 0) |
| 466 | { |
| 467 | return RT_NULL; |
| 468 | } |
| 469 | |
| 470 | if (!rt_ofw_parse_phandle_cells(np, "dmas", "#dma-cells", index, args)) |
| 471 | { |
| 472 | ctrl_np = args->data; |
| 473 | |
| 474 | if (!rt_ofw_data(ctrl_np)) |
| 475 | { |
| 476 | rt_platform_ofw_request(ctrl_np); |
| 477 | } |
| 478 | |
| 479 | ctrl = rt_ofw_data(ctrl_np); |
| 480 | rt_ofw_node_put(ctrl_np); |
| 481 | } |
| 482 | #endif /* RT_USING_OFW */ |
| 483 | return ctrl; |
| 484 | } |
| 485 | |
| 486 | struct rt_dma_chan *rt_dma_chan_request(struct rt_device *dev, const char *name) |
| 487 | { |
no test coverage detected