Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: sf-pdma: Support of_dma_controller_register()

Update sf-pdma driver to adopt generic DMA device tree bindings.
It calls of_dma_controller_register() with of_dma_xlate_by_chan_id
to get the generic DMA device tree helper support and the DMA
clients can look up the sf-pdma controller using standard APIs.

Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Link: https://lore.kernel.org/r/20231208103856.3732998-2-shravan.chippa@microchip.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Shravan Chippa and committed by
Vinod Koul
8e578b47 4a8ececb

+17
+17
drivers/dma/sf-pdma/sf-pdma.c
··· 20 20 #include <linux/mod_devicetable.h> 21 21 #include <linux/dma-mapping.h> 22 22 #include <linux/of.h> 23 + #include <linux/of_dma.h> 23 24 #include <linux/slab.h> 24 25 25 26 #include "sf-pdma.h" ··· 564 563 return ret; 565 564 } 566 565 566 + ret = of_dma_controller_register(pdev->dev.of_node, 567 + of_dma_xlate_by_chan_id, pdma); 568 + if (ret < 0) { 569 + dev_err(&pdev->dev, 570 + "Can't register SiFive Platform OF_DMA. (%d)\n", ret); 571 + goto err_unregister; 572 + } 573 + 567 574 return 0; 575 + 576 + err_unregister: 577 + dma_async_device_unregister(&pdma->dma_dev); 578 + 579 + return ret; 568 580 } 569 581 570 582 static void sf_pdma_remove(struct platform_device *pdev) ··· 596 582 tasklet_kill(&ch->done_tasklet); 597 583 tasklet_kill(&ch->err_tasklet); 598 584 } 585 + 586 + if (pdev->dev.of_node) 587 + of_dma_controller_free(pdev->dev.of_node); 599 588 600 589 dma_async_device_unregister(&pdma->dma_dev); 601 590 }