@samitouri / QOSamiQemu / commits / dd43cbbffa

hw/dma/omap_dma: Remove omap_3_1_compatible_disable flag

The OMAP DMA device has an omap_3_1_compatible_disable flag in its channel struct, which the 3.2 version of the DMA block used to tell whether it should behave compatibly with 3.1 or not. Now we have no 3.2 support, the omap_3_1_compatible_disable flag is set to false and can't be changed, so we can remove it, folding out all the conditions where we were testing it as always-false. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260512203414.3633237-10-peter.maydell@linaro.org

Peter Maydell committed May 12, 2026 at 21:34 UTC dd43cbbffa119255e4a84fd382545859e6712242
1 file changed +19 -40
hw/dma/omap_dma.c
+19 -40
@@ -73,9 +73,6 @@ struct omap_dma_channel_s {
73 int fs;
74 int bs;
75
76 - /* compatibility */
77 - int omap_3_1_compatible_disable;
78 -
76 qemu_irq irq;
77 struct omap_dma_channel_s *sibling;
78
@@ -144,7 +141,6 @@ static void omap_dma_channel_load(struct omap_dma_channel_s *ch)
141 {
142 struct omap_dma_reg_set_s *a = &ch->active_set;
143 int i, normal;
147 - int omap_3_1 = !ch->omap_3_1_compatible_disable;
144
145 /*
146 * TODO: verify address ranges and alignment
@@ -177,14 +173,14 @@ static void omap_dma_channel_load(struct omap_dma_channel_s *ch)
173 break;
174 case single_index:
175 a->elem_delta[i] = ch->data_type +
180 - ch->element_index[omap_3_1 ? 0 : i] - 1;
176 + ch->element_index[0] - 1;
177 a->frame_delta[i] = 0;
178 break;
179 case double_index:
180 a->elem_delta[i] = ch->data_type +
185 - ch->element_index[omap_3_1 ? 0 : i] - 1;
186 - a->frame_delta[i] = ch->frame_index[omap_3_1 ? 0 : i] -
187 - ch->element_index[omap_3_1 ? 0 : i];
181 + ch->element_index[0] - 1;
182 + a->frame_delta[i] = ch->frame_index[0] -
183 + ch->element_index[0];
184 break;
185 default:
186 break;
@@ -442,20 +438,13 @@ static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma)
438 /* End of Block */
439 /* Disable the channel */
440
445 - if (ch->omap_3_1_compatible_disable) {
441 + if (!ch->auto_init)
442 omap_dma_disable_channel(s, ch);
447 - if (ch->link_enabled)
448 - omap_dma_enable_channel(s,
449 - &s->ch[ch->link_next_ch]);
450 - } else {
451 - if (!ch->auto_init)
452 - omap_dma_disable_channel(s, ch);
453 - else if (ch->repeat || ch->end_prog)
454 - omap_dma_channel_load(ch);
455 - else {
456 - ch->waiting_end_prog = 1;
457 - omap_dma_deactivate_channel(s, ch);
458 - }
443 + else if (ch->repeat || ch->end_prog)
444 + omap_dma_channel_load(ch);
445 + else {
446 + ch->waiting_end_prog = 1;
447 + omap_dma_deactivate_channel(s, ch);
448 }
449
450 if (ch->interrupts & END_BLOCK_INTR)
@@ -610,19 +599,13 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
599 /* End of Block */
600 /* Disable the channel */
601
613 - if (ch->omap_3_1_compatible_disable) {
602 + if (!ch->auto_init)
603 omap_dma_disable_channel(s, ch);
615 - if (ch->link_enabled)
616 - omap_dma_enable_channel(s, &s->ch[ch->link_next_ch]);
617 - } else {
618 - if (!ch->auto_init)
619 - omap_dma_disable_channel(s, ch);
620 - else if (ch->repeat || ch->end_prog)
621 - omap_dma_channel_load(ch);
622 - else {
623 - ch->waiting_end_prog = 1;
624 - omap_dma_deactivate_channel(s, ch);
625 - }
604 + else if (ch->repeat || ch->end_prog)
605 + omap_dma_channel_load(ch);
606 + else {
607 + ch->waiting_end_prog = 1;
608 + omap_dma_deactivate_channel(s, ch);
609 }
610
611 if (ch->interrupts & END_BLOCK_INTR)
@@ -711,7 +694,6 @@ void omap_dma_reset(struct soc_dma_s *dma)
694 s->ch[i].cpc = 0x0000;
695 s->ch[i].fs = 0;
696 s->ch[i].bs = 0;
714 - s->ch[i].omap_3_1_compatible_disable = 0;
697 memset(&s->ch[i].active_set, 0, sizeof(s->ch[i].active_set));
698 s->ch[i].priority = 0;
699 s->ch[i].interleave_disabled = 0;
@@ -752,7 +734,7 @@ static int omap_dma_ch_reg_read(struct omap_dma_s *s,
734 case 0x06: /* SYS_DMA_CSR_CH0 */
735 *value = ch->status;
736 ch->status &= SYNC;
755 - if (!ch->omap_3_1_compatible_disable && ch->sibling) {
737 + if (ch->sibling) {
738 *value |= (ch->sibling->status & 0x3f) << 6;
739 ch->sibling->status &= SYNC;
740 }
@@ -791,11 +773,8 @@ static int omap_dma_ch_reg_read(struct omap_dma_s *s,
773 *value = ch->element_index[0];
774 break;
775
794 - case 0x18: /* SYS_DMA_CPC_CH0 or DMA_CSAC */
795 - if (ch->omap_3_1_compatible_disable)
796 - *value = ch->active_set.src & 0xffff; /* CSAC */
797 - else
798 - *value = ch->cpc;
776 + case 0x18: /* SYS_DMA_CPC_CH0 */
777 + *value = ch->cpc;
778 break;
779
780 case 0x1a: /* DMA_CDAC */