* [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability
@ 2025-10-23 10:01 Jamin Lin via
  2025-10-23 10:01 ` [PATCH v1 01/13] hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse Jamin Lin via
                   ` (12 more replies)
  0 siblings, 13 replies; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
v1:
 1. Move "AspeedMachineState" definition to a shared header.
 2. Make common helper functions globally accessible.
 3. Split each AST2500 machine into its own source file:
   - FP5280G2
   - G220A
   - Tiogapass
   - YosemiteV2
   - Witherspoon
   - Sonorapass
   - Romulus
   - Supermicro X11SPI
   - AST2500 EVB
 
Jamin Lin (13):
  hw/arm/aspeed: Move AspeedMachineState definition to common header for
    reuse
  hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally
    accessible
  hw/arm/aspeed: Make create_pca9552() globally accessible for reuse
  hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed
    machines
  hw/arm/aspeed: Split FP5280G2 machine into a separate source file for
    maintenance
  hw/arm/aspeed: Split G220A machine into a separate source file for
    better maintenance
  hw/arm/aspeed: Split Tiogapass machine into a separate source file for
    cleanup
  hw/arm/aspeed: Split YosemiteV2 machine into a separate source file
    for maintainability
  hw/arm/aspeed: Split Witherspoon machine into a separate source file
    for maintainability
  hw/arm/aspeed: Split Sonorapass machine into a separate source file
    for maintainability
  hw/arm/aspeed: Split Romulus machine into a separate source file for
    maintainability
  hw/arm/aspeed: Split Supermicro X11SPI machine into a separate file
    for maintainability
  hw/arm/aspeed: Split AST2500 EVB machine into a separate source file
    for maintainability
 hw/arm/aspeed_eeprom.h                    |   7 -
 include/hw/arm/aspeed.h                   |  17 +
 hw/arm/aspeed.c                           | 508 +---------------------
 hw/arm/aspeed_ast2500_evb.c               |  66 +++
 hw/arm/aspeed_ast2500_fp5280g2.c          |  87 ++++
 hw/arm/aspeed_ast2500_g220a.c             |  91 ++++
 hw/arm/aspeed_ast2500_romulus.c           |  61 +++
 hw/arm/aspeed_ast2500_sonorapass.c        | 101 +++++
 hw/arm/aspeed_ast2500_supermicro-x11spi.c |  76 ++++
 hw/arm/aspeed_ast2500_tiogapass.c         |  89 ++++
 hw/arm/aspeed_ast2500_witherspoon.c       | 111 +++++
 hw/arm/aspeed_ast2500_yosemitev2.c        |  90 ++++
 hw/arm/aspeed_eeprom.c                    |  44 --
 hw/arm/meson.build                        |   9 +
 14 files changed, 801 insertions(+), 556 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_evb.c
 create mode 100644 hw/arm/aspeed_ast2500_fp5280g2.c
 create mode 100644 hw/arm/aspeed_ast2500_g220a.c
 create mode 100644 hw/arm/aspeed_ast2500_romulus.c
 create mode 100644 hw/arm/aspeed_ast2500_sonorapass.c
 create mode 100644 hw/arm/aspeed_ast2500_supermicro-x11spi.c
 create mode 100644 hw/arm/aspeed_ast2500_tiogapass.c
 create mode 100644 hw/arm/aspeed_ast2500_witherspoon.c
 create mode 100644 hw/arm/aspeed_ast2500_yosemitev2.c
-- 
2.43.0
^ permalink raw reply	[flat|nested] 29+ messages in thread
* [PATCH v1 01/13] hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:06   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 02/13] hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally accessible Jamin Lin via
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
Aspeed machines will be moved into split C files for better
modularization and future maintenance.
To allow all machine implementations to reuse the same
AspeedMachineState structure, the struct definition is moved
from aspeed.c to the shared header aspeed.h.
This change centralizes the common state structure used across
all Aspeed machine models, reduces redundancy, and simplifies
future refactoring work for new machines.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 include/hw/arm/aspeed.h | 14 ++++++++++++++
 hw/arm/aspeed.c         | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 6c36455656..383ebb9759 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -11,6 +11,7 @@
 
 #include "hw/boards.h"
 #include "qom/object.h"
+#include "hw/arm/aspeed_soc.h"
 
 typedef struct AspeedMachineState AspeedMachineState;
 
@@ -24,6 +25,19 @@ DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass,
 #define ASPEED_MAC2_ON   (1 << 2)
 #define ASPEED_MAC3_ON   (1 << 3)
 
