Skip to contentSkip to conversation

Split AST2500 SoC machines into separate source files for maintainability

PATCH In review Jamin Lin via 3 participants 29 messages Oct 23, 2025 – Oct 31, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Split AST2500 SoC machines into separate source files for maintainability

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
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/13 hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse

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.

---
 include/hw/arm/aspeed.h | 14 ++++++++++++++
 hw/arm/aspeed.c         | 14 --------------
 2 files changed, 14 insertions(+), 14 deletions(-)
include/hw/arm/aspeed.h +14 -0
index 6c36455656..383ebb9759 100644
@@ -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;
hw/arm/aspeed.c +0 -14
index 1bc9e534ba..761b526994 100644
@@ -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)
Signature · 1 line
2.43.0
Reviewed-by on v1 1/13
#2 lore raw

Re: [SPAM] [PATCH v1 01/13] hw/arm/aspeed: Move AspeedMachineState definition to common header for reuse

Quoted 56 lines · Jamin Lin

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.

---
  include/hw/arm/aspeed.h | 14 ++++++++++++++
  hw/arm/aspeed.c         | 14 --------------
  2 files changed, 14 insertions(+), 14 deletions(-)
include/hw/arm/aspeed.h +14 -0
index 6c36455656..383ebb9759 100644
@@ -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;
hw/arm/aspeed.c +0 -0
index 1bc9e534ba..761b526994 100644

hw/arm/aspeed.c static struct arm_boot_info aspeed_board_binfo = { · line 41

Quoted 7 lines
hw/arm/aspeed.c +0 -4
@@ -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,

Thanks,

C.

Quoted 13 lines
hw/arm/aspeed.c +0 -10
-
-    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)
#3 lore raw

PATCH 2/13 hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally accessible

In reply to Jamin Lin via

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.

---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/arm/aspeed.h +1 -0
index 383ebb9759..7743ad2fb0 100644
@@ -59,5 +59,6 @@ struct AspeedMachineClass {
     bool vbootrom;
 };
 
+void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
 
 #endif
hw/arm/aspeed.c +1 -1
index 761b526994..5da21a4d6a 100644
@@ -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));
Signature · 1 line
2.43.0
Reviewed-by on v1 2/13
#4 lore raw

Re: [SPAM] [PATCH v1 02/13] hw/arm/aspeed: Make aspeed_machine_class_init_cpus_defaults() globally accessible

Quoted 33 lines · Jamin Lin

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.

---
  include/hw/arm/aspeed.h | 1 +
  hw/arm/aspeed.c         | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/arm/aspeed.h +1 -0
index 383ebb9759..7743ad2fb0 100644
@@ -59,5 +59,6 @@ struct AspeedMachineClass {
      bool vbootrom;
  };
 
+void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
 
  #endif
hw/arm/aspeed.c +0 -0
index 761b526994..5da21a4d6a 100644

hw/arm/aspeed.c static void aspeed_machine_class_props_init(ObjectClass *oc) · line 1344

Quoted 8 lines
hw/arm/aspeed.c +1 -1
@@ -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));

Thanks,

C.

#5 lore raw

PATCH 3/13 hw/arm/aspeed: Make create_pca9552() globally accessible for reuse

In reply to Jamin Lin via

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.

---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/arm/aspeed.h +1 -0
index 7743ad2fb0..d4d63996a6 100644
@@ -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
hw/arm/aspeed.c +1 -1
index 5da21a4d6a..2695f0c11b 100644
@@ -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);
Signature · 1 line
2.43.0
#6 lore raw

Re: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse

Quoted 24 lines · Jamin Lin

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.

---
  include/hw/arm/aspeed.h | 1 +
  hw/arm/aspeed.c         | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/arm/aspeed.h +0 -0
index 7743ad2fb0..d4d63996a6 100644

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 63

Quoted 4 lines
include/hw/arm/aspeed.h +1 -0
@@ -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.

Quoted 15 lines
include/hw/arm/aspeed.h +0 -0
  #endif
hw/arm/aspeed.c +1 -1
index 5da21a4d6a..2695f0c11b 100644
@@ -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);
#7 lore raw

RE: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse

Hi Cédric

Quoted 30 lines

Subject: Re: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse

Quoted 26 lines · Jamin Lin

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.

---
  include/hw/arm/aspeed.h | 1 +
  hw/arm/aspeed.c         | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/arm/aspeed.h index renamed from include/hw/arm/aspeed.h +0 -0

7743ad2fb0..d4d63996a6 100644

include/hw/arm/aspeed.h +0 -0
@@ -60,5 +60,6 @@ struct AspeedMachineClass {
  };
 
Quoted 7 lines

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 63

Quoted 2 lines
include/hw/arm/aspeed.h +1 -0
  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

Quoted 25 lines

Thanks,

C.

hw/arm/aspeed.c static void

