brcm2708: update linux 4.4 patches to latest version
[openwrt/staging/lynxis/omap.git] / target / linux / brcm2708 / patches-4.4 / 0402-dmaengine-bcm2835-Load-driver-early-and-support-lega.patch
1 From b0ad872cdb56e3dfd36ec2fbd0aad0375609bb0f Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
3 Date: Sat, 3 Oct 2015 22:22:55 +0200
4 Subject: [PATCH 402/423] dmaengine: bcm2835: Load driver early and support
5 legacy API
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Load driver early since at least bcm2708_fb doesn't support deferred
11 probing and even if it did, we don't want the video driver deferred.
12
13 Support the legacy DMA API which is needed by bcm2708_fb
14 (but only using the dedicated dma channel 0).
15
16 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
17 Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
18 ---
19 drivers/dma/Kconfig | 2 +-
20 drivers/dma/bcm2835-dma.c | 27 ++++++++++++++++++++++++++-
21 2 files changed, 27 insertions(+), 2 deletions(-)
22
23 --- a/drivers/dma/Kconfig
24 +++ b/drivers/dma/Kconfig
25 @@ -108,7 +108,7 @@ config COH901318
26
27 config DMA_BCM2835
28 tristate "BCM2835 DMA engine support"
29 - depends on ARCH_BCM2835
30 + depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
31 select DMA_ENGINE
32 select DMA_VIRTUAL_CHANNELS
33
34 --- a/drivers/dma/bcm2835-dma.c
35 +++ b/drivers/dma/bcm2835-dma.c
36 @@ -37,6 +37,7 @@
37 #include <linux/interrupt.h>
38 #include <linux/list.h>
39 #include <linux/module.h>
40 +#include <linux/platform_data/dma-bcm2708.h>
41 #include <linux/platform_device.h>
42 #include <linux/slab.h>
43 #include <linux/io.h>
44 @@ -1021,6 +1022,14 @@ static int bcm2835_dma_probe(struct plat
45
46 dev_dbg(&pdev->dev, "Load BCM2835 DMA engine driver\n");
47
48 + /* load the legacy api if bit 0 in the mask is cleared */
49 + if ((chans_available & BIT(0)) == 0) {
50 + rc = bcm_dmaman_probe(pdev, base, BIT(0));
51 + if (rc)
52 + dev_err(&pdev->dev,
53 + "Failed to initialize the legacy API\n");
54 + }
55 +
56 return 0;
57
58 err_no_dma:
59 @@ -1032,6 +1041,7 @@ static int bcm2835_dma_remove(struct pla
60 {
61 struct bcm2835_dmadev *od = platform_get_drvdata(pdev);
62
63 + bcm_dmaman_remove(pdev);
64 dma_async_device_unregister(&od->ddev);
65 bcm2835_dma_free(od);
66
67 @@ -1047,7 +1057,22 @@ static struct platform_driver bcm2835_dm
68 },
69 };
70
71 -module_platform_driver(bcm2835_dma_driver);
72 +static int bcm2835_dma_init(void)
73 +{
74 + return platform_driver_register(&bcm2835_dma_driver);
75 +}
76 +
77 +static void bcm2835_dma_exit(void)
78 +{
79 + platform_driver_unregister(&bcm2835_dma_driver);
80 +}
81 +
82 +/*
83 + * Load after serial driver (arch_initcall) so we see the messages if it fails,
84 + * but before drivers (module_init) that need a DMA channel.
85 + */
86 +subsys_initcall(bcm2835_dma_init);
87 +module_exit(bcm2835_dma_exit);
88
89 MODULE_ALIAS("platform:bcm2835-dma");
90 MODULE_DESCRIPTION("BCM2835 DMA engine driver");