+struct AspeedMachineState {
+    /* Private */
+    MachineState parent_obj;
+    /* Public */
+
+    AspeedSoCState *soc;
+    MemoryRegion boot_rom;
+    bool mmio_exec;
+    uint32_t uart_chosen;
+    char *fmc_model;
+    char *spi_model;
+    uint32_t hw_strap1;
+};
 
 struct AspeedMachineClass {
     MachineClass parent_obj;
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 1bc9e534ba..761b526994 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -35,20 +35,6 @@ static struct arm_boot_info aspeed_board_binfo = {
     .board_id = -1, /* device-tree-only board */
 };
 
-struct AspeedMachineState {
-    /* Private */
-    MachineState parent_obj;
-    /* Public */
-
-    AspeedSoCState *soc;
-    MemoryRegion boot_rom;
-    bool mmio_exec;
-    uint32_t uart_chosen;
-    char *fmc_model;
-    char *spi_model;
-    uint32_t hw_strap1;
-};
-
 /* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */
 #if HOST_LONG_BITS == 32
 #define ASPEED_RAM_SIZE(sz) MIN((sz), 1 * GiB)
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 02/13] hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally accessible
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
  2025-10-23 10:01 ` [PATCH v1 01/13] hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:08   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse Jamin Lin via
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
The function aspeed_machine_class_init_cpus_defaults() is now made
globally visible so that it can be used by other Aspeed machine C files.
Previously, this function was declared as static, restricting its
visibility to aspeed.c. Since future machine split files will also
need to call this helper to initialize default CPU settings, its
declaration has been moved to the common header aspeed.h and the
static keyword has been removed.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 383ebb9759..7743ad2fb0 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -59,5 +59,6 @@ struct AspeedMachineClass {
     bool vbootrom;
 };
 
+void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
 
 #endif
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 761b526994..5da21a4d6a 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -1338,7 +1338,7 @@ static void aspeed_machine_class_props_init(ObjectClass *oc)
                                           "Change the SPI Flash model");
 }
 
-static void aspeed_machine_class_init_cpus_defaults(MachineClass *mc)
+void aspeed_machine_class_init_cpus_defaults(MachineClass *mc)
 {
     AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(mc);
     AspeedSoCClass *sc = ASPEED_SOC_CLASS(object_class_by_name(amc->soc_name));
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
  2025-10-23 10:01 ` [PATCH v1 01/13] hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse Jamin Lin via
  2025-10-23 10:01 ` [PATCH v1 02/13] hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally accessible Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:08   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 04/13] hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed machines Jamin Lin via
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
The helper function create_pca9552() is now made globally visible
so it can be reused by different Aspeed machine source files.
Previously, the function was declared static, limiting its scope
to aspeed.c. Since multiple Aspeed machine implementations will
require I²C device initialization using PCA9552 GPIO expanders,
this function has been promoted to global visibility.
This change improves code sharing and reduces duplication across
machine-specific initialization files.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 7743ad2fb0..d4d63996a6 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -60,5 +60,6 @@ struct AspeedMachineClass {
 };
 
 void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
+void create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
 
 #endif
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 5da21a4d6a..2695f0c11b 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -536,7 +536,7 @@ static void tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
     i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4e);
 }
 
-static void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
+void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
 {
     i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
                             TYPE_PCA9552, addr);
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 04/13] hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed machines
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (2 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 05/13] hw/arm/aspeed: Split FP5280G2 machine into a separate source file for maintenance Jamin Lin via
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
The function create_pca9554() is now made globally accessible so that
it can be reused by different Aspeed machine source files.
Originally, this helper was declared static inside aspeed.c,
restricting its visibility. As future Aspeed machine implementations
will also require PCA9554 I²C device setup, the function has been
exported by removing the static keyword and adding its prototype
to aspeed.h.
This change promotes better code reuse and consistency across
machine initialization code.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index d4d63996a6..fbe684d505 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -61,5 +61,6 @@ struct AspeedMachineClass {
 
 void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
 void create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
+I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr);
 
 #endif
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 2695f0c11b..8a22696da9 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -542,7 +542,7 @@ void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
                             TYPE_PCA9552, addr);
 }
 
-static I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr)
+I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr)
 {
     return i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
                             TYPE_PCA9554, addr);
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 05/13] hw/arm/aspeed: Split FP5280G2 machine into a separate source file for maintenance
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (3 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 04/13] hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed machines Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 06/13] hw/arm/aspeed: Split G220A machine into a separate source file for better maintenance Jamin Lin via
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit moves the FP5280G2 BMC machine implementation from
aspeed.c into a new standalone file aspeed_ast2500_fp5280g2.c.
The change improves code organization and prepares the Aspeed
machine framework for future expansion and easier maintenance.
Key updates include:
- Moved fp5280g2_bmc_i2c_init() and related machine class init
functions into aspeed_ast2500_fp5280g2.c.
- Added new file to hw/arm/meson.build for compilation.
- Removed obsolete FP5280G2 definitions from aspeed.c
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c                  | 65 ------------------------
 hw/arm/aspeed_ast2500_fp5280g2.c | 87 ++++++++++++++++++++++++++++++++
 hw/arm/meson.build               |  1 +
 3 files changed, 88 insertions(+), 65 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_fp5280g2.c
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 8a22696da9..48c3d73e73 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -130,21 +130,6 @@ static struct arm_boot_info aspeed_board_binfo = {
         SCU_HW_STRAP_VGA_SIZE_SET(VGA_64M_DRAM) |                       \
         SCU_AST2500_HW_STRAP_RESERVED1)
 
-/* FP5280G2 hardware value: 0XF100D286 */
-#define FP5280G2_BMC_HW_STRAP1 (                                      \
-        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
-        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
-        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
-        SCU_AST2500_HW_STRAP_RESERVED28 |                               \
-        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
-        SCU_HW_STRAP_VGA_CLASS_CODE |                                   \
-        SCU_HW_STRAP_LPC_RESET_PIN |                                    \
-        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER) |                \
-        SCU_AST2500_HW_STRAP_SET_AXI_AHB_RATIO(AXI_AHB_RATIO_2_1) |     \
-        SCU_HW_STRAP_MAC1_RGMII |                                       \
-        SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) |                       \
-        SCU_AST2500_HW_STRAP_RESERVED1)
-
 /* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */
 #define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1
 
@@ -685,33 +670,6 @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
                           eeprom_buf);
 }
 
-static void fp5280g2_bmc_i2c_init(AspeedMachineState *bmc)
-{
-    AspeedSoCState *soc = bmc->soc;
-    I2CSlave *i2c_mux;
-
-    /* The at24c256 */
-    at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 1), 0x50, 32768);
-
-    /* The fp5280g2 expects a TMP112 but a TMP105 is compatible */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), TYPE_TMP105,
-                     0x48);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), TYPE_TMP105,
-                     0x49);
-
-    i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2),
-                     "pca9546", 0x70);
-    /* It expects a TMP112 but a TMP105 is compatible */
-    i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 0), TYPE_TMP105,
-                     0x4a);
-
-    /* It expects a ds3232 but a ds1338 is good enough */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), "ds1338", 0x68);
-
-    /* It expects a pca9555 but a pca9552 is compatible */
-    create_pca9552(soc, 8, 0x30);
-}
-
 static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
 {
     AspeedSoCState *soc = bmc->soc;
@@ -1607,25 +1565,6 @@ static void aspeed_machine_g220a_class_init(ObjectClass *oc, const void *data)
     aspeed_machine_class_init_cpus_defaults(mc);
 };
 
-static void aspeed_machine_fp5280g2_class_init(ObjectClass *oc,
-                                               const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "Inspur FP5280G2 BMC (ARM1176)";
-    mc->deprecation_reason = "use 'ast2500-evb' instead";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = FP5280G2_BMC_HW_STRAP1;
-    amc->fmc_model = "n25q512a";
-    amc->spi_model = "mx25l25635e";
-    amc->num_cs    = 2;
-    amc->macs_mask  = ASPEED_MAC0_ON | ASPEED_MAC1_ON;
-    amc->i2c_init  = fp5280g2_bmc_i2c_init;
-    mc->default_ram_size = 512 * MiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-};
-
 static void aspeed_machine_rainier_class_init(ObjectClass *oc, const void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -2001,10 +1940,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("qcom-firework-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_qcom_firework_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("fp5280g2-bmc"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_fp5280g2_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("quanta-q71l-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_fp5280g2.c b/hw/arm/aspeed_ast2500_fp5280g2.c
new file mode 100644
index 0000000000..a312c29c5d
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_fp5280g2.c
@@ -0,0 +1,87 @@
+/*
+ * Inspur FP5280G2
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/nvram/eeprom_at24c.h"
+#include "hw/i2c/i2c_mux_pca954x.h"
+#include "hw/sensor/tmp105.h"
+
+/* FP5280G2 hardware value: 0XF100D286 */
+#define FP5280G2_BMC_HW_STRAP1 (                                      \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_RESERVED28 |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_HW_STRAP_VGA_CLASS_CODE |                                   \
+        SCU_HW_STRAP_LPC_RESET_PIN |                                    \
+        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER) |                \
+        SCU_AST2500_HW_STRAP_SET_AXI_AHB_RATIO(AXI_AHB_RATIO_2_1) |     \
+        SCU_HW_STRAP_MAC1_RGMII |                                       \
+        SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) |                       \
+        SCU_AST2500_HW_STRAP_RESERVED1)
+
+static void fp5280g2_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+    I2CSlave *i2c_mux;
+
+    /* The at24c256 */
+    at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 1), 0x50, 32768);
+
+    /* The fp5280g2 expects a TMP112 but a TMP105 is compatible */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), TYPE_TMP105,
+                     0x48);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), TYPE_TMP105,
+                     0x49);
+
+    i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2),
+                     "pca9546", 0x70);
+    /* It expects a TMP112 but a TMP105 is compatible */
+    i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 0), TYPE_TMP105,
+                     0x4a);
+
+    /* It expects a ds3232 but a ds1338 is good enough */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), "ds1338", 0x68);
+
+    /* It expects a pca9555 but a pca9552 is compatible */
+    create_pca9552(soc, 8, 0x30);
+}
+
+static void aspeed_machine_fp5280g2_class_init(ObjectClass *oc,
+                                               const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "Inspur FP5280G2 BMC (ARM1176)";
+    mc->deprecation_reason = "use 'ast2500-evb' instead";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = FP5280G2_BMC_HW_STRAP1;
+    amc->fmc_model = "n25q512a";
+    amc->spi_model = "mx25l25635e";
+    amc->num_cs    = 2;
+    amc->macs_mask  = ASPEED_MAC0_ON | ASPEED_MAC1_ON;
+    amc->i2c_init  = fp5280g2_bmc_i2c_init;
+    mc->default_ram_size = 512 * MiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+};
+
+static const TypeInfo aspeed_ast2500_fp5280g2_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("fp5280g2-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_fp5280g2_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_fp5280g2_types)
+
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index b88b5b06d7..55513db65b 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -44,6 +44,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed.c',
   'aspeed_soc_common.c',
   'aspeed_ast2400.c',
+  'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2600.c',
   'aspeed_ast10x0.c',
   'aspeed_eeprom.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 06/13] hw/arm/aspeed: Split G220A machine into a separate source file for better maintenance
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (4 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 05/13] hw/arm/aspeed: Split FP5280G2 machine into a separate source file for maintenance Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 07/13] hw/arm/aspeed: Split Tiogapass machine into a separate source file for cleanup Jamin Lin via
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit refactors the Bytedance G220A BMC machine by moving its
implementation from aspeed.c into a new dedicated file
aspeed_ast2500_g220a.c.
The goal is to improve modularity and maintainability of Aspeed
machine definitions by isolating each platform into its own source
file. This aligns with ongoing efforts to simplify aspeed.c,
which previously contained all machine configurations.
Key updates include:
- Moved G220A_BMC_HW_STRAP1 definition and
g220a_bmc_i2c_init() function into aspeed_ast2500_g220a.c.
- Moved aspeed_machine_g220a_class_init() and related type
registration to the new file.
- Added the new file to the build system (meson.build).
- Removed all G220A-specific code from aspeed.c.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c               | 71 ---------------------------
 hw/arm/aspeed_ast2500_g220a.c | 91 +++++++++++++++++++++++++++++++++++
 hw/arm/meson.build            |  1 +
 3 files changed, 92 insertions(+), 71 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_g220a.c
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 48c3d73e73..dbeb751275 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -116,20 +116,6 @@ static struct arm_boot_info aspeed_board_binfo = {
         SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) |                       \
         SCU_AST2500_HW_STRAP_RESERVED1)
 
-#define G220A_BMC_HW_STRAP1 (                                      \
-        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
-        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
-        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
-        SCU_AST2500_HW_STRAP_RESERVED28 |                               \
-        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
-        SCU_HW_STRAP_2ND_BOOT_WDT |                                     \
-        SCU_HW_STRAP_VGA_CLASS_CODE |                                   \
-        SCU_HW_STRAP_LPC_RESET_PIN |                                    \
-        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER) |                \
-        SCU_AST2500_HW_STRAP_SET_AXI_AHB_RATIO(AXI_AHB_RATIO_2_1) |     \
-        SCU_HW_STRAP_VGA_SIZE_SET(VGA_64M_DRAM) |                       \
-        SCU_AST2500_HW_STRAP_RESERVED1)
-
 /* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */
 #define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1
 
@@ -634,42 +620,6 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
     /* Bus 11: TODO ucd90160@64 */
 }
 
-static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
-{
-    AspeedSoCState *soc = bmc->soc;
-    DeviceState *dev;
-
-    dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3),
-                                         "emc1413", 0x4c));
-    object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
-    object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
-    object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
-
-    dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 12),
-                                         "emc1413", 0x4c));
-    object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
-    object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
-    object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
-
-    dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 13),
-                                         "emc1413", 0x4c));
-    object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
-    object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
-    object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
-
-    static uint8_t eeprom_buf[2 * 1024] = {
-            0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xfe,
-            0x01, 0x06, 0x00, 0xc9, 0x42, 0x79, 0x74, 0x65,
-            0x64, 0x61, 0x6e, 0x63, 0x65, 0xc5, 0x47, 0x32,
-            0x32, 0x30, 0x41, 0xc4, 0x41, 0x41, 0x42, 0x42,
-            0xc4, 0x43, 0x43, 0x44, 0x44, 0xc4, 0x45, 0x45,
-            0x46, 0x46, 0xc4, 0x48, 0x48, 0x47, 0x47, 0xc1,
-            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7,
-    };
-    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 4), 0x57,
-                          eeprom_buf);
-}
-
 static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
 {
     AspeedSoCState *soc = bmc->soc;
@@ -1548,23 +1498,6 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc,
     aspeed_machine_ast2600_class_emmc_init(oc);
 };
 
-static void aspeed_machine_g220a_class_init(ObjectClass *oc, const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "Bytedance G220A BMC (ARM1176)";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = G220A_BMC_HW_STRAP1;
-    amc->fmc_model = "n25q512a";
-    amc->spi_model = "mx25l25635e";
-    amc->num_cs    = 2;
-    amc->macs_mask  = ASPEED_MAC0_ON | ASPEED_MAC1_ON;
-    amc->i2c_init  = g220a_bmc_i2c_init;
-    mc->default_ram_size = 1024 * MiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-};
-
 static void aspeed_machine_rainier_class_init(ObjectClass *oc, const void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -1928,10 +1861,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("tiogapass-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_tiogapass_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("g220a-bmc"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_g220a_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("qcom-dc-scm-v1-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_g220a.c b/hw/arm/aspeed_ast2500_g220a.c
new file mode 100644
index 0000000000..d9cc0ca018
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_g220a.c
@@ -0,0 +1,91 @@
+/*
+ * Bytedance G220A
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/i2c/smbus_eeprom.h"
+
+#define G220A_BMC_HW_STRAP1 (                                      \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_RESERVED28 |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_HW_STRAP_2ND_BOOT_WDT |                                     \
+        SCU_HW_STRAP_VGA_CLASS_CODE |                                   \
+        SCU_HW_STRAP_LPC_RESET_PIN |                                    \
+        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER) |                \
+        SCU_AST2500_HW_STRAP_SET_AXI_AHB_RATIO(AXI_AHB_RATIO_2_1) |     \
+        SCU_HW_STRAP_VGA_SIZE_SET(VGA_64M_DRAM) |                       \
+        SCU_AST2500_HW_STRAP_RESERVED1)
+
+static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+    DeviceState *dev;
+
+    dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3),
+                                         "emc1413", 0x4c));
+    object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
+
+    dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 12),
+                                         "emc1413", 0x4c));
+    object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
+
+    dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 13),
+                                         "emc1413", 0x4c));
+    object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
+
+    static uint8_t eeprom_buf[2 * 1024] = {
+            0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xfe,
+            0x01, 0x06, 0x00, 0xc9, 0x42, 0x79, 0x74, 0x65,
+            0x64, 0x61, 0x6e, 0x63, 0x65, 0xc5, 0x47, 0x32,
+            0x32, 0x30, 0x41, 0xc4, 0x41, 0x41, 0x42, 0x42,
+            0xc4, 0x43, 0x43, 0x44, 0x44, 0xc4, 0x45, 0x45,
+            0x46, 0x46, 0xc4, 0x48, 0x48, 0x47, 0x47, 0xc1,
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7,
+    };
+    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 4), 0x57,
+                          eeprom_buf);
+}
+
+static void aspeed_machine_g220a_class_init(ObjectClass *oc, const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "Bytedance G220A BMC (ARM1176)";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = G220A_BMC_HW_STRAP1;
+    amc->fmc_model = "n25q512a";
+    amc->spi_model = "mx25l25635e";
+    amc->num_cs    = 2;
+    amc->macs_mask  = ASPEED_MAC0_ON | ASPEED_MAC1_ON;
+    amc->i2c_init  = g220a_bmc_i2c_init;
+    mc->default_ram_size = 1024 * MiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+};
+
+static const TypeInfo aspeed_ast2500_g220a_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("g220a-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_g220a_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_g220a_types)
+
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index 55513db65b..a8539ff51e 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -45,6 +45,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_soc_common.c',
   'aspeed_ast2400.c',
   'aspeed_ast2500_fp5280g2.c',
+  'aspeed_ast2500_g220a.c',
   'aspeed_ast2600.c',
   'aspeed_ast10x0.c',
   'aspeed_eeprom.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 07/13] hw/arm/aspeed: Split Tiogapass machine into a separate source file for cleanup
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (5 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 06/13] hw/arm/aspeed: Split G220A machine into a separate source file for better maintenance Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 08/13] hw/arm/aspeed: Split YosemiteV2 machine into a separate source file for maintainability Jamin Lin via
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit moves the Tiogapass BMC machine implementation out of
aspeed.c into a new dedicated file aspeed_ast2500_tiogapass.c.
To support splitting Tiogapass into a dedicated source file,
a new TIOGAPASS_BMC_HW_STRAP1 macro is added as a copy of
AST2500_EVB_HW_STRAP1.
The change follows the ongoing effort to modularize Aspeed platform
support by splitting each machine definition into its own source file.
This makes aspeed.c cleaner, easier to maintain, and simplifies
future feature additions or refactoring for individual machines.
Key updates include:
- Removed tiogapass_bmc_i2c_init() and its FRU data from aspeed.c
and aspeed_eeprom.c.
- Removed Tiogapass type registration from aspeed_machine_types[].
- Added new source file aspeed_ast2500_tiogapass.c to meson.build.
- Removed unused Tiogapass FRUID declarations from aspeed_eeprom.h.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed_eeprom.h            |  4 --
 hw/arm/aspeed.c                   | 35 ------------
 hw/arm/aspeed_ast2500_tiogapass.c | 89 +++++++++++++++++++++++++++++++
 hw/arm/aspeed_eeprom.c            | 22 --------
 hw/arm/meson.build                |  1 +
 5 files changed, 90 insertions(+), 61 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_tiogapass.c
diff --git a/hw/arm/aspeed_eeprom.h b/hw/arm/aspeed_eeprom.h
index 3ed9bc1d9a..a9ae95940c 100644
--- a/hw/arm/aspeed_eeprom.h
+++ b/hw/arm/aspeed_eeprom.h
@@ -7,10 +7,6 @@
 #ifndef ASPEED_EEPROM_H
 #define ASPEED_EEPROM_H
 
-
-extern const uint8_t tiogapass_bmc_fruid[];
-extern const size_t tiogapass_bmc_fruid_len;
-
 extern const uint8_t fby35_nic_fruid[];
 extern const uint8_t fby35_bb_fruid[];
 extern const uint8_t fby35_bmc_fruid[];
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index dbeb751275..4ac998df4e 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -494,19 +494,6 @@ static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
     i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "ds1338", 0x32);
 }
 
-static void tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
-{
-    AspeedSoCState *soc = bmc->soc;
-
-    at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x54, 128 * KiB);
-    at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 6), 0x54, 128 * KiB,
-                          tiogapass_bmc_fruid, tiogapass_bmc_fruid_len);
-    /* TMP421 */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), "tmp421", 0x1f);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4f);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4e);
-}
-
 void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
 {
     i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
@@ -1423,24 +1410,6 @@ static void aspeed_machine_romulus_class_init(ObjectClass *oc,
     aspeed_machine_class_init_cpus_defaults(mc);
 };
 
-static void aspeed_machine_tiogapass_class_init(ObjectClass *oc,
-                                                const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "Facebook Tiogapass BMC (ARM1176)";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = AST2500_EVB_HW_STRAP1;
-    amc->hw_strap2 = 0;
-    amc->fmc_model = "n25q256a";
-    amc->spi_model = "mx25l25635e";
-    amc->num_cs    = 2;
-    amc->i2c_init  = tiogapass_bmc_i2c_init;
-    mc->default_ram_size       = 1 * GiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-};
-
 static void aspeed_machine_sonorapass_class_init(ObjectClass *oc,
                                                  const void *data)
 {
@@ -1857,10 +1826,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("yosemitev2-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_yosemitev2_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("tiogapass-bmc"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_tiogapass_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("qcom-dc-scm-v1-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_tiogapass.c b/hw/arm/aspeed_ast2500_tiogapass.c
new file mode 100644
index 0000000000..3fd81eb5be
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_tiogapass.c
@@ -0,0 +1,89 @@
+/*
+ * Facebook Tiogapass
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/nvram/eeprom_at24c.h"
+
+/* value: 0xF100C2E6 */
+#define TIOGAPASS_BMC_HW_STRAP1 ((                                        \
+        AST2500_HW_STRAP1_DEFAULTS |                                    \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_HW_STRAP_MAC1_RGMII |                                       \
+        SCU_HW_STRAP_MAC0_RGMII) &                                      \
+        ~SCU_HW_STRAP_2ND_BOOT_WDT)
+
+/* Tiogapass BMC FRU */
+static const uint8_t tiogapass_bmc_fruid[] = {
+    0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
+    0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x4d,
+    0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
+    0x64, 0x75, 0x6c, 0x65, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
+    0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x54, 0x69, 0x6f, 0x67, 0x61,
+    0x20, 0x50, 0x61, 0x73, 0x73, 0x20, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65,
+    0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0xc4, 0x58, 0x58, 0x58, 0x32, 0xcd, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
+    0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
+};
+
+static const size_t tiogapass_bmc_fruid_len = sizeof(tiogapass_bmc_fruid);
+
+static void tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+
+    at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x54, 128 * KiB);
+    at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 6), 0x54, 128 * KiB,
+                          tiogapass_bmc_fruid, tiogapass_bmc_fruid_len);
+    /* TMP421 */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), "tmp421", 0x1f);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4f);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4e);
+}
+
+static void aspeed_machine_tiogapass_class_init(ObjectClass *oc,
+                                                const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "Facebook Tiogapass BMC (ARM1176)";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = TIOGAPASS_BMC_HW_STRAP1;
+    amc->hw_strap2 = 0;
+    amc->fmc_model = "n25q256a";
+    amc->spi_model = "mx25l25635e";
+    amc->num_cs    = 2;
+    amc->i2c_init  = tiogapass_bmc_i2c_init;
+    mc->default_ram_size       = 1 * GiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+};
+
+static const TypeInfo aspeed_ast2500_tiogapass_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("tiogapass-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_tiogapass_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_tiogapass_types)
+
diff --git a/hw/arm/aspeed_eeprom.c b/hw/arm/aspeed_eeprom.c
index 8bbbdec834..f0ced29cf1 100644
--- a/hw/arm/aspeed_eeprom.c
+++ b/hw/arm/aspeed_eeprom.c
@@ -7,27 +7,6 @@
 #include "qemu/osdep.h"
 #include "aspeed_eeprom.h"
 
-/* Tiogapass BMC FRU */
-const uint8_t tiogapass_bmc_fruid[] = {
-    0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
-    0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x4d,
-    0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
-    0x64, 0x75, 0x6c, 0x65, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
-    0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x54, 0x69, 0x6f, 0x67, 0x61,
-    0x20, 0x50, 0x61, 0x73, 0x73, 0x20, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65,
-    0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0xc4, 0x58, 0x58, 0x58, 0x32, 0xcd, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
-    0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
-};
-
 const uint8_t fby35_nic_fruid[] = {
     0x01, 0x00, 0x00, 0x01, 0x0f, 0x20, 0x00, 0xcf, 0x01, 0x0e, 0x19, 0xd7,
     0x5e, 0xcf, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xdd,
@@ -181,7 +160,6 @@ const uint8_t gb200nvl_bmc_fruid[] = {
 
 };
 
-const size_t tiogapass_bmc_fruid_len = sizeof(tiogapass_bmc_fruid);
 const size_t fby35_nic_fruid_len = sizeof(fby35_nic_fruid);
 const size_t fby35_bb_fruid_len = sizeof(fby35_bb_fruid);
 const size_t fby35_bmc_fruid_len = sizeof(fby35_bmc_fruid);
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index a8539ff51e..849534f6ad 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -46,6 +46,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2400.c',
   'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2500_g220a.c',
+  'aspeed_ast2500_tiogapass.c',
   'aspeed_ast2600.c',
   'aspeed_ast10x0.c',
   'aspeed_eeprom.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 08/13] hw/arm/aspeed: Split YosemiteV2 machine into a separate source file for maintainability
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (6 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 07/13] hw/arm/aspeed: Split Tiogapass machine into a separate source file for cleanup Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 09/13] hw/arm/aspeed: Split Witherspoon " Jamin Lin via
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit moves the YosemiteV2 BMC machine implementation from
aspeed.c into a new standalone file aspeed_ast2500_yosemitev2.c.
To support splitting YosemiteV2 into a dedicated source file,
a new YOSEMITEV2_BMC_HW_STRAP1 macro is added as a copy of
AST2500_EVB_HW_STRAP1.
The refactor is part of an ongoing effort to modularize Aspeed
machine definitions by separating each board into its own source
file. This improves code readability, maintainability, and simplifies
future platform-specific changes.
Key updates include:
- Moved yosemitev2_bmc_i2c_init() and its FRU data into a new file.
- Removed aspeed_machine_yosemitev2_class_init() and type registration
from aspeed.c.
- Removed YosemiteV2 FRUID data and declarations from
aspeed_eeprom.c and aspeed_eeprom.h.
- Added aspeed_ast2500_yosemitev2.c to the build system
(meson.build).
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed_eeprom.h             |  3 -
 hw/arm/aspeed.c                    | 36 ------------
 hw/arm/aspeed_ast2500_yosemitev2.c | 90 ++++++++++++++++++++++++++++++
 hw/arm/aspeed_eeprom.c             | 22 --------
 hw/arm/meson.build                 |  1 +
 5 files changed, 91 insertions(+), 61 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_yosemitev2.c
diff --git a/hw/arm/aspeed_eeprom.h b/hw/arm/aspeed_eeprom.h
index a9ae95940c..5448eeeab7 100644
--- a/hw/arm/aspeed_eeprom.h
+++ b/hw/arm/aspeed_eeprom.h
@@ -14,9 +14,6 @@ extern const size_t fby35_nic_fruid_len;
 extern const size_t fby35_bb_fruid_len;
 extern const size_t fby35_bmc_fruid_len;
 
-extern const uint8_t yosemitev2_bmc_fruid[];
-extern const size_t yosemitev2_bmc_fruid_len;
-
 extern const uint8_t rainier_bb_fruid[];
 extern const size_t rainier_bb_fruid_len;
 extern const uint8_t rainier_bmc_fruid[];
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 4ac998df4e..f890d30d0e 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -469,20 +469,6 @@ static void ast2600_evb_i2c_init(AspeedMachineState *bmc)
                      TYPE_TMP105, 0x4d);
 }
 
-static void yosemitev2_bmc_i2c_init(AspeedMachineState *bmc)
-{
-    AspeedSoCState *soc = bmc->soc;
-
-    at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x51, 128 * KiB);
-    at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 128 * KiB,
-                          yosemitev2_bmc_fruid, yosemitev2_bmc_fruid_len);
-    /* TMP421 */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "tmp421", 0x1f);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x4e);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x4f);
-
-}
-
 static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
 {
     AspeedSoCState *soc = bmc->soc;
@@ -1375,24 +1361,6 @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc,
     aspeed_machine_class_init_cpus_defaults(mc);
 };
 
-static void aspeed_machine_yosemitev2_class_init(ObjectClass *oc,
-                                                 const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "Facebook YosemiteV2 BMC (ARM1176)";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = AST2500_EVB_HW_STRAP1;
-    amc->hw_strap2 = 0;
-    amc->fmc_model = "n25q256a";
-    amc->spi_model = "mx25l25635e";
-    amc->num_cs    = 2;
-    amc->i2c_init  = yosemitev2_bmc_i2c_init;
-    mc->default_ram_size       = 512 * MiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-};
-
 static void aspeed_machine_romulus_class_init(ObjectClass *oc,
                                               const void *data)
 {
@@ -1822,10 +1790,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("ast2600-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_ast2600_evb_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("yosemitev2-bmc"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_yosemitev2_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("qcom-dc-scm-v1-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_yosemitev2.c b/hw/arm/aspeed_ast2500_yosemitev2.c
new file mode 100644
index 0000000000..4ec9beb2b7
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_yosemitev2.c
@@ -0,0 +1,90 @@
+/*
+ * Facebook YosemiteV2
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/nvram/eeprom_at24c.h"
+
+/* value: 0xF100C2E6 */
+#define YOSEMITEV2_BMC_HW_STRAP1 ((                                        \
+        AST2500_HW_STRAP1_DEFAULTS |                                    \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_HW_STRAP_MAC1_RGMII |                                       \
+        SCU_HW_STRAP_MAC0_RGMII) &                                      \
+        ~SCU_HW_STRAP_2ND_BOOT_WDT)
+
+/* Yosemite V2 BMC FRU */
+static const uint8_t yosemitev2_bmc_fruid[] = {
+    0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
+    0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x61,
+    0x73, 0x65, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x4d, 0x50, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
+    0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
+    0x69, 0x74, 0x65, 0x20, 0x56, 0x32, 0x20, 0x4d, 0x50, 0x00, 0x00, 0x00,
+    0x00, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
+    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
+    0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
+};
+
+static const size_t yosemitev2_bmc_fruid_len = sizeof(yosemitev2_bmc_fruid);
+
+static void yosemitev2_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+
+    at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x51, 128 * KiB);
+    at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 128 * KiB,
+                          yosemitev2_bmc_fruid, yosemitev2_bmc_fruid_len);
+    /* TMP421 */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "tmp421", 0x1f);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x4e);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x4f);
+
+}
+
+static void aspeed_machine_yosemitev2_class_init(ObjectClass *oc,
+                                                 const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "Facebook YosemiteV2 BMC (ARM1176)";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = YOSEMITEV2_BMC_HW_STRAP1;
+    amc->hw_strap2 = 0;
+    amc->fmc_model = "n25q256a";
+    amc->spi_model = "mx25l25635e";
+    amc->num_cs    = 2;
+    amc->i2c_init  = yosemitev2_bmc_i2c_init;
+    mc->default_ram_size       = 512 * MiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+};
+
+static const TypeInfo aspeed_ast2500_yosemitev2_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("yosemitev2-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_yosemitev2_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_yosemitev2_types)
+
diff --git a/hw/arm/aspeed_eeprom.c b/hw/arm/aspeed_eeprom.c
index f0ced29cf1..124277eaca 100644
--- a/hw/arm/aspeed_eeprom.c
+++ b/hw/arm/aspeed_eeprom.c
@@ -78,27 +78,6 @@ const uint8_t fby35_bmc_fruid[] = {
     0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
 };
 
-/* Yosemite V2 BMC FRU */
-const uint8_t yosemitev2_bmc_fruid[] = {
-    0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
-    0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x61,
-    0x73, 0x65, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x4d, 0x50, 0x00, 0x00,
-    0x00, 0x00, 0x00, 0x00, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
-    0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
-    0x69, 0x74, 0x65, 0x20, 0x56, 0x32, 0x20, 0x4d, 0x50, 0x00, 0x00, 0x00,
-    0x00, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
-    0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
-    0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
-};
-
 const uint8_t rainier_bb_fruid[] = {
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84,
     0x28, 0x00, 0x52, 0x54, 0x04, 0x56, 0x48, 0x44, 0x52, 0x56, 0x44, 0x02,
@@ -163,7 +142,6 @@ const uint8_t gb200nvl_bmc_fruid[] = {
 const size_t fby35_nic_fruid_len = sizeof(fby35_nic_fruid);
 const size_t fby35_bb_fruid_len = sizeof(fby35_bb_fruid);
 const size_t fby35_bmc_fruid_len = sizeof(fby35_bmc_fruid);
-const size_t yosemitev2_bmc_fruid_len = sizeof(yosemitev2_bmc_fruid);
 const size_t rainier_bb_fruid_len = sizeof(rainier_bb_fruid);
 const size_t rainier_bmc_fruid_len = sizeof(rainier_bmc_fruid);
 const size_t gb200nvl_bmc_fruid_len = sizeof(gb200nvl_bmc_fruid);
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index 849534f6ad..d07ebc9dd7 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -47,6 +47,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2500_g220a.c',
   'aspeed_ast2500_tiogapass.c',
+  'aspeed_ast2500_yosemitev2.c',
   'aspeed_ast2600.c',
   'aspeed_ast10x0.c',
   'aspeed_eeprom.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 09/13] hw/arm/aspeed: Split Witherspoon machine into a separate source file for maintainability
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (7 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 08/13] hw/arm/aspeed: Split YosemiteV2 machine into a separate source file for maintainability Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 10/13] hw/arm/aspeed: Split Sonorapass " Jamin Lin via
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit moves the Witherspoon BMC machine implementation out of
aspeed.c and into a new dedicated file aspeed_ast2500_witherspoon.c.
To support splitting Witherspoon into a dedicated source file,
a new WITHERSPOON_BMC_HW_STRAP1 macro is added as a copy of
ROMULUS_BMC_HW_STRAP1.
The change is part of a broader effort to modularize Aspeed board
definitions, allowing each machine type to be maintained and updated
independently. By isolating Witherspoon logic, the aspeed.c file
becomes cleaner and easier to manage as more platforms are added.
Key updates include:
- Moved witherspoon_bmc_i2c_init() and related LED setup code into
aspeed_ast2500_witherspoon.c.
- Added WITHERSPOON_BMC_HW_STRAP1 replacement macro for local use.
- Removed aspeed_machine_witherspoon_class_init() and type
registration from aspeed.c.
- Added the new file to meson.build for compilation.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c                     |  81 --------------------
 hw/arm/aspeed_ast2500_witherspoon.c | 111 ++++++++++++++++++++++++++++
 hw/arm/meson.build                  |   1 +
 3 files changed, 112 insertions(+), 81 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_witherspoon.c
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index f890d30d0e..91d59e0d2d 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -116,9 +116,6 @@ static struct arm_boot_info aspeed_board_binfo = {
         SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) |                       \
         SCU_AST2500_HW_STRAP_RESERVED1)
 
-/* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */
-#define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1
-
 /* Quanta-Q71l hardware value */
 #define QUANTA_Q71L_BMC_HW_STRAP1 (                                     \
         SCU_AST2400_HW_STRAP_DRAM_SIZE(DRAM_SIZE_128MB) |               \
@@ -536,63 +533,6 @@ static void sonorapass_bmc_i2c_init(AspeedMachineState *bmc)
 
 }
 
-static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
-{
-    static const struct {
-        unsigned gpio_id;
-        LEDColor color;
-        const char *description;
-        bool gpio_polarity;
-    } pca1_leds[] = {
-        {13, LED_COLOR_GREEN, "front-fault-4",  GPIO_POLARITY_ACTIVE_LOW},
-        {14, LED_COLOR_GREEN, "front-power-3",  GPIO_POLARITY_ACTIVE_LOW},
-        {15, LED_COLOR_GREEN, "front-id-5",     GPIO_POLARITY_ACTIVE_LOW},
-    };
-    AspeedSoCState *soc = bmc->soc;
-    uint8_t *eeprom_buf = g_malloc0(8 * 1024);
-    DeviceState *dev;
-    LEDState *led;
-
-    /* Bus 3: TODO bmp280@77 */
-    dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60));
-    qdev_prop_set_string(dev, "description", "pca1");
-    i2c_slave_realize_and_unref(I2C_SLAVE(dev),
-                                aspeed_i2c_get_bus(&soc->i2c, 3),
-                                &error_fatal);
-
-    for (size_t i = 0; i < ARRAY_SIZE(pca1_leds); i++) {
-        led = led_create_simple(OBJECT(bmc),
-                                pca1_leds[i].gpio_polarity,
-                                pca1_leds[i].color,
-                                pca1_leds[i].description);
-        qdev_connect_gpio_out(dev, pca1_leds[i].gpio_id,
-                              qdev_get_gpio_in(DEVICE(led), 0));
-    }
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3), "dps310", 0x76);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3), "max31785", 0x52);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 0x4c);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x4c);
-
-    /* The Witherspoon expects a TMP275 but a TMP105 is compatible */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), TYPE_TMP105,
-                     0x4a);
-
-    /*
-     * 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);
-
-    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 11), 0x51,
-                          eeprom_buf);
-    dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60));
-    qdev_prop_set_string(dev, "description", "pca0");
-    i2c_slave_realize_and_unref(I2C_SLAVE(dev),
-                                aspeed_i2c_get_bus(&soc->i2c, 11),
-                                &error_fatal);
-    /* Bus 11: TODO ucd90160@64 */
-}
-
 static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
 {
     AspeedSoCState *soc = bmc->soc;
@@ -1396,23 +1336,6 @@ static void aspeed_machine_sonorapass_class_init(ObjectClass *oc,
     aspeed_machine_class_init_cpus_defaults(mc);
 };
 
-static void aspeed_machine_witherspoon_class_init(ObjectClass *oc,
-                                                  const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "OpenPOWER Witherspoon BMC (ARM1176)";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = WITHERSPOON_BMC_HW_STRAP1;
-    amc->fmc_model = "mx25l25635f";
-    amc->spi_model = "mx66l1g45g";
-    amc->num_cs    = 2;
-    amc->i2c_init  = witherspoon_bmc_i2c_init;
-    mc->default_ram_size = 512 * MiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-};
-
 static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc,
                                                   const void *data)
 {
@@ -1782,10 +1705,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("sonorapass-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_sonorapass_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("witherspoon-bmc"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_witherspoon_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("ast2600-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_witherspoon.c b/hw/arm/aspeed_ast2500_witherspoon.c
new file mode 100644
index 0000000000..249d63a9dd
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_witherspoon.c
@@ -0,0 +1,111 @@
+/*
+ * OpenPOWER Witherspoon
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/misc/led.h"
+#include "hw/sensor/tmp105.h"
+#include "hw/i2c/smbus_eeprom.h"
+#include "hw/gpio/pca9552.h"
+
+/* Witherspoon hardware value: 0xF10AD216 */
+#define WITHERSPOON_BMC_HW_STRAP1 (                                     \
+        AST2500_HW_STRAP1_DEFAULTS |                                    \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_AST2500_HW_STRAP_ACPI_ENABLE |                              \
+        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER))
+
+static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    static const struct {
+        unsigned gpio_id;
+        LEDColor color;
+        const char *description;
+        bool gpio_polarity;
+    } pca1_leds[] = {
+        {13, LED_COLOR_GREEN, "front-fault-4",  GPIO_POLARITY_ACTIVE_LOW},
+        {14, LED_COLOR_GREEN, "front-power-3",  GPIO_POLARITY_ACTIVE_LOW},
+        {15, LED_COLOR_GREEN, "front-id-5",     GPIO_POLARITY_ACTIVE_LOW},
+    };
+    AspeedSoCState *soc = bmc->soc;
+    uint8_t *eeprom_buf = g_malloc0(8 * 1024);
+    DeviceState *dev;
+    LEDState *led;
+
+    /* Bus 3: TODO bmp280@77 */
+    dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60));
+    qdev_prop_set_string(dev, "description", "pca1");
+    i2c_slave_realize_and_unref(I2C_SLAVE(dev),
+                                aspeed_i2c_get_bus(&soc->i2c, 3),
+                                &error_fatal);
+
+    for (size_t i = 0; i < ARRAY_SIZE(pca1_leds); i++) {
+        led = led_create_simple(OBJECT(bmc),
+                                pca1_leds[i].gpio_polarity,
+                                pca1_leds[i].color,
+                                pca1_leds[i].description);
+        qdev_connect_gpio_out(dev, pca1_leds[i].gpio_id,
+                              qdev_get_gpio_in(DEVICE(led), 0));
+    }
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3), "dps310", 0x76);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3), "max31785", 0x52);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 0x4c);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x4c);
+
+    /* The Witherspoon expects a TMP275 but a TMP105 is compatible */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), TYPE_TMP105,
+                     0x4a);
+
+    /*
+     * 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);
+
+    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 11), 0x51,
+                          eeprom_buf);
+    dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60));
+    qdev_prop_set_string(dev, "description", "pca0");
+    i2c_slave_realize_and_unref(I2C_SLAVE(dev),
+                                aspeed_i2c_get_bus(&soc->i2c, 11),
+                                &error_fatal);
+    /* Bus 11: TODO ucd90160@64 */
+}
+
+static void aspeed_machine_witherspoon_class_init(ObjectClass *oc,
+                                                  const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "OpenPOWER Witherspoon BMC (ARM1176)";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = WITHERSPOON_BMC_HW_STRAP1;
+    amc->fmc_model = "mx25l25635f";
+    amc->spi_model = "mx66l1g45g";
+    amc->num_cs    = 2;
+    amc->i2c_init  = witherspoon_bmc_i2c_init;
+    mc->default_ram_size = 512 * MiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+};
+
+static const TypeInfo aspeed_ast2500_witherspoon_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("witherspoon-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_witherspoon_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_witherspoon_types)
+
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index d07ebc9dd7..d3726d1b9d 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -47,6 +47,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2500_g220a.c',
   'aspeed_ast2500_tiogapass.c',
+  'aspeed_ast2500_witherspoon.c',
   'aspeed_ast2500_yosemitev2.c',
   'aspeed_ast2600.c',
   'aspeed_ast10x0.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 10/13] hw/arm/aspeed: Split Sonorapass machine into a separate source file for maintainability
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (8 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 09/13] hw/arm/aspeed: Split Witherspoon " Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 11/13] hw/arm/aspeed: Split Romulus " Jamin Lin via
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit moves the Sonorapass BMC machine implementation out of
aspeed.c and into a new standalone file aspeed_ast2500_sonorapass.c.
The refactor continues the effort to modularize Aspeed platform support
by separating each board’s implementation into its own source file.
This improves maintainability, readability, and simplifies future
updates to individual machine configurations.
Key updates include:
- Moved SONORAPASS_BMC_HW_STRAP1 definition into the new file.
- Moved sonorapass_bmc_i2c_init() and all I²C device initialization
logic from aspeed.c into aspeed_ast2500_sonorapass.c.
- Moved aspeed_machine_sonorapass_class_init() and type registration
into the new file.
- Added the new file to the build system (meson.build).
- Removed all Sonorapass-specific code and definitions from aspeed.c
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c                    |  81 -----------------------
 hw/arm/aspeed_ast2500_sonorapass.c | 101 +++++++++++++++++++++++++++++
 hw/arm/meson.build                 |   1 +
 3 files changed, 102 insertions(+), 81 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_sonorapass.c
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 91d59e0d2d..f01d71db8f 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -101,21 +101,6 @@ static struct arm_boot_info aspeed_board_binfo = {
         SCU_AST2500_HW_STRAP_ACPI_ENABLE |                              \
         SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER))
 
-/* Sonorapass hardware value: 0xF100D216 */
-#define SONORAPASS_BMC_HW_STRAP1 (                                      \
-        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
-        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
-        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
-        SCU_AST2500_HW_STRAP_RESERVED28 |                               \
-        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
-        SCU_HW_STRAP_VGA_CLASS_CODE |                                   \
-        SCU_HW_STRAP_LPC_RESET_PIN |                                    \
-        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER) |                \
-        SCU_AST2500_HW_STRAP_SET_AXI_AHB_RATIO(AXI_AHB_RATIO_2_1) |     \
-        SCU_HW_STRAP_VGA_BIOS_ROM |                                     \
-        SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) |                       \
-        SCU_AST2500_HW_STRAP_RESERVED1)
-
 /* Quanta-Q71l hardware value */
 #define QUANTA_Q71L_BMC_HW_STRAP1 (                                     \
         SCU_AST2400_HW_STRAP_DRAM_SIZE(DRAM_SIZE_128MB) |               \
@@ -489,50 +474,6 @@ I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr)
                             TYPE_PCA9554, addr);
 }
 
-static void sonorapass_bmc_i2c_init(AspeedMachineState *bmc)
-{
-    AspeedSoCState *soc = bmc->soc;
-
-    /* bus 2 : */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), "tmp105", 0x48);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), "tmp105", 0x49);
-    /* bus 2 : pca9546 @ 0x73 */
-
-    /* bus 3 : pca9548 @ 0x70 */
-
-    /* bus 4 : */
-    uint8_t *eeprom4_54 = g_malloc0(8 * 1024);
-    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 4), 0x54,
-                          eeprom4_54);
-    /* PCA9539 @ 0x76, but PCA9552 is compatible */
-    create_pca9552(soc, 4, 0x76);
-    /* PCA9539 @ 0x77, but PCA9552 is compatible */
-    create_pca9552(soc, 4, 0x77);
-
-    /* bus 6 : */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp105", 0x48);
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp105", 0x49);
-    /* bus 6 : pca9546 @ 0x73 */
-
-    /* bus 8 : */
-    uint8_t *eeprom8_56 = g_malloc0(8 * 1024);
-    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 8), 0x56,
-                          eeprom8_56);
-    create_pca9552(soc, 8, 0x60);
-    create_pca9552(soc, 8, 0x61);
-    /* bus 8 : adc128d818 @ 0x1d */
-    /* bus 8 : adc128d818 @ 0x1f */
-
-    /*
-     * bus 13 : pca9548 @ 0x71
-     *      - channel 3:
-     *          - tmm421 @ 0x4c
-     *          - tmp421 @ 0x4e
-     *          - tmp421 @ 0x4f
-     */
-
-}
-
 static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
 {
     AspeedSoCState *soc = bmc->soc;
@@ -1318,24 +1259,6 @@ static void aspeed_machine_romulus_class_init(ObjectClass *oc,
     aspeed_machine_class_init_cpus_defaults(mc);
 };
 
-static void aspeed_machine_sonorapass_class_init(ObjectClass *oc,
-                                                 const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "OCP SonoraPass BMC (ARM1176)";
-    mc->deprecation_reason = "use 'ast2500-evb' instead";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = SONORAPASS_BMC_HW_STRAP1;
-    amc->fmc_model = "mx66l1g45g";
-    amc->spi_model = "mx66l1g45g";
-    amc->num_cs    = 2;
-    amc->i2c_init  = sonorapass_bmc_i2c_init;
-    mc->default_ram_size       = 512 * MiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-};
-
 static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc,
                                                   const void *data)
 {
@@ -1701,10 +1624,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("romulus-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_romulus_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("sonorapass-bmc"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_sonorapass_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("ast2600-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_sonorapass.c b/hw/arm/aspeed_ast2500_sonorapass.c
new file mode 100644
index 0000000000..6c7f2da5cc
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_sonorapass.c
@@ -0,0 +1,101 @@
+/*
+ * OCP SonoraPass
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/i2c/smbus_eeprom.h"
+
+/* Sonorapass hardware value: 0xF100D216 */
+#define SONORAPASS_BMC_HW_STRAP1 (                                      \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_RESERVED28 |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_HW_STRAP_VGA_CLASS_CODE |                                   \
+        SCU_HW_STRAP_LPC_RESET_PIN |                                    \
+        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER) |                \
+        SCU_AST2500_HW_STRAP_SET_AXI_AHB_RATIO(AXI_AHB_RATIO_2_1) |     \
+        SCU_HW_STRAP_VGA_BIOS_ROM |                                     \
+        SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) |                       \
+        SCU_AST2500_HW_STRAP_RESERVED1)
+
+static void sonorapass_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+
+    /* bus 2 : */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), "tmp105", 0x48);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), "tmp105", 0x49);
+    /* bus 2 : pca9546 @ 0x73 */
+
+    /* bus 3 : pca9548 @ 0x70 */
+
+    /* bus 4 : */
+    uint8_t *eeprom4_54 = g_malloc0(8 * 1024);
+    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 4), 0x54,
+                          eeprom4_54);
+    /* PCA9539 @ 0x76, but PCA9552 is compatible */
+    create_pca9552(soc, 4, 0x76);
+    /* PCA9539 @ 0x77, but PCA9552 is compatible */
+    create_pca9552(soc, 4, 0x77);
+
+    /* bus 6 : */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp105", 0x48);
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp105", 0x49);
+    /* bus 6 : pca9546 @ 0x73 */
+
+    /* bus 8 : */
+    uint8_t *eeprom8_56 = g_malloc0(8 * 1024);
+    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 8), 0x56,
+                          eeprom8_56);
+    create_pca9552(soc, 8, 0x60);
+    create_pca9552(soc, 8, 0x61);
+    /* bus 8 : adc128d818 @ 0x1d */
+    /* bus 8 : adc128d818 @ 0x1f */
+
+    /*
+     * bus 13 : pca9548 @ 0x71
+     *      - channel 3:
+     *          - tmm421 @ 0x4c
+     *          - tmp421 @ 0x4e
+     *          - tmp421 @ 0x4f
+     */
+
+}
+
+static void aspeed_machine_sonorapass_class_init(ObjectClass *oc,
+                                                 const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "OCP SonoraPass BMC (ARM1176)";
+    mc->deprecation_reason = "use 'ast2500-evb' instead";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = SONORAPASS_BMC_HW_STRAP1;
+    amc->fmc_model = "mx66l1g45g";
+    amc->spi_model = "mx66l1g45g";
+    amc->num_cs    = 2;
+    amc->i2c_init  = sonorapass_bmc_i2c_init;
+    mc->default_ram_size       = 512 * MiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+};
+
+static const TypeInfo aspeed_ast2500_sonorapass_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("sonorapass-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_sonorapass_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_sonorapass_types)
+
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index d3726d1b9d..94f8a82f17 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -46,6 +46,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2400.c',
   'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2500_g220a.c',
+  'aspeed_ast2500_sonorapass.c',
   'aspeed_ast2500_tiogapass.c',
   'aspeed_ast2500_witherspoon.c',
   'aspeed_ast2500_yosemitev2.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 11/13] hw/arm/aspeed: Split Romulus machine into a separate source file for maintainability
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (9 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 10/13] hw/arm/aspeed: Split Sonorapass " Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 12/13] hw/arm/aspeed: Split Supermicro X11SPI machine into a separate " Jamin Lin via
  2025-10-23 10:01 ` [PATCH v1 13/13] hw/arm/aspeed: Split AST2500 EVB machine into a separate source " Jamin Lin via
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit moves the Romulus BMC machine implementation out of
aspeed.c into a new standalone file aspeed_ast2500_romulus.c.
The refactor continues the modularization of Aspeed platform
definitions, separating each board into its own C source file to
improve maintainability, readability, and reduce code clutter in
aspeed.c.
Key updates include:
- Moved ROMULUS_BMC_HW_STRAP1 definition to the new file.
- Moved romulus_bmc_i2c_init() and related I²C device setup.
- Moved aspeed_machine_romulus_class_init() and type registration
to aspeed_ast2500_romulus.c.
- Added the new file to the build system (meson.build).
- Removed all Romulus-specific code from aspeed.c.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c                 | 42 -----------------------
 hw/arm/aspeed_ast2500_romulus.c | 61 +++++++++++++++++++++++++++++++++
 hw/arm/meson.build              |  1 +
 3 files changed, 62 insertions(+), 42 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_romulus.c
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index f01d71db8f..a97d037acb 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -91,16 +91,6 @@ static struct arm_boot_info aspeed_board_binfo = {
         SCU_HW_STRAP_MAC0_RGMII) &                                      \
         ~SCU_HW_STRAP_2ND_BOOT_WDT)
 