Quoted 7 lines
include/hw/arm/aspeed.h +0 -0
  #endif
hw/arm/aspeed.c index renamed from hw/arm/aspeed.c +0 -0

5da21a4d6a..2695f0c11b 100644

hw/arm/aspeed.c +0 -0
@@ -536,7 +536,7 @@ static void

tiogapass_bmc_i2c_init(AspeedMachineState *bmc)

hw/arm/aspeed.c static void · line 536

Quoted 1 line
hw/arm/aspeed.c +0 -0
      i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6),

"tmp421", 0x4e);

Quoted 7 lines
hw/arm/aspeed.c +1 -1
  }
 
-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);
#8 lore raw

Re: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse

Quoted 39 lines · Jamin Lin

Hi Cédric

Quoted 30 lines

Subject: Re: [SPAM] [PATCH v1 03/13] hw/arm/aspeed: Make create_pca9552() globally accessible for reuse

Quoted 26 lines · Jamin Lin

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.

---
   include/hw/arm/aspeed.h | 1 +
   hw/arm/aspeed.c         | 2 +-
   2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/arm/aspeed.h index renamed from include/hw/arm/aspeed.h +0 -0

7743ad2fb0..d4d63996a6 100644

include/hw/arm/aspeed.h +0 -0
@@ -60,5 +60,6 @@ struct AspeedMachineClass {
   };
 
Quoted 7 lines

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 63

Quoted 2 lines
include/hw/arm/aspeed.h +1 -0
   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.

Quoted 3 lines

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.

#9 lore raw

PATCH 4/13 hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed machines

In reply to Jamin Lin via

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.

---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/arm/aspeed.h +1 -0
index d4d63996a6..fbe684d505 100644
@@ -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
hw/arm/aspeed.c +1 -1
index 2695f0c11b..8a22696da9 100644
@@ -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);
Signature · 1 line
2.43.0
#10 lore raw

Re: [SPAM] [PATCH v1 04/13] hw/arm/aspeed: Make create_pca9554() available for use by other Aspeed machines

Quoted 25 lines · Jamin Lin

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.

---
  include/hw/arm/aspeed.h | 1 +
  hw/arm/aspeed.c         | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
include/hw/arm/aspeed.h +0 -0
index d4d63996a6..fbe684d505 100644

include/hw/arm/aspeed.h struct AspeedMachineClass { · line 64

Quoted 4 lines
include/hw/arm/aspeed.h +1 -0
@@ -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.

Quoted 15 lines
include/hw/arm/aspeed.h +0 -0
  #endif
hw/arm/aspeed.c +1 -1
index 2695f0c11b..8a22696da9 100644
@@ -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);
#11 lore raw

PATCH 5/13 hw/arm/aspeed: Split FP5280G2 machine into a separate source file for maintenance

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed.c +0 -65
index 8a22696da9..48c3d73e73 100644
@@ -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,
hw/arm/aspeed_ast2500_fp5280g2.c new file +87 -0

87 lines not on this page · raw message

hw/arm/meson.build +1 -0
index b88b5b06d7..55513db65b 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 5/13
#12 lore raw

Re: [SPAM] [PATCH v1 05/13] hw/arm/aspeed: Split FP5280G2 machine into a separate source file for maintenance

Quoted 14 lines · Jamin Lin

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.

Quoted 8 lines
---
  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

Thanks,

C.

#13 lore raw

PATCH 6/13 hw/arm/aspeed: Split G220A machine into a separate source file for better maintenance

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed.c +0 -71
index 48c3d73e73..dbeb751275 100644
@@ -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,
hw/arm/aspeed_ast2500_g220a.c new file +91 -0

91 lines not on this page · raw message

hw/arm/meson.build +1 -0
index 55513db65b..a8539ff51e 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 6/13
#14 lore raw

Re: [SPAM] [PATCH v1 06/13] hw/arm/aspeed: Split G220A machine into a separate source file for better maintenance

Quoted 20 lines · Jamin Lin

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.

Quoted 8 lines
---
  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

Thanks,

C.

#15 lore raw

PATCH 7/13 hw/arm/aspeed: Split Tiogapass machine into a separate source file for cleanup

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed_eeprom.h +0 -4
index 3ed9bc1d9a..a9ae95940c 100644
@@ -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[];
hw/arm/aspeed.c +0 -35
index dbeb751275..4ac998df4e 100644
@@ -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,
hw/arm/aspeed_ast2500_tiogapass.c new file +89 -0

89 lines not on this page · raw message

hw/arm/aspeed_eeprom.c +0 -22
index 8bbbdec834..f0ced29cf1 100644
@@ -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);
hw/arm/meson.build +1 -0
index a8539ff51e..849534f6ad 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 7/13
#16 lore raw

Re: [SPAM] [PATCH v1 07/13] hw/arm/aspeed: Split Tiogapass machine into a separate source file for cleanup

