@samitouri / QOSamiQemu / commits / 40e7e6d6e8

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). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260512203414.3633237-2-peter.maydell@linaro.org

Peter Maydell committed May 12, 2026 at 21:34 UTC 40e7e6d6e8d2eb7e7a05c6c0dbad39d498c883d0
4 files changed +3 -58
hw/arm/omap1.c
+2 -26
@@ -948,8 +948,6 @@ static void omap_pin_cfg_init(MemoryRegion *system_memory,
948 static uint64_t omap_id_read(void *opaque, hwaddr addr,
949 unsigned size)
950 {
951 - struct omap_mpu_state_s *s = opaque;
952 -
951 if (size != 4) {
952 qemu_log_mask(LOG_GUEST_ERROR, "%s: read at offset 0x%" HWADDR_PRIx
953 " with bad width %d\n", __func__, addr, size);
@@ -968,25 +966,10 @@ static uint64_t omap_id_read(void *opaque, hwaddr addr,
966 return 0xcafeb574;
967
968 case 0xfffed400: /* JTAG_ID_LSB */
971 - switch (s->mpu_model) {
972 - case omap310:
973 - return 0x03310315;
974 - case omap1510:
975 - return 0x03310115;
976 - default:
977 - hw_error("%s: bad mpu model\n", __func__);
978 - }
979 - break;
969 + return 0x03310315; /* omap310 */
970
971 case 0xfffed404: /* JTAG_ID_MSB */
982 - switch (s->mpu_model) {
983 - case omap310:
984 - return 0xfb57402f;
985 - case omap1510:
986 - return 0xfb47002f;
987 - default:
988 - hw_error("%s: bad mpu model\n", __func__);
989 - }
972 + return 0xfb57402f; /* omap310 */
973 break;
974 }
975
@@ -1022,11 +1005,6 @@ static void omap_id_init(MemoryRegion *memory, struct omap_mpu_state_s *mpu)
1005 memory_region_init_alias(&mpu->id_iomem_ed4, NULL, "omap-id-ed4", &mpu->id_iomem,
1006 0xfffed400, 0x100);
1007 memory_region_add_subregion(memory, 0xfffed400, &mpu->id_iomem_ed4);
1025 - if (!cpu_is_omap15xx(mpu)) {
1026 - memory_region_init_alias(&mpu->id_iomem_ed4, NULL, "omap-id-e20",
1027 - &mpu->id_iomem, 0xfffe2000, 0x800);
1028 - memory_region_add_subregion(memory, 0xfffe2000, &mpu->id_iomem_e20);
1029 - }
1008 }
1009
1010 /* MPUI Control (Dummy) */
@@ -3819,7 +3797,6 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
3797 MemoryRegion *system_memory = get_system_memory();
3798
3799 /* Core */
3822 - s->mpu_model = omap310;
3800 s->cpu = ARM_CPU(cpu_create(cpu_type));
3801 s->sdram_size = memory_region_size(dram);
3802 s->sram_size = OMAP15XX_SRAM_SIZE;
@@ -3974,7 +3951,6 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
3951 s->wakeup, omap_findclk(s, "clk32-kHz"));
3952
3953 s->gpio = qdev_new("omap-gpio");
3977 - qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model);
3954 omap_gpio_set_clk(OMAP1_GPIO(s->gpio), omap_findclk(s, "arm_gpio_ck"));
3955 sysbus_realize_and_unref(SYS_BUS_DEVICE(s->gpio), &error_fatal);
3956 sysbus_connect_irq(SYS_BUS_DEVICE(s->gpio), 0,
hw/gpio/omap_gpio.c
-6
@@ -45,7 +45,6 @@ struct Omap1GpioState {
45 SysBusDevice parent_obj;
46
47 MemoryRegion iomem;
48 - int mpu_model;
48 void *clk;
49 struct omap_gpio_s omap1;
50 };
@@ -228,17 +227,12 @@ void omap_gpio_set_clk(Omap1GpioState *gpio, omap_clk clk)
227 gpio->clk = clk;
228 }
229
231 -static const Property omap_gpio_properties[] = {
232 - DEFINE_PROP_INT32("mpu_model", Omap1GpioState, mpu_model, 0),
233 -};
234 -
230 static void omap_gpio_class_init(ObjectClass *klass, const void *data)
231 {
232 DeviceClass *dc = DEVICE_CLASS(klass);
233
234 dc->realize = omap_gpio_realize;
235 device_class_set_legacy_reset(dc, omap_gpif_reset);
241 - device_class_set_props(dc, omap_gpio_properties);
236 /* Reason: pointer property "clk" */
237 dc->user_creatable = false;
238 }
hw/misc/omap_clk.c
+1 -8
@@ -707,14 +707,7 @@ void omap_clk_init(struct omap_mpu_state_s *mpu)
707 {
708 struct clk **i, *j, *k;
709 int count;
710 - int flag;
711 -
712 - if (cpu_is_omap310(mpu))
713 - flag = CLOCK_IN_OMAP310;
714 - else if (cpu_is_omap1510(mpu))
715 - flag = CLOCK_IN_OMAP1510;
716 - else
717 - return;
710 + int flag = CLOCK_IN_OMAP310;
711
712 for (i = onchip_clks, count = 0; *i; i ++)
713 if ((*i)->flags & flag)
include/hw/arm/omap.h
-18
@@ -542,24 +542,7 @@ void omap_mmc_set_clk(DeviceState *dev, omap_clk clk);
542 /* omap_i2c.c */
543 I2CBus *omap_i2c_bus(DeviceState *omap_i2c);
544
545 -#define cpu_is_omap310(cpu) (cpu->mpu_model == omap310)
546 -#define cpu_is_omap1510(cpu) (cpu->mpu_model == omap1510)
547 -#define cpu_is_omap1610(cpu) (cpu->mpu_model == omap1610)
548 -#define cpu_is_omap1710(cpu) (cpu->mpu_model == omap1710)
549 -
550 -#define cpu_is_omap15xx(cpu) \
551 - (cpu_is_omap310(cpu) || cpu_is_omap1510(cpu))
552 -#define cpu_is_omap16xx(cpu) \
553 - (cpu_is_omap1610(cpu) || cpu_is_omap1710(cpu))
554 -
545 struct omap_mpu_state_s {
556 - enum omap_mpu_model {
557 - omap310,
558 - omap1510,
559 - omap1610,
560 - omap1710,
561 - } mpu_model;
562 -
546 ARMCPU *cpu;
547
548 qemu_irq *drq;
@@ -571,7 +554,6 @@ struct omap_mpu_state_s {
554 MemoryRegion id_iomem;
555 MemoryRegion id_iomem_e18;
556 MemoryRegion id_iomem_ed4;
574 - MemoryRegion id_iomem_e20;
557 MemoryRegion mpui_iomem;
558 MemoryRegion tcmi_iomem;
559 MemoryRegion clkm_iomem;