Skip to contentSkip to conversation

arm: OMAP: Remove some dead code

PATCH Applied Peter Maydell 3 participants 32 messages May 12 – May 26

lore
Share & tools
lore
#0 lore raw

cover arm: OMAP: Remove some dead code

The arm OMAP SoC code still has some remnants of support for other SoCs in the family that we used to implement, and bits that were there for features that were never implemented and we're hardly likely to implement now. This patchset removes some of that dead code. (I noticed this because I was looking at the hw_error() calls and realized they were all in code that was dead or otherwise not needed any more. Then I realized there was actually quite a lot of dead code here...)

The OMAP code is still old and crufty, but at least this is 900 lines worth of it that we can just delete without even having to think about updating it :-)

thanks
-- PMM

Peter Maydell (12):
hw/arm/omap: Remove omap_mpu_model remnants hw/arm/omap: Remove unused omap_mpuio functions hw/arm/omap: Remove stray unused prototype
hw/arm/omap: Remove unused omap1_dma_irq_map[] entries hw/arm/omap: Delete unused #defines
hw/arm/omap: Remove unused wakeup irq
hw/dma/omap_dma: Remove support for dma_3_0 and dma_3_2 hw/dma/omap_dma: Fold omap_dma_sys_read() and omap_dma_sys_write()
into callers
hw/dma/omap_dma: Remove omap_3_1_compatible_disable flag hw/dma/omap_dma: Remove 3.1 mapping handling hw/dma/omap_dma: Remove unused ifdeffed out code hw/dma/omap_dma: Drop model argument to omap_dma_init()

 hw/arm/omap1.c        |  84 +-----
 hw/dma/omap_dma.c     | 666 ++++--------------------------------------
 hw/gpio/omap_gpio.c   |   6 -
 hw/misc/omap_clk.c    |   9 +-
 include/hw/arm/omap.h | 252 +---------------
 5 files changed, 65 insertions(+), 952 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/12 hw/arm/omap: Remove omap_mpu_model remnants

The omap1.c code has handling for an mpu_model field which is an enum of which OMAP SoC model it is. We removed most of our OMAP support some time ago, and now the only OMAP SoC we implement is the OMAP310, which sets s->mpu_model = omap310 in omap310_mpu_init().

That makes all the handling for other settings of mpu_model dead code; remove them. This includes the omap GPIO device's mpu_model property which we set but which the device makes no use of, and the omap-id-e20 memory region (because the OMAP310 satisfies cpu_is_omap15xx(), so never executed the old if() block).

---
 hw/arm/omap1.c        | 28 ++--------------------------
 hw/gpio/omap_gpio.c   |  6 ------
 hw/misc/omap_clk.c    |  9 +--------
 include/hw/arm/omap.h | 18 ------------------
 4 files changed, 3 insertions(+), 58 deletions(-)
hw/arm/omap1.c +2 -26
index 980959166d..c9f9c3ef40 100644
@@ -948,8 +948,6 @@ static void omap_pin_cfg_init(MemoryRegion *system_memory,
 static uint64_t omap_id_read(void *opaque, hwaddr addr,
                              unsigned size)
 {
-    struct omap_mpu_state_s *s = opaque;
-
     if (size != 4) {
         qemu_log_mask(LOG_GUEST_ERROR, "%s: read at offset 0x%" HWADDR_PRIx
                       " with bad width %d\n", __func__, addr, size);
@@ -968,25 +966,10 @@ static uint64_t omap_id_read(void *opaque, hwaddr addr,
         return 0xcafeb574;
 
     case 0xfffed400:    /* JTAG_ID_LSB */
-        switch (s->mpu_model) {
-        case omap310:
-            return 0x03310315;
-        case omap1510:
-            return 0x03310115;
-        default:
-            hw_error("%s: bad mpu model\n", __func__);
-        }
-        break;
+        return 0x03310315; /* omap310 */
 
     case 0xfffed404:    /* JTAG_ID_MSB */
-        switch (s->mpu_model) {
-        case omap310:
-            return 0xfb57402f;
-        case omap1510:
-            return 0xfb47002f;
-        default:
-            hw_error("%s: bad mpu model\n", __func__);
-        }
+        return 0xfb57402f; /* omap310 */
         break;
     }
 
@@ -1022,11 +1005,6 @@ static void omap_id_init(MemoryRegion *memory, struct omap_mpu_state_s *mpu)
     memory_region_init_alias(&mpu->id_iomem_ed4, NULL, "omap-id-ed4", &mpu->id_iomem,
                              0xfffed400, 0x100);
     memory_region_add_subregion(memory, 0xfffed400, &mpu->id_iomem_ed4);
-    if (!cpu_is_omap15xx(mpu)) {
-        memory_region_init_alias(&mpu->id_iomem_ed4, NULL, "omap-id-e20",
-                                 &mpu->id_iomem, 0xfffe2000, 0x800);
-        memory_region_add_subregion(memory, 0xfffe2000, &mpu->id_iomem_e20);
-    }
 }
 
 /* MPUI Control (Dummy) */
@@ -3819,7 +3797,6 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
     MemoryRegion *system_memory = get_system_memory();
 
     /* Core */
-    s->mpu_model = omap310;
     s->cpu = ARM_CPU(cpu_create(cpu_type));
     s->sdram_size = memory_region_size(dram);
     s->sram_size = OMAP15XX_SRAM_SIZE;
@@ -3974,7 +3951,6 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
                                s->wakeup, omap_findclk(s, "clk32-kHz"));
 
     s->gpio = qdev_new("omap-gpio");
-    qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model);
     omap_gpio_set_clk(OMAP1_GPIO(s->gpio), omap_findclk(s, "arm_gpio_ck"));
     sysbus_realize_and_unref(SYS_BUS_DEVICE(s->gpio), &error_fatal);
     sysbus_connect_irq(SYS_BUS_DEVICE(s->gpio), 0,
hw/gpio/omap_gpio.c +0 -6
index ee3ddb09e3..16da9a88d9 100644
@@ -45,7 +45,6 @@ struct Omap1GpioState {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
-    int mpu_model;
     void *clk;
     struct omap_gpio_s omap1;
 };
@@ -228,17 +227,12 @@ void omap_gpio_set_clk(Omap1GpioState *gpio, omap_clk clk)
     gpio->clk = clk;
 }
 
-static const Property omap_gpio_properties[] = {
-    DEFINE_PROP_INT32("mpu_model", Omap1GpioState, mpu_model, 0),
-};
-
 static void omap_gpio_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = omap_gpio_realize;
     device_class_set_legacy_reset(dc, omap_gpif_reset);
-    device_class_set_props(dc, omap_gpio_properties);
     /* Reason: pointer property "clk" */
     dc->user_creatable = false;
 }