-/* Romulus hardware value: 0xF10AD206 */
-#define ROMULUS_BMC_HW_STRAP1 (                                         \
-        AST2500_HW_STRAP1_DEFAULTS |                                    \
-        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
-        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
-        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
-        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
-        SCU_AST2500_HW_STRAP_ACPI_ENABLE |                              \
-        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER))
-
 /* Quanta-Q71l hardware value */
 #define QUANTA_Q71L_BMC_HW_STRAP1 (                                     \
         SCU_AST2400_HW_STRAP_DRAM_SIZE(DRAM_SIZE_128MB) |               \
@@ -451,17 +441,6 @@ static void ast2600_evb_i2c_init(AspeedMachineState *bmc)
                      TYPE_TMP105, 0x4d);
 }
 
-static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
-{
-    AspeedSoCState *soc = bmc->soc;
-
-    /*
-     * 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);
-}
-
 void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
 {
     i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
@@ -1242,23 +1221,6 @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc,
     aspeed_machine_class_init_cpus_defaults(mc);
 };
 
-static void aspeed_machine_romulus_class_init(ObjectClass *oc,
-                                              const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "OpenPOWER Romulus BMC (ARM1176)";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = ROMULUS_BMC_HW_STRAP1;
-    amc->fmc_model = "n25q256a";
-    amc->spi_model = "mx66l1g45g";
-    amc->num_cs    = 2;
-    amc->i2c_init  = romulus_bmc_i2c_init;
-    mc->default_ram_size       = 512 * MiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-};
-
 static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc,
                                                   const void *data)
 {
@@ -1620,10 +1582,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("ast2500-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_ast2500_evb_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("romulus-bmc"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_romulus_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("ast2600-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_romulus.c b/hw/arm/aspeed_ast2500_romulus.c
new file mode 100644
index 0000000000..6902319e37
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_romulus.c
@@ -0,0 +1,61 @@
+/*
+ * OpenPOWER Romulus
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+
+/* Romulus hardware value: 0xF10AD206 */
+#define ROMULUS_BMC_HW_STRAP1 (                                         \
+        AST2500_HW_STRAP1_DEFAULTS |                                    \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_AST2500_HW_STRAP_ACPI_ENABLE |                              \
+        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER))
+
+static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+
+    /*
+     * 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);
+}
+
+static void aspeed_machine_romulus_class_init(ObjectClass *oc,
+                                              const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "OpenPOWER Romulus BMC (ARM1176)";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = ROMULUS_BMC_HW_STRAP1;
+    amc->fmc_model = "n25q256a";
+    amc->spi_model = "mx66l1g45g";
+    amc->num_cs    = 2;
+    amc->i2c_init  = romulus_bmc_i2c_init;
+    mc->default_ram_size       = 512 * MiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+};
+
+static const TypeInfo aspeed_ast2500_romulus_types[] = {
+     {
+        .name          = MACHINE_TYPE_NAME("romulus-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_romulus_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_romulus_types)
+
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index 94f8a82f17..fdb825fd0e 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -46,6 +46,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2400.c',
   'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2500_g220a.c',
+  'aspeed_ast2500_romulus.c',
   'aspeed_ast2500_sonorapass.c',
   'aspeed_ast2500_tiogapass.c',
   'aspeed_ast2500_witherspoon.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 12/13] hw/arm/aspeed: Split Supermicro X11SPI machine into a separate file for maintainability
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (10 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 11/13] hw/arm/aspeed: Split Romulus " Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:10   ` [SPAM] " Cédric Le Goater
  2025-10-23 10:01 ` [PATCH v1 13/13] hw/arm/aspeed: Split AST2500 EVB machine into a separate source " Jamin Lin via
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit moves the Supermicro X11SPI BMC machine definition from
aspeed.c into a new standalone file aspeed_ast2500_supermicro-x11spi.c,
and adds a dedicated I²C initialization function for the platform.
The refactor continues the effort to modularize Aspeed platform support,
ensuring each machine model is defined in its own source file. This improves
code organization, readability, and simplifies maintenance when adding or
modifying platform-specific behavior.
Previously, the Supermicro X11SPI machine reused
palmetto_bmc_i2c_init() for its I²C setup. To make the machine
definition fully self-contained, the function was copied and renamed
to supermicro_x11spi_bmc_i2c_init(). This ensures that the machine
can evolve independently without depending on Palmetto’s board logi
Key updates include:
- Moved SUPERMICRO_X11SPI_BMC_HW_STRAP1 macro and machine class init
(aspeed_machine_supermicro_x11spi_bmc_class_init) into a new file.
- Added new function supermicro_x11spi_bmc_i2c_init() copied from
palmetto_bmc_i2c_init() for independent control.
- Updated the machine definition to use the new I²C init function.
- Registered the new source file in meson.build.
- Removed all Supermicro X11SPI-related definitions from aspeed.c.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c                           | 32 ----------
 hw/arm/aspeed_ast2500_supermicro-x11spi.c | 76 +++++++++++++++++++++++
 hw/arm/meson.build                        |  1 +
 3 files changed, 77 insertions(+), 32 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_supermicro-x11spi.c
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index a97d037acb..3618f01ea2 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -70,16 +70,6 @@ static struct arm_boot_info aspeed_board_binfo = {
         SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) |                       \
         SCU_AST2400_HW_STRAP_BOOT_MODE(AST2400_SPI_BOOT))
 
-/* TODO: Find the actual hardware value */
-#define SUPERMICRO_X11SPI_BMC_HW_STRAP1 (                               \
-        AST2500_HW_STRAP1_DEFAULTS |                                    \
-        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
-        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
-        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
-        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
-        SCU_HW_STRAP_SPI_WIDTH |                                        \
-        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_M_S_EN))
-
 /* AST2500 evb hardware value: 0xF100C2E6 */
 #define AST2500_EVB_HW_STRAP1 ((                                        \
         AST2500_HW_STRAP1_DEFAULTS |                                    \
