[PATCH for-9.2 23/53] hw/timer: Remove pxa27x-timer

Peter Maydell posted 53 patches 2 months, 3 weeks ago
[PATCH for-9.2 23/53] hw/timer: Remove pxa27x-timer
Posted by Peter Maydell 2 months, 3 weeks ago
The pxa27x-timer can be removed now we have removed the PXA2xx
SoC models. The pxa25x-timer device must remain as it is still
used by strongarm.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/timer/pxa2xx_timer.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c
index d1a3ecac2b5..3234bbb1f4a 100644
--- a/hw/timer/pxa2xx_timer.c
+++ b/hw/timer/pxa2xx_timer.c
@@ -54,7 +54,6 @@
 #define OSNR	0x20
 
 #define PXA25X_FREQ	3686400	/* 3.6864 MHz */
-#define PXA27X_FREQ	3250000	/* 3.25 MHz */
 
 static int pxa2xx_timer4_freq[8] = {
     [0] = 0,
@@ -572,28 +571,6 @@ static const TypeInfo pxa25x_timer_dev_info = {
     .class_init    = pxa25x_timer_dev_class_init,
 };
 
-static Property pxa27x_timer_dev_properties[] = {
-    DEFINE_PROP_UINT32("freq", PXA2xxTimerInfo, freq, PXA27X_FREQ),
-    DEFINE_PROP_BIT("tm4", PXA2xxTimerInfo, flags,
-                    PXA2XX_TIMER_HAVE_TM4, true),
-    DEFINE_PROP_END_OF_LIST(),
-};
-
-static void pxa27x_timer_dev_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-
-    dc->desc = "PXA27x timer";
-    device_class_set_props(dc, pxa27x_timer_dev_properties);
-}
-
-static const TypeInfo pxa27x_timer_dev_info = {
-    .name          = "pxa27x-timer",
-    .parent        = TYPE_PXA2XX_TIMER,
-    .instance_size = sizeof(PXA2xxTimerInfo),
-    .class_init    = pxa27x_timer_dev_class_init,
-};
-
 static void pxa2xx_timer_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
@@ -615,7 +592,6 @@ static void pxa2xx_timer_register_types(void)
 {
     type_register_static(&pxa2xx_timer_type_info);
     type_register_static(&pxa25x_timer_dev_info);
-    type_register_static(&pxa27x_timer_dev_info);
 }
 
 type_init(pxa2xx_timer_register_types)
-- 
2.34.1
Re: [PATCH for-9.2 23/53] hw/timer: Remove pxa27x-timer
Posted by Philippe Mathieu-Daudé 2 months, 2 weeks ago
On 3/9/24 18:07, Peter Maydell wrote:
> The pxa27x-timer can be removed now we have removed the PXA2xx
> SoC models. The pxa25x-timer device must remain as it is still
> used by strongarm.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/timer/pxa2xx_timer.c | 24 ------------------------
>   1 file changed, 24 deletions(-)
> 
> diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c
> index d1a3ecac2b5..3234bbb1f4a 100644
> --- a/hw/timer/pxa2xx_timer.c
> +++ b/hw/timer/pxa2xx_timer.c
> @@ -54,7 +54,6 @@
>   #define OSNR	0x20
>   
>   #define PXA25X_FREQ	3686400	/* 3.6864 MHz */
> -#define PXA27X_FREQ	3250000	/* 3.25 MHz */
>   
>   static int pxa2xx_timer4_freq[8] = {
>       [0] = 0,
> @@ -572,28 +571,6 @@ static const TypeInfo pxa25x_timer_dev_info = {
>       .class_init    = pxa25x_timer_dev_class_init,
>   };
>   
> -static Property pxa27x_timer_dev_properties[] = {
> -    DEFINE_PROP_UINT32("freq", PXA2xxTimerInfo, freq, PXA27X_FREQ),
> -    DEFINE_PROP_BIT("tm4", PXA2xxTimerInfo, flags,
> -                    PXA2XX_TIMER_HAVE_TM4, true),
> -    DEFINE_PROP_END_OF_LIST(),
> -};
> -
> -static void pxa27x_timer_dev_class_init(ObjectClass *klass, void *data)
> -{
> -    DeviceClass *dc = DEVICE_CLASS(klass);
> -
> -    dc->desc = "PXA27x timer";
> -    device_class_set_props(dc, pxa27x_timer_dev_properties);
> -}
> -
> -static const TypeInfo pxa27x_timer_dev_info = {
> -    .name          = "pxa27x-timer",
> -    .parent        = TYPE_PXA2XX_TIMER,
> -    .instance_size = sizeof(PXA2xxTimerInfo),
> -    .class_init    = pxa27x_timer_dev_class_init,
> -};
> -
>   static void pxa2xx_timer_class_init(ObjectClass *oc, void *data)
>   {
>       DeviceClass *dc = DEVICE_CLASS(oc);
> @@ -615,7 +592,6 @@ static void pxa2xx_timer_register_types(void)
>   {
>       type_register_static(&pxa2xx_timer_type_info);
>       type_register_static(&pxa25x_timer_dev_info);
> -    type_register_static(&pxa27x_timer_dev_info);
>   }
>   
>   type_init(pxa2xx_timer_register_types)

We could also remove the abstract parent:

-- >8 --
diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c
index 3234bbb1f4..b379b621cc 100644
--- a/hw/timer/pxa2xx_timer.c
+++ b/hw/timer/pxa2xx_timer.c
@@ -65,7 +65,7 @@ static int pxa2xx_timer4_freq[8] = {
      [5 ... 7] = 0,
  };

-#define TYPE_PXA2XX_TIMER "pxa2xx-timer"
+#define TYPE_PXA2XX_TIMER "pxa25x-timer"
  OBJECT_DECLARE_SIMPLE_TYPE(PXA2xxTimerInfo, PXA2XX_TIMER)


@@ -561,36 +561,21 @@ static void 
pxa25x_timer_dev_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);

      dc->desc = "PXA25x timer";
+    dc->realize  = pxa2xx_timer_realize;
+    dc->vmsd = &vmstate_pxa2xx_timer_regs;
      device_class_set_props(dc, pxa25x_timer_dev_properties);
  }

  static const TypeInfo pxa25x_timer_dev_info = {
      .name          = "pxa25x-timer",
-    .parent        = TYPE_PXA2XX_TIMER,
-    .instance_size = sizeof(PXA2xxTimerInfo),
-    .class_init    = pxa25x_timer_dev_class_init,
-};
-
-static void pxa2xx_timer_class_init(ObjectClass *oc, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(oc);
-
-    dc->realize  = pxa2xx_timer_realize;
-    dc->vmsd = &vmstate_pxa2xx_timer_regs;
-}
-
-static const TypeInfo pxa2xx_timer_type_info = {
-    .name          = TYPE_PXA2XX_TIMER,
      .parent        = TYPE_SYS_BUS_DEVICE,
      .instance_size = sizeof(PXA2xxTimerInfo),
      .instance_init = pxa2xx_timer_init,
-    .abstract      = true,
-    .class_init    = pxa2xx_timer_class_init,
+    .class_init    = pxa25x_timer_dev_class_init,
  };

  static void pxa2xx_timer_register_types(void)
  {
-    type_register_static(&pxa2xx_timer_type_info);
      type_register_static(&pxa25x_timer_dev_info);
  }

---

I can post a follow-up patch but not sure it is worth it.

Regardless,

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>