950-0141-bcm2835-dma-Add-support-for-per-channel-flags.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From d70a417420f9d10e86031ec24da68b71668aa833 Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <[email protected]>
  3. Date: Fri, 20 Jul 2018 22:03:41 +0100
  4. Subject: [PATCH] bcm2835-dma: Add support for per-channel flags
  5. Add the ability to interpret the high bits of the dreq specifier as
  6. flags to be included in the DMA_CS register. The motivation for this
  7. change is the ability to set the DISDEBUG flag for SD card transfers
  8. to avoid corruption when using the VPU debugger.
  9. Signed-off-by: Phil Elwell <[email protected]>
  10. ---
  11. drivers/dma/bcm2835-dma.c | 10 ++++++++--
  12. 1 file changed, 8 insertions(+), 2 deletions(-)
  13. --- a/drivers/dma/bcm2835-dma.c
  14. +++ b/drivers/dma/bcm2835-dma.c
  15. @@ -141,6 +141,10 @@ struct bcm2835_desc {
  16. #define BCM2835_DMA_S_DREQ BIT(10) /* enable SREQ for source */
  17. #define BCM2835_DMA_S_IGNORE BIT(11) /* ignore source reads - read 0 */
  18. #define BCM2835_DMA_BURST_LENGTH(x) ((x & 15) << 12)
  19. +#define BCM2835_DMA_CS_FLAGS(x) (x & (BCM2835_DMA_PRIORITY(15) | \
  20. + BCM2835_DMA_PANIC_PRIORITY(15) | \
  21. + BCM2835_DMA_WAIT_FOR_WRITES | \
  22. + BCM2835_DMA_DIS_DEBUG))
  23. #define BCM2835_DMA_PER_MAP(x) ((x & 31) << 16) /* REQ source */
  24. #define BCM2835_DMA_WAIT(x) ((x & 31) << 21) /* add DMA-wait cycles */
  25. #define BCM2835_DMA_NO_WIDE_BURSTS BIT(26) /* no 2 beat write bursts */
  26. @@ -454,7 +458,8 @@ static void bcm2835_dma_start_desc(struc
  27. c->desc = d = to_bcm2835_dma_desc(&vd->tx);
  28. writel(d->cb_list[0].paddr, c->chan_base + BCM2835_DMA_ADDR);
  29. - writel(BCM2835_DMA_ACTIVE, c->chan_base + BCM2835_DMA_CS);
  30. + writel(BCM2835_DMA_ACTIVE | BCM2835_DMA_CS_FLAGS(c->dreq),
  31. + c->chan_base + BCM2835_DMA_CS);
  32. }
  33. static irqreturn_t bcm2835_dma_callback(int irq, void *data)
  34. @@ -481,7 +486,8 @@ static irqreturn_t bcm2835_dma_callback(
  35. * if this IRQ handler is threaded.) If the channel is finished, it
  36. * will remain idle despite the ACTIVE flag being set.
  37. */
  38. - writel(BCM2835_DMA_INT | BCM2835_DMA_ACTIVE,
  39. + writel(BCM2835_DMA_INT | BCM2835_DMA_ACTIVE |
  40. + BCM2835_DMA_CS_FLAGS(c->dreq),
  41. c->chan_base + BCM2835_DMA_CS);
  42. d = c->desc;