hw/misc/omap_clk.c +1 -8
index e927ef22a0..dc398570ac 100644
@@ -707,14 +707,7 @@ void omap_clk_init(struct omap_mpu_state_s *mpu)
 {
     struct clk **i, *j, *k;
     int count;
-    int flag;
-
-    if (cpu_is_omap310(mpu))
-        flag = CLOCK_IN_OMAP310;
-    else if (cpu_is_omap1510(mpu))
-        flag = CLOCK_IN_OMAP1510;
-    else
-        return;
+    int flag = CLOCK_IN_OMAP310;
 
     for (i = onchip_clks, count = 0; *i; i ++)
         if ((*i)->flags & flag)
include/hw/arm/omap.h +0 -18
index 66a435a3d7..6ea47293a6 100644
@@ -542,24 +542,7 @@ void omap_mmc_set_clk(DeviceState *dev, omap_clk clk);
 /* omap_i2c.c */
 I2CBus *omap_i2c_bus(DeviceState *omap_i2c);
 
-#define cpu_is_omap310(cpu)        (cpu->mpu_model == omap310)
-#define cpu_is_omap1510(cpu)       (cpu->mpu_model == omap1510)
-#define cpu_is_omap1610(cpu)       (cpu->mpu_model == omap1610)
-#define cpu_is_omap1710(cpu)       (cpu->mpu_model == omap1710)
-
-#define cpu_is_omap15xx(cpu)       \
-        (cpu_is_omap310(cpu) || cpu_is_omap1510(cpu))
-#define cpu_is_omap16xx(cpu)       \
-        (cpu_is_omap1610(cpu) || cpu_is_omap1710(cpu))
-
 struct omap_mpu_state_s {
-    enum omap_mpu_model {
-        omap310,
-        omap1510,
-        omap1610,
-        omap1710,
-    } mpu_model;
-
     ARMCPU *cpu;
 
     qemu_irq *drq;
@@ -571,7 +554,6 @@ struct omap_mpu_state_s {
     MemoryRegion id_iomem;
     MemoryRegion id_iomem_e18;
     MemoryRegion id_iomem_ed4;
-    MemoryRegion id_iomem_e20;
     MemoryRegion mpui_iomem;
     MemoryRegion tcmi_iomem;
     MemoryRegion clkm_iomem;
Signature · 1 line
2.43.0
Reviewed-by on v1 1/12
#2 lore raw

Re: [PATCH 01/12] hw/arm/omap: Remove omap_mpu_model remnants

Quoted 12 lines · Peter Maydell

The omap1.c code has handling for an mpu_model field which is an enum of which OMAP SoC model it is. We removed most of our OMAP support some time ago, and now the only OMAP SoC we implement is the OMAP310, which sets s->mpu_model = omap310 in omap310_mpu_init().

That makes all the handling for other settings of mpu_model dead code; remove them. This includes the omap GPIO device's mpu_model property which we set but which the device makes no use of, and the omap-id-e20 memory region (because the OMAP310 satisfies cpu_is_omap15xx(), so never executed the old if() block).

Quoted 7 lines
---
  hw/arm/omap1.c        | 28 ++--------------------------
  hw/gpio/omap_gpio.c   |  6 ------
  hw/misc/omap_clk.c    |  9 +--------
  include/hw/arm/omap.h | 18 ------------------
  4 files changed, 3 insertions(+), 58 deletions(-)
Reviewed-by on v1 1/12
#3 lore raw

Re: [PATCH 01/12] hw/arm/omap: Remove omap_mpu_model remnants

In reply to Peter Maydell
Quoted 12 lines · Peter Maydell

The omap1.c code has handling for an mpu_model field which is an enum of which OMAP SoC model it is. We removed most of our OMAP support some time ago, and now the only OMAP SoC we implement is the OMAP310, which sets s->mpu_model = omap310 in omap310_mpu_init().

That makes all the handling for other settings of mpu_model dead code; remove them. This includes the omap GPIO device's mpu_model property which we set but which the device makes no use of, and the omap-id-e20 memory region (because the OMAP310 satisfies cpu_is_omap15xx(), so never executed the old if() block).

Quoted 7 lines
---
  hw/arm/omap1.c        | 28 ++--------------------------
  hw/gpio/omap_gpio.c   |  6 ------
  hw/misc/omap_clk.c    |  9 +--------
  include/hw/arm/omap.h | 18 ------------------
  4 files changed, 3 insertions(+), 58 deletions(-)

r~

#4 lore raw

PATCH 2/12 hw/arm/omap: Remove unused omap_mpuio functions

In reply to Peter Maydell

The omap1.c file includes some functions which used to be used by the other OMAP SoC variants which we removed a while ago, but which we missed when doing that removal. They have no callers, so we can delete them.

This code was the last user of hw_error() in this file, so we can also remove the hw-error.h include.

---
 hw/arm/omap1.c        | 26 --------------------------
 include/hw/arm/omap.h |  3 ---
 2 files changed, 29 deletions(-)
hw/arm/omap1.c +0 -26
index c9f9c3ef40..15087ba03e 100644
@@ -25,7 +25,6 @@
 #include "target/arm/cpu.h"
 #include "system/address-spaces.h"
 #include "exec/cpu-common.h"
-#include "hw/core/hw-error.h"
 #include "hw/core/irq.h"
 #include "hw/core/qdev-properties.h"
 #include "hw/arm/boot.h"
@@ -2095,31 +2094,6 @@ static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
     return s;
 }
 
-qemu_irq *omap_mpuio_in_get(struct omap_mpuio_s *s)
-{
-    return s->in;
-}
-
-void omap_mpuio_out_set(struct omap_mpuio_s *s, int line, qemu_irq handler)
-{
-    if (line >= 16 || line < 0)
-        hw_error("%s: No GPIO line %i\n", __func__, line);
-    s->handler[line] = handler;
-}
-
-void omap_mpuio_key(struct omap_mpuio_s *s, int row, int col, int down)
-{
-    if (row >= 5 || row < 0)
-        hw_error("%s: No key %i-%i\n", __func__, col, row);
-
-    if (down)
-        s->buttons[row] |= 1 << col;
-    else
-        s->buttons[row] &= ~(1 << col);
-
-    omap_mpuio_kbd_update(s);
-}
-
 /* MicroWire Interface */
 struct omap_uwire_s {
     MemoryRegion iomem;
include/hw/arm/omap.h +0 -3
index 6ea47293a6..dc63323210 100644
@@ -486,9 +486,6 @@ struct omap_uart_s *omap_uart_init(hwaddr base,
 void omap_uart_reset(struct omap_uart_s *s);
 
 struct omap_mpuio_s;
-qemu_irq *omap_mpuio_in_get(struct omap_mpuio_s *s);
-void omap_mpuio_out_set(struct omap_mpuio_s *s, int line, qemu_irq handler);
-void omap_mpuio_key(struct omap_mpuio_s *s, int row, int col, int down);
 
 struct omap_uwire_s;
 
Signature · 1 line
2.43.0
Reviewed-by on v1 2/12
#5 lore raw

Re: [PATCH 02/12] hw/arm/omap: Remove unused omap_mpuio functions

Quoted 5 lines · Peter Maydell

The omap1.c file includes some functions which used to be used by the other OMAP SoC variants which we removed a while ago, but which we missed when doing that removal. They have no callers, so we can delete them.

Quoted 8 lines

This code was the last user of hw_error() in this file, so we can also remove the hw-error.h include.

---
  hw/arm/omap1.c        | 26 --------------------------
  include/hw/arm/omap.h |  3 ---
  2 files changed, 29 deletions(-)
Reviewed-by on v1 2/12
#6 lore raw

Re: [PATCH 02/12] hw/arm/omap: Remove unused omap_mpuio functions

In reply to Peter Maydell
Quoted 5 lines · Peter Maydell

The omap1.c file includes some functions which used to be used by the other OMAP SoC variants which we removed a while ago, but which we missed when doing that removal. They have no callers, so we can delete them.

Quoted 8 lines

This code was the last user of hw_error() in this file, so we can also remove the hw-error.h include.

---
  hw/arm/omap1.c        | 26 --------------------------
  include/hw/arm/omap.h |  3 ---
  2 files changed, 29 deletions(-)

r~

#7 lore raw

PATCH 3/12 hw/arm/omap: Remove stray unused prototype

In reply to Peter Maydell

When we removed the support for most of the OMAP SoCs, we missed deleting a function prototype that was for a function defined in removed code. Delete it now.

---
 include/hw/arm/omap.h | 4 ----
 1 file changed, 4 deletions(-)
include/hw/arm/omap.h +0 -4
index dc63323210..96a52d280c 100644
@@ -338,10 +338,6 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
                 MemoryRegion *sysmem,
                 qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk,
                 enum omap_dma_model model);
-struct soc_dma_s *omap_dma4_init(hwaddr base, qemu_irq *irqs,
-                MemoryRegion *sysmem,
-                struct omap_mpu_state_s *mpu, int fifo,
-                int chans, omap_clk iclk, omap_clk fclk);
 void omap_dma_reset(struct soc_dma_s *s);
 
 struct dma_irq_map {
Signature · 1 line
2.43.0
Reviewed-by on v1 3/12
#8 lore raw

Re: [PATCH 03/12] hw/arm/omap: Remove stray unused prototype

Quoted 14 lines · Peter Maydell

When we removed the support for most of the OMAP SoCs, we missed deleting a function prototype that was for a function defined in removed code. Delete it now.

---
  include/hw/arm/omap.h | 4 ----
  1 file changed, 4 deletions(-)
include/hw/arm/omap.h +0 -0
index dc63323210..96a52d280c 100644

include/hw/arm/omap.h struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs, · line 343

Quoted 10 lines
include/hw/arm/omap.h +0 -4
@@ -338,10 +338,6 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
                  MemoryRegion *sysmem,
                  qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk,
                  enum omap_dma_model model);
-struct soc_dma_s *omap_dma4_init(hwaddr base, qemu_irq *irqs,
-                MemoryRegion *sysmem,
-                struct omap_mpu_state_s *mpu, int fifo,
-                int chans, omap_clk iclk, omap_clk fclk);
  void omap_dma_reset(struct soc_dma_s *s);
 
  struct dma_irq_map {

r~

#9 lore raw

PATCH 4/12 hw/arm/omap: Remove unused omap1_dma_irq_map[] entries

In reply to Peter Maydell

For the one remaining OMAP board, we use only the first 6 entries in the omap1_dma_irq_map[] array; the rest were for OMAP1610. Delete the now-unused elements.

---
 hw/arm/omap1.c | 10 ----------
 1 file changed, 10 deletions(-)
hw/arm/omap1.c +0 -10
index 15087ba03e..40ca8c9890 100644
@@ -3710,16 +3710,6 @@ static const struct dma_irq_map omap1_dma_irq_map[] = {
     { 0, OMAP_INT_DMA_CH3 },
     { 0, OMAP_INT_DMA_CH4 },
     { 0, OMAP_INT_DMA_CH5 },
-    { 1, OMAP_INT_1610_DMA_CH6 },
-    { 1, OMAP_INT_1610_DMA_CH7 },
-    { 1, OMAP_INT_1610_DMA_CH8 },
-    { 1, OMAP_INT_1610_DMA_CH9 },
-    { 1, OMAP_INT_1610_DMA_CH10 },
-    { 1, OMAP_INT_1610_DMA_CH11 },
-    { 1, OMAP_INT_1610_DMA_CH12 },
-    { 1, OMAP_INT_1610_DMA_CH13 },
-    { 1, OMAP_INT_1610_DMA_CH14 },
-    { 1, OMAP_INT_1610_DMA_CH15 }
 };
 
 /* DMA ports for OMAP1 */
Signature · 1 line
2.43.0
Reviewed-by on v1 4/12
#10 lore raw

Re: [PATCH 04/12] hw/arm/omap: Remove unused omap1_dma_irq_map[] entries

Quoted 8 lines · Peter Maydell

For the one remaining OMAP board, we use only the first 6 entries in the omap1_dma_irq_map[] array; the rest were for OMAP1610. Delete the now-unused elements.

---
  hw/arm/omap1.c | 10 ----------
  1 file changed, 10 deletions(-)

r~

#11 lore raw

PATCH 5/12 hw/arm/omap: Delete unused #defines

In reply to Peter Maydell

Delete some #defines which we no longer use because they are for OMAP SoCs which we dropped support for.

---
 include/hw/arm/omap.h | 185 ------------------------------------------
 1 file changed, 185 deletions(-)
include/hw/arm/omap.h +0 -185
index 96a52d280c..14d6e9d214 100644
@@ -35,10 +35,7 @@
 #define OMAP_LOCALBUS_BASE 0x30000000
 #define OMAP_MPUI_BASE     0xe1000000
 
-#define OMAP730_SRAM_SIZE  0x00032000
 #define OMAP15XX_SRAM_SIZE 0x00030000
-#define OMAP16XX_SRAM_SIZE 0x00004000
-#define OMAP1611_SRAM_SIZE 0x0003e800
 #define OMAP_CS0_SIZE      0x04000000
 #define OMAP_CS1_SIZE      0x04000000
 #define OMAP_CS2_SIZE      0x04000000
@@ -130,16 +127,6 @@ void omap_gpio_set_clk(Omap1GpioState *gpio, omap_clk clk);
  * Common OMAP-15xx IRQ numbers for level 1 interrupt handler
  */
 #define OMAP_INT_15XX_IH2_IRQ      0
-#define OMAP_INT_15XX_LB_MMU       17
-#define OMAP_INT_15XX_LOCAL_BUS    29
-
-/*
- * OMAP-1510 specific IRQ numbers for level 1 interrupt handler
- */
-#define OMAP_INT_1510_SPI_TX       4
-#define OMAP_INT_1510_SPI_RX       5
-#define OMAP_INT_1510_DSP_MAILBOX1 10
-#define OMAP_INT_1510_DSP_MAILBOX2 11
 
 /*
  * OMAP-310 specific IRQ numbers for level 1 interrupt handler
@@ -149,42 +136,6 @@ void omap_gpio_set_clk(Omap1GpioState *gpio, omap_clk clk);
 #define OMAP_INT_310_HSB_MAILBOX1  12
 #define OMAP_INT_310_HSAB_MMU      18
 
-/*
- * OMAP-1610 specific IRQ numbers for level 1 interrupt handler
- */
-#define OMAP_INT_1610_IH2_IRQ      0
-#define OMAP_INT_1610_IH2_FIQ      2
-#define OMAP_INT_1610_McBSP2_TX    4
-#define OMAP_INT_1610_McBSP2_RX    5
-#define OMAP_INT_1610_DSP_MAILBOX1 10
-#define OMAP_INT_1610_DSP_MAILBOX2 11
-#define OMAP_INT_1610_LCD_LINE     12
-#define OMAP_INT_1610_GPTIMER1     17
-#define OMAP_INT_1610_GPTIMER2     18
-#define OMAP_INT_1610_SSR_FIFO_0   29
-
-/*
- * OMAP-730 specific IRQ numbers for level 1 interrupt handler
- */
-#define OMAP_INT_730_IH2_FIQ       0
-#define OMAP_INT_730_IH2_IRQ       1
-#define OMAP_INT_730_USB_NON_ISO   2
-#define OMAP_INT_730_USB_ISO       3
-#define OMAP_INT_730_ICR           4
-#define OMAP_INT_730_EAC           5
-#define OMAP_INT_730_GPIO_BANK1    6
-#define OMAP_INT_730_GPIO_BANK2    7
-#define OMAP_INT_730_GPIO_BANK3    8
-#define OMAP_INT_730_McBSP2TX      10
-#define OMAP_INT_730_McBSP2RX      11
-#define OMAP_INT_730_McBSP2RX_OVF  12
-#define OMAP_INT_730_LCD_LINE      14
-#define OMAP_INT_730_GSM_PROTECT   15
-#define OMAP_INT_730_TIMER3        16
-#define OMAP_INT_730_GPIO_BANK5    17
-#define OMAP_INT_730_GPIO_BANK6    18
-#define OMAP_INT_730_SPGIO_WR      29
-
 /*
  * Common IRQ numbers for level 2 interrupt handler
  */
@@ -209,15 +160,6 @@ void omap_gpio_set_clk(Omap1GpioState *gpio, omap_clk clk);
 #define OMAP_INT_RTC_ALARM     26
 #define OMAP_INT_DSP_MMU       28
 
-/*
- * OMAP-1510 specific IRQ numbers for level 2 interrupt handler
- */
-#define OMAP_INT_1510_BT_MCSI1TX   16
-#define OMAP_INT_1510_BT_MCSI1RX   17
-#define OMAP_INT_1510_SoSSI_MATCH  19
-#define OMAP_INT_1510_MEM_STICK    27
-#define OMAP_INT_1510_COM_SPI_RO   31
-
 /*
  * OMAP-310 specific IRQ numbers for level 2 interrupt handler
  */
@@ -229,103 +171,6 @@ void omap_gpio_set_clk(Omap1GpioState *gpio, omap_clk clk);
 #define OMAP_INT_310_USB_W2FC_NON_ISO  30
 #define OMAP_INT_310_McBSP2RX_OF       31
 
-/*
- * OMAP-1610 specific IRQ numbers for level 2 interrupt handler
- */
-#define OMAP_INT_1610_FAC          0
-#define OMAP_INT_1610_USB_HHC_2    7
-#define OMAP_INT_1610_USB_OTG      8
-#define OMAP_INT_1610_SoSSI        9
-#define OMAP_INT_1610_BT_MCSI1TX   16
-#define OMAP_INT_1610_BT_MCSI1RX   17
-#define OMAP_INT_1610_SoSSI_MATCH  19
-#define OMAP_INT_1610_MEM_STICK    27
-#define OMAP_INT_1610_McBSP2RX_OF  31
-#define OMAP_INT_1610_STI          32
-#define OMAP_INT_1610_STI_WAKEUP   33
-#define OMAP_INT_1610_GPTIMER3     34
-#define OMAP_INT_1610_GPTIMER4     35
-#define OMAP_INT_1610_GPTIMER5     36
-#define OMAP_INT_1610_GPTIMER6     37
-#define OMAP_INT_1610_GPTIMER7     38
-#define OMAP_INT_1610_GPTIMER8     39
-#define OMAP_INT_1610_GPIO_BANK2   40
-#define OMAP_INT_1610_GPIO_BANK3   41
-#define OMAP_INT_1610_MMC2         42
-#define OMAP_INT_1610_CF           43
-#define OMAP_INT_1610_WAKE_UP_REQ  46
-#define OMAP_INT_1610_GPIO_BANK4   48
-#define OMAP_INT_1610_SPI          49
-#define OMAP_INT_1610_DMA_CH6      53
-#define OMAP_INT_1610_DMA_CH7      54
-#define OMAP_INT_1610_DMA_CH8      55
-#define OMAP_INT_1610_DMA_CH9      56
-#define OMAP_INT_1610_DMA_CH10     57
-#define OMAP_INT_1610_DMA_CH11     58
-#define OMAP_INT_1610_DMA_CH12     59
-#define OMAP_INT_1610_DMA_CH13     60
-#define OMAP_INT_1610_DMA_CH14     61
-#define OMAP_INT_1610_DMA_CH15     62
-#define OMAP_INT_1610_NAND         63
-
-/*
- * OMAP-730 specific IRQ numbers for level 2 interrupt handler
- */
-#define OMAP_INT_730_HW_ERRORS         0
-#define OMAP_INT_730_NFIQ_PWR_FAIL     1
-#define OMAP_INT_730_CFCD              2
-#define OMAP_INT_730_CFIREQ            3
-#define OMAP_INT_730_I2C               4
-#define OMAP_INT_730_PCC               5
-#define OMAP_INT_730_MPU_EXT_NIRQ      6
-#define OMAP_INT_730_SPI_100K_1        7
-#define OMAP_INT_730_SYREN_SPI         8
-#define OMAP_INT_730_VLYNQ             9
-#define OMAP_INT_730_GPIO_BANK4        10
-#define OMAP_INT_730_McBSP1TX          11
-#define OMAP_INT_730_McBSP1RX          12
-#define OMAP_INT_730_McBSP1RX_OF       13
-#define OMAP_INT_730_UART_MODEM_IRDA_2 14
-#define OMAP_INT_730_UART_MODEM_1      15
-#define OMAP_INT_730_MCSI              16
-#define OMAP_INT_730_uWireTX           17
-#define OMAP_INT_730_uWireRX           18
-#define OMAP_INT_730_SMC_CD            19
-#define OMAP_INT_730_SMC_IREQ          20
-#define OMAP_INT_730_HDQ_1WIRE         21
-#define OMAP_INT_730_TIMER32K          22
-#define OMAP_INT_730_MMC_SDIO          23
-#define OMAP_INT_730_UPLD              24
-#define OMAP_INT_730_USB_HHC_1         27
-#define OMAP_INT_730_USB_HHC_2         28
-#define OMAP_INT_730_USB_GENI          29
-#define OMAP_INT_730_USB_OTG           30
-#define OMAP_INT_730_CAMERA_IF         31
-#define OMAP_INT_730_RNG               32
-#define OMAP_INT_730_DUAL_MODE_TIMER   33
-#define OMAP_INT_730_DBB_RF_EN         34
-#define OMAP_INT_730_MPUIO_KEYPAD      35
-#define OMAP_INT_730_SHA1_MD5          36
-#define OMAP_INT_730_SPI_100K_2        37
-#define OMAP_INT_730_RNG_IDLE          38
-#define OMAP_INT_730_MPUIO             39
-#define OMAP_INT_730_LLPC_LCD_CTRL_OFF 40
-#define OMAP_INT_730_LLPC_OE_FALLING   41
-#define OMAP_INT_730_LLPC_OE_RISING    42
-#define OMAP_INT_730_LLPC_VSYNC        43
-#define OMAP_INT_730_WAKE_UP_REQ       46
-#define OMAP_INT_730_DMA_CH6           53
-#define OMAP_INT_730_DMA_CH7           54
-#define OMAP_INT_730_DMA_CH8           55
-#define OMAP_INT_730_DMA_CH9           56
-#define OMAP_INT_730_DMA_CH10          57
-#define OMAP_INT_730_DMA_CH11          58
-#define OMAP_INT_730_DMA_CH12          59
-#define OMAP_INT_730_DMA_CH13          60
-#define OMAP_INT_730_DMA_CH14          61
-#define OMAP_INT_730_DMA_CH15          62
-#define OMAP_INT_730_NAND              63
-
 /* omap_dma.c */
 enum omap_dma_model {
     omap_dma_3_0,
@@ -437,9 +282,6 @@ struct omap_dma_lcd_channel_s {
 #define OMAP_DMA_CAMERA_IF_RX      20
 #define OMAP_DMA_MMC_TX            21
 #define OMAP_DMA_MMC_RX            22
-#define OMAP_DMA_NAND              23  /* Not in OMAP310 */
-#define OMAP_DMA_IRQ_LCD_LINE      24  /* Not in OMAP310 */
-#define OMAP_DMA_MEMORY_STICK      25  /* Not in OMAP310 */
 #define OMAP_DMA_USB_W2FC_RX0      26
 #define OMAP_DMA_USB_W2FC_RX1      27
 #define OMAP_DMA_USB_W2FC_RX2      28
@@ -447,33 +289,6 @@ struct omap_dma_lcd_channel_s {
 #define OMAP_DMA_USB_W2FC_TX1      30
 #define OMAP_DMA_USB_W2FC_TX2      31
 
-/* These are only for 1610 */
-#define OMAP_DMA_CRYPTO_DES_IN         32
-#define OMAP_DMA_SPI_TX                33
-#define OMAP_DMA_SPI_RX                34
-#define OMAP_DMA_CRYPTO_HASH           35
-#define OMAP_DMA_CCP_ATTN              36
-#define OMAP_DMA_CCP_FIFO_NOT_EMPTY    37
-#define OMAP_DMA_CMT_APE_TX_CHAN_0     38
-#define OMAP_DMA_CMT_APE_RV_CHAN_0     39
-#define OMAP_DMA_CMT_APE_TX_CHAN_1     40
-#define OMAP_DMA_CMT_APE_RV_CHAN_1     41
-#define OMAP_DMA_CMT_APE_TX_CHAN_2     42
-#define OMAP_DMA_CMT_APE_RV_CHAN_2     43
-#define OMAP_DMA_CMT_APE_TX_CHAN_3     44
-#define OMAP_DMA_CMT_APE_RV_CHAN_3     45
-#define OMAP_DMA_CMT_APE_TX_CHAN_4     46
-#define OMAP_DMA_CMT_APE_RV_CHAN_4     47
-#define OMAP_DMA_CMT_APE_TX_CHAN_5     48
-#define OMAP_DMA_CMT_APE_RV_CHAN_5     49
-#define OMAP_DMA_CMT_APE_TX_CHAN_6     50
-#define OMAP_DMA_CMT_APE_RV_CHAN_6     51
-#define OMAP_DMA_CMT_APE_TX_CHAN_7     52
-#define OMAP_DMA_CMT_APE_RV_CHAN_7     53
-#define OMAP_DMA_MMC2_TX               54
-#define OMAP_DMA_MMC2_RX               55
-#define OMAP_DMA_CRYPTO_DES_OUT        56
-
 struct omap_uart_s;
 struct omap_uart_s *omap_uart_init(hwaddr base,
                 qemu_irq irq, omap_clk fclk, omap_clk iclk,
Signature · 1 line
2.43.0
#13 lore raw

PATCH 6/12 hw/arm/omap: Remove unused wakeup irq

In reply to Peter Maydell

The OMAP code creates a qemu_irq whose set function is omap_mpu_wakeup(), and passes that irq into omap_mpuio_init(), which saves it in its omap_mpuio_s::wakeup field. However nothing ever touches that qemu_irq again, so omap_mpu_wakeup() is never called.

Remove all this as dead code. This lets us remove a direct call to cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB) from within board/SoC code, which is pretty ugly and might not even do the right thing these days.

---
 hw/arm/omap1.c        | 18 ++----------------
 include/hw/arm/omap.h |  2 --
 2 files changed, 2 insertions(+), 18 deletions(-)
hw/arm/omap1.c +2 -16
index 40ca8c9890..80168644ce 100644
@@ -1846,7 +1846,6 @@ struct omap_mpuio_s {
     qemu_irq kbd_irq;
     qemu_irq *in;
     qemu_irq handler[16];
-    qemu_irq wakeup;
     MemoryRegion iomem;
 
     uint16_t inputs;
@@ -2074,14 +2073,13 @@ static void omap_mpuio_onoff(void *opaque, int line, int on)
 
 static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
                 hwaddr base,
-                qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,
+                qemu_irq kbd_int, qemu_irq gpio_int,
                 omap_clk clk)
 {
     struct omap_mpuio_s *s = g_new0(struct omap_mpuio_s, 1);
 
     s->irq = gpio_int;
     s->kbd_irq = kbd_int;
-    s->wakeup = wakeup;
     s->in = qemu_allocate_irqs(omap_mpuio_set, s, 16);
     omap_mpuio_reset(s);
 
@@ -3693,16 +3691,6 @@ static void omap_setup_dsp_mapping(MemoryRegion *system_memory,
     }
 }
 
-void omap_mpu_wakeup(void *opaque, int irq, int req)
-{
-    struct omap_mpu_state_s *mpu = opaque;
-    CPUState *cpu = CPU(mpu->cpu);
-
-    if (cpu->halted) {
-        cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB);
-    }
-}
-
 static const struct dma_irq_map omap1_dma_irq_map[] = {
     { 0, OMAP_INT_DMA_CH0_6 },
     { 0, OMAP_INT_DMA_CH1_7 },
@@ -3765,8 +3753,6 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
     s->sdram_size = memory_region_size(dram);
     s->sram_size = OMAP15XX_SRAM_SIZE;
 
-    s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
-
     /* Clocks */
     omap_clk_init(s);
 
@@ -3912,7 +3898,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
     s->mpuio = omap_mpuio_init(system_memory, 0xfffb5000,
                                qdev_get_gpio_in(s->ih[1], OMAP_INT_KEYBOARD),
                                qdev_get_gpio_in(s->ih[1], OMAP_INT_MPUIO),
-                               s->wakeup, omap_findclk(s, "clk32-kHz"));
+                               omap_findclk(s, "clk32-kHz"));
 
     s->gpio = qdev_new("omap-gpio");
     omap_gpio_set_clk(OMAP1_GPIO(s->gpio), omap_findclk(s, "arm_gpio_ck"));
include/hw/arm/omap.h +0 -2
index 14d6e9d214..ea5c0eff8b 100644
@@ -463,8 +463,6 @@ struct omap_mpu_state_s {
 struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *sdram,
                 const char *core);
 
-void omap_mpu_wakeup(void *opaque, int irq, int req);
-
 #define OMAP_BAD_REG(paddr)        \
         qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad register %#08"HWADDR_PRIx"\n", \
                       __func__, paddr)
Signature · 1 line
2.43.0
Reviewed-by on v1 6/12
#14 lore raw

Re: [PATCH 06/12] hw/arm/omap: Remove unused wakeup irq

Quoted 10 lines · Peter Maydell

The OMAP code creates a qemu_irq whose set function is omap_mpu_wakeup(), and passes that irq into omap_mpuio_init(), which saves it in its omap_mpuio_s::wakeup field. However nothing ever touches that qemu_irq again, so omap_mpu_wakeup() is never called.

Remove all this as dead code. This lets us remove a direct call to cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB) from within board/SoC code, which is pretty ugly and might not even do the right thing these days.

Quoted 5 lines
---
  hw/arm/omap1.c        | 18 ++----------------
  include/hw/arm/omap.h |  2 --
  2 files changed, 2 insertions(+), 18 deletions(-)
Reviewed-by on v1 6/12
#15 lore raw

Re: [PATCH 06/12] hw/arm/omap: Remove unused wakeup irq

In reply to Peter Maydell
Quoted 10 lines · Peter Maydell

The OMAP code creates a qemu_irq whose set function is omap_mpu_wakeup(), and passes that irq into omap_mpuio_init(), which saves it in its omap_mpuio_s::wakeup field. However nothing ever touches that qemu_irq again, so omap_mpu_wakeup() is never called.

Remove all this as dead code. This lets us remove a direct call to cpu_interrupt(cpu, CPU_INTERRUPT_EXITTB) from within board/SoC code, which is pretty ugly and might not even do the right thing these days.

Quoted 5 lines
---
  hw/arm/omap1.c        | 18 ++----------------
  include/hw/arm/omap.h |  2 --
  2 files changed, 2 insertions(+), 18 deletions(-)

r~

#16 lore raw

PATCH 7/12 hw/dma/omap_dma: Remove support for dma_3_0 and dma_3_2

In reply to Peter Maydell

The omap_dma device has support for modelling different variants of the DMA block, as enumerated by the omap_dma_model enum:
3_0, 3_1 and 3_2. However, our one remaining OMAP SoC always passes omap_dma_3_1 into the omap_dma_init() function, so the handling for 3_0 and 3_2 is never used.

Remove the support for the other versions; this lets us delete entirely two large functions that were specific to 3.2 DMA to the LCD controller, and all their associated fields in the omap_dma_lcd_channel_s struct.

---
 hw/dma/omap_dma.c     | 348 ++----------------------------------------
 include/hw/arm/omap.h |  28 ----
 2 files changed, 15 insertions(+), 361 deletions(-)
hw/dma/omap_dma.c +15 -333
index 784a3a4f7f..9a86d90b4e 100644
@@ -110,7 +110,6 @@ struct omap_dma_s {
     omap_clk clk;
     qemu_irq irq[4];
     void (*intr_update)(struct omap_dma_s *s);
-    enum omap_dma_model model;
     int omap_3_1_mapping_disabled;
 
     uint32_t gcr;
@@ -752,10 +751,7 @@ static int omap_dma_ch_reg_read(struct omap_dma_s *s,
         break;
 
     case 0x02:  /* SYS_DMA_CCR_CH0 */
-        if (s->model <= omap_dma_3_1)
-            *value = 0 << 10;           /* FIFO_FLUSH reads as 0 */
-        else
-            *value = ch->omap_3_1_compatible_disable << 10;
+        *value = 0 << 10;           /* FIFO_FLUSH reads as 0 */
         *value |= (ch->mode[1] << 14) |
                 (ch->mode[0] << 12) |
                 (ch->end_prog << 11) |
@@ -892,8 +888,6 @@ static int omap_dma_ch_reg_write(struct omap_dma_s *s,
         ch->mode[1] = (omap_dma_addressing_t) ((value & 0xc000) >> 14);
         ch->mode[0] = (omap_dma_addressing_t) ((value & 0x3000) >> 12);
         ch->end_prog = (value & 0x0800) >> 11;
-        if (s->model >= omap_dma_3_2)
-            ch->omap_3_1_compatible_disable  = (value >> 10) & 0x1;
         ch->repeat = (value & 0x0200) >> 9;
         ch->auto_init = (value & 0x0100) >> 8;
         ch->priority = (value & 0x0040) >> 6;
@@ -1002,250 +996,6 @@ static int omap_dma_ch_reg_write(struct omap_dma_s *s,
     return 0;
 }
 
-static int omap_dma_3_2_lcd_write(struct omap_dma_lcd_channel_s *s, int offset,
-                uint16_t value)
-{
-    switch (offset) {
-    case 0xbc0: /* DMA_LCD_CSDP */
-        s->brust_f2 = (value >> 14) & 0x3;
-        s->pack_f2 = (value >> 13) & 0x1;
-        s->data_type_f2 = (1 << ((value >> 11) & 0x3));
-        s->brust_f1 = (value >> 7) & 0x3;
-        s->pack_f1 = (value >> 6) & 0x1;
-        s->data_type_f1 = (1 << ((value >> 0) & 0x3));
-        break;
-
-    case 0xbc2: /* DMA_LCD_CCR */
-        s->mode_f2 = (value >> 14) & 0x3;
-        s->mode_f1 = (value >> 12) & 0x3;
-        s->end_prog = (value >> 11) & 0x1;
-        s->omap_3_1_compatible_disable = (value >> 10) & 0x1;
-        s->repeat = (value >> 9) & 0x1;
-        s->auto_init = (value >> 8) & 0x1;
-        s->running = (value >> 7) & 0x1;
-        s->priority = (value >> 6) & 0x1;
-        s->bs = (value >> 4) & 0x1;
-        break;
-
-    case 0xbc4: /* DMA_LCD_CTRL */
-        s->dst = (value >> 8) & 0x1;
-        s->src = ((value >> 6) & 0x3) << 1;
-        s->condition = 0;
-        /* Assume no bus errors and thus no BUS_ERROR irq bits.  */
-        s->interrupts = (value >> 1) & 1;
-        s->dual = value & 1;
-        break;
-
-    case 0xbc8: /* TOP_B1_L */
-        s->src_f1_top &= 0xffff0000;
-        s->src_f1_top |= 0x0000ffff & value;
-        break;
-
-    case 0xbca: /* TOP_B1_U */
-        s->src_f1_top &= 0x0000ffff;
-        s->src_f1_top |= (uint32_t)value << 16;
-        break;
-
-    case 0xbcc: /* BOT_B1_L */
-        s->src_f1_bottom &= 0xffff0000;
-        s->src_f1_bottom |= 0x0000ffff & value;
-        break;
-
-    case 0xbce: /* BOT_B1_U */
-        s->src_f1_bottom &= 0x0000ffff;
-        s->src_f1_bottom |= (uint32_t) value << 16;
-        break;
-
-    case 0xbd0: /* TOP_B2_L */
-        s->src_f2_top &= 0xffff0000;
-        s->src_f2_top |= 0x0000ffff & value;
-        break;
-
-    case 0xbd2: /* TOP_B2_U */
-        s->src_f2_top &= 0x0000ffff;
-        s->src_f2_top |= (uint32_t) value << 16;
-        break;
-
-    case 0xbd4: /* BOT_B2_L */
-        s->src_f2_bottom &= 0xffff0000;
-        s->src_f2_bottom |= 0x0000ffff & value;
-        break;
-
-    case 0xbd6: /* BOT_B2_U */
-        s->src_f2_bottom &= 0x0000ffff;
-        s->src_f2_bottom |= (uint32_t) value << 16;
-        break;
-
-    case 0xbd8: /* DMA_LCD_SRC_EI_B1 */
-        s->element_index_f1 = value;
-        break;
-
-    case 0xbda: /* DMA_LCD_SRC_FI_B1_L */
-        s->frame_index_f1 &= 0xffff0000;
-        s->frame_index_f1 |= 0x0000ffff & value;
-        break;
-
-    case 0xbf4: /* DMA_LCD_SRC_FI_B1_U */
-        s->frame_index_f1 &= 0x0000ffff;
-        s->frame_index_f1 |= (uint32_t) value << 16;
-        break;
-
-    case 0xbdc: /* DMA_LCD_SRC_EI_B2 */
-        s->element_index_f2 = value;
-        break;
-
-    case 0xbde: /* DMA_LCD_SRC_FI_B2_L */
-        s->frame_index_f2 &= 0xffff0000;
-        s->frame_index_f2 |= 0x0000ffff & value;
-        break;
-
-    case 0xbf6: /* DMA_LCD_SRC_FI_B2_U */
-        s->frame_index_f2 &= 0x0000ffff;
-        s->frame_index_f2 |= (uint32_t) value << 16;
-        break;
-
-    case 0xbe0: /* DMA_LCD_SRC_EN_B1 */
-        s->elements_f1 = value;
-        break;
-
-    case 0xbe4: /* DMA_LCD_SRC_FN_B1 */
-        s->frames_f1 = value;
-        break;
-
-    case 0xbe2: /* DMA_LCD_SRC_EN_B2 */
-        s->elements_f2 = value;
-        break;
-
-    case 0xbe6: /* DMA_LCD_SRC_FN_B2 */
-        s->frames_f2 = value;
-        break;
-
-    case 0xbea: /* DMA_LCD_LCH_CTRL */
-        s->lch_type = value & 0xf;
-        break;
-
-    default:
-        return 1;
-    }
-    return 0;
-}
-
-static int omap_dma_3_2_lcd_read(struct omap_dma_lcd_channel_s *s, int offset,
-                uint16_t *ret)
-{
-    switch (offset) {
-    case 0xbc0: /* DMA_LCD_CSDP */
-        *ret = (s->brust_f2 << 14) |
-            (s->pack_f2 << 13) |
-            ((s->data_type_f2 >> 1) << 11) |
-            (s->brust_f1 << 7) |
-            (s->pack_f1 << 6) |
-            ((s->data_type_f1 >> 1) << 0);
-        break;
-
-    case 0xbc2: /* DMA_LCD_CCR */
-        *ret = (s->mode_f2 << 14) |
-            (s->mode_f1 << 12) |
-            (s->end_prog << 11) |
-            (s->omap_3_1_compatible_disable << 10) |
-            (s->repeat << 9) |
-            (s->auto_init << 8) |
-            (s->running << 7) |
-            (s->priority << 6) |
-            (s->bs << 4);
-        break;
-
-    case 0xbc4: /* DMA_LCD_CTRL */
-        qemu_irq_lower(s->irq);
-        *ret = (s->dst << 8) |
-            ((s->src & 0x6) << 5) |
-            (s->condition << 3) |
-            (s->interrupts << 1) |
-            s->dual;
-        break;
-
-    case 0xbc8: /* TOP_B1_L */
-        *ret = s->src_f1_top & 0xffff;
-        break;
-
-    case 0xbca: /* TOP_B1_U */
-        *ret = s->src_f1_top >> 16;
-        break;
-
-    case 0xbcc: /* BOT_B1_L */
-        *ret = s->src_f1_bottom & 0xffff;
-        break;
-
-    case 0xbce: /* BOT_B1_U */
-        *ret = s->src_f1_bottom >> 16;
-        break;
-
-    case 0xbd0: /* TOP_B2_L */
-        *ret = s->src_f2_top & 0xffff;
-        break;
-
-    case 0xbd2: /* TOP_B2_U */
-        *ret = s->src_f2_top >> 16;
-        break;
-
-    case 0xbd4: /* BOT_B2_L */
-        *ret = s->src_f2_bottom & 0xffff;
-        break;
-
-    case 0xbd6: /* BOT_B2_U */
-        *ret = s->src_f2_bottom >> 16;
-        break;
-
-    case 0xbd8: /* DMA_LCD_SRC_EI_B1 */
-        *ret = s->element_index_f1;
-        break;
-
-    case 0xbda: /* DMA_LCD_SRC_FI_B1_L */
-        *ret = s->frame_index_f1 & 0xffff;
-        break;
-
-    case 0xbf4: /* DMA_LCD_SRC_FI_B1_U */
-        *ret = s->frame_index_f1 >> 16;
-        break;
-
-    case 0xbdc: /* DMA_LCD_SRC_EI_B2 */
-        *ret = s->element_index_f2;
-        break;
-
-    case 0xbde: /* DMA_LCD_SRC_FI_B2_L */
-        *ret = s->frame_index_f2 & 0xffff;
-        break;
-
-    case 0xbf6: /* DMA_LCD_SRC_FI_B2_U */
-        *ret = s->frame_index_f2 >> 16;
-        break;
-
-    case 0xbe0: /* DMA_LCD_SRC_EN_B1 */
-        *ret = s->elements_f1;
-        break;
-
-    case 0xbe4: /* DMA_LCD_SRC_FN_B1 */
-        *ret = s->frames_f1;
-        break;
-
-    case 0xbe2: /* DMA_LCD_SRC_EN_B2 */
-        *ret = s->elements_f2;
-        break;
-
-    case 0xbe6: /* DMA_LCD_SRC_FN_B2 */
-        *ret = s->frames_f2;
-        break;
-
-    case 0xbea: /* DMA_LCD_LCH_CTRL */
-        *ret = s->lch_type;
-        break;
-
-    default:
-        return 1;
-    }
-    return 0;
-}
-
 static int omap_dma_3_1_lcd_write(struct omap_dma_lcd_channel_s *s, int offset,
                 uint16_t value)
 {
@@ -1462,12 +1212,10 @@ static uint64_t omap_dma_read(void *opaque, hwaddr addr, unsigned size)
 
     switch (addr) {
     case 0x300 ... 0x3fe:
-        if (s->model <= omap_dma_3_1 || !s->omap_3_1_mapping_disabled) {
-            if (omap_dma_3_1_lcd_read(&s->lcd_ch, addr, &ret))
-                break;
-            return ret;
+        if (omap_dma_3_1_lcd_read(&s->lcd_ch, addr, &ret)) {
+            break;
         }
-        /* Fall through. */
+        return ret;
     case 0x000 ... 0x2fe:
         reg = addr & 0x3f;
         ch = (addr >> 6) & 0x0f;
@@ -1476,20 +1224,13 @@ static uint64_t omap_dma_read(void *opaque, hwaddr addr, unsigned size)
         return ret;
 
     case 0x404 ... 0x4fe:
-        if (s->model <= omap_dma_3_1)
-            break;
-        /* Fall through. */
+        break;
     case 0x400:
         if (omap_dma_sys_read(s, addr, &ret))
             break;
         return ret;
 
     case 0xb00 ... 0xbfe:
-        if (s->model == omap_dma_3_2 && s->omap_3_1_mapping_disabled) {
-            if (omap_dma_3_2_lcd_read(&s->lcd_ch, addr, &ret))
-                break;
-            return ret;
-        }
         break;
     }
 
@@ -1511,12 +1252,10 @@ static void omap_dma_write(void *opaque, hwaddr addr,
 
     switch (addr) {
     case 0x300 ... 0x3fe:
-        if (s->model <= omap_dma_3_1 || !s->omap_3_1_mapping_disabled) {
-            if (omap_dma_3_1_lcd_write(&s->lcd_ch, addr, value))
-                break;
-            return;
+        if (omap_dma_3_1_lcd_write(&s->lcd_ch, addr, value)) {
+            break;
         }
-        /* Fall through.  */
+        return;
     case 0x000 ... 0x2fe:
         reg = addr & 0x3f;
         ch = (addr >> 6) & 0x0f;
@@ -1525,20 +1264,13 @@ static void omap_dma_write(void *opaque, hwaddr addr,
         return;
 
     case 0x404 ... 0x4fe:
-        if (s->model <= omap_dma_3_1)
-            break;
-        /* fall through */
+        break;
     case 0x400:
         if (omap_dma_sys_write(s, addr, value))
             break;
         return;
 
     case 0xb00 ... 0xbfe:
-        if (s->model == omap_dma_3_2 && s->omap_3_1_mapping_disabled) {
-            if (omap_dma_3_2_lcd_write(&s->lcd_ch, addr, value))
-                break;
-            return;
-        }
         break;
     }
 
@@ -1577,51 +1309,6 @@ static void omap_dma_clk_update(void *opaque, int line, int on)
             soc_dma_set_request(s->ch[i].dma, on);
 }
 
-static void omap_dma_setcaps(struct omap_dma_s *s)
-{
-    switch (s->model) {
-    default:
-    case omap_dma_3_1:
-        break;
-    case omap_dma_3_2:
-        /* XXX Only available for sDMA */
-        s->caps[0] =
-                (1 << 19) | /* Constant Fill Capability */
-                (1 << 18);  /* Transparent BLT Capability */
-        s->caps[1] =
-                (1 << 1);   /* 1-bit palettized capability (DMA 3.2 only) */
-        s->caps[2] =
-                (1 << 8) |  /* SEPARATE_SRC_AND_DST_INDEX_CPBLTY */
-                (1 << 7) |  /* DST_DOUBLE_INDEX_ADRS_CPBLTY */
-                (1 << 6) |  /* DST_SINGLE_INDEX_ADRS_CPBLTY */
-                (1 << 5) |  /* DST_POST_INCRMNT_ADRS_CPBLTY */
-                (1 << 4) |  /* DST_CONST_ADRS_CPBLTY */
-                (1 << 3) |  /* SRC_DOUBLE_INDEX_ADRS_CPBLTY */
-                (1 << 2) |  /* SRC_SINGLE_INDEX_ADRS_CPBLTY */
-                (1 << 1) |  /* SRC_POST_INCRMNT_ADRS_CPBLTY */
-                (1 << 0);   /* SRC_CONST_ADRS_CPBLTY */
-        s->caps[3] =
-                (1 << 6) |  /* BLOCK_SYNCHR_CPBLTY (DMA 4 only) */
-                (1 << 7) |  /* PKT_SYNCHR_CPBLTY (DMA 4 only) */
-                (1 << 5) |  /* CHANNEL_CHAINING_CPBLTY */
-                (1 << 4) |  /* LCh_INTERLEAVE_CPBLTY */
-                (1 << 3) |  /* AUTOINIT_REPEAT_CPBLTY (DMA 3.2 only) */
-                (1 << 2) |  /* AUTOINIT_ENDPROG_CPBLTY (DMA 3.2 only) */
-                (1 << 1) |  /* FRAME_SYNCHR_CPBLTY */
-                (1 << 0);   /* ELMNT_SYNCHR_CPBLTY */
-        s->caps[4] =
-                (1 << 7) |  /* PKT_INTERRUPT_CPBLTY (DMA 4 only) */
-                (1 << 6) |  /* SYNC_STATUS_CPBLTY */
-                (1 << 5) |  /* BLOCK_INTERRUPT_CPBLTY */
-                (1 << 4) |  /* LAST_FRAME_INTERRUPT_CPBLTY */
-                (1 << 3) |  /* FRAME_INTERRUPT_CPBLTY */
-                (1 << 2) |  /* HALF_FRAME_INTERRUPT_CPBLTY */
-                (1 << 1) |  /* EVENT_DROP_INTERRUPT_CPBLTY */
-                (1 << 0);   /* TIMEOUT_INTERRUPT_CPBLTY (DMA 3.2 only) */
-        break;
-    }
-}
-
 struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
                 MemoryRegion *sysmem,
                 qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk,
@@ -1630,20 +1317,16 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
     int num_irqs, memsize, i;
     struct omap_dma_s *s = g_new0(struct omap_dma_s, 1);
 
-    if (model <= omap_dma_3_1) {
-        num_irqs = 6;
-        memsize = 0x800;
-    } else {
-        num_irqs = 16;
-        memsize = 0xc00;
-    }
-    s->model = model;
+    assert(model == omap_dma_3_1);
+
+    num_irqs = 6;
+    memsize = 0x800;
     s->mpu = mpu;
     s->clk = clk;
     s->lcd_ch.irq = lcd_irq;
     s->lcd_ch.mpu = mpu;
 
-    s->dma = soc_dma_init((model <= omap_dma_3_1) ? 9 : 16);
+    s->dma = soc_dma_init(9);
     s->dma->freq = omap_clk_getrate(clk);
     s->dma->transfer_fn = omap_dma_transfer_generic;
     s->dma->setup_fn = omap_dma_transfer_setup;
@@ -1656,12 +1339,11 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
         s->ch[i].sibling = &s->ch[i + 6];
         s->ch[i + 6].sibling = &s->ch[i];
     }
-    for (i = (model <= omap_dma_3_1) ? 8 : 15; i >= 0; i --) {
+    for (i = 8; i >= 0; i--) {
         s->ch[i].dma = &s->dma->ch[i];
         s->dma->ch[i].opaque = &s->ch[i];
     }
 
-    omap_dma_setcaps(s);
     omap_clk_adduser(s->clk, qemu_allocate_irq(omap_dma_clk_update, s, 0));
     omap_dma_reset(s->dma);
     omap_dma_clk_update(s, 0, 1);
include/hw/arm/omap.h +0 -28
index ea5c0eff8b..36569815e8 100644
@@ -216,34 +216,6 @@ struct omap_dma_lcd_channel_s {
     hwaddr src_f2_top;
     hwaddr src_f2_bottom;
 
-    /* Used in OMAP DMA 3.2 gigacell */
-    unsigned char brust_f1;
-    unsigned char pack_f1;
-    unsigned char data_type_f1;
-    unsigned char brust_f2;
-    unsigned char pack_f2;
-    unsigned char data_type_f2;
-    unsigned char end_prog;
-    unsigned char repeat;
-    unsigned char auto_init;
-    unsigned char priority;
-    unsigned char fs;
-    unsigned char running;
-    unsigned char bs;
-    unsigned char omap_3_1_compatible_disable;
-    unsigned char dst;
-    unsigned char lch_type;
-    int16_t element_index_f1;
-    int16_t element_index_f2;
-    int32_t frame_index_f1;
-    int32_t frame_index_f2;
-    uint16_t elements_f1;
-    uint16_t frames_f1;
-    uint16_t elements_f2;
-    uint16_t frames_f2;
-    omap_dma_addressing_t mode_f1;
-    omap_dma_addressing_t mode_f2;
-
     /* Destination port is fixed.  */
     int interrupts;
     int condition;
Signature · 1 line
2.43.0
Reviewed-by on v1 7/12
#17 lore raw

Re: [PATCH 07/12] hw/dma/omap_dma: Remove support for dma_3_0 and dma_3_2

Quoted 11 lines · Peter Maydell

The omap_dma device has support for modelling different variants of the DMA block, as enumerated by the omap_dma_model enum:
3_0, 3_1 and 3_2. However, our one remaining OMAP SoC always passes omap_dma_3_1 into the omap_dma_init() function, so the handling for 3_0 and 3_2 is never used.

Remove the support for the other versions; this lets us delete entirely two large functions that were specific to 3.2 DMA to the LCD controller, and all their associated fields in the omap_dma_lcd_channel_s struct.

Quoted 5 lines
---
  hw/dma/omap_dma.c     | 348 ++----------------------------------------
  include/hw/arm/omap.h |  28 ----
  2 files changed, 15 insertions(+), 361 deletions(-)

r~

#18 lore raw

PATCH 8/12 hw/dma/omap_dma: Fold omap_dma_sys_read() and omap_dma_sys_write() into callers

In reply to Peter Maydell

Now we have removed the DMA 3.2 support, we call omap_dma_sys_read() only for the single address offset 0x400, and similarly for omap_dma_sys_write(). The other cases in those functions are DMA 3.2-only and now dead code. Fold the 0x400 register directly into the callers, and remove the rest.

---
 hw/dma/omap_dma.c | 121 ++--------------------------------------------
 1 file changed, 5 insertions(+), 116 deletions(-)
hw/dma/omap_dma.c +5 -116
index 9a86d90b4e..49348f40c5 100644
@@ -317,16 +317,6 @@ static void omap_dma_interrupts_3_1_update(struct omap_dma_s *s)
         qemu_irq_raise(ch[5].irq);
 }
 
-static void omap_dma_interrupts_3_2_update(struct omap_dma_s *s)
-{
-    struct omap_dma_channel_s *ch = s->ch;
-    int i;
-
-    for (i = s->chans; i; ch ++, i --)
-        if (ch->status)
-            qemu_irq_raise(ch->irq);
-}
-
 static void omap_dma_enable_3_1_mapping(struct omap_dma_s *s)
 {
     s->omap_3_1_mapping_disabled = 0;
@@ -334,13 +324,6 @@ static void omap_dma_enable_3_1_mapping(struct omap_dma_s *s)
     s->intr_update = omap_dma_interrupts_3_1_update;
 }
 
-static void omap_dma_disable_3_1_mapping(struct omap_dma_s *s)
-{
-    s->omap_3_1_mapping_disabled = 1;
-    s->chans = 16;
-    s->intr_update = omap_dma_interrupts_3_2_update;
-}
-
 static void omap_dma_process_request(struct omap_dma_s *s, int request)
 {
     int channel;
@@ -1106,98 +1089,6 @@ static int omap_dma_3_1_lcd_read(struct omap_dma_lcd_channel_s *s, int offset,
     return 0;
 }
 
-static int omap_dma_sys_write(struct omap_dma_s *s, int offset, uint16_t value)
-{
-    switch (offset) {
-    case 0x400: /* SYS_DMA_GCR */
-        s->gcr = value;
-        break;
-
-    case 0x404: /* DMA_GSCR */
-        if (value & 0x8)
-            omap_dma_disable_3_1_mapping(s);
-        else
-            omap_dma_enable_3_1_mapping(s);
-        break;
-
-    case 0x408: /* DMA_GRST */
-        if (value & 0x1)
-            omap_dma_reset(s->dma);
-        break;
-
-    default:
-        return 1;
-    }
-    return 0;
-}
-
-static int omap_dma_sys_read(struct omap_dma_s *s, int offset,
-                uint16_t *ret)
-{
-    switch (offset) {
-    case 0x400: /* SYS_DMA_GCR */
-        *ret = s->gcr;
-        break;
-
-    case 0x404: /* DMA_GSCR */
-        *ret = s->omap_3_1_mapping_disabled << 3;
-        break;
-
-    case 0x408: /* DMA_GRST */
-        *ret = 0;
-        break;
-
-    case 0x442: /* DMA_HW_ID */
-    case 0x444: /* DMA_PCh2_ID */
-    case 0x446: /* DMA_PCh0_ID */
-    case 0x448: /* DMA_PCh1_ID */
-    case 0x44a: /* DMA_PChG_ID */
-    case 0x44c: /* DMA_PChD_ID */
-        *ret = 1;
-        break;
-
-    case 0x44e: /* DMA_CAPS_0_U */
-        *ret = (s->caps[0] >> 16) & 0xffff;
-        break;
-    case 0x450: /* DMA_CAPS_0_L */
-        *ret = (s->caps[0] >>  0) & 0xffff;
-        break;
-
-    case 0x452: /* DMA_CAPS_1_U */
-        *ret = (s->caps[1] >> 16) & 0xffff;
-        break;
-    case 0x454: /* DMA_CAPS_1_L */
-        *ret = (s->caps[1] >>  0) & 0xffff;
-        break;
-
-    case 0x456: /* DMA_CAPS_2 */
-        *ret = s->caps[2];
-        break;
-
-    case 0x458: /* DMA_CAPS_3 */
-        *ret = s->caps[3];
-        break;
-
-    case 0x45a: /* DMA_CAPS_4 */
-        *ret = s->caps[4];
-        break;
-
-    case 0x460: /* DMA_PCh2_SR */
-    case 0x480: /* DMA_PCh0_SR */
-    case 0x482: /* DMA_PCh1_SR */
-    case 0x4c0: /* DMA_PChD_SR_0 */
-        qemu_log_mask(LOG_UNIMP,
-                      "%s: Physical Channel Status Registers not implemented\n",
-                      __func__);
-        *ret = 0xff;
-        break;
-
-    default:
-        return 1;
-    }
-    return 0;
-}
-
 static uint64_t omap_dma_read(void *opaque, hwaddr addr, unsigned size)
 {
     struct omap_dma_s *s = opaque;
@@ -1225,10 +1116,9 @@ static uint64_t omap_dma_read(void *opaque, hwaddr addr, unsigned size)
 
     case 0x404 ... 0x4fe:
         break;
-    case 0x400:
-        if (omap_dma_sys_read(s, addr, &ret))
-            break;
-        return ret;
+    case 0x400: /* SYS_DMA_GCR */
+        return s->gcr;
+        break;
 
     case 0xb00 ... 0xbfe:
         break;
@@ -1265,9 +1155,8 @@ static void omap_dma_write(void *opaque, hwaddr addr,
 
     case 0x404 ... 0x4fe:
         break;
-    case 0x400:
-        if (omap_dma_sys_write(s, addr, value))
-            break;
+    case 0x400: /* SYS_DMA_GCR */
+        s->gcr = value;
         return;
 
     case 0xb00 ... 0xbfe:
Signature · 1 line
2.43.0
Reviewed-by on v1 8/12
#19 lore raw

Re: [PATCH 08/12] hw/dma/omap_dma: Fold omap_dma_sys_read() and omap_dma_sys_write() into callers

Quoted 10 lines · Peter Maydell

Now we have removed the DMA 3.2 support, we call omap_dma_sys_read() only for the single address offset 0x400, and similarly for omap_dma_sys_write(). The other cases in those functions are DMA 3.2-only and now dead code. Fold the 0x400 register directly into the callers, and remove the rest.

---
  hw/dma/omap_dma.c | 121 ++--------------------------------------------
  1 file changed, 5 insertions(+), 116 deletions(-)

r~

#20 lore raw

PATCH 9/12 hw/dma/omap_dma: Remove omap_3_1_compatible_disable flag

In reply to Peter Maydell

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.

---
 hw/dma/omap_dma.c | 59 +++++++++++++++--------------------------------
 1 file changed, 19 insertions(+), 40 deletions(-)
hw/dma/omap_dma.c +19 -40
index 49348f40c5..fe43fec58d 100644
@@ -73,9 +73,6 @@ struct omap_dma_channel_s {
     int fs;
     int bs;
 
-    /* compatibility */
-    int omap_3_1_compatible_disable;
-
     qemu_irq irq;
     struct omap_dma_channel_s *sibling;
 
@@ -144,7 +141,6 @@ static void omap_dma_channel_load(struct omap_dma_channel_s *ch)
 {
     struct omap_dma_reg_set_s *a = &ch->active_set;
     int i, normal;
-    int omap_3_1 = !ch->omap_3_1_compatible_disable;
 
     /*
      * TODO: verify address ranges and alignment
@@ -177,14 +173,14 @@ static void omap_dma_channel_load(struct omap_dma_channel_s *ch)
             break;
         case single_index:
             a->elem_delta[i] = ch->data_type +
-                    ch->element_index[omap_3_1 ? 0 : i] - 1;
+                    ch->element_index[0] - 1;
             a->frame_delta[i] = 0;
             break;
         case double_index:
             a->elem_delta[i] = ch->data_type +
-                    ch->element_index[omap_3_1 ? 0 : i] - 1;
-            a->frame_delta[i] = ch->frame_index[omap_3_1 ? 0 : i] -
-                    ch->element_index[omap_3_1 ? 0 : i];
+                    ch->element_index[0] - 1;
+            a->frame_delta[i] = ch->frame_index[0] -
+                    ch->element_index[0];
             break;
         default:
             break;
@@ -442,20 +438,13 @@ static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma)
                 /* End of Block */
                 /* Disable the channel */
 
-                if (ch->omap_3_1_compatible_disable) {
+                if (!ch->auto_init)
                     omap_dma_disable_channel(s, ch);
-                    if (ch->link_enabled)
-                        omap_dma_enable_channel(s,
-                                        &s->ch[ch->link_next_ch]);
-                } else {
-                    if (!ch->auto_init)
-                        omap_dma_disable_channel(s, ch);
-                    else if (ch->repeat || ch->end_prog)
-                        omap_dma_channel_load(ch);
-                    else {
-                        ch->waiting_end_prog = 1;
-                        omap_dma_deactivate_channel(s, ch);
-                    }
+                else if (ch->repeat || ch->end_prog)
+                    omap_dma_channel_load(ch);
+                else {
+                    ch->waiting_end_prog = 1;
+                    omap_dma_deactivate_channel(s, ch);
                 }
 
                 if (ch->interrupts & END_BLOCK_INTR)
@@ -610,19 +599,13 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
             /* End of Block */
             /* Disable the channel */
 
-            if (ch->omap_3_1_compatible_disable) {
+            if (!ch->auto_init)
                 omap_dma_disable_channel(s, ch);
-                if (ch->link_enabled)
-                    omap_dma_enable_channel(s, &s->ch[ch->link_next_ch]);
-            } else {
-                if (!ch->auto_init)
-                    omap_dma_disable_channel(s, ch);
-                else if (ch->repeat || ch->end_prog)
-                    omap_dma_channel_load(ch);
-                else {
-                    ch->waiting_end_prog = 1;
-                    omap_dma_deactivate_channel(s, ch);
-                }
+            else if (ch->repeat || ch->end_prog)
+                omap_dma_channel_load(ch);
+            else {
+                ch->waiting_end_prog = 1;
+                omap_dma_deactivate_channel(s, ch);
             }
 
             if (ch->interrupts & END_BLOCK_INTR)
@@ -711,7 +694,6 @@ void omap_dma_reset(struct soc_dma_s *dma)
         s->ch[i].cpc = 0x0000;
         s->ch[i].fs = 0;
         s->ch[i].bs = 0;
-        s->ch[i].omap_3_1_compatible_disable = 0;
         memset(&s->ch[i].active_set, 0, sizeof(s->ch[i].active_set));
         s->ch[i].priority = 0;
         s->ch[i].interleave_disabled = 0;
@@ -752,7 +734,7 @@ static int omap_dma_ch_reg_read(struct omap_dma_s *s,
     case 0x06:  /* SYS_DMA_CSR_CH0 */
         *value = ch->status;
         ch->status &= SYNC;
-        if (!ch->omap_3_1_compatible_disable && ch->sibling) {
+        if (ch->sibling) {
             *value |= (ch->sibling->status & 0x3f) << 6;
             ch->sibling->status &= SYNC;
         }
@@ -791,11 +773,8 @@ static int omap_dma_ch_reg_read(struct omap_dma_s *s,
         *value = ch->element_index[0];
         break;
 
-    case 0x18:  /* SYS_DMA_CPC_CH0 or DMA_CSAC */
-        if (ch->omap_3_1_compatible_disable)
-            *value = ch->active_set.src & 0xffff;   /* CSAC */
-        else
-            *value = ch->cpc;
+    case 0x18:  /* SYS_DMA_CPC_CH0 */
+        *value = ch->cpc;
         break;
 
     case 0x1a:  /* DMA_CDAC */
Signature · 1 line
2.43.0
Reviewed-by on v1 9/12
#21 lore raw

Re: [PATCH 09/12] hw/dma/omap_dma: Remove omap_3_1_compatible_disable flag

Quoted 11 lines · Peter Maydell

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.

---
  hw/dma/omap_dma.c | 59 +++++++++++++++--------------------------------
  1 file changed, 19 insertions(+), 40 deletions(-)

r~

#22 lore raw

PATCH 10/12 hw/dma/omap_dma: Remove 3.1 mapping handling

In reply to Peter Maydell

Now we have no 3.2 DMA support, the omap_dma_enable_3_1_mapping() function is called at reset, and there is no longer anywhere that disables it. Remove the function and the unused omap_3_1_mapping_disabled struct field, and drop the indirection from omap_dma_interrupts_update() through the intr_update function pointer to omap_dma_interrupts_3_1_update(), instead inlining that last function into omap_dma_interrupts_update().

The only other thing omap_dma_enable_3_1_mapping() was doing was setting s->chans; since this is now never changed at runtime we can move its setting into the init function rather than reset.

---
 hw/dma/omap_dma.c | 52 ++++++++++++++++++++---------------------------
 1 file changed, 22 insertions(+), 30 deletions(-)
hw/dma/omap_dma.c +22 -30
index fe43fec58d..b05e46724c 100644
@@ -106,8 +106,6 @@ struct omap_dma_s {
     struct omap_mpu_state_s *mpu;
     omap_clk clk;
     qemu_irq irq[4];
-    void (*intr_update)(struct omap_dma_s *s);
-    int omap_3_1_mapping_disabled;
 
     uint32_t gcr;
     uint32_t ocp;
@@ -134,7 +132,27 @@ struct omap_dma_s {
 
 static inline void omap_dma_interrupts_update(struct omap_dma_s *s)
 {
-    s->intr_update(s);
+    struct omap_dma_channel_s *ch = s->ch;
+
+    /* First three interrupts are shared between two channels each. */
+    if (ch[0].status | ch[6].status) {
+        qemu_irq_raise(ch[0].irq);
+    }
+    if (ch[1].status | ch[7].status) {
+        qemu_irq_raise(ch[1].irq);
+    }
+    if (ch[2].status | ch[8].status) {
+        qemu_irq_raise(ch[2].irq);
+    }
+    if (ch[3].status) {
+        qemu_irq_raise(ch[3].irq);
+    }
+    if (ch[4].status) {
+        qemu_irq_raise(ch[4].irq);
+    }
+    if (ch[5].status) {
+        qemu_irq_raise(ch[5].irq);
+    }
 }
 
 static void omap_dma_channel_load(struct omap_dma_channel_s *ch)
@@ -294,32 +312,6 @@ static void omap_dma_channel_end_prog(struct omap_dma_s *s,
     }
 }
 
-static void omap_dma_interrupts_3_1_update(struct omap_dma_s *s)
-{
-    struct omap_dma_channel_s *ch = s->ch;
-
-    /* First three interrupts are shared between two channels each. */
-    if (ch[0].status | ch[6].status)
-        qemu_irq_raise(ch[0].irq);
-    if (ch[1].status | ch[7].status)
-        qemu_irq_raise(ch[1].irq);
-    if (ch[2].status | ch[8].status)
-        qemu_irq_raise(ch[2].irq);
-    if (ch[3].status)
-        qemu_irq_raise(ch[3].irq);
-    if (ch[4].status)
-        qemu_irq_raise(ch[4].irq);
-    if (ch[5].status)
-        qemu_irq_raise(ch[5].irq);
-}
-
-static void omap_dma_enable_3_1_mapping(struct omap_dma_s *s)
-{
-    s->omap_3_1_mapping_disabled = 0;
-    s->chans = 9;
-    s->intr_update = omap_dma_interrupts_3_1_update;
-}
-
 static void omap_dma_process_request(struct omap_dma_s *s, int request)
 {
     int channel;
@@ -660,7 +652,6 @@ void omap_dma_reset(struct soc_dma_s *dma)
     s->lcd_ch.condition = 0;
     s->lcd_ch.interrupts = 0;
     s->lcd_ch.dual = 0;
-    omap_dma_enable_3_1_mapping(s);
     for (i = 0; i < s->chans; i ++) {
         s->ch[i].suspend = 0;
         s->ch[i].prefetch = 0;
@@ -1193,6 +1184,7 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
     s->clk = clk;
     s->lcd_ch.irq = lcd_irq;
     s->lcd_ch.mpu = mpu;
+    s->chans = 9;
 
     s->dma = soc_dma_init(9);
     s->dma->freq = omap_clk_getrate(clk);
Signature · 1 line
2.43.0
Reviewed-by on v1 10/12
#23 lore raw

Re: [PATCH 10/12] hw/dma/omap_dma: Remove 3.1 mapping handling

Quoted 8 lines · Peter Maydell

Now we have no 3.2 DMA support, the omap_dma_enable_3_1_mapping() function is called at reset, and there is no longer anywhere that disables it. Remove the function and the unused omap_3_1_mapping_disabled struct field, and drop the indirection from omap_dma_interrupts_update() through the intr_update function pointer to omap_dma_interrupts_3_1_update(), instead inlining that last function into omap_dma_interrupts_update().

Quoted 8 lines

The only other thing omap_dma_enable_3_1_mapping() was doing was setting s->chans; since this is now never changed at runtime we can move its setting into the init function rather than reset.

---
  hw/dma/omap_dma.c | 52 ++++++++++++++++++++---------------------------
  1 file changed, 22 insertions(+), 30 deletions(-)

r~

#24 lore raw

PATCH 11/12 hw/dma/omap_dma: Remove unused ifdeffed out code

In reply to Peter Maydell

The OMAP DMA device includes a lot of code which has been disabled via ifdefs for over a decade. Whatever this unfinished development work was, all knowledge of it is long gone, and we're unlikely to be doing any serious work on this device model in future. If we did, we'd likely have to start from scratch.

Remove all the ifdeffed out code.

---
 hw/dma/omap_dma.c | 94 -----------------------------------------------
 1 file changed, 94 deletions(-)
hw/dma/omap_dma.c +0 -94
index b05e46724c..dea251afbc 100644
@@ -343,9 +343,6 @@ static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma)
     struct omap_dma_channel_s *ch = dma->opaque;
     struct omap_dma_reg_set_s *a = &ch->active_set;
     int bytes = dma->bytes;
-#ifdef MULTI_REQ
-    uint16_t status = ch->status;
-#endif
 
     do {
         /* Transfer a single element */
@@ -362,7 +359,6 @@ static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma)
         a->dest += a->elem_delta[1];
         a->element ++;
 
-#ifndef MULTI_REQ
         if (a->element == a->elements) {
             /* End of Frame */
             a->element = 0;
@@ -375,78 +371,6 @@ static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma)
                 ch->cpc = a->dest & 0xffff;
         }
     } while ((bytes -= ch->data_type));
-#else
-        /* If the channel is element synchronized, deactivate it */
-        if (ch->sync && !ch->fs && !ch->bs)
-            omap_dma_deactivate_channel(s, ch);
-
-        /* If it is the last frame, set the LAST_FRAME interrupt */
-        if (a->element == 1 && a->frame == a->frames - 1)
-            if (ch->interrupts & LAST_FRAME_INTR)
-                ch->status |= LAST_FRAME_INTR;
-
-        /* If the half of the frame was reached, set the HALF_FRAME
-           interrupt */
-        if (a->element == (a->elements >> 1))
-            if (ch->interrupts & HALF_FRAME_INTR)
-                ch->status |= HALF_FRAME_INTR;
-
-        if (ch->fs && ch->bs) {
-            a->pck_element ++;
-            /* Check if a full packet has been transferred.  */
-            if (a->pck_element == a->pck_elements) {
-                a->pck_element = 0;
-
-                /* Set the END_PKT interrupt */
-                if ((ch->interrupts & END_PKT_INTR) && !ch->src_sync)
-                    ch->status |= END_PKT_INTR;
-
-                /* If the channel is packet-synchronized, deactivate it */
-                if (ch->sync)
-                    omap_dma_deactivate_channel(s, ch);
-            }
-        }
-
-        if (a->element == a->elements) {
-            /* End of Frame */
-            a->element = 0;
-            a->src += a->frame_delta[0];
-            a->dest += a->frame_delta[1];
-            a->frame ++;
-
-            /* If the channel is frame synchronized, deactivate it */
-            if (ch->sync && ch->fs && !ch->bs)
-                omap_dma_deactivate_channel(s, ch);
-
-            /* If the channel is async, update cpc */
-            if (!ch->sync)
-                ch->cpc = a->dest & 0xffff;
-
-            /* Set the END_FRAME interrupt */
-            if (ch->interrupts & END_FRAME_INTR)
-                ch->status |= END_FRAME_INTR;
-
-            if (a->frame == a->frames) {
-                /* End of Block */
-                /* Disable the channel */
-
-                if (!ch->auto_init)
-                    omap_dma_disable_channel(s, ch);
-                else if (ch->repeat || ch->end_prog)
-                    omap_dma_channel_load(ch);
-                else {
-                    ch->waiting_end_prog = 1;
-                    omap_dma_deactivate_channel(s, ch);
-                }
-
-                if (ch->interrupts & END_BLOCK_INTR)
-                    ch->status |= END_BLOCK_INTR;
-            }
-        }
-    } while (status == ch->status && ch->active);
-
-    omap_dma_interrupts_update(s);
-#endif
 }
 
 enum {
@@ -475,13 +399,6 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
     dest_p = &s->mpu->port[ch->port[1]];
     if ((!ch->constant_fill && !src_p->addr_valid(s->mpu, a->src)) ||
                     (!dest_p->addr_valid(s->mpu, a->dest))) {
-#if 0
-        /* Bus time-out */
-        if (ch->interrupts & TIMEOUT_INTR)
-            ch->status |= TIMEOUT_INTR;
-        omap_dma_deactivate_channel(s, ch);
-        continue;
-#endif
         printf("%s: Bus time-out in DMA%i operation\n",
                         __func__, dma->num);
     }
@@ -552,11 +469,6 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
 
     /* Set appropriate interrupts and/or deactivate channels */
 
-#ifdef MULTI_REQ
-    /* TODO: should all of this only be done if dma->update, and otherwise
-     * inside omap_dma_transfer_generic below - check what's faster.  */
-    if (dma->update) {
-#endif
 
         /* If the channel is element synchronized, deactivate it */
         if (min_elems == elements[omap_dma_intr_element_sync])
@@ -612,9 +524,7 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
 
         /* TODO: check if we really need to update anything here or perhaps we
          * can skip part of this.  */
-#ifndef MULTI_REQ
         if (dma->update) {
-#endif
             a->element += min_elems;
 
             frames = a->element / a->elements;
@@ -629,11 +539,7 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)
 
             /* TODO: if the destination port is IMIF or EMIFF, set the dirty
              * bits on it.  */
-#ifndef MULTI_REQ
         }
-#else
-    }
-#endif
 
     omap_dma_interrupts_update(s);
 }
Signature · 1 line
2.43.0
Reviewed-by on v1 11/12
#25 lore raw

Re: [PATCH 11/12] hw/dma/omap_dma: Remove unused ifdeffed out code

Quoted 6 lines · Peter Maydell

The OMAP DMA device includes a lot of code which has been disabled via ifdefs for over a decade. Whatever this unfinished development work was, all knowledge of it is long gone, and we're unlikely to be doing any serious work on this device model in future. If we did, we'd likely have to start from scratch.

Quoted 6 lines

Remove all the ifdeffed out code.

---
  hw/dma/omap_dma.c | 94 -----------------------------------------------
  1 file changed, 94 deletions(-)
Reviewed-by on v1 11/12
#26 lore raw

Re: [PATCH 11/12] hw/dma/omap_dma: Remove unused ifdeffed out code

In reply to Peter Maydell
Quoted 6 lines · Peter Maydell

The OMAP DMA device includes a lot of code which has been disabled via ifdefs for over a decade. Whatever this unfinished development work was, all knowledge of it is long gone, and we're unlikely to be doing any serious work on this device model in future. If we did, we'd likely have to start from scratch.

Quoted 6 lines

Remove all the ifdeffed out code.

---
  hw/dma/omap_dma.c | 94 -----------------------------------------------
  1 file changed, 94 deletions(-)

There's a bunch of code that's mis-indented after removing some ifdef'd if blocks.

Otherwise,

r~

#27 lore raw

Re: [PATCH 11/12] hw/dma/omap_dma: Remove unused ifdeffed out code

Quoted 8 lines · Richard Henderson
Quoted 6 lines · Peter Maydell

The OMAP DMA device includes a lot of code which has been disabled via ifdefs for over a decade. Whatever this unfinished development work was, all knowledge of it is long gone, and we're unlikely to be doing any serious work on this device model in future. If we did, we'd likely have to start from scratch.

Quoted 8 lines
Quoted 6 lines

Remove all the ifdeffed out code.

---
  hw/dma/omap_dma.c | 94 -----------------------------------------------
  1 file changed, 94 deletions(-)

There's a bunch of code that's mis-indented after removing some ifdef'd if blocks.

Yes; I deliberately didn't reindent as the patch diff would then be harder to read. I should have put in a separate reindent patch afterwards, though.

-- PMM

#28 lore raw

PATCH 12/12 hw/dma/omap_dma: Drop model argument to omap_dma_init()

In reply to Peter Maydell

The model argument to omap_dma_init() is always omap_dma_3_1, and all we do with it now is assert this; drop the argument and the enum.

---
 hw/arm/omap1.c        |  2 +-
 hw/dma/omap_dma.c     |  8 +++-----
 include/hw/arm/omap.h | 12 +++---------
 3 files changed, 7 insertions(+), 15 deletions(-)
hw/arm/omap1.c +1 -1
index 80168644ce..44f9dd67c3 100644
@@ -3789,7 +3789,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
     }
     s->dma = omap_dma_init(0xfffed800, dma_irqs, system_memory,
                            qdev_get_gpio_in(s->ih[0], OMAP_INT_DMA_LCD),
-                           s, omap_findclk(s, "dma_ck"), omap_dma_3_1);
+                           s, omap_findclk(s, "dma_ck"));
 
     s->port[emiff    ].addr_valid = omap_validate_emiff_addr;
     s->port[emifs    ].addr_valid = omap_validate_emifs_addr;
hw/dma/omap_dma.c +3 -5
index dea251afbc..a93d9ad196 100644
@@ -1075,15 +1075,13 @@ static void omap_dma_clk_update(void *opaque, int line, int on)
 }
 
 struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
-                MemoryRegion *sysmem,
-                qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk,
-                enum omap_dma_model model)
+                                MemoryRegion *sysmem,
+                                qemu_irq lcd_irq,
+                                struct omap_mpu_state_s *mpu, omap_clk clk)
 {
     int num_irqs, memsize, i;
     struct omap_dma_s *s = g_new0(struct omap_dma_s, 1);
 
-    assert(model == omap_dma_3_1);
-
     num_irqs = 6;
     memsize = 0x800;
     s->mpu = mpu;
include/hw/arm/omap.h +3 -9
index 36569815e8..2675d064f2 100644
@@ -172,17 +172,11 @@ void omap_gpio_set_clk(Omap1GpioState *gpio, omap_clk clk);
 #define OMAP_INT_310_McBSP2RX_OF       31
 
 /* omap_dma.c */
-enum omap_dma_model {
-    omap_dma_3_0,
-    omap_dma_3_1,
-    omap_dma_3_2,
-};
-
 struct soc_dma_s;
 struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
-                MemoryRegion *sysmem,
-                qemu_irq lcd_irq, struct omap_mpu_state_s *mpu, omap_clk clk,
-                enum omap_dma_model model);
+                                MemoryRegion *sysmem,
+                                qemu_irq lcd_irq,
+                                struct omap_mpu_state_s *mpu, omap_clk clk);
 void omap_dma_reset(struct soc_dma_s *s);
 
 struct dma_irq_map {
Signature · 1 line
2.43.0
Reviewed-by on v1 12/12
#29 lore raw

Re: [PATCH 12/12] hw/dma/omap_dma: Drop model argument to omap_dma_init()

Quoted 9 lines · Peter Maydell

The model argument to omap_dma_init() is always omap_dma_3_1, and all we do with it now is assert this; drop the argument and the enum.

---
  hw/arm/omap1.c        |  2 +-
  hw/dma/omap_dma.c     |  8 +++-----
  include/hw/arm/omap.h | 12 +++---------
  3 files changed, 7 insertions(+), 15 deletions(-)
Reviewed-by on v1 12/12
#30 lore raw

Re: [PATCH 12/12] hw/dma/omap_dma: Drop model argument to omap_dma_init()

In reply to Peter Maydell
Quoted 9 lines · Peter Maydell

The model argument to omap_dma_init() is always omap_dma_3_1, and all we do with it now is assert this; drop the argument and the enum.

---
  hw/arm/omap1.c        |  2 +-
  hw/dma/omap_dma.c     |  8 +++-----
  include/hw/arm/omap.h | 12 +++---------
  3 files changed, 7 insertions(+), 15 deletions(-)

r~

author Applied
#31 lore raw
In reply to Peter Maydell
Quoted 10 lines · Peter Maydell

The arm OMAP SoC code still has some remnants of support for other SoCs in the family that we used to implement, and bits that were there for features that were never implemented and we're hardly likely to implement now. This patchset removes some of that dead code. (I noticed this because I was looking at the hw_error() calls and realized they were all in code that was dead or otherwise not needed any more. Then I realized there was actually quite a lot of dead code here...)

Quoted 14 lines

Peter Maydell (12):
hw/arm/omap: Remove omap_mpu_model remnants hw/arm/omap: Remove unused omap_mpuio functions hw/arm/omap: Remove stray unused prototype
hw/arm/omap: Remove unused omap1_dma_irq_map[] entries hw/arm/omap: Delete unused #defines
hw/arm/omap: Remove unused wakeup irq
hw/dma/omap_dma: Remove support for dma_3_0 and dma_3_2 hw/dma/omap_dma: Fold omap_dma_sys_read() and omap_dma_sys_write()
into callers
hw/dma/omap_dma: Remove omap_3_1_compatible_disable flag hw/dma/omap_dma: Remove 3.1 mapping handling hw/dma/omap_dma: Remove unused ifdeffed out code hw/dma/omap_dma: Drop model argument to omap_dma_init()

I've applied all but patch 11 to target-arm.next; I'll resend 11 plus an extra patch to fix the resulting misindents.

thanks
-- PMM