@@ -1186,24 +1176,6 @@ static void aspeed_machine_supermicrox11_bmc_class_init(ObjectClass *oc,
     aspeed_machine_class_init_cpus_defaults(mc);
 }
 
-static void aspeed_machine_supermicro_x11spi_bmc_class_init(ObjectClass *oc,
-                                                            const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "Supermicro X11 SPI BMC (ARM1176)";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = SUPERMICRO_X11SPI_BMC_HW_STRAP1;
-    amc->fmc_model = "mx25l25635e";
-    amc->spi_model = "mx25l25635e";
-    amc->num_cs    = 1;
-    amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON;
-    amc->i2c_init  = palmetto_bmc_i2c_init;
-    mc->default_ram_size = 512 * MiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-}
-
 static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc,
                                                   const void *data)
 {
@@ -1574,10 +1546,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("supermicrox11-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_supermicrox11_bmc_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("supermicro-x11spi-bmc"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_supermicro_x11spi_bmc_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("ast2500-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_supermicro-x11spi.c b/hw/arm/aspeed_ast2500_supermicro-x11spi.c
new file mode 100644
index 0000000000..49332463c4
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_supermicro-x11spi.c
@@ -0,0 +1,76 @@
+/*
+ * Supermicro X11 SPI
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/i2c/smbus_eeprom.h"
+
+/* TODO: Find the actual hardware value */
+#define SUPERMICRO_X11SPI_BMC_HW_STRAP1 (                               \
+        AST2500_HW_STRAP1_DEFAULTS |                                    \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_HW_STRAP_SPI_WIDTH |                                        \
+        SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_M_S_EN))
+
+static void supermicro_x11spi_bmc_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+    DeviceState *dev;
+    uint8_t *eeprom_buf = g_malloc0(32 * 1024);
+
+    /*
+     * 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);
+
+    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 0), 0x50,
+                          eeprom_buf);
+
+    /* add a TMP423 temperature sensor */
+    dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2),
+                                         "tmp423", 0x4c));
+    object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
+    object_property_set_int(OBJECT(dev), "temperature3", 110000, &error_abort);
+}
+
+static void aspeed_machine_supermicro_x11spi_bmc_class_init(ObjectClass *oc,
+                                                            const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "Supermicro X11 SPI BMC (ARM1176)";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = SUPERMICRO_X11SPI_BMC_HW_STRAP1;
+    amc->fmc_model = "mx25l25635e";
+    amc->spi_model = "mx25l25635e";
+    amc->num_cs    = 1;
+    amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON;
+    amc->i2c_init  = supermicro_x11spi_bmc_i2c_init;
+    mc->default_ram_size = 512 * MiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+}
+
+static const TypeInfo aspeed_ast2500_supermicro_x11spi_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("supermicro-x11spi-bmc"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_supermicro_x11spi_bmc_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_supermicro_x11spi_types)
+
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index fdb825fd0e..f788baabeb 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -48,6 +48,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2500_g220a.c',
   'aspeed_ast2500_romulus.c',
   'aspeed_ast2500_sonorapass.c',
