Commit 56b0a668 authored by Kevin Hilman's avatar Kevin Hilman Committed by Vinod Koul

dmaengine: ti: convert k3-udma to module

Currently k3-udma driver is built as separate platform drivers with a
shared probe and identical code path, just differnet platform data.

To enable to build as module, convert the separate platform driver
into a single module_platform_driver with the data selection done via
compatible string and of_match.  The separate of_match tables are also
combined into a single table to avoid the multiple calls to
of_match_node()

Since all modern TI platforms using this are DT enabled, the removal
of separate platform_drivers should have no functional change.
Acked-by: default avatarPeter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: default avatarKevin Hilman <khilman@baylibre.com>
Link: https://lore.kernel.org/r/20220929234820.940048-3-khilman@baylibre.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent beb6f649
...@@ -35,7 +35,7 @@ config DMA_OMAP ...@@ -35,7 +35,7 @@ config DMA_OMAP
DMA engine is found on OMAP and DRA7xx parts. DMA engine is found on OMAP and DRA7xx parts.
config TI_K3_UDMA config TI_K3_UDMA
bool "Texas Instruments UDMA support" tristate "Texas Instruments UDMA support"
depends on ARCH_K3 depends on ARCH_K3
depends on TI_SCI_PROTOCOL depends on TI_SCI_PROTOCOL
depends on TI_SCI_INTA_IRQCHIP depends on TI_SCI_INTA_IRQCHIP
...@@ -48,7 +48,7 @@ config TI_K3_UDMA ...@@ -48,7 +48,7 @@ config TI_K3_UDMA
DMA engine is used in AM65x and j721e. DMA engine is used in AM65x and j721e.
config TI_K3_UDMA_GLUE_LAYER config TI_K3_UDMA_GLUE_LAYER
bool "Texas Instruments UDMA Glue layer for non DMAengine users" tristate "Texas Instruments UDMA Glue layer for non DMAengine users"
depends on ARCH_K3 depends on ARCH_K3
depends on TI_K3_UDMA depends on TI_K3_UDMA
help help
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* *
*/ */
#include <linux/module.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
...@@ -1433,4 +1434,6 @@ static int __init k3_udma_glue_class_init(void) ...@@ -1433,4 +1434,6 @@ static int __init k3_udma_glue_class_init(void)
{ {
return class_register(&k3_udma_glue_devclass); return class_register(&k3_udma_glue_devclass);
} }
arch_initcall(k3_udma_glue_class_init);
module_init(k3_udma_glue_class_init);
MODULE_LICENSE("GPL v2");
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
...@@ -4335,18 +4336,10 @@ static const struct of_device_id udma_of_match[] = { ...@@ -4335,18 +4336,10 @@ static const struct of_device_id udma_of_match[] = {
.compatible = "ti,j721e-navss-mcu-udmap", .compatible = "ti,j721e-navss-mcu-udmap",
.data = &j721e_mcu_data, .data = &j721e_mcu_data,
}, },
{ /* Sentinel */ },
};
static const struct of_device_id bcdma_of_match[] = {
{ {
.compatible = "ti,am64-dmss-bcdma", .compatible = "ti,am64-dmss-bcdma",
.data = &am64_bcdma_data, .data = &am64_bcdma_data,
}, },
{ /* Sentinel */ },
};
static const struct of_device_id pktdma_of_match[] = {
{ {
.compatible = "ti,am64-dmss-pktdma", .compatible = "ti,am64-dmss-pktdma",
.data = &am64_pktdma_data, .data = &am64_pktdma_data,
...@@ -5271,14 +5264,9 @@ static int udma_probe(struct platform_device *pdev) ...@@ -5271,14 +5264,9 @@ static int udma_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
match = of_match_node(udma_of_match, dev->of_node); match = of_match_node(udma_of_match, dev->of_node);
if (!match)
match = of_match_node(bcdma_of_match, dev->of_node);
if (!match) { if (!match) {
match = of_match_node(pktdma_of_match, dev->of_node); dev_err(dev, "No compatible match found\n");
if (!match) { return -ENODEV;
dev_err(dev, "No compatible match found\n");
return -ENODEV;
}
} }
ud->match_data = match->data; ud->match_data = match->data;
...@@ -5511,27 +5499,9 @@ static struct platform_driver udma_driver = { ...@@ -5511,27 +5499,9 @@ static struct platform_driver udma_driver = {
}, },
.probe = udma_probe, .probe = udma_probe,
}; };
builtin_platform_driver(udma_driver);
static struct platform_driver bcdma_driver = { module_platform_driver(udma_driver);
.driver = { MODULE_LICENSE("GPL v2");
.name = "ti-bcdma",
.of_match_table = bcdma_of_match,
.suppress_bind_attrs = true,
},
.probe = udma_probe,
};
builtin_platform_driver(bcdma_driver);
static struct platform_driver pktdma_driver = {
.driver = {
.name = "ti-pktdma",
.of_match_table = pktdma_of_match,
.suppress_bind_attrs = true,
},
.probe = udma_probe,
};
builtin_platform_driver(pktdma_driver);
/* Private interfaces to UDMA */ /* Private interfaces to UDMA */
#include "k3-udma-private.c" #include "k3-udma-private.c"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment