On 10/12/26 16:32, Emmanuel Blot wrote:
Now that TYPE_DS1338 is exposed by include/hw/rtc/ds1338.h, use it in
the machines that instantiate the RTC by its raw type name string.

No functional change.

Signed-off-by: Emmanuel Blot <[email protected]>
---
  hw/arm/aspeed_ast2400_palmetto.c          | 4 +++-
  hw/arm/aspeed_ast2400_supermicrox11.c     | 4 +++-
  hw/arm/aspeed_ast2500_romulus.c           | 4 +++-
  hw/arm/aspeed_ast2500_supermicro-x11spi.c | 4 +++-
  hw/arm/aspeed_ast2500_witherspoon.c       | 4 +++-
  hw/arm/aspeed_ast2600_bletchley.c         | 3 ++-
  hw/arm/aspeed_ast2600_catalina.c          | 2 +-
  hw/arm/aspeed_ast2600_sanmiguel.c         | 3 +--
  hw/arm/realview.c                         | 3 ++-
  hw/arm/versatilepb.c                      | 3 ++-
  hw/ppc/e500.c                             | 3 ++-
  hw/riscv/tt_atlantis.c                    | 3 ++-
  12 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/hw/arm/aspeed_ast2400_palmetto.c b/hw/arm/aspeed_ast2400_palmetto.c
index e2350e5b6c..185185f0bb 100644
--- a/hw/arm/aspeed_ast2400_palmetto.c
+++ b/hw/arm/aspeed_ast2400_palmetto.c
@@ -11,6 +11,7 @@
  #include "hw/arm/aspeed.h"
  #include "hw/arm/aspeed_soc.h"
  #include "hw/i2c/smbus_eeprom.h"
+#include "hw/rtc/ds1338.h"
/* Palmetto hardware value: 0x120CE416 */
  #define PALMETTO_BMC_HW_STRAP1 (                                        \
@@ -36,7 +37,8 @@ static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)
       * The palmetto platform expects a ds3231 RTC but a ds1338 is
       * enough to provide basic RTC features. Alarms will be missing
       */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 0x68);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0), TYPE_DS1338,
+                            0x68);
smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 0), 0x50,
                            eeprom_buf);
diff --git a/hw/arm/aspeed_ast2400_supermicrox11.c 
b/hw/arm/aspeed_ast2400_supermicrox11.c
index c75898cc6d..051e072c5a 100644
--- a/hw/arm/aspeed_ast2400_supermicrox11.c
+++ b/hw/arm/aspeed_ast2400_supermicrox11.c
@@ -11,6 +11,7 @@
  #include "hw/arm/aspeed.h"
  #include "hw/arm/aspeed_soc.h"
  #include "hw/i2c/smbus_eeprom.h"
+#include "hw/rtc/ds1338.h"
/* TODO: Find the actual hardware value */
  #define SUPERMICROX11_BMC_HW_STRAP1 (                                   \
@@ -36,7 +37,8 @@ static void supermicrox11_bmc_i2c_init(AspeedMachineState 
*bmc)
       * The palmetto platform expects a ds3231 RTC but a ds1338 is
       * enough to provide basic RTC features. Alarms will be missing
       */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 0x68);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0), TYPE_DS1338,
+                            0x68);
smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 0), 0x50,
                            eeprom_buf);
diff --git a/hw/arm/aspeed_ast2500_romulus.c b/hw/arm/aspeed_ast2500_romulus.c
index 340a74408b..87f90ed361 100644
--- a/hw/arm/aspeed_ast2500_romulus.c
+++ b/hw/arm/aspeed_ast2500_romulus.c
@@ -10,6 +10,7 @@
  #include "qapi/error.h"
  #include "hw/arm/aspeed.h"
  #include "hw/arm/aspeed_soc.h"
+#include "hw/rtc/ds1338.h"
/* Romulus hardware value: 0xF10AD206 */
  #define ROMULUS_BMC_HW_STRAP1 (                                         \
@@ -29,7 +30,8 @@ static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
       * The romulus board expects Epson RX8900 I2C RTC but a ds1338 is
       * good enough
       */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "ds1338", 0x32);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), TYPE_DS1338,
+                            0x32);
  }
static void aspeed_machine_romulus_class_init(ObjectClass *oc,
diff --git a/hw/arm/aspeed_ast2500_supermicro-x11spi.c 
b/hw/arm/aspeed_ast2500_supermicro-x11spi.c
index 5a7e49d6cc..dc0248422d 100644
--- a/hw/arm/aspeed_ast2500_supermicro-x11spi.c
+++ b/hw/arm/aspeed_ast2500_supermicro-x11spi.c
@@ -11,6 +11,7 @@
  #include "hw/arm/aspeed.h"
  #include "hw/arm/aspeed_soc.h"
  #include "hw/i2c/smbus_eeprom.h"
+#include "hw/rtc/ds1338.h"
/* TODO: Find the actual hardware value */
  #define SUPERMICRO_X11SPI_BMC_HW_STRAP1 (                               \
@@ -32,7 +33,8 @@ static void supermicro_x11spi_bmc_i2c_init(AspeedMachineState 
*bmc)
       * The palmetto platform expects a ds3231 RTC but a ds1338 is
       * enough to provide basic RTC features. Alarms will be missing
       */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 0x68);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 0), TYPE_DS1338,
+                            0x68);
smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 0), 0x50,
                            eeprom_buf);
diff --git a/hw/arm/aspeed_ast2500_witherspoon.c 
b/hw/arm/aspeed_ast2500_witherspoon.c
index 26ddb67347..c69065846c 100644
--- a/hw/arm/aspeed_ast2500_witherspoon.c
+++ b/hw/arm/aspeed_ast2500_witherspoon.c
@@ -14,6 +14,7 @@
  #include "hw/sensor/tmp105.h"
  #include "hw/i2c/smbus_eeprom.h"
  #include "hw/gpio/pca9552.h"
+#include "hw/rtc/ds1338.h"
/* Witherspoon hardware value: 0xF10AD216 */
  #define WITHERSPOON_BMC_HW_STRAP1 (                                     \
@@ -70,7 +71,8 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
       * The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is
       * good enough
       */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "ds1338", 0x32);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), TYPE_DS1338,
+                            0x32);
smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 11), 0x51,
                            eeprom_buf);
diff --git a/hw/arm/aspeed_ast2600_bletchley.c 
b/hw/arm/aspeed_ast2600_bletchley.c
index 6fa606c047..0e746055a2 100644
--- a/hw/arm/aspeed_ast2600_bletchley.c
+++ b/hw/arm/aspeed_ast2600_bletchley.c
@@ -12,6 +12,7 @@
  #include "hw/arm/aspeed_soc.h"
  #include "hw/gpio/pca9552.h"
  #include "hw/nvram/eeprom_at24c.h"
+#include "hw/rtc/ds1338.h"
#define TYPE_TMP421 "tmp421"
  /* Bletchley hardware value */
@@ -44,7 +45,7 @@ static void bletchley_bmc_i2c_init(AspeedMachineState *bmc)
      /* Bus 6 */
      at24c_eeprom_init(i2c[6], 0x56, 65536);
      /* Missing model: nxp,pcf85263 @ 0x51 , but ds1338 works enough */
-    i2c_slave_create_simple(i2c[6], "ds1338", 0x51);
+    i2c_slave_create_simple(i2c[6], TYPE_DS1338, 0x51);
/* Bus 7 */
diff --git a/hw/arm/aspeed_ast2600_catalina.c b/hw/arm/aspeed_ast2600_catalina.c
index 4f2b396f6f..b15d932086 100644
--- a/hw/arm/aspeed_ast2600_catalina.c
+++ b/hw/arm/aspeed_ast2600_catalina.c
@@ -14,6 +14,7 @@
  #include "hw/gpio/pca9552.h"
  #include "hw/gpio/pca9554.h"
  #include "hw/nvram/eeprom_at24c.h"
+#include "hw/rtc/ds1338.h"
  #include "hw/sensor/tmp105.h"
/* Catalina hardware value */
@@ -22,7 +23,6 @@
  #define CATALINA_BMC_RAM_SIZE (2 * GiB)
#define TYPE_TMP421 "tmp421"
-#define TYPE_DS1338 "ds1338"
/*
   * "BMC Storage Module" FRU data.  Generated with frugen.
diff --git a/hw/arm/aspeed_ast2600_sanmiguel.c 
b/hw/arm/aspeed_ast2600_sanmiguel.c
index ac2aef740a..b0935683e2 100644
--- a/hw/arm/aspeed_ast2600_sanmiguel.c
+++ b/hw/arm/aspeed_ast2600_sanmiguel.c
@@ -13,6 +13,7 @@
  #include "hw/gpio/pca9552.h"
  #include "hw/gpio/pca9554.h"
  #include "hw/nvram/eeprom_at24c.h"
+#include "hw/rtc/ds1338.h"
  #include "hw/sensor/tmp105.h"
/* SanMiguel hardware values */
@@ -20,8 +21,6 @@
  #define SANMIGUEL_BMC_HW_STRAP2 0x00000000
  #define SANMIGUEL_BMC_RAM_SIZE (2 * GiB)