+  'aspeed_ast2500_supermicro-x11spi.c',
   'aspeed_ast2500_tiogapass.c',
   'aspeed_ast2500_witherspoon.c',
   'aspeed_ast2500_yosemitev2.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* [PATCH v1 13/13] hw/arm/aspeed: Split AST2500 EVB machine into a separate source file for maintainability
  2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
                   ` (11 preceding siblings ...)
  2025-10-23 10:01 ` [PATCH v1 12/13] hw/arm/aspeed: Split Supermicro X11SPI machine into a separate " Jamin Lin via
@ 2025-10-23 10:01 ` Jamin Lin via
  2025-10-29 17:10   ` [SPAM] " Cédric Le Goater
  12 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin via @ 2025-10-23 10:01 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: jamin_lin, troy_lee, kane_chen
This commit moves the AST2500 EVB machine implementation out of
aspeed.c into a new standalone file aspeed_ast2500_evb.c.
This refactor continues the modularization effort for Aspeed platform
support, placing each board’s logic in its own dedicated source file.
It improves maintainability, readability, and simplifies future
development for new platforms without cluttering aspeed.c.
Key updates include:
- Moved AST2500_EVB_HW_STRAP1 macro definition into the new file.
- Moved ast2500_evb_i2c_init() I²C initialization logic.
- Moved aspeed_machine_ast2500_evb_class_init() and type registration.
- Added aspeed_ast2500_evb.c to the build system (meson.build).
- Removed all AST2500 EVB–specific code and macros from aspeed.c.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/arm/aspeed.c             | 45 -------------------------
 hw/arm/aspeed_ast2500_evb.c | 66 +++++++++++++++++++++++++++++++++++++
 hw/arm/meson.build          |  1 +
 3 files changed, 67 insertions(+), 45 deletions(-)
 create mode 100644 hw/arm/aspeed_ast2500_evb.c
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 3618f01ea2..11c74c3e1b 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -70,17 +70,6 @@ static struct arm_boot_info aspeed_board_binfo = {
         SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) |                       \
         SCU_AST2400_HW_STRAP_BOOT_MODE(AST2400_SPI_BOOT))
 
