tsi721_dma.c (552c69b36ebd966186573b9c7a286b390935cce1) tsi721_dma.c (750afb08ca71310fcf0c4e2cb1565c63b8235b60)
1/*
2 * DMA Engine support for Tsi721 PCIExpress-to-SRIO bridge
3 *
4 * Copyright (c) 2011-2014 Integrated Device Technology, Inc.
5 * Alexandre Bounine <alexandre.bounine@idt.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free

--- 76 unchanged lines hidden (view full) ---

85#endif
86
87 tsi_debug(DMA, &bdma_chan->dchan.dev->device, "DMAC%d", bdma_chan->id);
88
89 /*
90 * Allocate space for DMA descriptors
91 * (add an extra element for link descriptor)
92 */
1/*
2 * DMA Engine support for Tsi721 PCIExpress-to-SRIO bridge
3 *
4 * Copyright (c) 2011-2014 Integrated Device Technology, Inc.
5 * Alexandre Bounine <alexandre.bounine@idt.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free

--- 76 unchanged lines hidden (view full) ---

85#endif
86
87 tsi_debug(DMA, &bdma_chan->dchan.dev->device, "DMAC%d", bdma_chan->id);
88
89 /*
90 * Allocate space for DMA descriptors
91 * (add an extra element for link descriptor)
92 */
93 bd_ptr = dma_zalloc_coherent(dev,
94 (bd_num + 1) * sizeof(struct tsi721_dma_desc),
95 &bd_phys, GFP_ATOMIC);
93 bd_ptr = dma_alloc_coherent(dev,
94 (bd_num + 1) * sizeof(struct tsi721_dma_desc),
95 &bd_phys, GFP_ATOMIC);
96 if (!bd_ptr)
97 return -ENOMEM;
98
99 bdma_chan->bd_num = bd_num;
100 bdma_chan->bd_phys = bd_phys;
101 bdma_chan->bd_base = bd_ptr;
102
103 tsi_debug(DMA, &bdma_chan->dchan.dev->device,
104 "DMAC%d descriptors @ %p (phys = %pad)",
105 bdma_chan->id, bd_ptr, &bd_phys);
106
107 /* Allocate space for descriptor status FIFO */
108 sts_size = ((bd_num + 1) >= TSI721_DMA_MINSTSSZ) ?
109 (bd_num + 1) : TSI721_DMA_MINSTSSZ;
110 sts_size = roundup_pow_of_two(sts_size);
96 if (!bd_ptr)
97 return -ENOMEM;
98
99 bdma_chan->bd_num = bd_num;
100 bdma_chan->bd_phys = bd_phys;
101 bdma_chan->bd_base = bd_ptr;
102
103 tsi_debug(DMA, &bdma_chan->dchan.dev->device,
104 "DMAC%d descriptors @ %p (phys = %pad)",
105 bdma_chan->id, bd_ptr, &bd_phys);
106
107 /* Allocate space for descriptor status FIFO */
108 sts_size = ((bd_num + 1) >= TSI721_DMA_MINSTSSZ) ?
109 (bd_num + 1) : TSI721_DMA_MINSTSSZ;
110 sts_size = roundup_pow_of_two(sts_size);
111 sts_ptr = dma_zalloc_coherent(dev,
111 sts_ptr = dma_alloc_coherent(dev,
112 sts_size * sizeof(struct tsi721_dma_sts),
113 &sts_phys, GFP_ATOMIC);
114 if (!sts_ptr) {
115 /* Free space allocated for DMA descriptors */
116 dma_free_coherent(dev,
117 (bd_num + 1) * sizeof(struct tsi721_dma_desc),
118 bd_ptr, bd_phys);
119 bdma_chan->bd_base = NULL;

--- 935 unchanged lines hidden ---
112 sts_size * sizeof(struct tsi721_dma_sts),
113 &sts_phys, GFP_ATOMIC);
114 if (!sts_ptr) {
115 /* Free space allocated for DMA descriptors */
116 dma_free_coherent(dev,
117 (bd_num + 1) * sizeof(struct tsi721_dma_desc),
118 bd_ptr, bd_phys);
119 bdma_chan->bd_base = NULL;

--- 935 unchanged lines hidden ---