13 #include <linux/kernel.h>
14 #include <linux/module.h>
16 #include <asm/cacheflush.h>
50 #define g2_bytes_remaining(i) \
51 ((g2_dma->channel[i].size - \
52 g2_dma->status[i].size) & 0x0fffffff)
59 if (g2_dma->
status[i].status & 0x20000000) {
78 unsigned int chan_nr = chan->chan;
80 g2_dma->
channel[chan_nr].chan_enable = 1;
81 g2_dma->
channel[chan_nr].xfer_enable = 1;
88 unsigned int chan_nr = chan->chan;
90 g2_dma->
channel[chan_nr].chan_enable = 0;
91 g2_dma->
channel[chan_nr].xfer_enable = 0;
98 unsigned int chan_nr = chan->chan;
100 if (chan->sar & 31) {
101 printk(
"g2dma: unaligned source 0x%lx\n", chan->sar);
105 if (chan->dar & 31) {
106 printk(
"g2dma: unaligned dest 0x%lx\n", chan->dar);
111 if (chan->count & 31)
112 chan->count = (chan->count + (32 - 1)) & ~(32 - 1);
115 chan->dar += 0xa0800000;
118 chan->mode = !chan->mode;
122 g2_disable_dma(chan);
124 g2_dma->
channel[chan_nr].g2_addr = chan->dar & 0x1fffffe0;
125 g2_dma->
channel[chan_nr].root_addr = chan->sar & 0x1fffffe0;
126 g2_dma->
channel[chan_nr].size = (chan->count & ~31) | 0x80000000;
127 g2_dma->
channel[chan_nr].direction = chan->mode;
134 g2_dma->
channel[chan_nr].ctrl = 5;
139 pr_debug(
"count, sar, dar, mode, ctrl, chan, xfer: %ld, 0x%08lx, "
140 "0x%08lx, %ld, %ld, %ld, %ld\n",
142 g2_dma->
channel[chan_nr].root_addr,
143 g2_dma->
channel[chan_nr].g2_addr,
144 g2_dma->
channel[chan_nr].direction,
146 g2_dma->
channel[chan_nr].chan_enable,
147 g2_dma->
channel[chan_nr].xfer_enable);
152 static int g2_get_residue(
struct dma_channel *chan)
157 static struct dma_ops g2_dma_ops = {
159 .get_residue = g2_get_residue,
166 .flags = DMAC_CHANNELS_TEI_CAPABLE,
169 static int __init g2_dma_init(
void)
174 "g2 DMA handler", &g2_dma_info);
180 g2_dma->
magic = 0x4659404f;
189 static void __exit g2_dma_exit(
void)