-/* AST2500 evb hardware value: 0xF100C2E6 */
-#define AST2500_EVB_HW_STRAP1 ((                                        \
-        AST2500_HW_STRAP1_DEFAULTS |                                    \
-        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
-        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
-        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
-        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
-        SCU_HW_STRAP_MAC1_RGMII |                                       \
-        SCU_HW_STRAP_MAC0_RGMII) &                                      \
-        ~SCU_HW_STRAP_2ND_BOOT_WDT)
-
 /* Quanta-Q71l hardware value */
 #define QUANTA_Q71L_BMC_HW_STRAP1 (                                     \
         SCU_AST2400_HW_STRAP_DRAM_SIZE(DRAM_SIZE_128MB) |               \
@@ -405,19 +394,6 @@ static void quanta_q71l_bmc_i2c_init(AspeedMachineState *bmc)
     /* TODO: i2c-8: Add BMC FRU eeprom@50 */
 }
 
-static void ast2500_evb_i2c_init(AspeedMachineState *bmc)
-{
-    AspeedSoCState *soc = bmc->soc;
-    uint8_t *eeprom_buf = g_malloc0(8 * 1024);
-
-    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 3), 0x50,
-                          eeprom_buf);
-
-    /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */
-    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7),
-                     TYPE_TMP105, 0x4d);
-}
-
 static void ast2600_evb_i2c_init(AspeedMachineState *bmc)
 {
     AspeedSoCState *soc = bmc->soc;
@@ -1176,23 +1152,6 @@ static void aspeed_machine_supermicrox11_bmc_class_init(ObjectClass *oc,
     aspeed_machine_class_init_cpus_defaults(mc);
 }
 
-static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc,
-                                                  const void *data)
-{
-    MachineClass *mc = MACHINE_CLASS(oc);
-    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-    mc->desc       = "Aspeed AST2500 EVB (ARM1176)";
-    amc->soc_name  = "ast2500-a1";
-    amc->hw_strap1 = AST2500_EVB_HW_STRAP1;
-    amc->fmc_model = "mx25l25635e";
-    amc->spi_model = "mx25l25635f";
-    amc->num_cs    = 1;
-    amc->i2c_init  = ast2500_evb_i2c_init;
-    mc->default_ram_size       = 512 * MiB;
-    aspeed_machine_class_init_cpus_defaults(mc);
-};
-
 static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc,
                                                   const void *data)
 {
@@ -1546,10 +1505,6 @@ static const TypeInfo aspeed_machine_types[] = {
         .name          = MACHINE_TYPE_NAME("supermicrox11-bmc"),
         .parent        = TYPE_ASPEED_MACHINE,
         .class_init    = aspeed_machine_supermicrox11_bmc_class_init,
-    }, {
-        .name          = MACHINE_TYPE_NAME("ast2500-evb"),
-        .parent        = TYPE_ASPEED_MACHINE,
-        .class_init    = aspeed_machine_ast2500_evb_class_init,
     }, {
         .name          = MACHINE_TYPE_NAME("ast2600-evb"),
         .parent        = TYPE_ASPEED_MACHINE,
diff --git a/hw/arm/aspeed_ast2500_evb.c b/hw/arm/aspeed_ast2500_evb.c
new file mode 100644
index 0000000000..4646c73e8e
--- /dev/null
+++ b/hw/arm/aspeed_ast2500_evb.c
@@ -0,0 +1,66 @@
+/*
+ * ASPEED AST2500 EVB
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/arm/aspeed.h"
+#include "hw/arm/aspeed_soc.h"
+#include "hw/i2c/smbus_eeprom.h"
+#include "hw/sensor/tmp105.h"
+
+/* AST2500 evb hardware value: 0xF100C2E6 */
+#define AST2500_EVB_HW_STRAP1 ((                                        \
+        AST2500_HW_STRAP1_DEFAULTS |                                    \
+        SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE |                     \
+        SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE |                        \
+        SCU_AST2500_HW_STRAP_UART_DEBUG |                               \
+        SCU_AST2500_HW_STRAP_DDR4_ENABLE |                              \
+        SCU_HW_STRAP_MAC1_RGMII |                                       \
+        SCU_HW_STRAP_MAC0_RGMII) &                                      \
+        ~SCU_HW_STRAP_2ND_BOOT_WDT)
+
+static void ast2500_evb_i2c_init(AspeedMachineState *bmc)
+{
+    AspeedSoCState *soc = bmc->soc;
+    uint8_t *eeprom_buf = g_malloc0(8 * 1024);
+
+    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 3), 0x50,
+                          eeprom_buf);
+
+    /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */
+    i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7),
+                     TYPE_TMP105, 0x4d);
+}
+
+static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc,
+                                                  const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
+
+    mc->desc       = "Aspeed AST2500 EVB (ARM1176)";
+    amc->soc_name  = "ast2500-a1";
+    amc->hw_strap1 = AST2500_EVB_HW_STRAP1;
+    amc->fmc_model = "mx25l25635e";
+    amc->spi_model = "mx25l25635f";
+    amc->num_cs    = 1;
+    amc->i2c_init  = ast2500_evb_i2c_init;
+    mc->default_ram_size       = 512 * MiB;
+    aspeed_machine_class_init_cpus_defaults(mc);
+};
+
+static const TypeInfo aspeed_ast2500_evb_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("ast2500-evb"),
+        .parent        = TYPE_ASPEED_MACHINE,
+        .class_init    = aspeed_machine_ast2500_evb_class_init,
+    }
+};
+
+DEFINE_TYPES(aspeed_ast2500_evb_types)
+
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index f788baabeb..cbee7ebf60 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -44,6 +44,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed.c',
   'aspeed_soc_common.c',
   'aspeed_ast2400.c',
+  'aspeed_ast2500_evb.c',
   'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2500_g220a.c',
   'aspeed_ast2500_romulus.c',