-#define TYPE_DS1338 "ds1338"
-
  /*
   * "Front IO" FRU data. Generated with frugen.
   *
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index ceba0331b0..4cdf939511 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -28,6 +28,7 @@
  #include "hw/intc/realview_gic.h"
  #include "hw/core/irq.h"
  #include "hw/i2c/arm_sbcon_i2c.h"
+#include "hw/rtc/ds1338.h"
  #include "hw/sd/sd.h"
  #include "target/arm/cpu-qom.h"
@@ -323,7 +324,7 @@ static void realview_init(MachineState *machine, dev = sysbus_create_simple(TYPE_ARM_SBCON_I2C, 0x10002000, NULL);
      i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
-    i2c_slave_create_simple(i2c, "ds1338", 0x68);
+    i2c_slave_create_simple(i2c, TYPE_DS1338, 0x68);
/* Memory map for RealView Emulation Baseboard: */
      /* 0x10000000 System registers.  */
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index f94bf96599..737cd21c27 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -18,6 +18,7 @@
  #include "hw/pci/pci.h"
  #include "hw/i2c/i2c.h"
  #include "hw/i2c/arm_sbcon_i2c.h"
+#include "hw/rtc/ds1338.h"
  #include "hw/core/irq.h"
  #include "hw/core/boards.h"
  #include "hw/block/flash.h"
@@ -346,7 +347,7 @@ static void versatile_init(MachineState *machine, int 
board_id)
dev = sysbus_create_simple(TYPE_ARM_SBCON_I2C, 0x10002000, NULL);
      i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
-    i2c_slave_create_simple(i2c, "ds1338", 0x68);
+    i2c_slave_create_simple(i2c, TYPE_DS1338, 0x68);
/* Add PL041 AACI Interface to the LM4549 codec */
      pl041 = qdev_new("pl041");
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 1876882a04..469cef9d2f 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -50,6 +50,7 @@
  #include "hw/core/platform-bus.h"
  #include "hw/net/fsl_etsec/etsec.h"
  #include "hw/i2c/i2c.h"
+#include "hw/rtc/ds1338.h"
  #include "hw/core/irq.h"
  #include "hw/sd/sdhci.h"
  #include "hw/misc/unimp.h"
@@ -1025,7 +1026,7 @@ void ppce500_init(MachineState *machine)
      memory_region_add_subregion(ccsr_addr_space, MPC8544_I2C_REGS_OFFSET,
                                  sysbus_mmio_get_region(s, 0));
      i2c = I2C_BUS(qdev_get_child_bus(dev, "i2c"));
-    i2c_slave_create_simple(i2c, "ds1338", RTC_REGS_OFFSET);
+    i2c_slave_create_simple(i2c, TYPE_DS1338, RTC_REGS_OFFSET);
/* eSDHC */
      if (pmc->has_esdhc) {
diff --git a/hw/riscv/tt_atlantis.c b/hw/riscv/tt_atlantis.c
index 8a219afef7..910713c6bb 100644
--- a/hw/riscv/tt_atlantis.c
+++ b/hw/riscv/tt_atlantis.c
@@ -27,6 +27,7 @@
  #include "hw/char/serial-mm.h"
  #include "hw/intc/riscv_aclint.h"
  #include "hw/misc/unimp.h"
+#include "hw/rtc/ds1338.h"
#include "system/system.h"
  #include "system/device_tree.h"
@@ -657,7 +658,7 @@ static void tt_atlantis_machine_init(MachineState *machine)
      qdev_realize(DEVICE(&ams->soc), NULL, &error_fatal);
/* I2C peripherals: qemu specific */
-    i2c_slave_create_simple(i2c_get_bus(s, 0), "ds1338", 0x6f);
+    i2c_slave_create_simple(i2c_get_bus(s, 0), TYPE_DS1338, 0x6f);
      i2c_slave_create_simple(i2c_get_bus(s, 4), "tmp105", 0x48);
/* Load or create device tree */


Reviewed-by: Cédric Le Goater <[email protected]>

Thanks,

C.


Reply via email to