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