-- 
2.43.0
^ permalink raw reply related	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 01/13] hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse
  2025-10-23 10:01 ` [PATCH v1 01/13] hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse Jamin Lin via
@ 2025-10-29 17:06   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:06 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> Aspeed machines will be moved into split C files for better
> modularization and future maintenance.
> 
> To allow all machine implementations to reuse the same
> AspeedMachineState structure, the struct definition is moved
> from aspeed.c to the shared header aspeed.h.
> 
> This change centralizes the common state structure used across
> all Aspeed machine models, reduces redundancy, and simplifies
> future refactoring work for new machines.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   include/hw/arm/aspeed.h | 14 ++++++++++++++
>   hw/arm/aspeed.c         | 14 --------------
>   2 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
> index 6c36455656..383ebb9759 100644
> --- a/include/hw/arm/aspeed.h
> +++ b/include/hw/arm/aspeed.h
> @@ -11,6 +11,7 @@
>   
>   #include "hw/boards.h"
>   #include "qom/object.h"
> +#include "hw/arm/aspeed_soc.h"
>   
>   typedef struct AspeedMachineState AspeedMachineState;
>   
> @@ -24,6 +25,19 @@ DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass,
>   #define ASPEED_MAC2_ON   (1 << 2)
>   #define ASPEED_MAC3_ON   (1 << 3)
>   
> +struct AspeedMachineState {
> +    /* Private */
> +    MachineState parent_obj;
> +    /* Public */
> +
> +    AspeedSoCState *soc;
> +    MemoryRegion boot_rom;
> +    bool mmio_exec;
> +    uint32_t uart_chosen;
> +    char *fmc_model;
> +    char *spi_model;
> +    uint32_t hw_strap1;
> +};
>   
>   struct AspeedMachineClass {
>       MachineClass parent_obj;
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 1bc9e534ba..761b526994 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -35,20 +35,6 @@ static struct arm_boot_info aspeed_board_binfo = {
>       .board_id = -1, /* device-tree-only board */
>   };
>   
> -struct AspeedMachineState {
> -    /* Private */
> -    MachineState parent_obj;
> -    /* Public */
You could drop the 'Private' and 'Public' comments.
Anyhow,
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
   > -
> -    AspeedSoCState *soc;
> -    MemoryRegion boot_rom;
> -    bool mmio_exec;
> -    uint32_t uart_chosen;
> -    char *fmc_model;
> -    char *spi_model;
> -    uint32_t hw_strap1;
> -};
> -
>   /* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */
>   #if HOST_LONG_BITS == 32
>   #define ASPEED_RAM_SIZE(sz) MIN((sz), 1 * GiB)
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 02/13] hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally accessible
  2025-10-23 10:01 ` [PATCH v1 02/13] hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally accessible Jamin Lin via
@ 2025-10-29 17:08   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:08 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> The function aspeed_machine_class_init_cpus_defaults() is now made
> globally visible so that it can be used by other Aspeed machine C files.
> 
> Previously, this function was declared as static, restricting its
> visibility to aspeed.c. Since future machine split files will also
> need to call this helper to initialize default CPU settings, its
> declaration has been moved to the common header aspeed.h and the
> static keyword has been removed.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   include/hw/arm/aspeed.h | 1 +
>   hw/arm/aspeed.c         | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
> index 383ebb9759..7743ad2fb0 100644
> --- a/include/hw/arm/aspeed.h
> +++ b/include/hw/arm/aspeed.h
> @@ -59,5 +59,6 @@ struct AspeedMachineClass {
>       bool vbootrom;
>   };
>   
> +void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
>   
>   #endif
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 761b526994..5da21a4d6a 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -1338,7 +1338,7 @@ static void aspeed_machine_class_props_init(ObjectClass *oc)
>                                             "Change the SPI Flash model");
>   }
>   
> -static void aspeed_machine_class_init_cpus_defaults(MachineClass *mc)
> +void aspeed_machine_class_init_cpus_defaults(MachineClass *mc)
>   {
>       AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(mc);
>       AspeedSoCClass *sc = ASPEED_SOC_CLASS(object_class_by_name(amc->soc_name));
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse
  2025-10-23 10:01 ` [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse Jamin Lin via
@ 2025-10-29 17:08   ` Cédric Le Goater
  2025-10-31  6:45     ` Jamin Lin
  0 siblings, 1 reply; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:08 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> The helper function create_pca9552() is now made globally visible
> so it can be reused by different Aspeed machine source files.
> 
> Previously, the function was declared static, limiting its scope
> to aspeed.c. Since multiple Aspeed machine implementations will
> require I²C device initialization using PCA9552 GPIO expanders,
> this function has been promoted to global visibility.
> 
> This change improves code sharing and reduces duplication across
> machine-specific initialization files.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   include/hw/arm/aspeed.h | 1 +
>   hw/arm/aspeed.c         | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
> index 7743ad2fb0..d4d63996a6 100644
> --- a/include/hw/arm/aspeed.h
> +++ b/include/hw/arm/aspeed.h
> @@ -60,5 +60,6 @@ struct AspeedMachineClass {
>   };
>   
>   void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
> +void create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
Please add an 'aspeed_' prefix. We should start documenting the
aspeed routines too.
Thanks,
C.
   
   >
>   #endif
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 5da21a4d6a..2695f0c11b 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -536,7 +536,7 @@ static void tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
>       i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4e);
>   }
>   
> -static void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
> +void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
>   {
>       i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
>                               TYPE_PCA9552, addr);
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 04/13] hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed machines
  2025-10-23 10:01 ` [PATCH v1 04/13] hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed machines Jamin Lin via
@ 2025-10-29 17:09   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:09 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> The function create_pca9554() is now made globally accessible so that
> it can be reused by different Aspeed machine source files.
> 
> Originally, this helper was declared static inside aspeed.c,
> restricting its visibility. As future Aspeed machine implementations
> will also require PCA9554 I²C device setup, the function has been
> exported by removing the static keyword and adding its prototype
> to aspeed.h.
> 
> This change promotes better code reuse and consistency across
> machine initialization code.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   include/hw/arm/aspeed.h | 1 +
>   hw/arm/aspeed.c         | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
> index d4d63996a6..fbe684d505 100644
> --- a/include/hw/arm/aspeed.h
> +++ b/include/hw/arm/aspeed.h
> @@ -61,5 +61,6 @@ struct AspeedMachineClass {
>   
>   void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
>   void create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
> +I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr);
Please add an 'aspeed_' prefix.
Thanks,
C.
>   
>   #endif
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 2695f0c11b..8a22696da9 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -542,7 +542,7 @@ void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
>                               TYPE_PCA9552, addr);
>   }
>   
> -static I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr)
> +I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr)
>   {
>       return i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
>                               TYPE_PCA9554, addr);
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 05/13] hw/arm/aspeed: Split FP5280G2 machine into a separate source file for maintenance
  2025-10-23 10:01 ` [PATCH v1 05/13] hw/arm/aspeed: Split FP5280G2 machine into a separate source file for maintenance Jamin Lin via
@ 2025-10-29 17:09   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:09 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit moves the FP5280G2 BMC machine implementation from
> aspeed.c into a new standalone file aspeed_ast2500_fp5280g2.c.
> 
> The change improves code organization and prepares the Aspeed
> machine framework for future expansion and easier maintenance.
> 
> Key updates include:
> - Moved fp5280g2_bmc_i2c_init() and related machine class init
> functions into aspeed_ast2500_fp5280g2.c.
> - Added new file to hw/arm/meson.build for compilation.
> - Removed obsolete FP5280G2 definitions from aspeed.c
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed.c                  | 65 ------------------------
>   hw/arm/aspeed_ast2500_fp5280g2.c | 87 ++++++++++++++++++++++++++++++++
>   hw/arm/meson.build               |  1 +
>   3 files changed, 88 insertions(+), 65 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_fp5280g2.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 06/13] hw/arm/aspeed: Split G220A machine into a separate source file for better maintenance
  2025-10-23 10:01 ` [PATCH v1 06/13] hw/arm/aspeed: Split G220A machine into a separate source file for better maintenance Jamin Lin via
@ 2025-10-29 17:09   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:09 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit refactors the Bytedance G220A BMC machine by moving its
> implementation from aspeed.c into a new dedicated file
> aspeed_ast2500_g220a.c.
> 
> The goal is to improve modularity and maintainability of Aspeed
> machine definitions by isolating each platform into its own source
> file. This aligns with ongoing efforts to simplify aspeed.c,
> which previously contained all machine configurations.
> 
> Key updates include:
> 
> - Moved G220A_BMC_HW_STRAP1 definition and
> g220a_bmc_i2c_init() function into aspeed_ast2500_g220a.c.
> - Moved aspeed_machine_g220a_class_init() and related type
> registration to the new file.
> - Added the new file to the build system (meson.build).
> - Removed all G220A-specific code from aspeed.c.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed.c               | 71 ---------------------------
>   hw/arm/aspeed_ast2500_g220a.c | 91 +++++++++++++++++++++++++++++++++++
>   hw/arm/meson.build            |  1 +
>   3 files changed, 92 insertions(+), 71 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_g220a.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 07/13] hw/arm/aspeed: Split Tiogapass machine into a separate source file for cleanup
  2025-10-23 10:01 ` [PATCH v1 07/13] hw/arm/aspeed: Split Tiogapass machine into a separate source file for cleanup Jamin Lin via
@ 2025-10-29 17:09   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:09 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit moves the Tiogapass BMC machine implementation out of
> aspeed.c into a new dedicated file aspeed_ast2500_tiogapass.c.
> 
> To support splitting Tiogapass into a dedicated source file,
> a new TIOGAPASS_BMC_HW_STRAP1 macro is added as a copy of
> AST2500_EVB_HW_STRAP1.
> 
> The change follows the ongoing effort to modularize Aspeed platform
> support by splitting each machine definition into its own source file.
> This makes aspeed.c cleaner, easier to maintain, and simplifies
> future feature additions or refactoring for individual machines.
> 
> Key updates include:
> - Removed tiogapass_bmc_i2c_init() and its FRU data from aspeed.c
> and aspeed_eeprom.c.
> - Removed Tiogapass type registration from aspeed_machine_types[].
> - Added new source file aspeed_ast2500_tiogapass.c to meson.build.
> - Removed unused Tiogapass FRUID declarations from aspeed_eeprom.h.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed_eeprom.h            |  4 --
>   hw/arm/aspeed.c                   | 35 ------------
>   hw/arm/aspeed_ast2500_tiogapass.c | 89 +++++++++++++++++++++++++++++++
>   hw/arm/aspeed_eeprom.c            | 22 --------
>   hw/arm/meson.build                |  1 +
>   5 files changed, 90 insertions(+), 61 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_tiogapass.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 08/13] hw/arm/aspeed: Split YosemiteV2 machine into a separate source file for maintainability
  2025-10-23 10:01 ` [PATCH v1 08/13] hw/arm/aspeed: Split YosemiteV2 machine into a separate source file for maintainability Jamin Lin via
@ 2025-10-29 17:09   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:09 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit moves the YosemiteV2 BMC machine implementation from
> aspeed.c into a new standalone file aspeed_ast2500_yosemitev2.c.
> 
> To support splitting YosemiteV2 into a dedicated source file,
> a new YOSEMITEV2_BMC_HW_STRAP1 macro is added as a copy of
> AST2500_EVB_HW_STRAP1.
> 
> The refactor is part of an ongoing effort to modularize Aspeed
> machine definitions by separating each board into its own source
> file. This improves code readability, maintainability, and simplifies
> future platform-specific changes.
> 
> Key updates include:
> 
> - Moved yosemitev2_bmc_i2c_init() and its FRU data into a new file.
> - Removed aspeed_machine_yosemitev2_class_init() and type registration
> from aspeed.c.
> - Removed YosemiteV2 FRUID data and declarations from
> aspeed_eeprom.c and aspeed_eeprom.h.
> - Added aspeed_ast2500_yosemitev2.c to the build system
> (meson.build).
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed_eeprom.h             |  3 -
>   hw/arm/aspeed.c                    | 36 ------------
>   hw/arm/aspeed_ast2500_yosemitev2.c | 90 ++++++++++++++++++++++++++++++
>   hw/arm/aspeed_eeprom.c             | 22 --------
>   hw/arm/meson.build                 |  1 +
>   5 files changed, 91 insertions(+), 61 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_yosemitev2.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 09/13] hw/arm/aspeed: Split Witherspoon machine into a separate source file for maintainability
  2025-10-23 10:01 ` [PATCH v1 09/13] hw/arm/aspeed: Split Witherspoon " Jamin Lin via
@ 2025-10-29 17:09   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:09 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit moves the Witherspoon BMC machine implementation out of
> aspeed.c and into a new dedicated file aspeed_ast2500_witherspoon.c.
> 
> To support splitting Witherspoon into a dedicated source file,
> a new WITHERSPOON_BMC_HW_STRAP1 macro is added as a copy of
> ROMULUS_BMC_HW_STRAP1.
> 
> The change is part of a broader effort to modularize Aspeed board
> definitions, allowing each machine type to be maintained and updated
> independently. By isolating Witherspoon logic, the aspeed.c file
> becomes cleaner and easier to manage as more platforms are added.
> 
> Key updates include:
> 
> - Moved witherspoon_bmc_i2c_init() and related LED setup code into
> aspeed_ast2500_witherspoon.c.
> - Added WITHERSPOON_BMC_HW_STRAP1 replacement macro for local use.
> - Removed aspeed_machine_witherspoon_class_init() and type
> registration from aspeed.c.
> - Added the new file to meson.build for compilation.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed.c                     |  81 --------------------
>   hw/arm/aspeed_ast2500_witherspoon.c | 111 ++++++++++++++++++++++++++++
>   hw/arm/meson.build                  |   1 +
>   3 files changed, 112 insertions(+), 81 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_witherspoon.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 10/13] hw/arm/aspeed: Split Sonorapass machine into a separate source file for maintainability
  2025-10-23 10:01 ` [PATCH v1 10/13] hw/arm/aspeed: Split Sonorapass " Jamin Lin via
