2 * TI OMAP DMA gigacell.
4 * Copyright (C) 2006-2008 Andrzej Zaborowski <balrog@zabor.org>
5 * Copyright (C) 2007-2008 Lauro Ramos Venancio <lauro.venancio@indt.org.br>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "qemu-common.h"
22 #include "qemu-timer.h"
28 //#define OMAP_DMA_DEBUG
31 #define TRACE(fmt,...) fprintf(stderr, "%s:" fmt "\n", __FUNCTION__, ##__VA_ARGS__)
36 struct omap_dma_channel_s {
43 enum omap_dma_port port[2];
44 target_phys_addr_t addr[2];
45 omap_dma_addressing_t mode[2];
48 int32_t frame_index[2];
49 int16_t element_index[2];
58 /* auto init and linked channel data */
65 /* interruption data */
85 int omap_3_1_compatible_disable;
88 struct omap_dma_channel_s *sibling;
90 struct omap_dma_reg_set_s {
91 target_phys_addr_t src, dest;
102 struct soc_dma_ch_s *dma;
104 /* unused parameters */
107 int interleave_disabled;
114 struct soc_dma_s *dma;
116 struct omap_mpu_state_s *mpu;
119 void (*intr_update)(struct omap_dma_s *s);
120 enum omap_dma_model model;
121 int omap_3_1_mapping_disabled;
130 struct omap_dma_channel_s ch[32];
131 struct omap_dma_lcd_channel_s lcd_ch;
135 #define TIMEOUT_INTR (1 << 0)
136 #define EVENT_DROP_INTR (1 << 1)
137 #define HALF_FRAME_INTR (1 << 2)
138 #define END_FRAME_INTR (1 << 3)
139 #define LAST_FRAME_INTR (1 << 4)
140 #define END_BLOCK_INTR (1 << 5)
141 #define SYNC (1 << 6)
142 #define END_PKT_INTR (1 << 7)
143 #define TRANS_ERR_INTR (1 << 8)
144 #define MISALIGN_INTR (1 << 11)
146 static inline void omap_dma_interrupts_update(struct omap_dma_s *s)
148 return s->intr_update(s);
151 static void omap_dma_channel_load(struct omap_dma_channel_s *ch)
153 struct omap_dma_reg_set_s *a = &ch->active_set;
155 int omap_3_1 = !ch->omap_3_1_compatible_disable;
158 * TODO: verify address ranges and alignment
159 * TODO: port endianness
162 a->src = ch->addr[0];
163 a->dest = ch->addr[1];
164 a->frames = ch->frames;
165 a->elements = ch->elements;
166 a->pck_elements = ch->frame_index[!ch->src_sync];
171 if (unlikely(!ch->elements || !ch->frames)) {
172 printf("%s: bad DMA request\n", __FUNCTION__);
176 for (i = 0; i < 2; i ++)
177 switch (ch->mode[i]) {
179 a->elem_delta[i] = 0;
180 a->frame_delta[i] = 0;
182 case post_incremented:
183 a->elem_delta[i] = ch->data_type;
184 a->frame_delta[i] = 0;
187 a->elem_delta[i] = ch->data_type +
188 ch->element_index[omap_3_1 ? 0 : i] - 1;
189 a->frame_delta[i] = 0;
192 a->elem_delta[i] = ch->data_type +
193 ch->element_index[omap_3_1 ? 0 : i] - 1;
194 a->frame_delta[i] = ch->frame_index[omap_3_1 ? 0 : i] -
195 ch->element_index[omap_3_1 ? 0 : i];
201 normal = !ch->transparent_copy && !ch->constant_fill &&
202 /* FIFO is big-endian so either (ch->endian[n] == 1) OR
203 * (ch->endian_lock[n] == 1) mean no endianism conversion. */
204 (ch->endian[0] | ch->endian_lock[0]) ==
205 (ch->endian[1] | ch->endian_lock[1]);
206 for (i = 0; i < 2; i ++) {
207 /* TODO: for a->frame_delta[i] > 0 still use the fast path, just
208 * limit min_elems in omap_dma_transfer_setup to the nearest frame
210 if (!a->elem_delta[i] && normal &&
211 (a->frames == 1 || !a->frame_delta[i]))
212 ch->dma->type[i] = soc_dma_access_const;
213 else if (a->elem_delta[i] == ch->data_type && normal &&
214 (a->frames == 1 || !a->frame_delta[i]))
215 ch->dma->type[i] = soc_dma_access_linear;
217 ch->dma->type[i] = soc_dma_access_other;
219 ch->dma->vaddr[i] = ch->addr[i];
221 soc_dma_ch_update(ch->dma);
224 static void omap_dma_activate_channel(struct omap_dma_s *s,
225 struct omap_dma_channel_s *ch)
228 if (ch->set_update) {
229 /* It's not clear when the active set is supposed to be
230 * loaded from registers. We're already loading it when the
231 * channel is enabled, and for some guests this is not enough
232 * but that may be also because of a race condition (no
233 * delays in qemu) in the guest code, which we're just
234 * working around here. */
235 omap_dma_channel_load(ch);
240 soc_dma_set_request(ch->dma, 1);
246 static void omap_dma_deactivate_channel(struct omap_dma_s *s,
247 struct omap_dma_channel_s *ch)
250 ch->cpc = ch->active_set.dest & 0xffff;
252 if (ch->pending_request && !ch->waiting_end_prog && ch->enable) {
253 /* Don't deactivate the channel */
254 ch->pending_request = 0;
258 /* Don't deactive the channel if it is synchronized and the DMA request is
260 if (ch->sync && ch->enable && s->dma->drqst[ch->sync])
266 soc_dma_set_request(ch->dma, 0);
270 static void omap_dma_enable_channel(struct omap_dma_s *s,
271 struct omap_dma_channel_s *ch)
275 ch->waiting_end_prog = 0;
276 omap_dma_channel_load(ch);
277 /* TODO: theoretically if ch->sync && ch->prefetch &&
278 * !s->dma->drqst[ch->sync], we should also activate and fetch
279 * from source and then stall until signalled. */
280 if ((!ch->sync) || s->dma->drqst[ch->sync])
281 omap_dma_activate_channel(s, ch);
285 static void omap_dma_disable_channel(struct omap_dma_s *s,
286 struct omap_dma_channel_s *ch)
290 /* Discard any pending request */
291 ch->pending_request = 0;
292 omap_dma_deactivate_channel(s, ch);
296 static void omap_dma_channel_end_prog(struct omap_dma_s *s,
297 struct omap_dma_channel_s *ch)
299 if (ch->waiting_end_prog) {
300 ch->waiting_end_prog = 0;
301 if (!ch->sync || ch->pending_request) {
302 ch->pending_request = 0;
303 omap_dma_activate_channel(s, ch);
308 static void omap_dma_interrupts_3_1_update(struct omap_dma_s *s)
310 struct omap_dma_channel_s *ch = s->ch;
312 /* First three interrupts are shared between two channels each. */
313 if (ch[0].status | ch[6].status)
314 qemu_irq_raise(ch[0].irq);
315 if (ch[1].status | ch[7].status)
316 qemu_irq_raise(ch[1].irq);
317 if (ch[2].status | ch[8].status)
318 qemu_irq_raise(ch[2].irq);
320 qemu_irq_raise(ch[3].irq);
322 qemu_irq_raise(ch[4].irq);
324 qemu_irq_raise(ch[5].irq);
327 static void omap_dma_interrupts_3_2_update(struct omap_dma_s *s)
329 struct omap_dma_channel_s *ch = s->ch;
332 for (i = s->chans; i; ch ++, i --)
334 qemu_irq_raise(ch->irq);
337 static void omap_dma_enable_3_1_mapping(struct omap_dma_s *s)
339 s->omap_3_1_mapping_disabled = 0;
341 s->intr_update = omap_dma_interrupts_3_1_update;
344 static void omap_dma_disable_3_1_mapping(struct omap_dma_s *s)
346 s->omap_3_1_mapping_disabled = 1;
348 s->intr_update = omap_dma_interrupts_3_2_update;
351 static void omap_dma_process_request(struct omap_dma_s *s, int request)
355 struct omap_dma_channel_s *ch = s->ch;
357 for (channel = 0; channel < s->chans; channel ++, ch ++) {
358 if (ch->enable && ch->sync == request) {
360 omap_dma_activate_channel(s, ch);
361 else if (!ch->pending_request)
362 ch->pending_request = 1;
364 /* Request collision */
365 /* Second request received while processing other request */
366 ch->status |= EVENT_DROP_INTR;
373 omap_dma_interrupts_update(s);
376 static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma)
379 struct omap_dma_channel_s *ch = dma->opaque;
380 struct omap_dma_reg_set_s *a = &ch->active_set;
381 int bytes = dma->bytes;
383 uint16_t status = ch->status;
386 TRACE("frame %d", a->frame);
388 /* Transfer a single element */
389 /* FIXME: check the endianness */
390 if (!ch->constant_fill)
391 cpu_physical_memory_read(a->src, value, ch->data_type);
393 *(uint32_t *) value = ch->color;
395 if (!ch->transparent_copy || *(uint32_t *) value != ch->color)
396 cpu_physical_memory_write(a->dest, value, ch->data_type);
398 a->src += a->elem_delta[0];
399 a->dest += a->elem_delta[1];
403 if (a->element == a->elements) {
406 a->src += a->frame_delta[0];
407 a->dest += a->frame_delta[1];
410 /* If the channel is async, update cpc */
412 ch->cpc = a->dest & 0xffff;
414 } while ((bytes -= ch->data_type));
416 /* If the channel is element synchronized, deactivate it */
417 if (ch->sync && !ch->fs && !ch->bs)
418 omap_dma_deactivate_channel(s, ch);
420 /* If it is the last frame, set the LAST_FRAME interrupt */
421 if (a->element == 1 && a->frame == a->frames - 1)
422 if (ch->interrupts & LAST_FRAME_INTR)
423 ch->status |= LAST_FRAME_INTR;
425 /* If the half of the frame was reached, set the HALF_FRAME
427 if (a->element == (a->elements >> 1))
428 if (ch->interrupts & HALF_FRAME_INTR)
429 ch->status |= HALF_FRAME_INTR;
431 if (ch->fs && ch->bs) {
433 /* Check if a full packet has beed transferred. */
434 if (a->pck_element == a->pck_elements) {
437 /* Set the END_PKT interrupt */
438 if ((ch->interrupts & END_PKT_INTR) && !ch->src_sync)
439 ch->status |= END_PKT_INTR;
441 /* If the channel is packet-synchronized, deactivate it */
443 omap_dma_deactivate_channel(s, ch);
447 if (a->element == a->elements) {
450 a->src += a->frame_delta[0];
451 a->dest += a->frame_delta[1];
454 /* If the channel is frame synchronized, deactivate it */
455 if (ch->sync && ch->fs && !ch->bs)
456 omap_dma_deactivate_channel(s, ch);
458 /* If the channel is async, update cpc */
460 ch->cpc = a->dest & 0xffff;
462 /* Set the END_FRAME interrupt */
463 if (ch->interrupts & END_FRAME_INTR)
464 ch->status |= END_FRAME_INTR;
466 if (a->frame == a->frames) {
468 /* Disable the channel */
470 if (ch->omap_3_1_compatible_disable) {
471 omap_dma_disable_channel(s, ch);
472 if (ch->link_enabled)
473 omap_dma_enable_channel(s,
474 &s->ch[ch->link_next_ch]);
477 omap_dma_disable_channel(s, ch);
478 else if (ch->repeat || ch->end_prog)
479 omap_dma_channel_load(ch);
481 ch->waiting_end_prog = 1;
482 omap_dma_deactivate_channel(s, ch);
486 if (ch->interrupts & END_BLOCK_INTR)
487 ch->status |= END_BLOCK_INTR;
490 } while (status == ch->status && ch->active);
492 omap_dma_interrupts_update(s);
497 omap_dma_intr_element_sync,
498 omap_dma_intr_last_frame,
499 omap_dma_intr_half_frame,
501 omap_dma_intr_frame_sync,
502 omap_dma_intr_packet,
503 omap_dma_intr_packet_sync,
505 __omap_dma_intr_last,
508 static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
510 struct omap_dma_port_if_s *src_p, *dest_p;
511 struct omap_dma_reg_set_s *a;
512 struct omap_dma_channel_s *ch = dma->opaque;
513 struct omap_dma_s *s = dma->dma->opaque;
514 int frames, min_elems, elements[__omap_dma_intr_last];
518 src_p = &s->mpu->port[ch->port[0]];
519 dest_p = &s->mpu->port[ch->port[1]];
520 if ((!ch->constant_fill && !src_p->addr_valid(s->mpu, a->src)) ||
521 (!dest_p->addr_valid(s->mpu, a->dest))) {
524 if (ch->interrupts & TIMEOUT_INTR)
525 ch->status |= TIMEOUT_INTR;
526 omap_dma_deactivate_channel(s, ch);
529 printf("%s: Bus time-out in DMA%i operation\n",
530 __FUNCTION__, dma->num);
535 /* Check all the conditions that terminate the transfer starting
536 * with those that can occur the soonest. */
537 #define INTR_CHECK(cond, id, nelements) \
539 elements[id] = nelements; \
540 if (elements[id] < min_elems) \
541 min_elems = elements[id]; \
543 elements[id] = INT_MAX;
547 ch->sync && !ch->fs && !ch->bs,
548 omap_dma_intr_element_sync,
552 /* TODO: for transfers where entire frames can be read and written
553 * using memcpy() but a->frame_delta is non-zero, try to still do
554 * transfers using soc_dma but limit min_elems to a->elements - ...
555 * See also the TODO in omap_dma_channel_load. */
557 (ch->interrupts & LAST_FRAME_INTR) &&
558 ((a->frame < a->frames - 1) || !a->element),
559 omap_dma_intr_last_frame,
560 (a->frames - a->frame - 2) * a->elements +
561 (a->elements - a->element + 1))
563 ch->interrupts & HALF_FRAME_INTR,
564 omap_dma_intr_half_frame,
566 (a->element >= (a->elements >> 1) ? a->elements : 0) -
569 ch->sync && ch->fs && (ch->interrupts & END_FRAME_INTR),
571 a->elements - a->element)
573 ch->sync && ch->fs && !ch->bs,
574 omap_dma_intr_frame_sync,
575 a->elements - a->element)
580 (ch->interrupts & END_PKT_INTR) && !ch->src_sync,
581 omap_dma_intr_packet,
582 a->pck_elements - a->pck_element)
584 ch->fs && ch->bs && ch->sync,
585 omap_dma_intr_packet_sync,
586 a->pck_elements - a->pck_element)
592 (a->frames - a->frame - 1) * a->elements +
593 (a->elements - a->element))
595 dma->bytes = min_elems * ch->data_type;
597 /* Set appropriate interrupts and/or deactivate channels */
600 /* TODO: should all of this only be done if dma->update, and otherwise
601 * inside omap_dma_transfer_generic below - check what's faster. */
605 /* If the channel is element synchronized, deactivate it */
606 if (min_elems == elements[omap_dma_intr_element_sync])
607 omap_dma_deactivate_channel(s, ch);
609 /* If it is the last frame, set the LAST_FRAME interrupt */
610 if (min_elems == elements[omap_dma_intr_last_frame])
611 ch->status |= LAST_FRAME_INTR;
613 /* If exactly half of the frame was reached, set the HALF_FRAME
615 if (min_elems == elements[omap_dma_intr_half_frame])
616 ch->status |= HALF_FRAME_INTR;
618 /* If a full packet has been transferred, set the END_PKT interrupt */
619 if (min_elems == elements[omap_dma_intr_packet])
620 ch->status |= END_PKT_INTR;
622 /* If the channel is packet-synchronized, deactivate it */
623 if (min_elems == elements[omap_dma_intr_packet_sync])
624 omap_dma_deactivate_channel(s, ch);
626 /* If the channel is frame synchronized, deactivate it */
627 if (min_elems == elements[omap_dma_intr_frame_sync])
628 omap_dma_deactivate_channel(s, ch);
630 /* Set the END_FRAME interrupt */
631 if (min_elems == elements[omap_dma_intr_frame])
632 ch->status |= END_FRAME_INTR;
634 if (min_elems == elements[omap_dma_intr_block]) {
636 /* Disable the channel */
638 if (ch->omap_3_1_compatible_disable) {
639 omap_dma_disable_channel(s, ch);
640 if (ch->link_enabled)
641 omap_dma_enable_channel(s, &s->ch[ch->link_next_ch]);
644 omap_dma_disable_channel(s, ch);
645 else if (ch->repeat || ch->end_prog)
646 omap_dma_channel_load(ch);
648 ch->waiting_end_prog = 1;
649 omap_dma_deactivate_channel(s, ch);
653 if (ch->interrupts & END_BLOCK_INTR)
654 ch->status |= END_BLOCK_INTR;
657 /* Update packet number */
658 if (ch->fs && ch->bs) {
659 a->pck_element += min_elems;
660 a->pck_element %= a->pck_elements;
663 /* TODO: check if we really need to update anything here or perhaps we
664 * can skip part of this. */
668 a->element += min_elems;
670 frames = a->element / a->elements;
671 a->element = a->element % a->elements;
673 a->src += min_elems * a->elem_delta[0] + frames * a->frame_delta[0];
674 a->dest += min_elems * a->elem_delta[1] + frames * a->frame_delta[1];
676 /* If the channel is async, update cpc */
677 if (!ch->sync && frames)
678 ch->cpc = a->dest & 0xffff;
680 /* TODO: if the destination port is IMIF or EMIFF, set the dirty
684 omap_dma_interrupts_update(s);
687 void omap_dma_reset(struct soc_dma_s *dma)
690 struct omap_dma_s *s = dma->opaque;
692 soc_dma_reset(s->dma);
693 if (s->model < omap_dma_4)
698 memset(&s->irqstat, 0, sizeof(s->irqstat));
699 memset(&s->irqen, 0, sizeof(s->irqen));
700 s->lcd_ch.src = emiff;
701 s->lcd_ch.condition = 0;
702 s->lcd_ch.interrupts = 0;
704 if (s->model < omap_dma_4)
705 omap_dma_enable_3_1_mapping(s);
706 for (i = 0; i < s->chans; i ++) {
707 s->ch[i].suspend = 0;
708 s->ch[i].prefetch = 0;
709 s->ch[i].buf_disable = 0;
710 s->ch[i].src_sync = 0;
711 memset(&s->ch[i].burst, 0, sizeof(s->ch[i].burst));
712 memset(&s->ch[i].port, 0, sizeof(s->ch[i].port));
713 memset(&s->ch[i].mode, 0, sizeof(s->ch[i].mode));
714 memset(&s->ch[i].frame_index, 0, sizeof(s->ch[i].frame_index));
715 memset(&s->ch[i].element_index, 0, sizeof(s->ch[i].element_index));
716 memset(&s->ch[i].endian, 0, sizeof(s->ch[i].endian));
717 memset(&s->ch[i].endian_lock, 0, sizeof(s->ch[i].endian_lock));
718 memset(&s->ch[i].translate, 0, sizeof(s->ch[i].translate));
719 s->ch[i].write_mode = 0;
720 s->ch[i].data_type = 0;
721 s->ch[i].transparent_copy = 0;
722 s->ch[i].constant_fill = 0;
723 s->ch[i].color = 0x00000000;
724 s->ch[i].end_prog = 0;
726 s->ch[i].auto_init = 0;
727 s->ch[i].link_enabled = 0;
728 if (s->model < omap_dma_4)
729 s->ch[i].interrupts = 0x0003;
731 s->ch[i].interrupts = 0x0000;
733 s->ch[i].cstatus = 0;
737 s->ch[i].pending_request = 0;
738 s->ch[i].waiting_end_prog = 0;
739 s->ch[i].cpc = 0x0000;
742 s->ch[i].omap_3_1_compatible_disable = 0;
743 memset(&s->ch[i].active_set, 0, sizeof(s->ch[i].active_set));
744 s->ch[i].priority = 0;
745 s->ch[i].interleave_disabled = 0;
750 static int omap_dma_ch_reg_read(struct omap_dma_s *s,
751 struct omap_dma_channel_s *ch, int reg, uint16_t *value)
754 case 0x00: /* SYS_DMA_CSDP_CH0 */
755 *value = (ch->burst[1] << 14) |
756 (ch->pack[1] << 13) |
758 (ch->burst[0] << 7) |
761 (ch->data_type >> 1);
764 case 0x02: /* SYS_DMA_CCR_CH0 */
765 if (s->model <= omap_dma_3_1)
766 *value = 0 << 10; /* FIFO_FLUSH reads as 0 */
768 *value = ch->omap_3_1_compatible_disable << 10;
769 *value |= (ch->mode[1] << 14) |
770 (ch->mode[0] << 12) |
771 (ch->end_prog << 11) |
773 (ch->auto_init << 8) |
775 (ch->priority << 6) |
776 (ch->fs << 5) | ch->sync;
779 case 0x04: /* SYS_DMA_CICR_CH0 */
780 *value = ch->interrupts;
783 case 0x06: /* SYS_DMA_CSR_CH0 */
786 if (!ch->omap_3_1_compatible_disable && ch->sibling) {
787 *value |= (ch->sibling->status & 0x3f) << 6;
788 ch->sibling->status &= SYNC;
790 qemu_irq_lower(ch->irq);
793 case 0x08: /* SYS_DMA_CSSA_L_CH0 */
794 *value = ch->addr[0] & 0x0000ffff;
797 case 0x0a: /* SYS_DMA_CSSA_U_CH0 */
798 *value = ch->addr[0] >> 16;
801 case 0x0c: /* SYS_DMA_CDSA_L_CH0 */
802 *value = ch->addr[1] & 0x0000ffff;
805 case 0x0e: /* SYS_DMA_CDSA_U_CH0 */
806 *value = ch->addr[1] >> 16;
809 case 0x10: /* SYS_DMA_CEN_CH0 */
810 *value = ch->elements;
813 case 0x12: /* SYS_DMA_CFN_CH0 */
817 case 0x14: /* SYS_DMA_CFI_CH0 */
818 *value = ch->frame_index[0];
821 case 0x16: /* SYS_DMA_CEI_CH0 */
822 *value = ch->element_index[0];
825 case 0x18: /* SYS_DMA_CPC_CH0 or DMA_CSAC */
826 if (ch->omap_3_1_compatible_disable)
827 *value = ch->active_set.src & 0xffff; /* CSAC */
832 case 0x1a: /* DMA_CDAC */
833 *value = ch->active_set.dest & 0xffff; /* CDAC */
836 case 0x1c: /* DMA_CDEI */
837 *value = ch->element_index[1];
840 case 0x1e: /* DMA_CDFI */
841 *value = ch->frame_index[1];
844 case 0x20: /* DMA_COLOR_L */
845 *value = ch->color & 0xffff;
848 case 0x22: /* DMA_COLOR_U */
849 *value = ch->color >> 16;
852 case 0x24: /* DMA_CCR2 */
853 *value = (ch->bs << 2) |
854 (ch->transparent_copy << 1) |
858 case 0x28: /* DMA_CLNK_CTRL */
859 *value = (ch->link_enabled << 15) |
860 (ch->link_next_ch & 0xf);
863 case 0x2a: /* DMA_LCH_CTRL */
864 *value = (ch->interleave_disabled << 15) |
874 static int omap_dma_ch_reg_write(struct omap_dma_s *s,
875 struct omap_dma_channel_s *ch, int reg, uint16_t value)
878 case 0x00: /* SYS_DMA_CSDP_CH0 */
879 ch->burst[1] = (value & 0xc000) >> 14;
880 ch->pack[1] = (value & 0x2000) >> 13;
881 ch->port[1] = (enum omap_dma_port) ((value & 0x1e00) >> 9);
882 ch->burst[0] = (value & 0x0180) >> 7;
883 ch->pack[0] = (value & 0x0040) >> 6;
884 ch->port[0] = (enum omap_dma_port) ((value & 0x003c) >> 2);
885 ch->data_type = 1 << (value & 3);
886 if (ch->port[0] >= __omap_dma_port_last)
887 printf("%s: invalid DMA port %i\n", __FUNCTION__,
889 if (ch->port[1] >= __omap_dma_port_last)
890 printf("%s: invalid DMA port %i\n", __FUNCTION__,
892 if ((value & 3) == 3)
893 printf("%s: bad data_type for DMA channel\n", __FUNCTION__);
896 case 0x02: /* SYS_DMA_CCR_CH0 */
897 ch->mode[1] = (omap_dma_addressing_t) ((value & 0xc000) >> 14);
898 ch->mode[0] = (omap_dma_addressing_t) ((value & 0x3000) >> 12);
899 ch->end_prog = (value & 0x0800) >> 11;
900 if (s->model >= omap_dma_3_2)
901 ch->omap_3_1_compatible_disable = (value >> 10) & 0x1;
902 ch->repeat = (value & 0x0200) >> 9;
903 ch->auto_init = (value & 0x0100) >> 8;
904 ch->priority = (value & 0x0040) >> 6;
905 ch->fs = (value & 0x0020) >> 5;
906 ch->sync = value & 0x001f;
909 omap_dma_enable_channel(s, ch);
911 omap_dma_disable_channel(s, ch);
914 omap_dma_channel_end_prog(s, ch);
918 case 0x04: /* SYS_DMA_CICR_CH0 */
919 ch->interrupts = value & 0x3f;
922 case 0x06: /* SYS_DMA_CSR_CH0 */
923 OMAP_RO_REG((target_phys_addr_t) reg);
926 case 0x08: /* SYS_DMA_CSSA_L_CH0 */
927 ch->addr[0] &= 0xffff0000;
928 ch->addr[0] |= value;
931 case 0x0a: /* SYS_DMA_CSSA_U_CH0 */
932 ch->addr[0] &= 0x0000ffff;
933 ch->addr[0] |= (uint32_t) value << 16;
936 case 0x0c: /* SYS_DMA_CDSA_L_CH0 */
937 ch->addr[1] &= 0xffff0000;
938 ch->addr[1] |= value;
941 case 0x0e: /* SYS_DMA_CDSA_U_CH0 */
942 ch->addr[1] &= 0x0000ffff;
943 ch->addr[1] |= (uint32_t) value << 16;
946 case 0x10: /* SYS_DMA_CEN_CH0 */
947 ch->elements = value;
950 case 0x12: /* SYS_DMA_CFN_CH0 */
954 case 0x14: /* SYS_DMA_CFI_CH0 */
955 ch->frame_index[0] = (int16_t) value;
958 case 0x16: /* SYS_DMA_CEI_CH0 */
959 ch->element_index[0] = (int16_t) value;
962 case 0x18: /* SYS_DMA_CPC_CH0 or DMA_CSAC */
963 OMAP_RO_REG((target_phys_addr_t) reg);
966 case 0x1c: /* DMA_CDEI */
967 ch->element_index[1] = (int16_t) value;
970 case 0x1e: /* DMA_CDFI */
971 ch->frame_index[1] = (int16_t) value;
974 case 0x20: /* DMA_COLOR_L */
975 ch->color &= 0xffff0000;
979 case 0x22: /* DMA_COLOR_U */
981 ch->color |= value << 16;
984 case 0x24: /* DMA_CCR2 */
985 ch->bs = (value >> 2) & 0x1;
986 ch->transparent_copy = (value >> 1) & 0x1;
987 ch->constant_fill = value & 0x1;
990 case 0x28: /* DMA_CLNK_CTRL */
991 ch->link_enabled = (value >> 15) & 0x1;
992 if (value & (1 << 14)) { /* Stop_Lnk */
993 ch->link_enabled = 0;
994 omap_dma_disable_channel(s, ch);
996 ch->link_next_ch = value & 0x1f;
999 case 0x2a: /* DMA_LCH_CTRL */
1000 ch->interleave_disabled = (value >> 15) & 0x1;
1001 ch->type = value & 0xf;
1010 static int omap_dma_3_2_lcd_write(struct omap_dma_lcd_channel_s *s, int offset,
1014 case 0xbc0: /* DMA_LCD_CSDP */
1015 s->brust_f2 = (value >> 14) & 0x3;
1016 s->pack_f2 = (value >> 13) & 0x1;
1017 s->data_type_f2 = (1 << ((value >> 11) & 0x3));
1018 s->brust_f1 = (value >> 7) & 0x3;
1019 s->pack_f1 = (value >> 6) & 0x1;
1020 s->data_type_f1 = (1 << ((value >> 0) & 0x3));
1023 case 0xbc2: /* DMA_LCD_CCR */
1024 s->mode_f2 = (value >> 14) & 0x3;
1025 s->mode_f1 = (value >> 12) & 0x3;
1026 s->end_prog = (value >> 11) & 0x1;
1027 s->omap_3_1_compatible_disable = (value >> 10) & 0x1;
1028 s->repeat = (value >> 9) & 0x1;
1029 s->auto_init = (value >> 8) & 0x1;
1030 s->running = (value >> 7) & 0x1;
1031 s->priority = (value >> 6) & 0x1;
1032 s->bs = (value >> 4) & 0x1;
1035 case 0xbc4: /* DMA_LCD_CTRL */
1036 s->dst = (value >> 8) & 0x1;
1037 s->src = ((value >> 6) & 0x3) << 1;
1039 /* Assume no bus errors and thus no BUS_ERROR irq bits. */
1040 s->interrupts = (value >> 1) & 1;
1041 s->dual = value & 1;
1044 case 0xbc8: /* TOP_B1_L */
1045 s->src_f1_top &= 0xffff0000;
1046 s->src_f1_top |= 0x0000ffff & value;
1049 case 0xbca: /* TOP_B1_U */
1050 s->src_f1_top &= 0x0000ffff;
1051 s->src_f1_top |= value << 16;
1054 case 0xbcc: /* BOT_B1_L */
1055 s->src_f1_bottom &= 0xffff0000;
1056 s->src_f1_bottom |= 0x0000ffff & value;
1059 case 0xbce: /* BOT_B1_U */
1060 s->src_f1_bottom &= 0x0000ffff;
1061 s->src_f1_bottom |= (uint32_t) value << 16;
1064 case 0xbd0: /* TOP_B2_L */
1065 s->src_f2_top &= 0xffff0000;
1066 s->src_f2_top |= 0x0000ffff & value;
1069 case 0xbd2: /* TOP_B2_U */
1070 s->src_f2_top &= 0x0000ffff;
1071 s->src_f2_top |= (uint32_t) value << 16;
1074 case 0xbd4: /* BOT_B2_L */
1075 s->src_f2_bottom &= 0xffff0000;
1076 s->src_f2_bottom |= 0x0000ffff & value;
1079 case 0xbd6: /* BOT_B2_U */
1080 s->src_f2_bottom &= 0x0000ffff;
1081 s->src_f2_bottom |= (uint32_t) value << 16;
1084 case 0xbd8: /* DMA_LCD_SRC_EI_B1 */
1085 s->element_index_f1 = value;
1088 case 0xbda: /* DMA_LCD_SRC_FI_B1_L */
1089 s->frame_index_f1 &= 0xffff0000;
1090 s->frame_index_f1 |= 0x0000ffff & value;
1093 case 0xbf4: /* DMA_LCD_SRC_FI_B1_U */
1094 s->frame_index_f1 &= 0x0000ffff;
1095 s->frame_index_f1 |= (uint32_t) value << 16;
1098 case 0xbdc: /* DMA_LCD_SRC_EI_B2 */
1099 s->element_index_f2 = value;
1102 case 0xbde: /* DMA_LCD_SRC_FI_B2_L */
1103 s->frame_index_f2 &= 0xffff0000;
1104 s->frame_index_f2 |= 0x0000ffff & value;
1107 case 0xbf6: /* DMA_LCD_SRC_FI_B2_U */
1108 s->frame_index_f2 &= 0x0000ffff;
1109 s->frame_index_f2 |= (uint32_t) value << 16;
1112 case 0xbe0: /* DMA_LCD_SRC_EN_B1 */
1113 s->elements_f1 = value;
1116 case 0xbe4: /* DMA_LCD_SRC_FN_B1 */
1117 s->frames_f1 = value;
1120 case 0xbe2: /* DMA_LCD_SRC_EN_B2 */
1121 s->elements_f2 = value;
1124 case 0xbe6: /* DMA_LCD_SRC_FN_B2 */
1125 s->frames_f2 = value;
1128 case 0xbea: /* DMA_LCD_LCH_CTRL */
1129 s->lch_type = value & 0xf;
1138 static int omap_dma_3_2_lcd_read(struct omap_dma_lcd_channel_s *s, int offset,
1142 case 0xbc0: /* DMA_LCD_CSDP */
1143 *ret = (s->brust_f2 << 14) |
1144 (s->pack_f2 << 13) |
1145 ((s->data_type_f2 >> 1) << 11) |
1146 (s->brust_f1 << 7) |
1148 ((s->data_type_f1 >> 1) << 0);
1151 case 0xbc2: /* DMA_LCD_CCR */
1152 *ret = (s->mode_f2 << 14) |
1153 (s->mode_f1 << 12) |
1154 (s->end_prog << 11) |
1155 (s->omap_3_1_compatible_disable << 10) |
1157 (s->auto_init << 8) |
1159 (s->priority << 6) |
1163 case 0xbc4: /* DMA_LCD_CTRL */
1164 qemu_irq_lower(s->irq);
1165 *ret = (s->dst << 8) |
1166 ((s->src & 0x6) << 5) |
1167 (s->condition << 3) |
1168 (s->interrupts << 1) |
1172 case 0xbc8: /* TOP_B1_L */
1173 *ret = s->src_f1_top & 0xffff;
1176 case 0xbca: /* TOP_B1_U */
1177 *ret = s->src_f1_top >> 16;
1180 case 0xbcc: /* BOT_B1_L */
1181 *ret = s->src_f1_bottom & 0xffff;
1184 case 0xbce: /* BOT_B1_U */
1185 *ret = s->src_f1_bottom >> 16;
1188 case 0xbd0: /* TOP_B2_L */
1189 *ret = s->src_f2_top & 0xffff;
1192 case 0xbd2: /* TOP_B2_U */
1193 *ret = s->src_f2_top >> 16;
1196 case 0xbd4: /* BOT_B2_L */
1197 *ret = s->src_f2_bottom & 0xffff;
1200 case 0xbd6: /* BOT_B2_U */
1201 *ret = s->src_f2_bottom >> 16;
1204 case 0xbd8: /* DMA_LCD_SRC_EI_B1 */
1205 *ret = s->element_index_f1;
1208 case 0xbda: /* DMA_LCD_SRC_FI_B1_L */
1209 *ret = s->frame_index_f1 & 0xffff;
1212 case 0xbf4: /* DMA_LCD_SRC_FI_B1_U */
1213 *ret = s->frame_index_f1 >> 16;
1216 case 0xbdc: /* DMA_LCD_SRC_EI_B2 */
1217 *ret = s->element_index_f2;
1220 case 0xbde: /* DMA_LCD_SRC_FI_B2_L */
1221 *ret = s->frame_index_f2 & 0xffff;
1224 case 0xbf6: /* DMA_LCD_SRC_FI_B2_U */
1225 *ret = s->frame_index_f2 >> 16;
1228 case 0xbe0: /* DMA_LCD_SRC_EN_B1 */
1229 *ret = s->elements_f1;
1232 case 0xbe4: /* DMA_LCD_SRC_FN_B1 */
1233 *ret = s->frames_f1;
1236 case 0xbe2: /* DMA_LCD_SRC_EN_B2 */
1237 *ret = s->elements_f2;
1240 case 0xbe6: /* DMA_LCD_SRC_FN_B2 */
1241 *ret = s->frames_f2;
1244 case 0xbea: /* DMA_LCD_LCH_CTRL */
1254 static int omap_dma_3_1_lcd_write(struct omap_dma_lcd_channel_s *s, int offset,
1258 case 0x300: /* SYS_DMA_LCD_CTRL */
1259 s->src = (value & 0x40) ? imif : emiff;
1261 /* Assume no bus errors and thus no BUS_ERROR irq bits. */
1262 s->interrupts = (value >> 1) & 1;
1263 s->dual = value & 1;
1266 case 0x302: /* SYS_DMA_LCD_TOP_F1_L */
1267 s->src_f1_top &= 0xffff0000;
1268 s->src_f1_top |= 0x0000ffff & value;
1271 case 0x304: /* SYS_DMA_LCD_TOP_F1_U */
1272 s->src_f1_top &= 0x0000ffff;
1273 s->src_f1_top |= value << 16;
1276 case 0x306: /* SYS_DMA_LCD_BOT_F1_L */
1277 s->src_f1_bottom &= 0xffff0000;
1278 s->src_f1_bottom |= 0x0000ffff & value;
1281 case 0x308: /* SYS_DMA_LCD_BOT_F1_U */
1282 s->src_f1_bottom &= 0x0000ffff;
1283 s->src_f1_bottom |= value << 16;
1286 case 0x30a: /* SYS_DMA_LCD_TOP_F2_L */
1287 s->src_f2_top &= 0xffff0000;
1288 s->src_f2_top |= 0x0000ffff & value;
1291 case 0x30c: /* SYS_DMA_LCD_TOP_F2_U */
1292 s->src_f2_top &= 0x0000ffff;
1293 s->src_f2_top |= value << 16;
1296 case 0x30e: /* SYS_DMA_LCD_BOT_F2_L */
1297 s->src_f2_bottom &= 0xffff0000;
1298 s->src_f2_bottom |= 0x0000ffff & value;
1301 case 0x310: /* SYS_DMA_LCD_BOT_F2_U */
1302 s->src_f2_bottom &= 0x0000ffff;
1303 s->src_f2_bottom |= value << 16;
1312 static int omap_dma_3_1_lcd_read(struct omap_dma_lcd_channel_s *s, int offset,
1318 case 0x300: /* SYS_DMA_LCD_CTRL */
1321 qemu_irq_lower(s->irq);
1322 *ret = ((s->src == imif) << 6) | (i << 3) |
1323 (s->interrupts << 1) | s->dual;
1326 case 0x302: /* SYS_DMA_LCD_TOP_F1_L */
1327 *ret = s->src_f1_top & 0xffff;
1330 case 0x304: /* SYS_DMA_LCD_TOP_F1_U */
1331 *ret = s->src_f1_top >> 16;
1334 case 0x306: /* SYS_DMA_LCD_BOT_F1_L */
1335 *ret = s->src_f1_bottom & 0xffff;
1338 case 0x308: /* SYS_DMA_LCD_BOT_F1_U */
1339 *ret = s->src_f1_bottom >> 16;
1342 case 0x30a: /* SYS_DMA_LCD_TOP_F2_L */
1343 *ret = s->src_f2_top & 0xffff;
1346 case 0x30c: /* SYS_DMA_LCD_TOP_F2_U */
1347 *ret = s->src_f2_top >> 16;
1350 case 0x30e: /* SYS_DMA_LCD_BOT_F2_L */
1351 *ret = s->src_f2_bottom & 0xffff;
1354 case 0x310: /* SYS_DMA_LCD_BOT_F2_U */
1355 *ret = s->src_f2_bottom >> 16;
1364 static int omap_dma_sys_write(struct omap_dma_s *s, int offset, uint16_t value)
1367 case 0x400: /* SYS_DMA_GCR */
1371 case 0x404: /* DMA_GSCR */
1373 omap_dma_disable_3_1_mapping(s);
1375 omap_dma_enable_3_1_mapping(s);
1378 case 0x408: /* DMA_GRST */
1380 omap_dma_reset(s->dma);
1389 static int omap_dma_sys_read(struct omap_dma_s *s, int offset,
1393 case 0x400: /* SYS_DMA_GCR */
1397 case 0x404: /* DMA_GSCR */
1398 *ret = s->omap_3_1_mapping_disabled << 3;
1401 case 0x408: /* DMA_GRST */
1405 case 0x442: /* DMA_HW_ID */
1406 case 0x444: /* DMA_PCh2_ID */
1407 case 0x446: /* DMA_PCh0_ID */
1408 case 0x448: /* DMA_PCh1_ID */
1409 case 0x44a: /* DMA_PChG_ID */
1410 case 0x44c: /* DMA_PChD_ID */
1414 case 0x44e: /* DMA_CAPS_0_U */
1415 *ret = (s->caps[0] >> 16) & 0xffff;
1417 case 0x450: /* DMA_CAPS_0_L */
1418 *ret = (s->caps[0] >> 0) & 0xffff;
1421 case 0x452: /* DMA_CAPS_1_U */
1422 *ret = (s->caps[1] >> 16) & 0xffff;
1424 case 0x454: /* DMA_CAPS_1_L */
1425 *ret = (s->caps[1] >> 0) & 0xffff;
1428 case 0x456: /* DMA_CAPS_2 */
1432 case 0x458: /* DMA_CAPS_3 */
1436 case 0x45a: /* DMA_CAPS_4 */
1440 case 0x460: /* DMA_PCh2_SR */
1441 case 0x480: /* DMA_PCh0_SR */
1442 case 0x482: /* DMA_PCh1_SR */
1443 case 0x4c0: /* DMA_PChD_SR_0 */
1444 printf("%s: Physical Channel Status Registers not implemented.\n",
1455 static uint32_t omap_dma_read(void *opaque, target_phys_addr_t addr)
1457 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1462 case 0x300 ... 0x3fe:
1463 if (s->model <= omap_dma_3_1 || !s->omap_3_1_mapping_disabled) {
1464 if (omap_dma_3_1_lcd_read(&s->lcd_ch, addr, &ret))
1469 case 0x000 ... 0x2fe:
1471 ch = (addr >> 6) & 0x0f;
1472 if (omap_dma_ch_reg_read(s, &s->ch[ch], reg, &ret))
1476 case 0x404 ... 0x4fe:
1477 if (s->model <= omap_dma_3_1)
1481 if (omap_dma_sys_read(s, addr, &ret))
1485 case 0xb00 ... 0xbfe:
1486 if (s->model == omap_dma_3_2 && s->omap_3_1_mapping_disabled) {
1487 if (omap_dma_3_2_lcd_read(&s->lcd_ch, addr, &ret))
1498 static void omap_dma_write(void *opaque, target_phys_addr_t addr,
1501 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1505 case 0x300 ... 0x3fe:
1506 if (s->model <= omap_dma_3_1 || !s->omap_3_1_mapping_disabled) {
1507 if (omap_dma_3_1_lcd_write(&s->lcd_ch, addr, value))
1512 case 0x000 ... 0x2fe:
1514 ch = (addr >> 6) & 0x0f;
1515 if (omap_dma_ch_reg_write(s, &s->ch[ch], reg, value))
1519 case 0x404 ... 0x4fe:
1520 if (s->model <= omap_dma_3_1)
1524 if (omap_dma_sys_write(s, addr, value))
1528 case 0xb00 ... 0xbfe:
1529 if (s->model == omap_dma_3_2 && s->omap_3_1_mapping_disabled) {
1530 if (omap_dma_3_2_lcd_write(&s->lcd_ch, addr, value))
1540 static CPUReadMemoryFunc *omap_dma_readfn[] = {
1541 omap_badwidth_read16,
1543 omap_badwidth_read16,
1546 static CPUWriteMemoryFunc *omap_dma_writefn[] = {
1547 omap_badwidth_write16,
1549 omap_badwidth_write16,
1552 static void omap_dma_request(void *opaque, int drq, int req)
1554 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1555 /* The request pins are level triggered in QEMU. */
1557 if (!s->dma->drqst[drq]) {
1558 s->dma->drqst[drq] = 1;
1559 omap_dma_process_request(s, drq);
1562 s->dma->drqst[drq] = 0;
1565 /* XXX: this won't be needed once soc_dma knows about clocks. */
1566 static void omap_dma_clk_update(void *opaque, int line, int on)
1568 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1571 s->dma->freq = omap_clk_getrate(s->clk);
1573 for (i = 0; i < s->chans; i ++)
1574 if (s->ch[i].active)
1575 soc_dma_set_request(s->ch[i].dma, on);
1578 static void omap_dma_setcaps(struct omap_dma_s *s)
1586 /* XXX Only available for sDMA */
1588 (1 << 19) | /* Constant Fill Capability */
1589 (1 << 18); /* Transparent BLT Capability */
1591 (1 << 1); /* 1-bit palettized capability (DMA 3.2 only) */
1593 (1 << 8) | /* SEPARATE_SRC_AND_DST_INDEX_CPBLTY */
1594 (1 << 7) | /* DST_DOUBLE_INDEX_ADRS_CPBLTY */
1595 (1 << 6) | /* DST_SINGLE_INDEX_ADRS_CPBLTY */
1596 (1 << 5) | /* DST_POST_INCRMNT_ADRS_CPBLTY */
1597 (1 << 4) | /* DST_CONST_ADRS_CPBLTY */
1598 (1 << 3) | /* SRC_DOUBLE_INDEX_ADRS_CPBLTY */
1599 (1 << 2) | /* SRC_SINGLE_INDEX_ADRS_CPBLTY */
1600 (1 << 1) | /* SRC_POST_INCRMNT_ADRS_CPBLTY */
1601 (1 << 0); /* SRC_CONST_ADRS_CPBLTY */
1603 (1 << 6) | /* BLOCK_SYNCHR_CPBLTY (DMA 4 only) */
1604 (1 << 7) | /* PKT_SYNCHR_CPBLTY (DMA 4 only) */
1605 (1 << 5) | /* CHANNEL_CHAINING_CPBLTY */
1606 (1 << 4) | /* LCh_INTERLEAVE_CPBLTY */
1607 (1 << 3) | /* AUTOINIT_REPEAT_CPBLTY (DMA 3.2 only) */
1608 (1 << 2) | /* AUTOINIT_ENDPROG_CPBLTY (DMA 3.2 only) */
1609 (1 << 1) | /* FRAME_SYNCHR_CPBLTY */
1610 (1 << 0); /* ELMNT_SYNCHR_CPBLTY */
1612 (1 << 7) | /* PKT_INTERRUPT_CPBLTY (DMA 4 only) */
1613 (1 << 6) | /* SYNC_STATUS_CPBLTY */
1614 (1 << 5) | /* BLOCK_INTERRUPT_CPBLTY */
1615 (1 << 4) | /* LAST_FRAME_INTERRUPT_CPBLTY */
1616 (1 << 3) | /* FRAME_INTERRUPT_CPBLTY */
1617 (1 << 2) | /* HALF_FRAME_INTERRUPT_CPBLTY */
1618 (1 << 1) | /* EVENT_DROP_INTERRUPT_CPBLTY */
1619 (1 << 0); /* TIMEOUT_INTERRUPT_CPBLTY (DMA 3.2 only) */
1624 struct soc_dma_s *omap_dma_init(target_phys_addr_t base, qemu_irq *irqs,
1625 qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk,
1626 enum omap_dma_model model)
1628 int iomemtype, num_irqs, memsize, i;
1629 struct omap_dma_s *s = (struct omap_dma_s *)
1630 qemu_mallocz(sizeof(struct omap_dma_s));
1632 if (model <= omap_dma_3_1) {
1642 s->lcd_ch.irq = lcd_irq;
1643 s->lcd_ch.mpu = mpu;
1645 s->dma = soc_dma_init((model <= omap_dma_3_1) ? 9 : 16);
1646 s->dma->freq = omap_clk_getrate(clk);
1647 s->dma->transfer_fn = omap_dma_transfer_generic;
1648 s->dma->setup_fn = omap_dma_transfer_setup;
1649 s->dma->drq = qemu_allocate_irqs(omap_dma_request, s, 32);
1653 s->ch[num_irqs].irq = irqs[num_irqs];
1654 for (i = 0; i < 3; i ++) {
1655 s->ch[i].sibling = &s->ch[i + 6];
1656 s->ch[i + 6].sibling = &s->ch[i];
1658 for (i = (model <= omap_dma_3_1) ? 8 : 15; i >= 0; i --) {
1659 s->ch[i].dma = &s->dma->ch[i];
1660 s->dma->ch[i].opaque = &s->ch[i];
1663 omap_dma_setcaps(s);
1664 omap_clk_adduser(s->clk, qemu_allocate_irqs(omap_dma_clk_update, s, 1)[0]);
1665 omap_dma_reset(s->dma);
1666 omap_dma_clk_update(s, 0, 1);
1668 iomemtype = cpu_register_io_memory(0, omap_dma_readfn,
1669 omap_dma_writefn, s);
1670 cpu_register_physical_memory(base, memsize, iomemtype);
1672 mpu->drq = s->dma->drq;
1677 static void omap_dma_interrupts_4_update(struct omap_dma_s *s)
1679 struct omap_dma_channel_s *ch = s->ch;
1682 for (bmp = 0, bit = 1; bit; ch ++, bit <<= 1)
1683 if ((ch->status &= ch->interrupts)) {
1685 ch->cstatus |= ch->status;
1688 if ((s->irqstat[0] |= s->irqen[0] & bmp))
1689 qemu_irq_raise(s->irq[0]);
1690 if ((s->irqstat[1] |= s->irqen[1] & bmp))
1691 qemu_irq_raise(s->irq[1]);
1692 if ((s->irqstat[2] |= s->irqen[2] & bmp))
1693 qemu_irq_raise(s->irq[2]);
1694 if ((s->irqstat[3] |= s->irqen[3] & bmp))
1695 qemu_irq_raise(s->irq[3]);
1698 static uint32_t omap_dma4_read(void *opaque, target_phys_addr_t addr)
1700 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1701 int irqn = 0, chnum;
1702 struct omap_dma_channel_s *ch;
1705 case 0x00: /* DMA4_REVISION */
1708 case 0x14: /* DMA4_IRQSTATUS_L3 */
1710 case 0x10: /* DMA4_IRQSTATUS_L2 */
1712 case 0x0c: /* DMA4_IRQSTATUS_L1 */
1714 case 0x08: /* DMA4_IRQSTATUS_L0 */
1715 return s->irqstat[irqn];
1717 case 0x24: /* DMA4_IRQENABLE_L3 */
1719 case 0x20: /* DMA4_IRQENABLE_L2 */
1721 case 0x1c: /* DMA4_IRQENABLE_L1 */
1723 case 0x18: /* DMA4_IRQENABLE_L0 */
1724 return s->irqen[irqn];
1726 case 0x28: /* DMA4_SYSSTATUS */
1727 return 1; /* RESETDONE */
1729 case 0x2c: /* DMA4_OCP_SYSCONFIG */
1732 case 0x64: /* DMA4_CAPS_0 */
1734 case 0x6c: /* DMA4_CAPS_2 */
1736 case 0x70: /* DMA4_CAPS_3 */
1738 case 0x74: /* DMA4_CAPS_4 */
1741 case 0x78: /* DMA4_GCR */
1744 case 0x80 ... 0xfff:
1746 chnum = addr / 0x60;
1748 addr -= chnum * 0x60;
1756 /* Per-channel registers */
1758 case 0x00: /* DMA4_CCR */
1759 return (ch->buf_disable << 25) |
1760 (ch->src_sync << 24) |
1761 (ch->prefetch << 23) |
1762 ((ch->sync & 0x60) << 14) |
1764 (ch->transparent_copy << 17) |
1765 (ch->constant_fill << 16) |
1766 (ch->mode[1] << 14) |
1767 (ch->mode[0] << 12) |
1768 (0 << 10) | (0 << 9) |
1769 (ch->suspend << 8) |
1771 (ch->priority << 6) |
1772 (ch->fs << 5) | (ch->sync & 0x1f);
1774 case 0x04: /* DMA4_CLNK_CTRL */
1775 return (ch->link_enabled << 15) | ch->link_next_ch;
1777 case 0x08: /* DMA4_CICR */
1778 return ch->interrupts;
1780 case 0x0c: /* DMA4_CSR */
1781 TRACE("CSR = %04x", ch->cstatus);
1784 case 0x10: /* DMA4_CSDP */
1785 return (ch->endian[0] << 21) |
1786 (ch->endian_lock[0] << 20) |
1787 (ch->endian[1] << 19) |
1788 (ch->endian_lock[1] << 18) |
1789 (ch->write_mode << 16) |
1790 (ch->burst[1] << 14) |
1791 (ch->pack[1] << 13) |
1792 (ch->translate[1] << 9) |
1793 (ch->burst[0] << 7) |
1794 (ch->pack[0] << 6) |
1795 (ch->translate[0] << 2) |
1796 (ch->data_type >> 1);
1798 case 0x14: /* DMA4_CEN */
1799 return ch->elements;
1801 case 0x18: /* DMA4_CFN */
1804 case 0x1c: /* DMA4_CSSA */
1807 case 0x20: /* DMA4_CDSA */
1810 case 0x24: /* DMA4_CSEI */
1811 return ch->element_index[0];
1813 case 0x28: /* DMA4_CSFI */
1814 return ch->frame_index[0];
1816 case 0x2c: /* DMA4_CDEI */
1817 return ch->element_index[1];
1819 case 0x30: /* DMA4_CDFI */
1820 return ch->frame_index[1];
1822 case 0x34: /* DMA4_CSAC */
1823 return ch->active_set.src & 0xffff;
1825 case 0x38: /* DMA4_CDAC */
1826 return ch->active_set.dest & 0xffff;
1828 case 0x3c: /* DMA4_CCEN */
1829 return ch->active_set.element;
1831 case 0x40: /* DMA4_CCFN */
1832 return ch->active_set.frame;
1834 case 0x44: /* DMA4_COLOR */
1835 /* XXX only in sDMA */
1839 OMAP_BAD_REG(0x80 + chnum * 0x60 + addr);
1844 static void omap_dma4_write(void *opaque, target_phys_addr_t addr,
1847 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1848 int chnum, irqn = 0;
1849 struct omap_dma_channel_s *ch;
1852 case 0x14: /* DMA4_IRQSTATUS_L3 */
1854 case 0x10: /* DMA4_IRQSTATUS_L2 */
1856 case 0x0c: /* DMA4_IRQSTATUS_L1 */
1858 case 0x08: /* DMA4_IRQSTATUS_L0 */
1859 s->irqstat[irqn] &= ~value;
1860 if (!s->irqstat[irqn])
1861 qemu_irq_lower(s->irq[irqn]);
1864 case 0x24: /* DMA4_IRQENABLE_L3 */
1866 case 0x20: /* DMA4_IRQENABLE_L2 */
1868 case 0x1c: /* DMA4_IRQENABLE_L1 */
1870 case 0x18: /* DMA4_IRQENABLE_L0 */
1871 s->irqen[irqn] = value;
1874 case 0x2c: /* DMA4_OCP_SYSCONFIG */
1875 if (value & 2) /* SOFTRESET */
1876 omap_dma_reset(s->dma);
1877 s->ocp = value & 0x3321;
1878 if (((s->ocp >> 12) & 3) == 3) /* MIDLEMODE */
1879 fprintf(stderr, "%s: invalid DMA power mode\n", __FUNCTION__);
1882 case 0x78: /* DMA4_GCR */
1883 s->gcr = value & 0x00ff00ff;
1884 if ((value & 0xff) == 0x00) /* MAX_CHANNEL_FIFO_DEPTH */
1885 fprintf(stderr, "%s: wrong FIFO depth in GCR\n", __FUNCTION__);
1888 case 0x80 ... 0xfff:
1890 chnum = addr / 0x60;
1892 addr -= chnum * 0x60;
1895 case 0x00: /* DMA4_REVISION */
1896 case 0x28: /* DMA4_SYSSTATUS */
1897 case 0x64: /* DMA4_CAPS_0 */
1898 case 0x6c: /* DMA4_CAPS_2 */
1899 case 0x70: /* DMA4_CAPS_3 */
1900 case 0x74: /* DMA4_CAPS_4 */
1909 /* Per-channel registers */
1911 case 0x00: /* DMA4_CCR */
1912 ch->buf_disable = (value >> 25) & 1;
1913 ch->src_sync = (value >> 24) & 1; /* XXX For CamDMA must be 1 */
1914 if (ch->buf_disable && !ch->src_sync)
1915 fprintf(stderr, "%s: Buffering disable is not allowed in "
1916 "destination synchronised mode\n", __FUNCTION__);
1917 ch->prefetch = (value >> 23) & 1;
1918 ch->bs = (value >> 18) & 1;
1919 ch->transparent_copy = (value >> 17) & 1;
1920 ch->constant_fill = (value >> 16) & 1;
1921 ch->mode[1] = (omap_dma_addressing_t) ((value & 0xc000) >> 14);
1922 ch->mode[0] = (omap_dma_addressing_t) ((value & 0x3000) >> 12);
1923 ch->suspend = (value & 0x0100) >> 8;
1924 ch->priority = (value & 0x0040) >> 6;
1925 ch->fs = (value & 0x0020) >> 5;
1926 if (ch->fs && ch->bs && ch->mode[0] && ch->mode[1])
1927 fprintf(stderr, "%s: For a packet transfer at least one port "
1928 "must be constant-addressed\n", __FUNCTION__);
1929 ch->sync = (value & 0x001f) | ((value >> 14) & 0x0060);
1930 /* XXX must be 0x01 for CamDMA */
1933 omap_dma_enable_channel(s, ch);
1935 omap_dma_disable_channel(s, ch);
1939 case 0x04: /* DMA4_CLNK_CTRL */
1940 ch->link_enabled = (value >> 15) & 0x1;
1941 ch->link_next_ch = value & 0x1f;
1944 case 0x08: /* DMA4_CICR */
1945 if (cpu_class_omap3(s->mpu))
1946 ch->interrupts = value & 0x1dbe;
1948 ch->interrupts = value & 0x09be;
1949 TRACE("CICR = 0x%04x", ch->interrupts);
1952 case 0x0c: /* DMA4_CSR */
1953 ch->cstatus &= ~value;
1954 TRACE("CSR = 0x%04x --> 0x%04x", value, ch->cstatus);
1957 case 0x10: /* DMA4_CSDP */
1958 ch->endian[0] =(value >> 21) & 1;
1959 ch->endian_lock[0] =(value >> 20) & 1;
1960 ch->endian[1] =(value >> 19) & 1;
1961 ch->endian_lock[1] =(value >> 18) & 1;
1962 if (ch->endian[0] != ch->endian[1])
1963 fprintf(stderr, "%s: DMA endiannes conversion enable attempt\n",
1965 ch->write_mode = (value >> 16) & 3;
1966 ch->burst[1] = (value & 0xc000) >> 14;
1967 ch->pack[1] = (value & 0x2000) >> 13;
1968 ch->translate[1] = (value & 0x1e00) >> 9;
1969 ch->burst[0] = (value & 0x0180) >> 7;
1970 ch->pack[0] = (value & 0x0040) >> 6;
1971 ch->translate[0] = (value & 0x003c) >> 2;
1972 if (ch->translate[0] | ch->translate[1])
1973 fprintf(stderr, "%s: bad MReqAddressTranslate sideband signal\n",
1975 ch->data_type = 1 << (value & 3);
1976 if ((value & 3) == 3)
1977 printf("%s: bad data_type for DMA channel\n", __FUNCTION__);
1980 case 0x14: /* DMA4_CEN */
1982 ch->elements = value & 0xffffff;
1983 TRACE("elements=%d, frames=%d, data=%d bytes",
1984 ch->elements, ch->frames, ch->data_type);
1987 case 0x18: /* DMA4_CFN */
1988 ch->frames = value & 0xffff;
1990 TRACE("elements=%d, frames=%d, data=%d bytes",
1991 ch->elements, ch->frames, ch->data_type);
1994 case 0x1c: /* DMA4_CSSA */
1995 ch->addr[0] = (target_phys_addr_t) (uint32_t) value;
1999 case 0x20: /* DMA4_CDSA */
2000 ch->addr[1] = (target_phys_addr_t) (uint32_t) value;
2004 case 0x24: /* DMA4_CSEI */
2005 ch->element_index[0] = (int16_t) value;
2009 case 0x28: /* DMA4_CSFI */
2010 ch->frame_index[0] = (int32_t) value;
2014 case 0x2c: /* DMA4_CDEI */
2015 ch->element_index[1] = (int16_t) value;
2019 case 0x30: /* DMA4_CDFI */
2020 ch->frame_index[1] = (int32_t) value;
2024 case 0x44: /* DMA4_COLOR */
2025 /* XXX only in sDMA */
2029 case 0x34: /* DMA4_CSAC */
2030 case 0x38: /* DMA4_CDAC */
2031 case 0x3c: /* DMA4_CCEN */
2032 case 0x40: /* DMA4_CCFN */
2033 /* f.ex. linux kernel writes zeroes to these registers as well
2034 when performing a DMA channel reset. let's just ignore the
2035 writes instead of reporting "dummy" errors */
2036 /*OMAP_RO_REG(0x80 + chnum * 0x60 + addr);*/
2040 OMAP_BAD_REG(0x80 + chnum * 0x60 + addr);
2044 static CPUReadMemoryFunc *omap_dma4_readfn[] = {
2045 omap_badwidth_read16,
2050 static CPUWriteMemoryFunc *omap_dma4_writefn[] = {
2051 omap_badwidth_write16,
2056 static void omap_dma4_save_state(QEMUFile *f, void *opaque)
2058 struct omap_dma_s *s = (struct omap_dma_s *)opaque;
2061 qemu_put_be32(f, s->gcr);
2062 qemu_put_be32(f, s->ocp);
2063 for (i = 0; i < 5; i++) {
2064 qemu_put_be32(f, s->caps[i]);
2066 qemu_put_be32(f, s->irqen[i]);
2067 qemu_put_be32(f, s->irqstat[i]);
2070 for (i = 0; i < 32; i++) {
2071 qemu_put_be32(f, s->ch[i].elements);
2072 qemu_put_be16(f, s->ch[i].frames);
2073 qemu_put_sbe32(f, s->ch[i].data_type);
2074 for (j = 0; j < 2; j++) {
2075 qemu_put_sbe32(f, s->ch[i].burst[j]);
2076 qemu_put_sbe32(f, s->ch[i].pack[j]);
2077 qemu_put_sbe32(f, s->ch[i].endian[j]);
2078 qemu_put_sbe32(f, s->ch[i].endian_lock[j]);
2079 qemu_put_sbe32(f, s->ch[i].translate[j]);
2080 qemu_put_sbe32(f, s->ch[i].port[j]);
2081 #if TARGET_PHYS_ADDR_BITS == 32
2082 qemu_put_be32(f, s->ch[i].addr[j]);
2083 #elif TARGET_PHYS_ADDR_BITS == 64
2084 qemu_put_be64(f, s->ch[i].addr[j]);
2086 #error TARGET_PHYS_ADDR_BITS undefined
2088 qemu_put_sbe32(f, s->ch[i].mode[j]);
2089 qemu_put_sbe32(f, s->ch[i].frame_index[j]);
2090 qemu_put_sbe16(f, s->ch[i].element_index[j]);
2092 qemu_put_sbe32(f, s->ch[i].transparent_copy);
2093 qemu_put_sbe32(f, s->ch[i].constant_fill);
2094 qemu_put_be32(f, s->ch[i].color);
2095 qemu_put_sbe32(f, s->ch[i].prefetch);
2096 qemu_put_sbe32(f, s->ch[i].end_prog);
2097 qemu_put_sbe32(f, s->ch[i].repeat);
2098 qemu_put_sbe32(f, s->ch[i].auto_init);
2099 qemu_put_sbe32(f, s->ch[i].link_enabled);
2100 qemu_put_sbe32(f, s->ch[i].link_next_ch);
2101 qemu_put_sbe32(f, s->ch[i].interrupts);
2102 qemu_put_sbe32(f, s->ch[i].status);
2103 qemu_put_sbe32(f, s->ch[i].cstatus);
2104 qemu_put_sbe32(f, s->ch[i].active);
2105 qemu_put_sbe32(f, s->ch[i].enable);
2106 qemu_put_sbe32(f, s->ch[i].sync);
2107 qemu_put_sbe32(f, s->ch[i].src_sync);
2108 qemu_put_sbe32(f, s->ch[i].pending_request);
2109 qemu_put_sbe32(f, s->ch[i].waiting_end_prog);
2110 qemu_put_be16(f, s->ch[i].cpc);
2111 qemu_put_sbe32(f, s->ch[i].set_update);
2112 qemu_put_sbe32(f, s->ch[i].fs);
2113 qemu_put_sbe32(f, s->ch[i].bs);
2114 qemu_put_sbe32(f, s->ch[i].omap_3_1_compatible_disable);
2115 #if TARGET_PHYS_ADDR_BITS == 32
2116 qemu_put_be32(f, s->ch[i].active_set.src);
2117 qemu_put_be32(f, s->ch[i].active_set.dest);
2118 #elif TARGET_PHYS_ADDR_BITS == 64
2119 qemu_put_be64(f, s->ch[i].active_set.src);
2120 qemu_put_be64(f, s->ch[i].active_set.dest);
2122 #error TARGET_PHYS_ADDR_BITS undefined
2124 qemu_put_sbe32(f, s->ch[i].active_set.frame);
2125 qemu_put_sbe32(f, s->ch[i].active_set.element);
2126 qemu_put_sbe32(f, s->ch[i].active_set.pck_element);
2127 qemu_put_sbe32(f, s->ch[i].active_set.frame_delta[0]);
2128 qemu_put_sbe32(f, s->ch[i].active_set.frame_delta[1]);
2129 qemu_put_sbe32(f, s->ch[i].active_set.elem_delta[0]);
2130 qemu_put_sbe32(f, s->ch[i].active_set.elem_delta[1]);
2131 qemu_put_sbe32(f, s->ch[i].active_set.frames);
2132 qemu_put_sbe32(f, s->ch[i].active_set.elements);
2133 qemu_put_sbe32(f, s->ch[i].active_set.pck_elements);
2134 qemu_put_sbe32(f, s->ch[i].write_mode);
2135 qemu_put_sbe32(f, s->ch[i].priority);
2136 qemu_put_sbe32(f, s->ch[i].interleave_disabled);
2137 qemu_put_sbe32(f, s->ch[i].type);
2138 qemu_put_sbe32(f, s->ch[i].suspend);
2139 qemu_put_sbe32(f, s->ch[i].buf_disable);
2143 static int omap_dma4_load_state(QEMUFile *f, void *opaque, int version_id)
2145 struct omap_dma_s *s = (struct omap_dma_s *)opaque;
2151 s->gcr = qemu_get_be32(f);
2152 s->ocp = qemu_get_be32(f);
2153 for (i = 0; i < 5; i++) {
2154 s->caps[i] = qemu_get_be32(f);
2156 s->irqen[i] = qemu_get_be32(f);
2157 s->irqstat[i] = qemu_get_be32(f);
2160 for (i = 0; i < 32; i++) {
2161 s->ch[i].elements = qemu_get_be32(f);
2162 s->ch[i].frames = qemu_get_be16(f);
2163 s->ch[i].data_type = qemu_get_sbe32(f);
2164 for (j = 0; j < 2; j++) {
2165 s->ch[i].burst[j] = qemu_get_sbe32(f);
2166 s->ch[i].pack[j] = qemu_get_sbe32(f);
2167 s->ch[i].endian[j] = qemu_get_sbe32(f);
2168 s->ch[i].endian_lock[j] = qemu_get_sbe32(f);
2169 s->ch[i].translate[j] = qemu_get_sbe32(f);
2170 s->ch[i].port[j] = qemu_get_sbe32(f);
2171 #if TARGET_PHYS_ADDR_BITS == 32
2172 s->ch[i].addr[j] = qemu_get_be32(f);
2173 #elif TARGET_PHYS_ADDR_BITS == 64
2174 s->ch[i].addr[j] = qemu_get_be64(f);
2176 #error TARGET_PHYS_ADDR_BITS undefined
2178 s->ch[i].mode[j] = qemu_get_sbe32(f);
2179 s->ch[i].frame_index[j] = qemu_get_sbe32(f);
2180 s->ch[i].element_index[j] = qemu_get_sbe16(f);
2182 s->ch[i].transparent_copy = qemu_get_sbe32(f);
2183 s->ch[i].constant_fill = qemu_get_sbe32(f);
2184 s->ch[i].color = qemu_get_be32(f);
2185 s->ch[i].prefetch = qemu_get_sbe32(f);
2186 s->ch[i].end_prog = qemu_get_sbe32(f);
2187 s->ch[i].repeat = qemu_get_sbe32(f);
2188 s->ch[i].auto_init = qemu_get_sbe32(f);
2189 s->ch[i].link_enabled = qemu_get_sbe32(f);
2190 s->ch[i].link_next_ch = qemu_get_sbe32(f);
2191 s->ch[i].interrupts = qemu_get_sbe32(f);
2192 s->ch[i].status = qemu_get_sbe32(f);
2193 s->ch[i].cstatus = qemu_get_sbe32(f);
2194 s->ch[i].active = qemu_get_sbe32(f);
2195 s->ch[i].enable = qemu_get_sbe32(f);
2196 s->ch[i].sync = qemu_get_sbe32(f);
2197 s->ch[i].src_sync = qemu_get_sbe32(f);
2198 s->ch[i].pending_request = qemu_get_sbe32(f);
2199 s->ch[i].waiting_end_prog = qemu_get_sbe32(f);
2200 s->ch[i].cpc = qemu_get_be16(f);
2201 s->ch[i].set_update = qemu_get_sbe32(f);
2202 s->ch[i].fs = qemu_get_sbe32(f);
2203 s->ch[i].bs = qemu_get_sbe32(f);
2204 s->ch[i].omap_3_1_compatible_disable = qemu_get_sbe32(f);
2205 #if TARGET_PHYS_ADDR_BITS == 32
2206 s->ch[i].active_set.src = qemu_get_be32(f);
2207 s->ch[i].active_set.dest = qemu_get_be32(f);
2208 #elif TARGET_PHYS_ADDR_BITS == 64
2209 s->ch[i].active_set.src = qemu_get_be64(f);
2210 s->ch[i].active_set.dest = qemu_get_be64(f);
2212 #error TARGET_PHYS_ADDR_BITS undefined
2214 s->ch[i].active_set.frame = qemu_get_sbe32(f);
2215 s->ch[i].active_set.element = qemu_get_sbe32(f);
2216 s->ch[i].active_set.pck_element = qemu_get_sbe32(f);
2217 s->ch[i].active_set.frame_delta[0] = qemu_get_sbe32(f);
2218 s->ch[i].active_set.frame_delta[1] = qemu_get_sbe32(f);
2219 s->ch[i].active_set.elem_delta[0] = qemu_get_sbe32(f);
2220 s->ch[i].active_set.elem_delta[1] = qemu_get_sbe32(f);
2221 s->ch[i].active_set.frames = qemu_get_sbe32(f);
2222 s->ch[i].active_set.elements = qemu_get_sbe32(f);
2223 s->ch[i].active_set.pck_elements = qemu_get_sbe32(f);
2224 s->ch[i].write_mode = qemu_get_sbe32(f);
2225 s->ch[i].priority = qemu_get_sbe32(f);
2226 s->ch[i].interleave_disabled = qemu_get_sbe32(f);
2227 s->ch[i].type = qemu_get_sbe32(f);
2228 s->ch[i].suspend = qemu_get_sbe32(f);
2229 s->ch[i].buf_disable = qemu_get_sbe32(f);
2235 static struct omap_dma_s *omap_dma4_init_internal(struct omap_mpu_state_s *mpu,
2237 int chans, int drq_count,
2238 omap_clk iclk, omap_clk fclk)
2241 struct omap_dma_s *s = (struct omap_dma_s *)
2242 qemu_mallocz(sizeof(struct omap_dma_s));
2244 s->model = omap_dma_4;
2249 s->dma = soc_dma_init(s->chans);
2250 s->dma->freq = omap_clk_getrate(fclk);
2251 s->dma->transfer_fn = omap_dma_transfer_generic;
2252 s->dma->setup_fn = omap_dma_transfer_setup;
2253 s->dma->drq = qemu_allocate_irqs(omap_dma_request, s, drq_count);
2255 for (i = 0; i < s->chans; i ++) {
2256 s->ch[i].dma = &s->dma->ch[i];
2257 s->dma->ch[i].opaque = &s->ch[i];
2260 memcpy(&s->irq, irqs, sizeof(s->irq));
2261 s->intr_update = omap_dma_interrupts_4_update;
2263 omap_dma_setcaps(s);
2264 omap_clk_adduser(s->clk, qemu_allocate_irqs(omap_dma_clk_update, s, 1)[0]);
2265 omap_dma_reset(s->dma);
2266 omap_dma_clk_update(s, 0, !!s->dma->freq);
2268 mpu->drq = s->dma->drq;
2270 register_savevm("omap_dma4", -1, 0,
2271 omap_dma4_save_state, omap_dma4_load_state, s);
2275 struct soc_dma_s *omap_dma4_init(target_phys_addr_t base, qemu_irq *irqs,
2276 struct omap_mpu_state_s *mpu, int fifo,
2277 int chans, omap_clk iclk, omap_clk fclk)
2280 struct omap_dma_s *s = omap_dma4_init_internal(mpu, irqs, chans, 64,
2283 iomemtype = cpu_register_io_memory(0, omap_dma4_readfn,
2284 omap_dma4_writefn, s);
2285 cpu_register_physical_memory(base, 0x1000, iomemtype);
2290 struct soc_dma_s *omap3_dma4_init(struct omap_target_agent_s *ta,
2291 struct omap_mpu_state_s *mpu,
2292 qemu_irq *irqs, int chans,
2293 omap_clk iclk, omap_clk fclk)
2295 struct omap_dma_s *s = omap_dma4_init_internal(mpu, irqs, chans, 96,
2297 omap_l4_attach(ta, 0, cpu_register_io_memory(0, omap_dma4_readfn,
2298 omap_dma4_writefn, s));
2302 struct omap_dma_lcd_channel_s *omap_dma_get_lcdch(struct soc_dma_s *dma)
2304 struct omap_dma_s *s = dma->opaque;