Quoted 22 lines · Jamin Lin

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.

Quoted 9 lines
---
  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

Thanks,

C.

#17 lore raw

PATCH 8/13 hw/arm/aspeed: Split YosemiteV2 machine into a separate source file for maintainability

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed_eeprom.h +0 -3
index a9ae95940c..5448eeeab7 100644
@@ -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[];
hw/arm/aspeed.c +0 -36
index 4ac998df4e..f890d30d0e 100644
@@ -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,
hw/arm/aspeed_ast2500_yosemitev2.c new file +90 -0

90 lines not on this page · raw message

hw/arm/aspeed_eeprom.c +0 -22
index f0ced29cf1..124277eaca 100644
@@ -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);
hw/arm/meson.build +1 -0
index 849534f6ad..d07ebc9dd7 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 8/13
#18 lore raw

Re: [SPAM] [PATCH v1 08/13] hw/arm/aspeed: Split YosemiteV2 machine into a separate source file for maintainability

Quoted 25 lines · Jamin Lin

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.

Quoted 9 lines
---
  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

Thanks,

C.

#19 lore raw

PATCH 9/13 hw/arm/aspeed: Split Witherspoon machine into a separate source file for maintainability

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed.c +0 -81
index f890d30d0e..91d59e0d2d 100644
@@ -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,
hw/arm/aspeed_ast2500_witherspoon.c new file +111 -0

111 lines not on this page · raw message

hw/arm/meson.build +1 -0
index d07ebc9dd7..d3726d1b9d 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 9/13
#20 lore raw

Re: [SPAM] [PATCH v1 09/13] hw/arm/aspeed: Split Witherspoon machine into a separate source file for maintainability

Quoted 23 lines · Jamin Lin

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.

Quoted 8 lines
---
  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

Thanks,

C.

#21 lore raw

PATCH 10/13 hw/arm/aspeed: Split Sonorapass machine into a separate source file for maintainability

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed.c +0 -81
index 91d59e0d2d..f01d71db8f 100644
@@ -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,
hw/arm/aspeed_ast2500_sonorapass.c new file +101 -0

101 lines not on this page · raw message

hw/arm/meson.build +1 -0
index d3726d1b9d..94f8a82f17 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 10/13
#22 lore raw

Re: [SPAM] [PATCH v1 10/13] hw/arm/aspeed: Split Sonorapass machine into a separate source file for maintainability

Quoted 19 lines · Jamin Lin

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.

Quoted 8 lines
---
  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

Thanks,

C.

#23 lore raw

PATCH 11/13 hw/arm/aspeed: Split Romulus machine into a separate source file for maintainability

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed.c +0 -42
index f01d71db8f..a97d037acb 100644
@@ -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,
hw/arm/aspeed_ast2500_romulus.c new file +61 -0

61 lines not on this page · raw message

hw/arm/meson.build +1 -0
index 94f8a82f17..fdb825fd0e 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 11/13
#24 lore raw

Re: [SPAM] [PATCH v1 11/13] hw/arm/aspeed: Split Romulus machine into a separate source file for maintainability

Quoted 18 lines · Jamin Lin

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.

Quoted 8 lines
---
  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

Thanks,

C.

#25 lore raw

PATCH 12/13 hw/arm/aspeed: Split Supermicro X11SPI machine into a separate file for maintainability

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed.c +0 -32
index a97d037acb..3618f01ea2 100644
@@ -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,
hw/arm/aspeed_ast2500_supermicro-x11spi.c new file +76 -0

76 lines not on this page · raw message

hw/arm/meson.build +1 -0
index fdb825fd0e..f788baabeb 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 12/13
#26 lore raw

Re: [SPAM] [PATCH v1 12/13] hw/arm/aspeed: Split Supermicro X11SPI machine into a separate file for maintainability

Quoted 26 lines · Jamin Lin

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.

Quoted 8 lines
---
  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

Thanks,

C.

#27 lore raw

PATCH 13/13 hw/arm/aspeed: Split AST2500 EVB machine into a separate source file for maintainability

In reply to Jamin Lin via

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.

---
 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
hw/arm/aspeed.c +0 -45
index 3618f01ea2..11c74c3e1b 100644
@@ -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,
hw/arm/aspeed_ast2500_evb.c new file +66 -0

66 lines not on this page · raw message

hw/arm/meson.build +1 -0
index f788baabeb..cbee7ebf60 100644
@@ -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',
Signature · 1 line
2.43.0
Reviewed-by on v1 13/13
#28 lore raw

Re: [SPAM] [PATCH v1 13/13] hw/arm/aspeed: Split AST2500 EVB machine into a separate source file for maintainability

Quoted 18 lines · Jamin Lin

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.

Quoted 8 lines
---
  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

Thanks,

C.