0388-Revert-bcm2835-dma-Fix-up-convert-to-DMA-pool.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From 80e7256b69b395f91738b44dc259c9fa4d15dda3 Mon Sep 17 00:00:00 2001
  2. From: Martin Sperl <kernel@martin.sperl.org>
  3. Date: Fri, 22 Apr 2016 17:17:13 +0000
  4. Subject: [PATCH] Revert "bcm2835-dma: Fix up convert to DMA pool"
  5. This reverts commit ec2e48fda22c57cab56a4332d1a095f91c919493.
  6. ---
  7. drivers/dma/bcm2835-dma.c | 36 ++++++++++--------------------------
  8. 1 file changed, 10 insertions(+), 26 deletions(-)
  9. --- a/drivers/dma/bcm2835-dma.c
  10. +++ b/drivers/dma/bcm2835-dma.c
  11. @@ -488,17 +488,6 @@ static struct dma_async_tx_descriptor *b
  12. c->cyclic = true;
  13. return vchan_tx_prep(&c->vc, &d->vd, flags);
  14. -error_cb:
  15. - i--;
  16. - for (; i >= 0; i--) {
  17. - struct bcm2835_cb_entry *cb_entry = &d->cb_list[i];
  18. -
  19. - dma_pool_free(c->cb_pool, cb_entry->cb, cb_entry->paddr);
  20. - }
  21. -
  22. - kfree(d->cb_list);
  23. - kfree(d);
  24. - return NULL;
  25. }
  26. static struct dma_async_tx_descriptor *
  27. @@ -545,7 +534,6 @@ bcm2835_dma_prep_slave_sg(struct dma_cha
  28. if (!d)
  29. return NULL;
  30. - d->c = c;
  31. d->dir = direction;
  32. if (c->ch >= 8) /* LITE channel */
  33. @@ -565,21 +553,15 @@ bcm2835_dma_prep_slave_sg(struct dma_cha
  34. d->frames += len / max_size + 1;
  35. }
  36. - d->cb_list = kcalloc(d->frames, sizeof(*d->cb_list), GFP_KERNEL);
  37. - if (!d->cb_list) {
  38. + /* Allocate memory for control blocks */
  39. + d->control_block_size = d->frames * sizeof(struct bcm2835_dma_cb);
  40. + d->control_block_base = dma_zalloc_coherent(chan->device->dev,
  41. + d->control_block_size, &d->control_block_base_phys,
  42. + GFP_NOWAIT);
  43. + if (!d->control_block_base) {
  44. kfree(d);
  45. return NULL;
  46. }
  47. - /* Allocate memory for control blocks */
  48. - for (i = 0; i < d->frames; i++) {
  49. - struct bcm2835_cb_entry *cb_entry = &d->cb_list[i];
  50. -
  51. - cb_entry->cb = dma_pool_zalloc(c->cb_pool, GFP_ATOMIC,
  52. - &cb_entry->paddr);
  53. -
  54. - if (!cb_entry->cb)
  55. - goto error_cb;
  56. - }
  57. /*
  58. * Iterate over all SG entries, create a control block
  59. @@ -596,7 +578,7 @@ bcm2835_dma_prep_slave_sg(struct dma_cha
  60. for (j = 0; j < len; j += max_size) {
  61. struct bcm2835_dma_cb *control_block =
  62. - d->cb_list[i + split_cnt].cb;
  63. + &d->control_block_base[i + split_cnt];
  64. /* Setup addresses */
  65. if (d->dir == DMA_DEV_TO_MEM) {
  66. @@ -638,7 +620,9 @@ bcm2835_dma_prep_slave_sg(struct dma_cha
  67. if (i < sg_len - 1 || len - j > max_size) {
  68. /* Next block is the next frame. */
  69. control_block->next =
  70. - d->cb_list[i + split_cnt + 1].paddr;
  71. + d->control_block_base_phys +
  72. + sizeof(struct bcm2835_dma_cb) *
  73. + (i + split_cnt + 1);
  74. } else {
  75. /* Next block is empty. */
  76. control_block->next = 0;