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

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