0022-dmaengine-bcm2835-Load-driver-early-and-support-lega.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. From c64813bbb6d293b06994bd8ca2de6075953d8879 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 022/381] 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. 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. Support the legacy DMA API which is needed by bcm2708_fb.
  12. Don't mask out channel 2.
  13. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
  14. ---
  15. drivers/dma/Kconfig | 2 +-
  16. drivers/dma/bcm2835-dma.c | 30 ++++++++++++++++++++++++------
  17. 2 files changed, 25 insertions(+), 7 deletions(-)
  18. --- a/drivers/dma/Kconfig
  19. +++ b/drivers/dma/Kconfig
  20. @@ -108,7 +108,7 @@ config COH901318
  21. config DMA_BCM2835
  22. tristate "BCM2835 DMA engine support"
  23. - depends on ARCH_BCM2835
  24. + depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709
  25. select DMA_ENGINE
  26. select DMA_VIRTUAL_CHANNELS
  27. --- a/drivers/dma/bcm2835-dma.c
  28. +++ b/drivers/dma/bcm2835-dma.c
  29. @@ -36,6 +36,7 @@
  30. #include <linux/interrupt.h>
  31. #include <linux/list.h>
  32. #include <linux/module.h>
  33. +#include <linux/platform_data/dma-bcm2708.h>
  34. #include <linux/platform_device.h>
  35. #include <linux/slab.h>
  36. #include <linux/io.h>
  37. @@ -786,6 +787,10 @@ static int bcm2835_dma_probe(struct plat
  38. if (IS_ERR(base))
  39. return PTR_ERR(base);
  40. + rc = bcm_dmaman_probe(pdev, base, BCM2835_DMA_BULK_MASK);
  41. + if (rc)
  42. + dev_err(&pdev->dev, "Failed to initialize the legacy API\n");
  43. +
  44. od->base = base;
  45. dma_cap_set(DMA_SLAVE, od->ddev.cap_mask);
  46. @@ -818,11 +823,8 @@ static int bcm2835_dma_probe(struct plat
  47. goto err_no_dma;
  48. }
  49. - /*
  50. - * Do not use the FIQ and BULK channels,
  51. - * because they are used by the GPU.
  52. - */
  53. - chans_available &= ~(BCM2835_DMA_FIQ_MASK | BCM2835_DMA_BULK_MASK);
  54. + /* Channel 0 is used by the legacy API */
  55. + chans_available &= ~BCM2835_DMA_BULK_MASK;
  56. for (i = 0; i < pdev->num_resources; i++) {
  57. irq = platform_get_irq(pdev, i);
  58. @@ -866,6 +868,7 @@ static int bcm2835_dma_remove(struct pla
  59. {
  60. struct bcm2835_dmadev *od = platform_get_drvdata(pdev);
  61. + bcm_dmaman_remove(pdev);
  62. dma_async_device_unregister(&od->ddev);
  63. bcm2835_dma_free(od);
  64. @@ -881,7 +884,22 @@ static struct platform_driver bcm2835_dm
  65. },
  66. };
  67. -module_platform_driver(bcm2835_dma_driver);
  68. +static int bcm2835_dma_init(void)
  69. +{
  70. + return platform_driver_register(&bcm2835_dma_driver);
  71. +}
  72. +
  73. +static void bcm2835_dma_exit(void)
  74. +{
  75. + platform_driver_unregister(&bcm2835_dma_driver);
  76. +}
  77. +
  78. +/*
  79. + * Load after serial driver (arch_initcall) so we see the messages if it fails,
  80. + * but before drivers (module_init) that need a DMA channel.
  81. + */
  82. +subsys_initcall(bcm2835_dma_init);
  83. +module_exit(bcm2835_dma_exit);
  84. MODULE_ALIAS("platform:bcm2835-dma");
  85. MODULE_DESCRIPTION("BCM2835 DMA engine driver");