@ 2025-10-29 17:09   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:09 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit moves the Sonorapass BMC machine implementation out of
> aspeed.c and into a new standalone file aspeed_ast2500_sonorapass.c.
> 
> The refactor continues the effort to modularize Aspeed platform support
> by separating each board’s implementation into its own source file.
> This improves maintainability, readability, and simplifies future
> updates to individual machine configurations.
> 
> Key updates include:
> - Moved SONORAPASS_BMC_HW_STRAP1 definition into the new file.
> - Moved sonorapass_bmc_i2c_init() and all I²C device initialization
> logic from aspeed.c into aspeed_ast2500_sonorapass.c.
> - Moved aspeed_machine_sonorapass_class_init() and type registration
> into the new file.
> - Added the new file to the build system (meson.build).
> - Removed all Sonorapass-specific code and definitions from aspeed.c
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed.c                    |  81 -----------------------
>   hw/arm/aspeed_ast2500_sonorapass.c | 101 +++++++++++++++++++++++++++++
>   hw/arm/meson.build                 |   1 +
>   3 files changed, 102 insertions(+), 81 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_sonorapass.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 11/13] hw/arm/aspeed: Split Romulus machine into a separate source file for maintainability
  2025-10-23 10:01 ` [PATCH v1 11/13] hw/arm/aspeed: Split Romulus " Jamin Lin via
@ 2025-10-29 17:09   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:09 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit moves the Romulus BMC machine implementation out of
> aspeed.c into a new standalone file aspeed_ast2500_romulus.c.
> 
> The refactor continues the modularization of Aspeed platform
> definitions, separating each board into its own C source file to
> improve maintainability, readability, and reduce code clutter in
> aspeed.c.
> 
> Key updates include:
> - Moved ROMULUS_BMC_HW_STRAP1 definition to the new file.
> - Moved romulus_bmc_i2c_init() and related I²C device setup.
> - Moved aspeed_machine_romulus_class_init() and type registration
> to aspeed_ast2500_romulus.c.
> - Added the new file to the build system (meson.build).
> - Removed all Romulus-specific code from aspeed.c.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed.c                 | 42 -----------------------
>   hw/arm/aspeed_ast2500_romulus.c | 61 +++++++++++++++++++++++++++++++++
>   hw/arm/meson.build              |  1 +
>   3 files changed, 62 insertions(+), 42 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_romulus.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 12/13] hw/arm/aspeed: Split Supermicro X11SPI machine into a separate file for maintainability
  2025-10-23 10:01 ` [PATCH v1 12/13] hw/arm/aspeed: Split Supermicro X11SPI machine into a separate " Jamin Lin via
@ 2025-10-29 17:10   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:10 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit moves the Supermicro X11SPI BMC machine definition from
> aspeed.c into a new standalone file aspeed_ast2500_supermicro-x11spi.c,
> and adds a dedicated I²C initialization function for the platform.
> 
> The refactor continues the effort to modularize Aspeed platform support,
> ensuring each machine model is defined in its own source file. This improves
> code organization, readability, and simplifies maintenance when adding or
> modifying platform-specific behavior.
> 
> Previously, the Supermicro X11SPI machine reused
> palmetto_bmc_i2c_init() for its I²C setup. To make the machine
> definition fully self-contained, the function was copied and renamed
> to supermicro_x11spi_bmc_i2c_init(). This ensures that the machine
> can evolve independently without depending on Palmetto’s board logi
> 
> Key updates include:
> - Moved SUPERMICRO_X11SPI_BMC_HW_STRAP1 macro and machine class init
> (aspeed_machine_supermicro_x11spi_bmc_class_init) into a new file.
> - Added new function supermicro_x11spi_bmc_i2c_init() copied from
> palmetto_bmc_i2c_init() for independent control.
> - Updated the machine definition to use the new I²C init function.
> - Registered the new source file in meson.build.
> - Removed all Supermicro X11SPI-related definitions from aspeed.c.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed.c                           | 32 ----------
>   hw/arm/aspeed_ast2500_supermicro-x11spi.c | 76 +++++++++++++++++++++++
>   hw/arm/meson.build                        |  1 +
>   3 files changed, 77 insertions(+), 32 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_supermicro-x11spi.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 13/13] hw/arm/aspeed: Split AST2500 EVB machine into a separate source file for maintainability
  2025-10-23 10:01 ` [PATCH v1 13/13] hw/arm/aspeed: Split AST2500 EVB machine into a separate source " Jamin Lin via
@ 2025-10-29 17:10   ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-29 17:10 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: troy_lee, kane_chen
On 10/23/25 12:01, Jamin Lin wrote:
> This commit moves the AST2500 EVB machine implementation out of
> aspeed.c into a new standalone file aspeed_ast2500_evb.c.
> 
> This refactor continues the modularization effort for Aspeed platform
> support, placing each board’s logic in its own dedicated source file.
> It improves maintainability, readability, and simplifies future
> development for new platforms without cluttering aspeed.c.
> 
> Key updates include:
> 
> - Moved AST2500_EVB_HW_STRAP1 macro definition into the new file.
> - Moved ast2500_evb_i2c_init() I²C initialization logic.
> - Moved aspeed_machine_ast2500_evb_class_init() and type registration.
> - Added aspeed_ast2500_evb.c to the build system (meson.build).
> - Removed all AST2500 EVB–specific code and macros from aspeed.c.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/arm/aspeed.c             | 45 -------------------------
>   hw/arm/aspeed_ast2500_evb.c | 66 +++++++++++++++++++++++++++++++++++++
>   hw/arm/meson.build          |  1 +
>   3 files changed, 67 insertions(+), 45 deletions(-)
>   create mode 100644 hw/arm/aspeed_ast2500_evb.c
> 
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
* RE: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse
  2025-10-29 17:08   ` [SPAM] " Cédric Le Goater
@ 2025-10-31  6:45     ` Jamin Lin
  2025-10-31  6:59       ` Cédric Le Goater
  0 siblings, 1 reply; 29+ messages in thread
From: Jamin Lin @ 2025-10-31  6:45 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Steven Lee, Troy Lee,
	Andrew Jeffery, Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: Troy Lee, Kane Chen
Hi Cédric
> Subject: Re: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552()
> globally accessible for reuse
> 
> On 10/23/25 12:01, Jamin Lin wrote:
> > The helper function create_pca9552() is now made globally visible so
> > it can be reused by different Aspeed machine source files.
> >
> > Previously, the function was declared static, limiting its scope to
> > aspeed.c. Since multiple Aspeed machine implementations will require
> > I²C device initialization using PCA9552 GPIO expanders, this function
> > has been promoted to global visibility.
> >
> > This change improves code sharing and reduces duplication across
> > machine-specific initialization files.
> >
> > No functional changes.
> >
> > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> > ---
> >   include/hw/arm/aspeed.h | 1 +
> >   hw/arm/aspeed.c         | 2 +-
> >   2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index
> > 7743ad2fb0..d4d63996a6 100644
> > --- a/include/hw/arm/aspeed.h
> > +++ b/include/hw/arm/aspeed.h
> > @@ -60,5 +60,6 @@ struct AspeedMachineClass {
> >   };
> >
> >   void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
> > +void create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
> 
> 
> Please add an 'aspeed_' prefix. We should start documenting the aspeed
> routines too.
> 
I will add the aspeed_ prefix to the common APIs.
Regarding the documentation of the Aspeed routines - do you mean adding usage descriptions
at the beginning of each function, or could you please advise where you’d like these to be added?
Thanks,
Jamin
> 
> Thanks,
> 
> C.
> 
> 
> 
>    >
> >   #endif
> > diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index
> > 5da21a4d6a..2695f0c11b 100644
> > --- a/hw/arm/aspeed.c
> > +++ b/hw/arm/aspeed.c
> > @@ -536,7 +536,7 @@ static void
> tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
> >       i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6),
> "tmp421", 0x4e);
> >   }
> >
> > -static void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
> > +void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
> >   {
> >       i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
> >                               TYPE_PCA9552, addr);
> 
^ permalink raw reply	[flat|nested] 29+ messages in thread
* Re: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse
  2025-10-31  6:45     ` Jamin Lin
@ 2025-10-31  6:59       ` Cédric Le Goater
  0 siblings, 0 replies; 29+ messages in thread
From: Cédric Le Goater @ 2025-10-31  6:59 UTC (permalink / raw)
  To: Jamin Lin, Peter Maydell, Steven Lee, Troy Lee, Andrew Jeffery,
	Joel Stanley, open list:ASPEED BMCs,
	open list:All patches CC here
  Cc: Troy Lee, Kane Chen
On 10/31/25 07:45, Jamin Lin wrote:
> Hi Cédric
> 
>> Subject: Re: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552()
>> globally accessible for reuse
>>
>> On 10/23/25 12:01, Jamin Lin wrote:
>>> The helper function create_pca9552() is now made globally visible so
>>> it can be reused by different Aspeed machine source files.
>>>
>>> Previously, the function was declared static, limiting its scope to
>>> aspeed.c. Since multiple Aspeed machine implementations will require
>>> I²C device initialization using PCA9552 GPIO expanders, this function
>>> has been promoted to global visibility.
>>>
>>> This change improves code sharing and reduces duplication across
>>> machine-specific initialization files.
>>>
>>> No functional changes.
>>>
>>> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
>>> ---
>>>    include/hw/arm/aspeed.h | 1 +
>>>    hw/arm/aspeed.c         | 2 +-
>>>    2 files changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index
>>> 7743ad2fb0..d4d63996a6 100644
>>> --- a/include/hw/arm/aspeed.h
>>> +++ b/include/hw/arm/aspeed.h
>>> @@ -60,5 +60,6 @@ struct AspeedMachineClass {
>>>    };
>>>
>>>    void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
>>> +void create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
>>
>>
>> Please add an 'aspeed_' prefix. We should start documenting the aspeed
>> routines too.
>>
> I will add the aspeed_ prefix to the common APIs.
> Regarding the documentation of the Aspeed routines - do you mean adding usage descriptions
> at the beginning of each function, or could you please advise where you’d like these to be added?
yes. include/system/memory.h has good examples.
Thanks,
C.
^ permalink raw reply	[flat|nested] 29+ messages in thread
end of thread, other threads:[~2025-10-31  7:01 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 10:01 [PATCH v1 00/13] Split AST2500 SoC machines into separate source files for maintainability Jamin Lin via
2025-10-23 10:01 ` [PATCH v1 01/13] hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse Jamin Lin via
2025-10-29 17:06   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 02/13] hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally accessible Jamin Lin via
2025-10-29 17:08   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse Jamin Lin via
2025-10-29 17:08   ` [SPAM] " Cédric Le Goater
2025-10-31  6:45     ` Jamin Lin
2025-10-31  6:59       ` Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 04/13] hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed machines Jamin Lin via
2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 05/13] hw/arm/aspeed: Split FP5280G2 machine into a separate source file for maintenance Jamin Lin via
2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 06/13] hw/arm/aspeed: Split G220A machine into a separate source file for better maintenance Jamin Lin via
2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 07/13] hw/arm/aspeed: Split Tiogapass machine into a separate source file for cleanup Jamin Lin via
2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 08/13] hw/arm/aspeed: Split YosemiteV2 machine into a separate source file for maintainability Jamin Lin via
2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 09/13] hw/arm/aspeed: Split Witherspoon " Jamin Lin via
2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 10/13] hw/arm/aspeed: Split Sonorapass " Jamin Lin via
2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 11/13] hw/arm/aspeed: Split Romulus " Jamin Lin via
2025-10-29 17:09   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 12/13] hw/arm/aspeed: Split Supermicro X11SPI machine into a separate " Jamin Lin via
2025-10-29 17:10   ` [SPAM] " Cédric Le Goater
2025-10-23 10:01 ` [PATCH v1 13/13] hw/arm/aspeed: Split AST2500 EVB machine into a separate source " Jamin Lin via
2025-10-29 17:10   ` [SPAM] " Cédric Le Goater
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).