提交 65675842 编写于 作者: O Olivier Dautricourt 提交者: Vinod Koul

dmaengine: altera-msgdma: add OF support

This driver had no device tree support.

- add compatible field "altr,socfpga-msgdma"
- register dma controller with of_dma_controller_register
Reviewed-by: NStefan Roese <sr@denx.de>
Signed-off-by: NOlivier Dautricourt <olivier.dautricourt@orolia.com>
Link: https://lore.kernel.org/r/7459635ba093d87b6bf12413cf7cfe09f6e3019b.1623251990.git.olivier.dautricourt@orolia.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
上级 ce91c622
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of_dma.h>
#include "dmaengine.h" #include "dmaengine.h"
...@@ -888,6 +889,13 @@ static int msgdma_probe(struct platform_device *pdev) ...@@ -888,6 +889,13 @@ static int msgdma_probe(struct platform_device *pdev)
if (ret) if (ret)
goto fail; goto fail;
ret = of_dma_controller_register(pdev->dev.of_node,
of_dma_xlate_by_chan_id, dma_dev);
if (ret == -EINVAL)
dev_warn(&pdev->dev, "device was not probed from DT");
else if (ret && ret != -ENODEV)
goto fail;
dev_notice(&pdev->dev, "Altera mSGDMA driver probe success\n"); dev_notice(&pdev->dev, "Altera mSGDMA driver probe success\n");
return 0; return 0;
...@@ -908,6 +916,8 @@ static int msgdma_remove(struct platform_device *pdev) ...@@ -908,6 +916,8 @@ static int msgdma_remove(struct platform_device *pdev)
{ {
struct msgdma_device *mdev = platform_get_drvdata(pdev); struct msgdma_device *mdev = platform_get_drvdata(pdev);
if (pdev->dev.of_node)
of_dma_controller_free(pdev->dev.of_node);
dma_async_device_unregister(&mdev->dmadev); dma_async_device_unregister(&mdev->dmadev);
msgdma_dev_remove(mdev); msgdma_dev_remove(mdev);
...@@ -916,9 +926,19 @@ static int msgdma_remove(struct platform_device *pdev) ...@@ -916,9 +926,19 @@ static int msgdma_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_OF
static const struct of_device_id msgdma_match[] = {
{ .compatible = "altr,socfpga-msgdma", },
{ }
};
MODULE_DEVICE_TABLE(of, msgdma_match);
#endif
static struct platform_driver msgdma_driver = { static struct platform_driver msgdma_driver = {
.driver = { .driver = {
.name = "altera-msgdma", .name = "altera-msgdma",
.of_match_table = of_match_ptr(msgdma_match),
}, },
.probe = msgdma_probe, .probe = msgdma_probe,
.remove = msgdma_remove, .remove = msgdma_remove,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册