mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
dmaengine: bcm2835: Load driver early and support legacy API
Load driver early since at least bcm2708_fb doesn't support deferred probing and even if it did, we don't want the video driver deferred. Support the legacy DMA API which is needed by bcm2708_fb. Don't mask out channel 2. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
This commit is contained in:
committed by
popcornmix
parent
8a06431070
commit
7fa6f48bb8
@@ -133,7 +133,7 @@ config COH901318
|
|||||||
|
|
||||||
config DMA_BCM2835
|
config DMA_BCM2835
|
||||||
tristate "BCM2835 DMA engine support"
|
tristate "BCM2835 DMA engine support"
|
||||||
depends on ARCH_BCM2835
|
depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
|
||||||
select DMA_ENGINE
|
select DMA_ENGINE
|
||||||
select DMA_VIRTUAL_CHANNELS
|
select DMA_VIRTUAL_CHANNELS
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/platform_data/dma-bcm2708.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
|
|
||||||
#define BCM2835_DMA_MAX_DMA_CHAN_SUPPORTED 14
|
#define BCM2835_DMA_MAX_DMA_CHAN_SUPPORTED 14
|
||||||
#define BCM2835_DMA_CHAN_NAME_SIZE 8
|
#define BCM2835_DMA_CHAN_NAME_SIZE 8
|
||||||
|
#define BCM2835_DMA_BULK_MASK BIT(0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct bcm2835_dmadev - BCM2835 DMA controller
|
* struct bcm2835_dmadev - BCM2835 DMA controller
|
||||||
@@ -906,6 +908,9 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
|
|||||||
base = devm_ioremap_resource(&pdev->dev, res);
|
base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
if (IS_ERR(base))
|
if (IS_ERR(base))
|
||||||
return PTR_ERR(base);
|
return PTR_ERR(base);
|
||||||
|
rc = bcm_dmaman_probe(pdev, base, BCM2835_DMA_BULK_MASK);
|
||||||
|
if (rc)
|
||||||
|
dev_err(&pdev->dev, "Failed to initialize the legacy API\n");
|
||||||
|
|
||||||
od->base = base;
|
od->base = base;
|
||||||
|
|
||||||
@@ -951,6 +956,9 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
|
|||||||
goto err_no_dma;
|
goto err_no_dma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Channel 0 is used by the legacy API */
|
||||||
|
chans_available &= ~BCM2835_DMA_BULK_MASK;
|
||||||
|
|
||||||
/* get irqs for each channel that we support */
|
/* get irqs for each channel that we support */
|
||||||
for (i = 0; i <= BCM2835_DMA_MAX_DMA_CHAN_SUPPORTED; i++) {
|
for (i = 0; i <= BCM2835_DMA_MAX_DMA_CHAN_SUPPORTED; i++) {
|
||||||
/* skip masked out channels */
|
/* skip masked out channels */
|
||||||
@@ -1025,6 +1033,7 @@ static int bcm2835_dma_remove(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct bcm2835_dmadev *od = platform_get_drvdata(pdev);
|
struct bcm2835_dmadev *od = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
bcm_dmaman_remove(pdev);
|
||||||
dma_async_device_unregister(&od->ddev);
|
dma_async_device_unregister(&od->ddev);
|
||||||
bcm2835_dma_free(od);
|
bcm2835_dma_free(od);
|
||||||
|
|
||||||
@@ -1040,7 +1049,22 @@ static struct platform_driver bcm2835_dma_driver = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(bcm2835_dma_driver);
|
static int bcm2835_dma_init(void)
|
||||||
|
{
|
||||||
|
return platform_driver_register(&bcm2835_dma_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bcm2835_dma_exit(void)
|
||||||
|
{
|
||||||
|
platform_driver_unregister(&bcm2835_dma_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load after serial driver (arch_initcall) so we see the messages if it fails,
|
||||||
|
* but before drivers (module_init) that need a DMA channel.
|
||||||
|
*/
|
||||||
|
subsys_initcall(bcm2835_dma_init);
|
||||||
|
module_exit(bcm2835_dma_exit);
|
||||||
|
|
||||||
MODULE_ALIAS("platform:bcm2835-dma");
|
MODULE_ALIAS("platform:bcm2835-dma");
|
||||||
MODULE_DESCRIPTION("BCM2835 DMA engine driver");
|
MODULE_DESCRIPTION("BCM2835 DMA engine driver");
|
||||||
|
|||||||
Reference in New Issue
Block a user