Skip to content

Commit 7835fbd

Browse files
notropopcornmix
authored andcommitted
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 <[email protected]>
1 parent 0e9c1fc commit 7835fbd

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

drivers/dma/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ config COH901318
108108

109109
config DMA_BCM2835
110110
tristate "BCM2835 DMA engine support"
111-
depends on ARCH_BCM2835
111+
depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
112112
select DMA_ENGINE
113113
select DMA_VIRTUAL_CHANNELS
114114

drivers/dma/bcm2835-dma.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <linux/interrupt.h>
3737
#include <linux/list.h>
3838
#include <linux/module.h>
39+
#include <linux/platform_data/dma-bcm2708.h>
3940
#include <linux/platform_device.h>
4041
#include <linux/slab.h>
4142
#include <linux/io.h>
@@ -786,6 +787,10 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
786787
if (IS_ERR(base))
787788
return PTR_ERR(base);
788789

790+
rc = bcm_dmaman_probe(pdev, base, BCM2835_DMA_BULK_MASK);
791+
if (rc)
792+
dev_err(&pdev->dev, "Failed to initialize the legacy API\n");
793+
789794
od->base = base;
790795

791796
dma_cap_set(DMA_SLAVE, od->ddev.cap_mask);
@@ -818,11 +823,8 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
818823
goto err_no_dma;
819824
}
820825

821-
/*
822-
* Do not use the FIQ and BULK channels,
823-
* because they are used by the GPU.
824-
*/
825-
chans_available &= ~(BCM2835_DMA_FIQ_MASK | BCM2835_DMA_BULK_MASK);
826+
/* Channel 0 is used by the legacy API */
827+
chans_available &= ~BCM2835_DMA_BULK_MASK;
826828

827829
for (i = 0; i < pdev->num_resources; i++) {
828830
irq = platform_get_irq(pdev, i);
@@ -866,6 +868,7 @@ static int bcm2835_dma_remove(struct platform_device *pdev)
866868
{
867869
struct bcm2835_dmadev *od = platform_get_drvdata(pdev);
868870

871+
bcm_dmaman_remove(pdev);
869872
dma_async_device_unregister(&od->ddev);
870873
bcm2835_dma_free(od);
871874

@@ -881,7 +884,22 @@ static struct platform_driver bcm2835_dma_driver = {
881884
},
882885
};
883886

884-
module_platform_driver(bcm2835_dma_driver);
887+
static int bcm2835_dma_init(void)
888+
{
889+
return platform_driver_register(&bcm2835_dma_driver);
890+
}
891+
892+
static void bcm2835_dma_exit(void)
893+
{
894+
platform_driver_unregister(&bcm2835_dma_driver);
895+
}
896+
897+
/*
898+
* Load after serial driver (arch_initcall) so we see the messages if it fails,
899+
* but before drivers (module_init) that need a DMA channel.
900+
*/
901+
subsys_initcall(bcm2835_dma_init);
902+
module_exit(bcm2835_dma_exit);
885903

886904
MODULE_ALIAS("platform:bcm2835-dma");
887905
MODULE_DESCRIPTION("BCM2835 DMA engine driver");

0 commit comments

Comments
 (0)