Skip to contentSkip to conversation

hw/arm/aspeed: AST1700 LTPI support and device hookups

PATCH In review Kane Chen via 4 participants 37 messages Jan 20 – Feb 3

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

v5 cover hw/arm/aspeed: AST1700 LTPI support and device hookups

From: Kane-Chen-AS <[email protected]>

Hi all,

LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM 2.0 specification (see Figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdf

LTPI provides a protocol and physical interface for tunneling various low-speed signals between the Host Processor Module (HPM) and the Satellite Controller Module (SCM). In Figure 2 of the specification, the AST27x0 SoC (left) integrates two LTPI controllers, allowing it to connect to up to two AST1700 boards. On the other side, the AST1700 consolidates HPM FPGA functions and multiple peripheral interfaces (GPIO, UART, I2C, I3C, etc.) onto a single board.

Because the AST1700 exposes additional I/O interfaces (GPIO, I2C, I3C, and others), it acts as an I/O expander. Once connected over LTPI, the AST27x0 can control additional downstream devices through this link.

This patch series is based on the aspeed_next branch and incorporates
recent I2C bus label changes.
Ref: https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/

It introduces a basic LTPI controller model and wires it into the AST27x0 SoC. The series also adds the AST1700-specific LTPI expander device and incrementally connects common peripherals on the AST1700 model. For the I3C block, which may cause kernel crashes, its MMIO region is modeled as an unimplemented device to reserve address space and make the missing functionality explicit, ensuring stable guest probing.

In the official release images, the AST1700 functions are not included by default. To test the AST1700-related functionality, please include the following DTS files for probing:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi0.dtsi
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi1.dtsi

After including these DTS files in the BMC image, you can verify LTPI functionality using the following scenarios:

1. In U-Boot:
Run the ltpi command to trigger the LTPI connection and display the current connection status.
2. In BMC Linux:
Run i2cdetect -y <16-38> to scan and test the I2C buses exposed by the AST1700.

Any feedback or suggestions are appreciated!

Kane

---

ChangeLog
---------
v5:
- Add functional test case for AST1700 I2C
- Corrected the From attribution
- Fixed incorrect DRAM setting for SPI and I2C controllers
- Refine code structure

v4:
- Add missing Signed-off-by
- Fix checkpatch.pl warnings
- Refine code structure
- Enable AST1700 support only after all devices are ready

v3:
- Add PWM model
- Integrate the SGPIO model
- Fix I2C test case failure
- Refine code structure

v2:
- Separate the AST1700 model into a standalone implementation
- Refine the mechanism for assigning the AST1700 board number

v1:
- Initial version
---

Cédric Le Goater (1):
hw/misc: Add basic Aspeed PWM model

Kane-Chen-AS (21):
hw/misc: Add LTPI controller
hw/arm/aspeed: Attach LTPI controller to AST27X0 platform hw/arm/aspeed: Add AST1700 LTPI expander device model hw/arm/aspeed: Integrate AST1700 device into AST27X0 hw/arm/aspeed: Integrate interrupt controller for AST1700 hw/arm/aspeed: Attach LTPI controller to AST1700 model hw/arm/aspeed: Attach UART device to AST1700 model hw/arm/aspeed: Attach SRAM device to AST1700 model hw/arm/aspeed: Attach SPI device to AST1700 model hw/arm/aspeed: Attach ADC device to AST1700 model hw/arm/aspeed: Attach SCU device to AST1700 model hw/arm/aspeed: Attach GPIO device to AST1700 model hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC hw/arm/aspeed: attach I2C device to AST1700 model hw/arm/aspeed: Attach WDT device to AST1700 model hw/arm/aspeed: Attach PWM device to AST1700 model hw/arm/aspeed: Attach SGPIOM device to AST1700 model hw/arm/aspeed: Model AST1700 I3C block as unimplemented device hw/arm/aspeed: Enable AST1700 IO expander support test/functional/aarch64: Parameterize I2C bus ID in AST2700 test test/functional/aarch64: Add I2C test for AST1700 IO expanders

 include/hw/arm/aspeed_ast1700.h               |  55 ++++
 include/hw/arm/aspeed_soc.h                   |  25 +-
 include/hw/intc/aspeed_intc.h                 |   2 +
 include/hw/misc/aspeed_ltpi.h                 |  33 +++
 include/hw/misc/aspeed_pwm.h                  |  31 ++
 hw/arm/aspeed_ast1700.c                       | 280 ++++++++++++++++++
 hw/arm/aspeed_ast27x0.c                       | 170 ++++++++++-
 hw/intc/aspeed_intc.c                         |  60 ++++
 hw/misc/aspeed_ltpi.c                         | 193 ++++++++++++
 hw/misc/aspeed_pwm.c                          | 121 ++++++++
 hw/arm/meson.build                            |   1 +
 hw/misc/meson.build                           |   2 +
 hw/misc/trace-events                          |   4 +
 .../functional/aarch64/test_aspeed_ast2700.py |  52 +++-
 14 files changed, 999 insertions(+), 30 deletions(-)
 create mode 100644 include/hw/arm/aspeed_ast1700.h
 create mode 100644 include/hw/misc/aspeed_ltpi.h
 create mode 100644 include/hw/misc/aspeed_pwm.h
 create mode 100644 hw/arm/aspeed_ast1700.c
 create mode 100644 hw/misc/aspeed_ltpi.c
 create mode 100644 hw/misc/aspeed_pwm.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH v5 1/22 hw/misc: Add LTPI controller

From: Kane-Chen-AS <[email protected]>

LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM 2.0 specification:
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdf

LTPI is a protocol and physical interface for tunneling various low-speed signals between the HPM and SCM. As shown in Figure 2, the AST27x0 (left) integrates two LTPI controllers, allowing it to connect to up to two extended boards.

This commit introduces a simple device model for the ASPEED LTPI controller in QEMU.

The model includes basic MMIO read/write operations and sets default register values during reset to emulate a link-up state.

Implements register space with read/write callbacks.

---
 include/hw/misc/aspeed_ltpi.h |  33 ++++++
 hw/misc/aspeed_ltpi.c         | 193 ++++++++++++++++++++++++++++++++++
 hw/misc/meson.build           |   1 +
 3 files changed, 227 insertions(+)
 create mode 100644 include/hw/misc/aspeed_ltpi.h
 create mode 100644 hw/misc/aspeed_ltpi.c
include/hw/misc/aspeed_ltpi.h new file +33 -0
new file mode 100644
index 0000000000..3330a49b05
@@ -0,0 +1,33 @@
+/*
+ * ASPEED LTPI Controller
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef ASPEED_LTPI_H
+#define ASPEED_LTPI_H
+
+#include "hw/core/sysbus.h"
+
+#define TYPE_ASPEED_LTPI "aspeed.ltpi-ctrl"
+OBJECT_DECLARE_SIMPLE_TYPE(AspeedLTPIState, ASPEED_LTPI)
+
+#define ASPEED_LTPI_TOTAL_SIZE  0x900
+#define ASPEED_LTPI_CTRL_SIZE   0x200
+#define ASPEED_LTPI_PHY_SIZE    0x100
+#define ASPEED_LTPI_TOP_SIZE    0x100
+
+struct AspeedLTPIState {
+    SysBusDevice parent;
+    MemoryRegion mmio;
+    MemoryRegion mmio_ctrl;
+    MemoryRegion mmio_phy;
+    MemoryRegion mmio_top;
+
+    uint32_t ctrl_regs[ASPEED_LTPI_CTRL_SIZE >> 2];
+    uint32_t phy_regs[ASPEED_LTPI_PHY_SIZE >> 2];
+    uint32_t top_regs[ASPEED_LTPI_TOP_SIZE >> 2];
+};
+
+#endif /* ASPEED_LTPI_H */
hw/misc/aspeed_ltpi.c new file +193 -0

193 lines not on this page · raw message

hw/misc/meson.build +1 -0
index b1d8d8e5d2..45b16e7797 100644
@@ -136,6 +136,7 @@ system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_hace.c',
   'aspeed_i3c.c',
   'aspeed_lpc.c',
+  'aspeed_ltpi.c',
   'aspeed_scu.c',
   'aspeed_sbc.c',
   'aspeed_sdmc.c',
Signature · 1 line
2.43.0
#2 lore raw

PATCH v5 2/22 hw/arm/aspeed: Attach LTPI controller to AST27X0 platform

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the LTPI controller device (representing the AST1700 I/O expander) to the AST27X0 SoC model. This patch sets up the memory mapping and device registration according to the AST2700 SoC design, where the LTPI controller is exposed at fixed MMIO regions.

This change only handles device instantiation and integration, without implementing the controller's internal logic.

---
 include/hw/arm/aspeed_soc.h |  5 +++++
 hw/arm/aspeed_ast27x0.c     | 21 +++++++++++++++++++++
 2 files changed, 26 insertions(+)
include/hw/arm/aspeed_soc.h +5 -0
index 18ff961a38..bca10c387b 100644
@@ -43,6 +43,7 @@
 #include "hw/fsi/aspeed_apb2opb.h"
 #include "hw/char/serial-mm.h"
 #include "hw/intc/arm_gicv3.h"
+#include "hw/misc/aspeed_ltpi.h"
 
 #define VBOOTROM_FILE_NAME  "ast27x0_bootrom.bin"
 
@@ -55,6 +56,7 @@
 #define ASPEED_UARTS_NUM 13
 #define ASPEED_JTAG_NUM  2
 #define ASPEED_PCIE_NUM  3
+#define ASPEED_IOEXP_NUM 2
 
 struct AspeedSoCState {
     DeviceState parent;
@@ -112,6 +114,7 @@ struct AspeedSoCState {
     UnimplementedDeviceState ltpi;
     UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
     AspeedAPB2OPBState fsi[2];
+    AspeedLTPIState ltpi_ctrl[ASPEED_IOEXP_NUM];
 };
 
 #define TYPE_ASPEED_SOC "aspeed-soc"
@@ -279,6 +282,8 @@ enum {
     ASPEED_GIC_REDIST,
     ASPEED_DEV_IPC0,
     ASPEED_DEV_IPC1,
+    ASPEED_DEV_LTPI_CTRL1,
+    ASPEED_DEV_LTPI_CTRL2,
 };
 
 const char *aspeed_soc_cpu_type(const char * const *valid_cpu_types);
hw/arm/aspeed_ast27x0.c +21 -0
index d17f446661..3b458f50d1 100644
@@ -88,6 +88,8 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_UART10]    =  0x14C33900,
     [ASPEED_DEV_UART11]    =  0x14C33A00,
     [ASPEED_DEV_UART12]    =  0x14C33B00,
+    [ASPEED_DEV_LTPI_CTRL1] =  0x14C34000,
+    [ASPEED_DEV_LTPI_CTRL2] =  0x14C35000,
     [ASPEED_DEV_WDT]       =  0x14C37000,
     [ASPEED_DEV_LTPI]      =  0x30000000,
     [ASPEED_DEV_PCIE_MMIO0] = 0x60000000,
@@ -489,6 +491,11 @@ static void aspeed_soc_ast2700_init(Object *obj)
         object_property_set_int(OBJECT(&s->pcie[i]), "id", i, &error_abort);
     }
 
+    for (i = 0; i < ASPEED_IOEXP_NUM; i++) {
+        object_initialize_child(obj, "ltpi-ctrl[*]",
+                                &s->ltpi_ctrl[i], TYPE_ASPEED_LTPI);
+    }
+
     object_initialize_child(obj, "dpmcu", &s->dpmcu,
                             TYPE_UNIMPLEMENTED_DEVICE);
     object_initialize_child(obj, "ltpi", &s->ltpi,
@@ -972,6 +979,20 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
         return;
     }
 
+    /* LTPI controller */
+    for (i = 0; i < ASPEED_IOEXP_NUM; i++) {
+        AspeedLTPIState *ltpi_ctrl;
+        hwaddr ltpi_base;
+
+        ltpi_ctrl = ASPEED_LTPI(&s->ltpi_ctrl[i]);
+        ltpi_base = sc->memmap[ASPEED_DEV_LTPI_CTRL1 + i];
+
+        if (!sysbus_realize(SYS_BUS_DEVICE(ltpi_ctrl), errp)) {
+            return;
+        }
+        aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(ltpi_ctrl), 0, ltpi_base);
+    }
+
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
                                   "aspeed.dpmcu",
                                   sc->memmap[ASPEED_DEV_DPMCU],
Signature · 1 line
2.43.0
#3 lore raw

PATCH v5 3/22 hw/misc: Add basic Aspeed PWM model

In reply to Kane Chen via

From: Cédric Le Goater <[email protected]>

Add an initial PWM model for Aspeed SoCs, including device state, register definitions, and basic initialization as a sysbus device.

---
 include/hw/arm/aspeed_soc.h  |   3 +-
 include/hw/misc/aspeed_pwm.h |  31 +++++++++
 hw/misc/aspeed_pwm.c         | 121 +++++++++++++++++++++++++++++++++++
 hw/misc/meson.build          |   1 +
 hw/misc/trace-events         |   4 ++
 5 files changed, 159 insertions(+), 1 deletion(-)
 create mode 100644 include/hw/misc/aspeed_pwm.h
 create mode 100644 hw/misc/aspeed_pwm.c
include/hw/arm/aspeed_soc.h +2 -1
index bca10c387b..7b08cca908 100644
@@ -28,6 +28,7 @@
 #include "hw/misc/aspeed_hace.h"
 #include "hw/misc/aspeed_sbc.h"
 #include "hw/misc/aspeed_sli.h"
+#include "hw/misc/aspeed_pwm.h"
 #include "hw/watchdog/wdt_aspeed.h"
 #include "hw/net/ftgmac100.h"
 #include "target/arm/cpu.h"
@@ -88,6 +89,7 @@ struct AspeedSoCState {
     MemoryRegion secsram;
     UnimplementedDeviceState sbc_unimplemented;
     AspeedSDMCState sdmc;
+    AspeedPWMState pwm;
     AspeedWDTState wdt[ASPEED_WDTS_NUM];
     FTGMAC100State ftgmac100[ASPEED_MACS_NUM];
     AspeedMiiState mii[ASPEED_MACS_NUM];
@@ -108,7 +110,6 @@ struct AspeedSoCState {
     UnimplementedDeviceState video;
     UnimplementedDeviceState emmc_boot_controller;
     UnimplementedDeviceState dpmcu;
-    UnimplementedDeviceState pwm;
     UnimplementedDeviceState espi;
     UnimplementedDeviceState udc;
     UnimplementedDeviceState ltpi;
include/hw/misc/aspeed_pwm.h new file +31 -0
new file mode 100644
index 0000000000..4d5b0bbd86
@@ -0,0 +1,31 @@
+/*
+ * ASPEED PWM Controller
+ *
+ * Copyright (C) 2017-2021 IBM Corp.
+ *
+ * This code is licensed under the GPL version 2 or later.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef ASPEED_PWM_H
+#define ASPEED_PWM_H
+
+#include "hw/core/sysbus.h"
+
+#define TYPE_ASPEED_PWM "aspeed.pwm"
+#define ASPEED_PWM(obj) OBJECT_CHECK(AspeedPWMState, (obj), TYPE_ASPEED_PWM)
+
+#define ASPEED_PWM_NR_REGS (0x10C >> 2)
+
+typedef struct AspeedPWMState {
+    /* <private> */
+    SysBusDevice parent;
+
+    /*< public >*/
+    MemoryRegion iomem;
+    qemu_irq irq;
+
+    uint32_t regs[ASPEED_PWM_NR_REGS];
+} AspeedPWMState;
+
+#endif /* _ASPEED_PWM_H_ */
hw/misc/aspeed_pwm.c new file +121 -0

121 lines not on this page · raw message

hw/misc/meson.build +1 -0
index 45b16e7797..7afe1d0009 100644
@@ -137,6 +137,7 @@ system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_i3c.c',
   'aspeed_lpc.c',
   'aspeed_ltpi.c',
+  'aspeed_pwm.c',
   'aspeed_scu.c',
   'aspeed_sbc.c',
   'aspeed_sdmc.c',
hw/misc/trace-events +4 -0
index eeb9243898..f7870babba 100644
@@ -299,6 +299,10 @@ aspeed_i3c_write(uint64_t offset, uint64_t data) "I3C write: offset 0x%" PRIx64
 aspeed_i3c_device_read(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] read: offset 0x%" PRIx64 " data 0x%" PRIx64
 aspeed_i3c_device_write(uint32_t deviceid, uint64_t offset, uint64_t data) "I3C Dev[%u] write: offset 0x%" PRIx64 " data 0x%" PRIx64
 
+# aspeed_pwm.c
+aspeed_pwm_read(uint64_t offset, uint64_t data) "read: offset 0x%" PRIx64 " data 0x%" PRIx64
+aspeed_pwm_write(uint64_t offset, uint64_t data) "write: offset 0x%" PRIx64 " data 0x%" PRIx64
+
 # aspeed_sdmc.c
 aspeed_sdmc_write(uint64_t reg, uint64_t data) "reg @0x%" PRIx64 " data: 0x%" PRIx64
 aspeed_sdmc_read(uint64_t reg, uint64_t data) "reg @0x%" PRIx64 " data: 0x%" PRIx64
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH v5 03/22] hw/misc: Add basic Aspeed PWM model

Quoted 14 lines · Kane Chen via

From: Cédric Le Goater <[email protected]>

Add an initial PWM model for Aspeed SoCs, including device state, register definitions, and basic initialization as a sysbus device.

---
  include/hw/arm/aspeed_soc.h  |   3 +-
  include/hw/misc/aspeed_pwm.h |  31 +++++++++
  hw/misc/aspeed_pwm.c         | 121 +++++++++++++++++++++++++++++++++++
  hw/misc/meson.build          |   1 +
  hw/misc/trace-events         |   4 ++
  5 files changed, 159 insertions(+), 1 deletion(-)
Quoted 2 lines

create mode 100644 include/hw/misc/aspeed_pwm.h
create mode 100644 hw/misc/aspeed_pwm.c

Kane,

When you resend, could you please fix :

ERROR: New file 'include/hw/misc/aspeed_pwm.h' requires 'SPDX-License-Identifier'
ERROR: New file 'hw/misc/aspeed_pwm.c' requires 'SPDX-License-Identifier'

ERRORs detected by ../scripts/checkpatch.pl should be fixed before sending. WARNING are OK.

Thanks,

C.

#5 lore raw

RE: [PATCH v5 03/22] hw/misc: Add basic Aspeed PWM model

Quoted 40 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Monday, January 26, 2026 4:57 PM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v5 03/22] hw/misc: Add basic Aspeed PWM model

Quoted 11 lines · Kane Chen via

From: Cédric Le Goater <[email protected]>

Add an initial PWM model for Aspeed SoCs, including device state, register definitions, and basic initialization as a sysbus device.

---
  include/hw/arm/aspeed_soc.h  |   3 +-
  include/hw/misc/aspeed_pwm.h |  31 +++++++++
  hw/misc/aspeed_pwm.c         | 121

+++++++++++++++++++++++++++++++++++

Quoted 5 lines
  hw/misc/meson.build          |   1 +
  hw/misc/trace-events         |   4 ++
  5 files changed, 159 insertions(+), 1 deletion(-)

create mode 100644 include/hw/misc/aspeed_pwm.h
create mode 100644 hw/misc/aspeed_pwm.c

Kane,

When you resend, could you please fix :

ERROR: New file 'include/hw/misc/aspeed_pwm.h' requires
'SPDX-License-Identifier'
ERROR: New file 'hw/misc/aspeed_pwm.c' requires
'SPDX-License-Identifier'

Quoted 6 lines

ERRORs detected by ../scripts/checkpatch.pl should be fixed before sending. WARNING are OK.

Thanks,

C.

Hi Cédric,

Thanks for the catch. I missed the SPDX errors because I was running checkpatch.pl -f on the source files instead of the generated patches. I will fix these errors in the next version.

Best Regards,
Kane

#6 lore raw

PATCH v5 4/22 hw/arm/aspeed: Add AST1700 LTPI expander device model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Introduce a minimal QEMU device model for the ASPEED AST1700, an MCU-less I/O expander used in the LTPI topology defined by the DC-SCM 2.0 specification (see figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdf

This initial implementation includes:

* Definition of aspeed.ast1700 as a SysBusDevice

* Setup of a basic memory region to reserve I/O space for future peripheral modeling

This stub establishes the foundation for LTPI-related device emulation, without implementing any functional peripherals at this stage.

---
 include/hw/arm/aspeed_ast1700.h | 23 +++++++++++++++++
 hw/arm/aspeed_ast1700.c         | 46 +++++++++++++++++++++++++++++++++
 hw/arm/meson.build              |  1 +
 3 files changed, 70 insertions(+)
 create mode 100644 include/hw/arm/aspeed_ast1700.h
 create mode 100644 hw/arm/aspeed_ast1700.c
include/hw/arm/aspeed_ast1700.h new file +23 -0
new file mode 100644
index 0000000000..378dcb437a
@@ -0,0 +1,23 @@
+/*
+ * ASPEED AST1700 IO Expander
+ *
+ * Copyright (C) 2025 ASPEED Technology Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef ASPEED_AST1700_H
+#define ASPEED_AST1700_H
+
+#include "hw/core/sysbus.h"
+
+#define TYPE_ASPEED_AST1700 "aspeed.ast1700"
+
+OBJECT_DECLARE_SIMPLE_TYPE(AspeedAST1700SoCState, ASPEED_AST1700)
+
+struct AspeedAST1700SoCState {
+    SysBusDevice parent_obj;
+
+    MemoryRegion iomem;
+};
+
+#endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c new file +46 -0

46 lines not on this page · raw message

hw/arm/meson.build +1 -0
index aeaf654790..175942263d 100644
@@ -70,6 +70,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast10x0_evb.c',
   'fby35.c'))
 arm_common_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files(
+  'aspeed_ast1700.c',
   'aspeed_ast27x0.c',
   'aspeed_ast27x0_evb.c',
   'aspeed_ast27x0-fc.c',
Signature · 1 line
2.43.0
#7 lore raw

PATCH v5 5/22 hw/arm/aspeed: Integrate AST1700 device into AST27X0

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the AST1700 device as a child of the AST27X0 model to reflect its role in DC-SCM 2.0 LTPI-based architectures. This patch wires the AST1700 device into the platform without introducing functional peripherals.

This forms the base for LTPI expander emulation in QEMU using AST27X0 as the host controller.

Note: ioexp_num is set to 0 at this stage. Once all related devices and interrupts are fully implemented, ioexp_num will be updated to its expected value. This ensures the machine remains functional at every commit and avoids potential compiler or build issues.

---
 include/hw/arm/aspeed_soc.h |  7 +++++--
 hw/arm/aspeed_ast27x0.c     | 26 ++++++++++++++++++--------
 2 files changed, 23 insertions(+), 10 deletions(-)
include/hw/arm/aspeed_soc.h +5 -2
index 7b08cca908..f19bab3457 100644
@@ -45,6 +45,7 @@
 #include "hw/char/serial-mm.h"
 #include "hw/intc/arm_gicv3.h"
 #include "hw/misc/aspeed_ltpi.h"
+#include "hw/arm/aspeed_ast1700.h"
 
 #define VBOOTROM_FILE_NAME  "ast27x0_bootrom.bin"
 
@@ -112,10 +113,10 @@ struct AspeedSoCState {
     UnimplementedDeviceState dpmcu;
     UnimplementedDeviceState espi;
     UnimplementedDeviceState udc;
-    UnimplementedDeviceState ltpi;
     UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
     AspeedAPB2OPBState fsi[2];
     AspeedLTPIState ltpi_ctrl[ASPEED_IOEXP_NUM];
+    AspeedAST1700SoCState ioexp[ASPEED_IOEXP_NUM];
 };
 
 #define TYPE_ASPEED_SOC "aspeed-soc"
@@ -178,6 +179,7 @@ struct AspeedSoCClass {
     int macs_num;
     int uarts_num;
     int uarts_base;
+    int ioexp_num;
     const int *irqmap;
     const hwaddr *memmap;
     uint32_t num_cpus;
@@ -190,7 +192,6 @@ enum {
     ASPEED_DEV_IOMEM,
     ASPEED_DEV_IOMEM0,
     ASPEED_DEV_IOMEM1,
-    ASPEED_DEV_LTPI,
     ASPEED_DEV_UART0,
     ASPEED_DEV_UART1,
     ASPEED_DEV_UART2,
@@ -285,6 +286,8 @@ enum {
     ASPEED_DEV_IPC1,
     ASPEED_DEV_LTPI_CTRL1,
     ASPEED_DEV_LTPI_CTRL2,
+    ASPEED_DEV_LTPI_IO0,
+    ASPEED_DEV_LTPI_IO1,
 };
 
 const char *aspeed_soc_cpu_type(const char * const *valid_cpu_types);
hw/arm/aspeed_ast27x0.c +18 -8
index 3b458f50d1..0517a5351d 100644
@@ -26,7 +26,6 @@
 #define AST2700_SOC_IO_SIZE          0x00FE0000
 #define AST2700_SOC_IOMEM_SIZE       0x01000000
 #define AST2700_SOC_DPMCU_SIZE       0x00040000
-#define AST2700_SOC_LTPI_SIZE        0x01000000
 
 static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_VBOOTROM]  =  0x00000000,
@@ -91,7 +90,8 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_LTPI_CTRL1] =  0x14C34000,
     [ASPEED_DEV_LTPI_CTRL2] =  0x14C35000,
     [ASPEED_DEV_WDT]       =  0x14C37000,
-    [ASPEED_DEV_LTPI]      =  0x30000000,
+    [ASPEED_DEV_LTPI_IO0]  =  0x30000000,
+    [ASPEED_DEV_LTPI_IO1]  =  0x50000000,
     [ASPEED_DEV_PCIE_MMIO0] = 0x60000000,
     [ASPEED_DEV_PCIE_MMIO1] = 0x80000000,
     [ASPEED_DEV_PCIE_MMIO2] = 0xA0000000,
@@ -496,10 +496,14 @@ static void aspeed_soc_ast2700_init(Object *obj)
                                 &s->ltpi_ctrl[i], TYPE_ASPEED_LTPI);
     }
 
+    for (i = 0; i < sc->ioexp_num; i++) {
+        /* AST1700 IOEXP */
+        object_initialize_child(obj, "ioexp[*]", &s->ioexp[i],
+                                TYPE_ASPEED_AST1700);
+    }
+
     object_initialize_child(obj, "dpmcu", &s->dpmcu,
                             TYPE_UNIMPLEMENTED_DEVICE);
-    object_initialize_child(obj, "ltpi", &s->ltpi,
-                            TYPE_UNIMPLEMENTED_DEVICE);
     object_initialize_child(obj, "iomem", &s->iomem,
                             TYPE_UNIMPLEMENTED_DEVICE);
     object_initialize_child(obj, "iomem0", &s->iomem0,
@@ -993,14 +997,19 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
         aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(ltpi_ctrl), 0, ltpi_base);
     }
 
+    /* IO Expander */
+    for (i = 0; i < sc->ioexp_num; i++) {
+        if (!sysbus_realize(SYS_BUS_DEVICE(&s->ioexp[i]), errp)) {
+            return;
+        }
+        sysbus_mmio_map(SYS_BUS_DEVICE(&s->ioexp[i]), 0,
+                        sc->memmap[ASPEED_DEV_LTPI_IO0 + i]);
+    }
+
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
                                   "aspeed.dpmcu",
                                   sc->memmap[ASPEED_DEV_DPMCU],
                                   AST2700_SOC_DPMCU_SIZE);
-    aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->ltpi),
-                                  "aspeed.ltpi",
-                                  sc->memmap[ASPEED_DEV_LTPI],
-                                  AST2700_SOC_LTPI_SIZE);
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->iomem),
                                   "aspeed.io",
                                   sc->memmap[ASPEED_DEV_IOMEM],
@@ -1039,6 +1048,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, const void *data)
     sc->macs_num     = 3;
     sc->uarts_num    = 13;
     sc->num_cpus     = 4;
+    sc->ioexp_num    = 0;
     sc->uarts_base   = ASPEED_DEV_UART0;
     sc->irqmap       = aspeed_soc_ast2700a1_irqmap;
     sc->memmap       = aspeed_soc_ast2700_memmap;
Signature · 1 line
2.43.0
#8 lore raw

PATCH v5 6/22 hw/arm/aspeed: Integrate interrupt controller for AST1700

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the AST1700 interrupt lines to the GIC in AST27X0, enabling the propagation of AST1700-originated interrupts to the host SoC.

This patch does not implement interrupt sources in AST1700 itself, only the wiring into AST27X0.

---
 include/hw/arm/aspeed_soc.h   |  6 +++-
 include/hw/intc/aspeed_intc.h |  2 ++
 hw/arm/aspeed_ast27x0.c       | 37 +++++++++++++++++++++
 hw/intc/aspeed_intc.c         | 60 +++++++++++++++++++++++++++++++++++
 4 files changed, 104 insertions(+), 1 deletion(-)
include/hw/arm/aspeed_soc.h +5 -1
index f19bab3457..b051d0eb3a 100644
@@ -58,6 +58,7 @@
 #define ASPEED_UARTS_NUM 13
 #define ASPEED_JTAG_NUM  2
 #define ASPEED_PCIE_NUM  3
+#define ASPEED_INTC_NUM  2
 #define ASPEED_IOEXP_NUM 2
 
 struct AspeedSoCState {
@@ -146,7 +147,8 @@ struct Aspeed27x0SoCState {
     AspeedSoCState parent;
 
     ARMCPU cpu[ASPEED_CPUS_NUM];
-    AspeedINTCState intc[2];
+    AspeedINTCState intc[ASPEED_INTC_NUM];
+    AspeedINTCState intcioexp[ASPEED_IOEXP_NUM];
     GICv3State gic;
     MemoryRegion dram_empty;
 };
@@ -288,6 +290,8 @@ enum {
     ASPEED_DEV_LTPI_CTRL2,
     ASPEED_DEV_LTPI_IO0,
     ASPEED_DEV_LTPI_IO1,
+    ASPEED_DEV_IOEXP0_INTCIO,
+    ASPEED_DEV_IOEXP1_INTCIO,
 };
 
 const char *aspeed_soc_cpu_type(const char * const *valid_cpu_types);
include/hw/intc/aspeed_intc.h +2 -0
index 5d10268fff..b25ef4a464 100644
@@ -15,6 +15,8 @@
 #define TYPE_ASPEED_INTC "aspeed.intc"
 #define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700"
 #define TYPE_ASPEED_2700_INTCIO TYPE_ASPEED_INTC "io-ast2700"
+#define TYPE_ASPEED_2700_INTCIOEXP1 TYPE_ASPEED_INTC "-ast2700-ioexp1"
+#define TYPE_ASPEED_2700_INTCIOEXP2 TYPE_ASPEED_INTC "-ast2700-ioexp2"
 #define TYPE_ASPEED_2700SSP_INTC TYPE_ASPEED_INTC "-ast2700ssp"
 #define TYPE_ASPEED_2700SSP_INTCIO TYPE_ASPEED_INTC "io-ast2700ssp"
 #define TYPE_ASPEED_2700TSP_INTC TYPE_ASPEED_INTC "-ast2700tsp"
hw/arm/aspeed_ast27x0.c +37 -0
index 0517a5351d..7b1c49bf16 100644
@@ -91,7 +91,9 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_LTPI_CTRL2] =  0x14C35000,
     [ASPEED_DEV_WDT]       =  0x14C37000,
     [ASPEED_DEV_LTPI_IO0]  =  0x30000000,
+    [ASPEED_DEV_IOEXP0_INTCIO] = 0x30C18000,
     [ASPEED_DEV_LTPI_IO1]  =  0x50000000,
+    [ASPEED_DEV_IOEXP1_INTCIO] = 0x50C18000,
     [ASPEED_DEV_PCIE_MMIO0] = 0x60000000,
     [ASPEED_DEV_PCIE_MMIO1] = 0x80000000,
     [ASPEED_DEV_PCIE_MMIO2] = 0xA0000000,
@@ -444,6 +446,10 @@ static void aspeed_soc_ast2700_init(Object *obj)
     object_initialize_child(obj, "intc", &a->intc[0], TYPE_ASPEED_2700_INTC);
     object_initialize_child(obj, "intcio", &a->intc[1],
                             TYPE_ASPEED_2700_INTCIO);
+    object_initialize_child(obj, "intc-ioexp0", &a->intcioexp[0],
+                            TYPE_ASPEED_2700_INTCIOEXP1);
+    object_initialize_child(obj, "intc-ioexp1", &a->intcioexp[1],
+                            TYPE_ASPEED_2700_INTCIOEXP2);
 
     snprintf(typename, sizeof(typename), "aspeed.adc-%s", socname);
     object_initialize_child(obj, "adc", &s->adc, typename);
@@ -688,6 +694,22 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
     aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&a->intc[1]), 0,
                     sc->memmap[ASPEED_DEV_INTCIO]);
 
+    /* INTCIOEXP0 */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&a->intcioexp[0]), errp)) {
+        return;
+    }
+
+    aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&a->intcioexp[0]), 0,
+                    sc->memmap[ASPEED_DEV_IOEXP0_INTCIO]);
+
+    /* INTCIOEXP1 */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&a->intcioexp[1]), errp)) {
+        return;
+    }
+
+    aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&a->intcioexp[1]), 0,
+                    sc->memmap[ASPEED_DEV_IOEXP1_INTCIO]);
+
     /* irq sources -> orgates -> INTC */
     for (i = 0; i < ic->num_inpins; i++) {
         qdev_connect_gpio_out(DEVICE(&a->intc[0].orgates[i]), 0,
@@ -1004,6 +1026,21 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
         }
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->ioexp[i]), 0,
                         sc->memmap[ASPEED_DEV_LTPI_IO0 + i]);
+
+        icio = ASPEED_INTC_GET_CLASS(&a->intcioexp[i]);
+        /* INTC_IOEXP internal: orgate[i] -> input[i] */
+        for (int j = 0; j < icio->num_inpins; j++) {
+            irq = qdev_get_gpio_in(DEVICE(&a->intcioexp[i]), j);
+            qdev_connect_gpio_out(DEVICE(&a->intcioexp[i].orgates[j]), 0,
+                                  irq);
+        }
+
+        /* INTC_IOEXP output[i] -> INTC0.orgate[0].input[i] */
+        for (int j = 0; j < icio->num_outpins; j++) {
+            irq = qdev_get_gpio_in(DEVICE(&a->intc[0].orgates[0]), j);
+            sysbus_connect_irq(SYS_BUS_DEVICE(&a->intcioexp[i]), j,
+                               irq);
+        }
     }
 
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
hw/intc/aspeed_intc.c +60 -0

72 lines not on this page · raw message

Signature · 1 line
2.43.0
#9 lore raw

PATCH v5 7/22 hw/arm/aspeed: Attach LTPI controller to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the LTPI controller to the AST1700 model by mapping its MMIO region.

---
 include/hw/arm/aspeed_ast1700.h |  3 +++
 hw/arm/aspeed_ast1700.c         | 28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
include/hw/arm/aspeed_ast1700.h +3 -0
index 378dcb437a..addea3ab1f 100644
@@ -9,6 +9,7 @@
 #define ASPEED_AST1700_H
 
 #include "hw/core/sysbus.h"
+#include "hw/misc/aspeed_ltpi.h"
 
 #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
 
@@ -18,6 +19,8 @@ struct AspeedAST1700SoCState {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
+
+    AspeedLTPIState ltpi;
 };
 
 #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +28 -0
index dd38b819b8..e4c8565d3f 100644
@@ -13,6 +13,14 @@
 
 #define AST2700_SOC_LTPI_SIZE        0x01000000
 
+enum {
+    ASPEED_AST1700_DEV_LTPI_CTRL,
+};
+
+static const hwaddr aspeed_ast1700_io_memmap[] = {
+    [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
+};
+
 static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
 {
     AspeedAST1700SoCState *s = ASPEED_AST1700(dev);
@@ -22,6 +30,25 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
     memory_region_init(&s->iomem, OBJECT(s), TYPE_ASPEED_AST1700,
                        AST2700_SOC_LTPI_SIZE);
     sysbus_init_mmio(sbd, &s->iomem);
+
+    /* LTPI controller */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0));
+}
+
+static void aspeed_ast1700_instance_init(Object *obj)
+{
+    AspeedAST1700SoCState *s = ASPEED_AST1700(obj);
+
+    /* LTPI controller */
+    object_initialize_child(obj, "ltpi-ctrl",
+                            &s->ltpi, TYPE_ASPEED_LTPI);
+
+    return;
 }
 
 static void aspeed_ast1700_class_init(ObjectClass *klass, const void *data)
@@ -36,6 +63,7 @@ static const TypeInfo aspeed_ast1700_info = {
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(AspeedAST1700SoCState),
     .class_init    = aspeed_ast1700_class_init,
+    .instance_init = aspeed_ast1700_instance_init,
 };
 
 static void aspeed_ast1700_register_types(void)
Signature · 1 line
2.43.0
#10 lore raw

PATCH v5 8/22 hw/arm/aspeed: Attach UART device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the UART controller to the AST1700 model by mapping its MMIO region.

---
 include/hw/arm/aspeed_ast1700.h |  2 ++
 hw/arm/aspeed_ast1700.c         | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)
include/hw/arm/aspeed_ast1700.h +2 -0
index addea3ab1f..b15b13aedd 100644
@@ -10,6 +10,7 @@
 
 #include "hw/core/sysbus.h"
 #include "hw/misc/aspeed_ltpi.h"
+#include "hw/char/serial-mm.h"
 
 #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
 
@@ -21,6 +22,7 @@ struct AspeedAST1700SoCState {
     MemoryRegion iomem;
 
     AspeedLTPIState ltpi;
+    SerialMM uart;
 };
 
 #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +18 -0
index e4c8565d3f..450ca6f5c7 100644
@@ -9,15 +9,18 @@
 #include "qemu/osdep.h"
 #include "hw/core/boards.h"
 #include "qom/object.h"
+#include "hw/core/qdev-properties.h"
 #include "hw/arm/aspeed_ast1700.h"
 
 #define AST2700_SOC_LTPI_SIZE        0x01000000
 
 enum {
+    ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
 };
 
 static const hwaddr aspeed_ast1700_io_memmap[] = {
+    [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
 };
 
@@ -31,6 +34,17 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                        AST2700_SOC_LTPI_SIZE);
     sysbus_init_mmio(sbd, &s->iomem);
 
+    /* UART */
+    qdev_prop_set_uint8(DEVICE(&s->uart), "regshift", 2);
+    qdev_prop_set_uint32(DEVICE(&s->uart), "baudbase", 38400);
+    qdev_prop_set_uint8(DEVICE(&s->uart), "endianness", DEVICE_LITTLE_ENDIAN);
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0));
+
     /* LTPI controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
         return;
@@ -44,6 +58,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
 {
     AspeedAST1700SoCState *s = ASPEED_AST1700(obj);
 
+    /* UART */
+    object_initialize_child(obj, "uart[*]", &s->uart,
+                            TYPE_SERIAL_MM);
+
     /* LTPI controller */
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
Signature · 1 line
2.43.0
#11 lore raw

Re: [PATCH v5 08/22] hw/arm/aspeed: Attach UART device to AST1700 model

Quoted 76 lines · Kane Chen via qemu development

From: Kane-Chen-AS <[email protected]>

Connect the UART controller to the AST1700 model by mapping its MMIO region.

---
  include/hw/arm/aspeed_ast1700.h |  2 ++
  hw/arm/aspeed_ast1700.c         | 18 ++++++++++++++++++
  2 files changed, 20 insertions(+)
include/hw/arm/aspeed_ast1700.h +2 -0
index addea3ab1f..b15b13aedd 100644
@@ -10,6 +10,7 @@
 
  #include "hw/core/sysbus.h"
  #include "hw/misc/aspeed_ltpi.h"
+#include "hw/char/serial-mm.h"
 
  #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
 
@@ -21,6 +22,7 @@ struct AspeedAST1700SoCState {
      MemoryRegion iomem;
 
      AspeedLTPIState ltpi;
+    SerialMM uart;
  };
 
  #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +14 -0
index e4c8565d3f..450ca6f5c7 100644
@@ -9,15 +9,18 @@
  #include "qemu/osdep.h"
  #include "hw/core/boards.h"
  #include "qom/object.h"
+#include "hw/core/qdev-properties.h"
  #include "hw/arm/aspeed_ast1700.h"
 
  #define AST2700_SOC_LTPI_SIZE        0x01000000
 
  enum {
+    ASPEED_AST1700_DEV_UART12,
      ASPEED_AST1700_DEV_LTPI_CTRL,
  };
 
  static const hwaddr aspeed_ast1700_io_memmap[] = {
+    [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
      [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
  };
 
@@ -31,6 +34,17 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                         AST2700_SOC_LTPI_SIZE);
      sysbus_init_mmio(sbd, &s->iomem);
 
+    /* UART */
+    qdev_prop_set_uint8(DEVICE(&s->uart), "regshift", 2);
+    qdev_prop_set_uint32(DEVICE(&s->uart), "baudbase", 38400);
+    qdev_prop_set_uint8(DEVICE(&s->uart), "endianness", DEVICE_LITTLE_ENDIAN);
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0));
+
      /* LTPI controller */
      if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
          return;

hw/arm/aspeed_ast1700.c static void aspeed_ast1700_instance_init(Object *obj) · line 63

Quoted 6 lines
hw/arm/aspeed_ast1700.c +3 -0
@@ -44,6 +58,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
  {
      AspeedAST1700SoCState *s = ASPEED_AST1700(obj);
 
+    /* UART */
+    object_initialize_child(obj, "uart[*]", &s->uart,
+                            TYPE_SERIAL_MM);

There is only one uart device per AspeedAST1700SoCState; so you don't need the "[*]" array suffix.

This is true for several other devices added to AspeedAST1700SoCState. Please remove.

Thanks,

C.

Quoted 4 lines
hw/arm/aspeed_ast1700.c +1 -0
+
      /* LTPI controller */
      object_initialize_child(obj, "ltpi-ctrl",
                              &s->ltpi, TYPE_ASPEED_LTPI);
#12 lore raw

RE: [PATCH v5 08/22] hw/arm/aspeed: Attach UART device to AST1700 model

Quoted 107 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Monday, January 26, 2026 4:40 PM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>; Cédric Le Goater <[email protected]>; Nabih Estefan <[email protected]>
Subject: Re: [PATCH v5 08/22] hw/arm/aspeed: Attach UART device to AST1700 model

Quoted 9 lines · Kane Chen via qemu development

From: Kane-Chen-AS <[email protected]>

Connect the UART controller to the AST1700 model by mapping its MMIO region.

Quoted 7 lines
---
  include/hw/arm/aspeed_ast1700.h |  2 ++
  hw/arm/aspeed_ast1700.c         | 18 ++++++++++++++++++
  2 files changed, 20 insertions(+)
(quoted diff) +0 -0

b/include/hw/arm/aspeed_ast1700.h index addea3ab1f..b15b13aedd

100644

hw/arm/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev,

Quoted 42 lines
include/hw/arm/aspeed_ast1700.h +2 -0
@@ -10,6 +10,7 @@
 
  #include "hw/core/sysbus.h"
  #include "hw/misc/aspeed_ltpi.h"
+#include "hw/char/serial-mm.h"
 
  #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
 
@@ -21,6 +22,7 @@ struct AspeedAST1700SoCState {
      MemoryRegion iomem;
 
      AspeedLTPIState ltpi;
+    SerialMM uart;
  };
 
  #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c index renamed from hw/arm/aspeed_ast1700.c +0 -0

e4c8565d3f..450ca6f5c7 100644

hw/arm/aspeed_ast1700.c +3 -0
@@ -9,15 +9,18 @@
  #include "qemu/osdep.h"
  #include "hw/core/boards.h"
  #include "qom/object.h"
+#include "hw/core/qdev-properties.h"
  #include "hw/arm/aspeed_ast1700.h"
 
  #define AST2700_SOC_LTPI_SIZE        0x01000000
 
  enum {
+    ASPEED_AST1700_DEV_UART12,
      ASPEED_AST1700_DEV_LTPI_CTRL,
  };
 
  static const hwaddr aspeed_ast1700_io_memmap[] = {
+    [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
      [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
  };
 
@@ -31,6 +34,17 @@ static void aspeed_ast1700_realize(DeviceState *dev,

Error **errp)

hw/arm/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)

Quoted 7 lines
hw/arm/aspeed_ast1700.c +4 -0
                         AST2700_SOC_LTPI_SIZE);
      sysbus_init_mmio(sbd, &s->iomem);
 
+    /* UART */
+    qdev_prop_set_uint8(DEVICE(&s->uart), "regshift", 2);
+    qdev_prop_set_uint32(DEVICE(&s->uart), "baudbase", 38400);
+    qdev_prop_set_uint8(DEVICE(&s->uart), "endianness",

DEVICE_LITTLE_ENDIAN);

hw/arm/aspeed_ast1700.c static void aspeed_ast1700_realize(DeviceState *dev, Error **errp) · line 47

Quoted 5 lines
hw/arm/aspeed_ast1700.c +5 -0
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+

aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12],

hw/arm/aspeed_ast1700.c static void aspeed_ast1700_instance_init(Object

Quoted 7 lines
hw/arm/aspeed_ast1700.c +3 -0
+
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0));
+
      /* LTPI controller */
      if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
          return;
@@ -44,6 +58,10 @@ static void aspeed_ast1700_instance_init(Object

*obj)

hw/arm/aspeed_ast1700.c static void aspeed_ast1700_instance_init(Object *obj) · line 63

Quoted 6 lines
hw/arm/aspeed_ast1700.c +3 -0
  {
      AspeedAST1700SoCState *s = ASPEED_AST1700(obj);
 
+    /* UART */
+    object_initialize_child(obj, "uart[*]", &s->uart,
+                            TYPE_SERIAL_MM);

There is only one uart device per AspeedAST1700SoCState; so you don't need the "[*]" array suffix.

Quoted 6 lines

This is true for several other devices added to AspeedAST1700SoCState. Please remove.

Thanks,

C.

Hi Cédric,

Thanks for your review and comments. I will remove the "[*]" array suffix in the next patch series.

Best Regards,
Kane

Quoted 6 lines
Quoted 6 lines
hw/arm/aspeed_ast1700.c +1 -0
+
      /* LTPI controller */
      object_initialize_child(obj, "ltpi-ctrl",
                              &s->ltpi, TYPE_ASPEED_LTPI);
#13 lore raw

PATCH v5 9/22 hw/arm/aspeed: Attach SRAM device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Map the SRAM device to AST1700 model

---
 include/hw/arm/aspeed_ast1700.h |  2 ++
 hw/arm/aspeed_ast1700.c         | 17 +++++++++++++++++
 hw/arm/aspeed_ast27x0.c         |  1 +
 3 files changed, 20 insertions(+)
include/hw/arm/aspeed_ast1700.h +2 -0
index b15b13aedd..a981bff3b2 100644
@@ -20,9 +20,11 @@ struct AspeedAST1700SoCState {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
+    uint8_t board_idx;
 
     AspeedLTPIState ltpi;
     SerialMM uart;
+    MemoryRegion sram;
 };
 
 #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +17 -0
index 450ca6f5c7..c82825d71d 100644
@@ -13,13 +13,16 @@
 #include "hw/arm/aspeed_ast1700.h"
 
 #define AST2700_SOC_LTPI_SIZE        0x01000000
+#define AST1700_SOC_SRAM_SIZE        0x00040000
 
 enum {
+    ASPEED_AST1700_DEV_SRAM,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
 };
 
 static const hwaddr aspeed_ast1700_io_memmap[] = {
+    [ASPEED_AST1700_DEV_SRAM]      =  0x00BC0000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
 };
@@ -28,12 +31,21 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
 {
     AspeedAST1700SoCState *s = ASPEED_AST1700(dev);
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+    char dev_name[32];
 
     /* Occupy memory space for all controllers in AST1700 */
     memory_region_init(&s->iomem, OBJECT(s), TYPE_ASPEED_AST1700,
                        AST2700_SOC_LTPI_SIZE);
     sysbus_init_mmio(sbd, &s->iomem);
 
+    /* SRAM */
+    snprintf(dev_name, sizeof(dev_name), "aspeed.ioexp-sram.%d", s->board_idx);
+    memory_region_init_ram(&s->sram, OBJECT(s), dev_name,
+                           AST1700_SOC_SRAM_SIZE, errp);
+    memory_region_add_subregion(&s->iomem,
+                            aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SRAM],
+                            &s->sram);
+
     /* UART */
     qdev_prop_set_uint8(DEVICE(&s->uart), "regshift", 2);
     qdev_prop_set_uint32(DEVICE(&s->uart), "baudbase", 38400);
@@ -69,11 +81,16 @@ static void aspeed_ast1700_instance_init(Object *obj)
     return;
 }
 
+static const Property aspeed_ast1700_props[] = {
+    DEFINE_PROP_UINT8("board-idx", AspeedAST1700SoCState, board_idx, 0),
+};
+
 static void aspeed_ast1700_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = aspeed_ast1700_realize;
+    device_class_set_props(dc, aspeed_ast1700_props);
 }
 
 static const TypeInfo aspeed_ast1700_info = {
hw/arm/aspeed_ast27x0.c +1 -0
index 7b1c49bf16..6933d03fbf 100644
@@ -1021,6 +1021,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
 
     /* IO Expander */
     for (i = 0; i < sc->ioexp_num; i++) {
+        qdev_prop_set_uint8(DEVICE(&s->ioexp[i]), "board-idx", i);
         if (!sysbus_realize(SYS_BUS_DEVICE(&s->ioexp[i]), errp)) {
             return;
         }
Signature · 1 line
2.43.0
#14 lore raw

PATCH v5 10/22 hw/arm/aspeed: Attach SPI device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the SPI device to AST1700 model.

---
 include/hw/arm/aspeed_ast1700.h |  3 +++
 hw/arm/aspeed_ast1700.c         | 30 ++++++++++++++++++++++++++++++
 hw/arm/aspeed_ast27x0.c         |  2 ++
 3 files changed, 35 insertions(+)
include/hw/arm/aspeed_ast1700.h +3 -0
index a981bff3b2..89562eb64f 100644
@@ -10,6 +10,7 @@
 
 #include "hw/core/sysbus.h"
 #include "hw/misc/aspeed_ltpi.h"
+#include "hw/ssi/aspeed_smc.h"
 #include "hw/char/serial-mm.h"
 
 #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
@@ -20,11 +21,13 @@ struct AspeedAST1700SoCState {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
+    MemoryRegion *dram_mr;
     uint8_t board_idx;
 
     AspeedLTPIState ltpi;
     SerialMM uart;
     MemoryRegion sram;
+    AspeedSMCState spi;
 };
 
 #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +30 -0
index c82825d71d..49f9b67c91 100644
@@ -9,6 +9,7 @@
 #include "qemu/osdep.h"
 #include "hw/core/boards.h"
 #include "qom/object.h"
+#include "qapi/error.h"
 #include "hw/core/qdev-properties.h"
 #include "hw/arm/aspeed_ast1700.h"
 
@@ -16,15 +17,19 @@
 #define AST1700_SOC_SRAM_SIZE        0x00040000
 
 enum {
+    ASPEED_AST1700_DEV_SPI0,
     ASPEED_AST1700_DEV_SRAM,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
+    ASPEED_AST1700_DEV_SPI0_MEM,
 };
 
 static const hwaddr aspeed_ast1700_io_memmap[] = {
+    [ASPEED_AST1700_DEV_SPI0]      =  0x00030000,
     [ASPEED_AST1700_DEV_SRAM]      =  0x00BC0000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
+    [ASPEED_AST1700_DEV_SPI0_MEM]  =  0x04000000,
 };
 
 static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
@@ -33,6 +38,11 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
     char dev_name[32];
 
+    if (!s->dram_mr) {
+        error_setg(errp, TYPE_ASPEED_AST1700 ": 'dram' link not set");
+        return;
+    }
+
     /* Occupy memory space for all controllers in AST1700 */
     memory_region_init(&s->iomem, OBJECT(s), TYPE_ASPEED_AST1700,
                        AST2700_SOC_LTPI_SIZE);
@@ -57,6 +67,20 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                         aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_UART12],
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0));
 
+    /* SPI */
+    object_property_set_link(OBJECT(&s->spi), "dram",
+                             OBJECT(s->dram_mr), errp);
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi), 0));
+
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0_MEM],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi), 1));
+
     /* LTPI controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
         return;
@@ -74,6 +98,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
     object_initialize_child(obj, "uart[*]", &s->uart,
                             TYPE_SERIAL_MM);
 
+    /* SPI */
+    object_initialize_child(obj, "ioexp-spi[*]", &s->spi,
+                            "aspeed.spi0-ast2700");
+
     /* LTPI controller */
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
@@ -83,6 +111,8 @@ static void aspeed_ast1700_instance_init(Object *obj)
 
 static const Property aspeed_ast1700_props[] = {
     DEFINE_PROP_UINT8("board-idx", AspeedAST1700SoCState, board_idx, 0),
+    DEFINE_PROP_LINK("dram", AspeedAST1700SoCState, dram_mr,
+                     TYPE_MEMORY_REGION, MemoryRegion *),
 };
 
 static void aspeed_ast1700_class_init(ObjectClass *klass, const void *data)
hw/arm/aspeed_ast27x0.c +2 -0
index 6933d03fbf..158f44782b 100644
@@ -1022,6 +1022,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
     /* IO Expander */
     for (i = 0; i < sc->ioexp_num; i++) {
         qdev_prop_set_uint8(DEVICE(&s->ioexp[i]), "board-idx", i);
+        object_property_set_link(OBJECT(&s->ioexp[i]), "dram",
+                                 OBJECT(s->dram_mr), &error_abort);
         if (!sysbus_realize(SYS_BUS_DEVICE(&s->ioexp[i]), errp)) {
             return;
         }
Signature · 1 line
2.43.0
#15 lore raw

PATCH v5 11/22 hw/arm/aspeed: Attach ADC device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the ADC device to AST1700 model.

---
 include/hw/arm/aspeed_ast1700.h |  2 ++
 hw/arm/aspeed_ast1700.c         | 14 ++++++++++++++
 hw/arm/aspeed_ast27x0.c         |  4 ++++
 3 files changed, 20 insertions(+)
include/hw/arm/aspeed_ast1700.h +2 -0
index 89562eb64f..441655cee7 100644
@@ -9,6 +9,7 @@
 #define ASPEED_AST1700_H
 
 #include "hw/core/sysbus.h"
+#include "hw/adc/aspeed_adc.h"
 #include "hw/misc/aspeed_ltpi.h"
 #include "hw/ssi/aspeed_smc.h"
 #include "hw/char/serial-mm.h"
@@ -28,6 +29,7 @@ struct AspeedAST1700SoCState {
     SerialMM uart;
     MemoryRegion sram;
     AspeedSMCState spi;
+    AspeedADCState adc;
 };
 
 #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +14 -0
index 49f9b67c91..3b3cd9c585 100644
@@ -19,6 +19,7 @@
 enum {
     ASPEED_AST1700_DEV_SPI0,
     ASPEED_AST1700_DEV_SRAM,
+    ASPEED_AST1700_DEV_ADC,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
     ASPEED_AST1700_DEV_SPI0_MEM,
@@ -27,6 +28,7 @@ enum {
 static const hwaddr aspeed_ast1700_io_memmap[] = {
     [ASPEED_AST1700_DEV_SPI0]      =  0x00030000,
     [ASPEED_AST1700_DEV_SRAM]      =  0x00BC0000,
+    [ASPEED_AST1700_DEV_ADC]       =  0x00C00000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
     [ASPEED_AST1700_DEV_SPI0_MEM]  =  0x04000000,
@@ -81,6 +83,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                         aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0_MEM],
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi), 1));
 
+    /* ADC */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->adc), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_ADC],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->adc), 0));
+
     /* LTPI controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
         return;
@@ -102,6 +112,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
     object_initialize_child(obj, "ioexp-spi[*]", &s->spi,
                             "aspeed.spi0-ast2700");
 
+    /* ADC */
+    object_initialize_child(obj, "ioexp-adc[*]", &s->adc,
+                            "aspeed.adc-ast2700");
+
     /* LTPI controller */
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
hw/arm/aspeed_ast27x0.c +4 -0
index 158f44782b..9b5383dfea 100644
@@ -1044,6 +1044,10 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
             sysbus_connect_irq(SYS_BUS_DEVICE(&a->intcioexp[i]), j,
                                irq);
         }
+
+        /* ADC */
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->ioexp[i].adc), 0,
+                           aspeed_soc_ast2700_get_irq(s, ASPEED_DEV_ADC));
     }
 
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
Signature · 1 line
2.43.0
#16 lore raw

PATCH v5 12/22 hw/arm/aspeed: Attach SCU device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the SCU device to AST1700 model.

---
 include/hw/arm/aspeed_ast1700.h |  3 +++
 hw/arm/aspeed_ast1700.c         | 17 +++++++++++++++++
 hw/arm/aspeed_ast27x0.c         |  2 ++
 3 files changed, 22 insertions(+)
include/hw/arm/aspeed_ast1700.h +3 -0
index 441655cee7..65f1497a2d 100644
@@ -9,6 +9,7 @@
 #define ASPEED_AST1700_H
 
 #include "hw/core/sysbus.h"
+#include "hw/misc/aspeed_scu.h"
 #include "hw/adc/aspeed_adc.h"
 #include "hw/misc/aspeed_ltpi.h"
 #include "hw/ssi/aspeed_smc.h"
@@ -24,12 +25,14 @@ struct AspeedAST1700SoCState {
     MemoryRegion iomem;
     MemoryRegion *dram_mr;
     uint8_t board_idx;
+    uint32_t silicon_rev;
 
     AspeedLTPIState ltpi;
     SerialMM uart;
     MemoryRegion sram;
     AspeedSMCState spi;
     AspeedADCState adc;
+    AspeedSCUState scu;
 };
 
 #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +17 -0
index 3b3cd9c585..82f4568af9 100644
@@ -20,6 +20,7 @@ enum {
     ASPEED_AST1700_DEV_SPI0,
     ASPEED_AST1700_DEV_SRAM,
     ASPEED_AST1700_DEV_ADC,
+    ASPEED_AST1700_DEV_SCU,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
     ASPEED_AST1700_DEV_SPI0_MEM,
@@ -29,6 +30,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
     [ASPEED_AST1700_DEV_SPI0]      =  0x00030000,
     [ASPEED_AST1700_DEV_SRAM]      =  0x00BC0000,
     [ASPEED_AST1700_DEV_ADC]       =  0x00C00000,
+    [ASPEED_AST1700_DEV_SCU]       =  0x00C02000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
     [ASPEED_AST1700_DEV_SPI0_MEM]  =  0x04000000,
@@ -91,6 +93,16 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                         aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_ADC],
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->adc), 0));
 
+    /* SCU */
+    qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev",
+                         s->silicon_rev);
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SCU],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->scu), 0));
+
     /* LTPI controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
         return;
@@ -116,6 +128,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
     object_initialize_child(obj, "ioexp-adc[*]", &s->adc,
                             "aspeed.adc-ast2700");
 
+    /* SCU */
+    object_initialize_child(obj, "ioexp-scu[*]", &s->scu,
+                            TYPE_ASPEED_2700_SCU);
+
     /* LTPI controller */
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
@@ -125,6 +141,7 @@ static void aspeed_ast1700_instance_init(Object *obj)
 
 static const Property aspeed_ast1700_props[] = {
     DEFINE_PROP_UINT8("board-idx", AspeedAST1700SoCState, board_idx, 0),
+    DEFINE_PROP_UINT32("silicon-rev", AspeedAST1700SoCState, silicon_rev, 0),
     DEFINE_PROP_LINK("dram", AspeedAST1700SoCState, dram_mr,
                      TYPE_MEMORY_REGION, MemoryRegion *),
 };
hw/arm/aspeed_ast27x0.c +2 -0
index 9b5383dfea..dc7a5b8677 100644
@@ -506,6 +506,8 @@ static void aspeed_soc_ast2700_init(Object *obj)
         /* AST1700 IOEXP */
         object_initialize_child(obj, "ioexp[*]", &s->ioexp[i],
                                 TYPE_ASPEED_AST1700);
+        qdev_prop_set_uint32(DEVICE(&s->ioexp[i]), "silicon-rev",
+                             sc->silicon_rev);
     }
 
     object_initialize_child(obj, "dpmcu", &s->dpmcu,
Signature · 1 line
2.43.0
#17 lore raw

PATCH v5 13/22 hw/arm/aspeed: Attach GPIO device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the GPIO controller to the AST1700 model by mapping its MMIO region and wiring its interrupt line.

---
 include/hw/arm/aspeed_ast1700.h |  2 ++
 hw/arm/aspeed_ast1700.c         | 14 ++++++++++++++
 hw/arm/aspeed_ast27x0.c         |  5 +++++
 3 files changed, 21 insertions(+)
include/hw/arm/aspeed_ast1700.h +2 -0
index 65f1497a2d..63cfcb4c24 100644
@@ -11,6 +11,7 @@
 #include "hw/core/sysbus.h"
 #include "hw/misc/aspeed_scu.h"
 #include "hw/adc/aspeed_adc.h"
+#include "hw/gpio/aspeed_gpio.h"
 #include "hw/misc/aspeed_ltpi.h"
 #include "hw/ssi/aspeed_smc.h"
 #include "hw/char/serial-mm.h"
@@ -33,6 +34,7 @@ struct AspeedAST1700SoCState {
     AspeedSMCState spi;
     AspeedADCState adc;
     AspeedSCUState scu;
+    AspeedGPIOState gpio;
 };
 
 #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +14 -0
index 82f4568af9..c7eaf583e2 100644
@@ -21,6 +21,7 @@ enum {
     ASPEED_AST1700_DEV_SRAM,
     ASPEED_AST1700_DEV_ADC,
     ASPEED_AST1700_DEV_SCU,
+    ASPEED_AST1700_DEV_GPIO,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
     ASPEED_AST1700_DEV_SPI0_MEM,
@@ -31,6 +32,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
     [ASPEED_AST1700_DEV_SRAM]      =  0x00BC0000,
     [ASPEED_AST1700_DEV_ADC]       =  0x00C00000,
     [ASPEED_AST1700_DEV_SCU]       =  0x00C02000,
+    [ASPEED_AST1700_DEV_GPIO]      =  0x00C0B000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
     [ASPEED_AST1700_DEV_SPI0_MEM]  =  0x04000000,
@@ -103,6 +105,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                         aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SCU],
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->scu), 0));
 
+    /* GPIO */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_GPIO],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0));
+
     /* LTPI controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
         return;
@@ -132,6 +142,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
     object_initialize_child(obj, "ioexp-scu[*]", &s->scu,
                             TYPE_ASPEED_2700_SCU);
 
+    /* GPIO */
+    object_initialize_child(obj, "ioexp-gpio[*]", &s->gpio,
+                            "aspeed.gpio-ast2700");
+
     /* LTPI controller */
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
hw/arm/aspeed_ast27x0.c +5 -0
index dc7a5b8677..58977e2fa3 100644
@@ -1050,6 +1050,11 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
         /* ADC */
         sysbus_connect_irq(SYS_BUS_DEVICE(&s->ioexp[i].adc), 0,
                            aspeed_soc_ast2700_get_irq(s, ASPEED_DEV_ADC));
+
+        /* GPIO */
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->ioexp[i].gpio), 0,
+                           aspeed_soc_ast2700_get_irq(s, ASPEED_DEV_GPIO));
+
     }
 
     aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
Signature · 1 line
2.43.0
#18 lore raw

PATCH v5 14/22 hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

The AST2700 SoC can be integrated with multiple AST1700 IO expanders. Without unique identifiers, the I2C bus object names for the primary BMC SoC and multiple expander chips may collide in the QOM (QEMU Object Model) tree.

To resolve this, introduce a bus-label property to the AST1700 SoC. This allows the parent SoC (AST2700) to assign a unique prefix (e.g., "ioexp0", "ioexp1") to each AST1700 instance. These labels ensure that the bus naming hierarchy remains distinct and traceable across different expanders.

---
 include/hw/arm/aspeed_ast1700.h | 1 +
 hw/arm/aspeed_ast1700.c         | 1 +
 hw/arm/aspeed_ast27x0.c         | 3 +++
 3 files changed, 5 insertions(+)
include/hw/arm/aspeed_ast1700.h +1 -0
index 63cfcb4c24..d364203175 100644
@@ -27,6 +27,7 @@ struct AspeedAST1700SoCState {
     MemoryRegion *dram_mr;
     uint8_t board_idx;
     uint32_t silicon_rev;
+    char *bus_label;
 
     AspeedLTPIState ltpi;
     SerialMM uart;
hw/arm/aspeed_ast1700.c +1 -0
index c7eaf583e2..0f2d2c381d 100644
@@ -156,6 +156,7 @@ static void aspeed_ast1700_instance_init(Object *obj)
 static const Property aspeed_ast1700_props[] = {
     DEFINE_PROP_UINT8("board-idx", AspeedAST1700SoCState, board_idx, 0),
     DEFINE_PROP_UINT32("silicon-rev", AspeedAST1700SoCState, silicon_rev, 0),
+    DEFINE_PROP_STRING("bus-label", AspeedAST1700SoCState, bus_label),
     DEFINE_PROP_LINK("dram", AspeedAST1700SoCState, dram_mr,
                      TYPE_MEMORY_REGION, MemoryRegion *),
 };
hw/arm/aspeed_ast27x0.c +3 -0
index 58977e2fa3..b4b5afe6d3 100644
@@ -503,11 +503,14 @@ static void aspeed_soc_ast2700_init(Object *obj)
     }
 
     for (i = 0; i < sc->ioexp_num; i++) {
+        g_autofree char *bus_label = g_strdup_printf("ioexp%d", i);
         /* AST1700 IOEXP */
         object_initialize_child(obj, "ioexp[*]", &s->ioexp[i],
                                 TYPE_ASPEED_AST1700);
         qdev_prop_set_uint32(DEVICE(&s->ioexp[i]), "silicon-rev",
                              sc->silicon_rev);
+        qdev_prop_set_string(DEVICE(&s->ioexp[i]), "bus-label",
+                             bus_label);
     }
 
     object_initialize_child(obj, "dpmcu", &s->dpmcu,
Signature · 1 line
2.43.0
#19 lore raw

Re: [PATCH v5 14/22] hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC

Quoted 13 lines · Kane Chen via

From: Kane-Chen-AS <[email protected]>

The AST2700 SoC can be integrated with multiple AST1700 IO expanders. Without unique identifiers, the I2C bus object names for the primary BMC SoC and multiple expander chips may collide in the QOM (QEMU Object Model) tree.

To resolve this, introduce a bus-label property to the AST1700 SoC. This allows the parent SoC (AST2700) to assign a unique prefix (e.g., "ioexp0", "ioexp1") to each AST1700 instance. These labels ensure that the bus naming hierarchy remains distinct and traceable across different expanders.

Quoted 6 lines
---
  include/hw/arm/aspeed_ast1700.h | 1 +
  hw/arm/aspeed_ast1700.c         | 1 +
  hw/arm/aspeed_ast27x0.c         | 3 +++
  3 files changed, 5 insertions(+)

I don't think this change is needed.

Setting the AspeedI2CState "bus-label" property in aspeed_ast1700_realize() should be sufficient.

Thanks,

C.

#20 lore raw

RE: [PATCH v5 14/22] hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC

Quoted 33 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Monday, January 26, 2026 4:45 PM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v5 14/22] hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC

Quoted 13 lines · Kane Chen via

From: Kane-Chen-AS <[email protected]>

The AST2700 SoC can be integrated with multiple AST1700 IO expanders. Without unique identifiers, the I2C bus object names for the primary BMC SoC and multiple expander chips may collide in the QOM (QEMU Object Model) tree.

To resolve this, introduce a bus-label property to the AST1700 SoC. This allows the parent SoC (AST2700) to assign a unique prefix (e.g., "ioexp0", "ioexp1") to each AST1700 instance. These labels ensure that the bus naming hierarchy remains distinct and traceable across different expanders.

Quoted 6 lines
---
  include/hw/arm/aspeed_ast1700.h | 1 +
  hw/arm/aspeed_ast1700.c         | 1 +
  hw/arm/aspeed_ast27x0.c         | 3 +++
  3 files changed, 5 insertions(+)
Quoted 8 lines

I don't think this change is needed.

Setting the AspeedI2CState "bus-label" property in aspeed_ast1700_realize() should be sufficient.

Thanks,

C.

Hi Cédric,

Understood. I will drop this change in the next patch series. Thanks.

Best Regards,
Kane

#21 lore raw

PATCH v5 15/22 hw/arm/aspeed: attach I2C device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the I2C controller to the AST1700 model by mapping its MMIO region and wiring its interrupt line.

---
 include/hw/arm/aspeed_ast1700.h |  2 ++
 include/hw/arm/aspeed_soc.h     |  2 ++
 hw/arm/aspeed_ast1700.c         | 22 ++++++++++++++
 hw/arm/aspeed_ast27x0.c         | 51 +++++++++++++++++++++++++++++++--
 4 files changed, 74 insertions(+), 3 deletions(-)
include/hw/arm/aspeed_ast1700.h +2 -0
index d364203175..7b68b23a84 100644
@@ -12,6 +12,7 @@
 #include "hw/misc/aspeed_scu.h"
 #include "hw/adc/aspeed_adc.h"
 #include "hw/gpio/aspeed_gpio.h"
+#include "hw/i2c/aspeed_i2c.h"
 #include "hw/misc/aspeed_ltpi.h"
 #include "hw/ssi/aspeed_smc.h"
 #include "hw/char/serial-mm.h"
@@ -36,6 +37,7 @@ struct AspeedAST1700SoCState {
     AspeedADCState adc;
     AspeedSCUState scu;
     AspeedGPIOState gpio;
+    AspeedI2CState i2c;
 };
 
 #endif /* ASPEED_AST1700_H */
include/hw/arm/aspeed_soc.h +2 -0
index b051d0eb3a..4ea2521041 100644
@@ -290,6 +290,8 @@ enum {
     ASPEED_DEV_LTPI_CTRL2,
     ASPEED_DEV_LTPI_IO0,
     ASPEED_DEV_LTPI_IO1,
+    ASPEED_DEV_IOEXP0_I2C,
+    ASPEED_DEV_IOEXP1_I2C,
     ASPEED_DEV_IOEXP0_INTCIO,
     ASPEED_DEV_IOEXP1_INTCIO,
 };
hw/arm/aspeed_ast1700.c +22 -0
index 0f2d2c381d..ce43fd8988 100644
@@ -22,6 +22,7 @@ enum {
     ASPEED_AST1700_DEV_ADC,
     ASPEED_AST1700_DEV_SCU,
     ASPEED_AST1700_DEV_GPIO,
+    ASPEED_AST1700_DEV_I2C,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
     ASPEED_AST1700_DEV_SPI0_MEM,
@@ -33,6 +34,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
     [ASPEED_AST1700_DEV_ADC]       =  0x00C00000,
     [ASPEED_AST1700_DEV_SCU]       =  0x00C02000,
     [ASPEED_AST1700_DEV_GPIO]      =  0x00C0B000,
+    [ASPEED_AST1700_DEV_I2C]       =  0x00C0F000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
     [ASPEED_AST1700_DEV_SPI0_MEM]  =  0x04000000,
@@ -113,6 +115,22 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                         aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_GPIO],
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gpio), 0));
 
+    /* I2C */
+    if (s->bus_label) {
+        qdev_prop_set_string(DEVICE(&s->i2c), "bus-label", s->bus_label);
+    } else {
+        snprintf(dev_name, sizeof(dev_name), "ioexp%d.i2c.bus", s->board_idx);
+        qdev_prop_set_string(DEVICE(&s->i2c), "bus-label", dev_name);
+    }
+    object_property_set_link(OBJECT(&s->i2c), "dram",
+                             OBJECT(s->dram_mr), errp);
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->i2c), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I2C],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->i2c), 0));
+
     /* LTPI controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
         return;
@@ -146,6 +164,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
     object_initialize_child(obj, "ioexp-gpio[*]", &s->gpio,
                             "aspeed.gpio-ast2700");
 
+    /* I2C */
+    object_initialize_child(obj, "ioexp-i2c[*]", &s->i2c,
+                            "aspeed.i2c-ast2700");
+
     /* LTPI controller */
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
hw/arm/aspeed_ast27x0.c +48 -3

95 lines not on this page · raw message

Signature · 1 line
2.43.0
#22 lore raw

PATCH v5 16/22 hw/arm/aspeed: Attach WDT device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the WDT device to AST1700 model.

---
 include/hw/arm/aspeed_ast1700.h |  4 ++++
 hw/arm/aspeed_ast1700.c         | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
include/hw/arm/aspeed_ast1700.h +4 -0
index 7b68b23a84..a830392798 100644
@@ -15,8 +15,11 @@
 #include "hw/i2c/aspeed_i2c.h"
 #include "hw/misc/aspeed_ltpi.h"
 #include "hw/ssi/aspeed_smc.h"
+#include "hw/watchdog/wdt_aspeed.h"
 #include "hw/char/serial-mm.h"
 
+#define AST1700_WDT_NUM              9
+
 #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
 
 OBJECT_DECLARE_SIMPLE_TYPE(AspeedAST1700SoCState, ASPEED_AST1700)
@@ -38,6 +41,7 @@ struct AspeedAST1700SoCState {
     AspeedSCUState scu;
     AspeedGPIOState gpio;
     AspeedI2CState i2c;
+    AspeedWDTState wdt[AST1700_WDT_NUM];
 };
 
 #endif /* ASPEED_AST1700_H */
hw/arm/aspeed_ast1700.c +24 -0
index ce43fd8988..94e0110501 100644
@@ -25,6 +25,7 @@ enum {
     ASPEED_AST1700_DEV_I2C,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
+    ASPEED_AST1700_DEV_WDT,
     ASPEED_AST1700_DEV_SPI0_MEM,
 };
 
@@ -37,6 +38,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
     [ASPEED_AST1700_DEV_I2C]       =  0x00C0F000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
+    [ASPEED_AST1700_DEV_WDT]       =  0x00C37000,
     [ASPEED_AST1700_DEV_SPI0_MEM]  =  0x04000000,
 };
 
@@ -138,6 +140,22 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
     memory_region_add_subregion(&s->iomem,
                         aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL],
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0));
+    /* WDT */
+    for (int i = 0; i < AST1700_WDT_NUM; i++) {
+        AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
+        hwaddr wdt_offset = aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_WDT] +
+                            i * awc->iosize;
+
+        object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
+                                 errp);
+        if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
+            return;
+        }
+        memory_region_add_subregion(&s->iomem,
+                        wdt_offset,
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->wdt[i]), 0));
+    }
+
 }
 
 static void aspeed_ast1700_instance_init(Object *obj)
@@ -172,6 +190,12 @@ static void aspeed_ast1700_instance_init(Object *obj)
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
 
+    /* WDT */
+    for (int i = 0; i < AST1700_WDT_NUM; i++) {
+        object_initialize_child(obj, "ioexp-wdt[*]",
+                                &s->wdt[i], "aspeed.wdt-ast2700");
+    }
+
     return;
 }
 
Signature · 1 line
2.43.0
#23 lore raw

PATCH v5 17/22 hw/arm/aspeed: Attach PWM device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the PWM device to AST1700 model.

---
 include/hw/arm/aspeed_ast1700.h |  2 ++
 hw/arm/aspeed_ast1700.c         | 13 +++++++++++++
 2 files changed, 15 insertions(+)
include/hw/arm/aspeed_ast1700.h +2 -0
index a830392798..5fc363d0c2 100644
@@ -14,6 +14,7 @@
 #include "hw/gpio/aspeed_gpio.h"
 #include "hw/i2c/aspeed_i2c.h"
 #include "hw/misc/aspeed_ltpi.h"
+#include "hw/misc/aspeed_pwm.h"
 #include "hw/ssi/aspeed_smc.h"
 #include "hw/watchdog/wdt_aspeed.h"
 #include "hw/char/serial-mm.h"
@@ -41,6 +42,7 @@ struct AspeedAST1700SoCState {
     AspeedSCUState scu;
     AspeedGPIOState gpio;
     AspeedI2CState i2c;
+    AspeedPWMState pwm;
     AspeedWDTState wdt[AST1700_WDT_NUM];
 };
 
hw/arm/aspeed_ast1700.c +13 -0
index 94e0110501..108804f35b 100644
@@ -18,6 +18,7 @@
 
 enum {
     ASPEED_AST1700_DEV_SPI0,
+    ASPEED_AST1700_DEV_PWM,
     ASPEED_AST1700_DEV_SRAM,
     ASPEED_AST1700_DEV_ADC,
     ASPEED_AST1700_DEV_SCU,
@@ -31,6 +32,7 @@ enum {
 
 static const hwaddr aspeed_ast1700_io_memmap[] = {
     [ASPEED_AST1700_DEV_SPI0]      =  0x00030000,
+    [ASPEED_AST1700_DEV_PWM]       =  0x000C0000,
     [ASPEED_AST1700_DEV_SRAM]      =  0x00BC0000,
     [ASPEED_AST1700_DEV_ADC]       =  0x00C00000,
     [ASPEED_AST1700_DEV_SCU]       =  0x00C02000,
@@ -133,6 +135,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                         aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I2C],
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->i2c), 0));
 
+    /* PWM */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->pwm), errp)) {
+        return;
+    }
+    memory_region_add_subregion(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_PWM],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->pwm), 0));
+
     /* LTPI controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
         return;
@@ -186,6 +196,9 @@ static void aspeed_ast1700_instance_init(Object *obj)
     object_initialize_child(obj, "ioexp-i2c[*]", &s->i2c,
                             "aspeed.i2c-ast2700");
 
+    /* PWM */
+    object_initialize_child(obj, "pwm", &s->pwm, TYPE_ASPEED_PWM);
+
     /* LTPI controller */
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
Signature · 1 line
2.43.0
#24 lore raw

PATCH v5 18/22 hw/arm/aspeed: Attach SGPIOM device to AST1700 model

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Connect the SGPIOM device to AST1700 model.

---
 include/hw/arm/aspeed_ast1700.h |  3 +++
 hw/arm/aspeed_ast1700.c         | 21 +++++++++++++++++++++
 2 files changed, 24 insertions(+)
include/hw/arm/aspeed_ast1700.h +3 -0
index 5fc363d0c2..c50987fc76 100644
@@ -12,6 +12,7 @@
 #include "hw/misc/aspeed_scu.h"
 #include "hw/adc/aspeed_adc.h"
 #include "hw/gpio/aspeed_gpio.h"
+#include "hw/gpio/aspeed_sgpio.h"
 #include "hw/i2c/aspeed_i2c.h"
 #include "hw/misc/aspeed_ltpi.h"
 #include "hw/misc/aspeed_pwm.h"
@@ -19,6 +20,7 @@
 #include "hw/watchdog/wdt_aspeed.h"
 #include "hw/char/serial-mm.h"
 
+#define AST1700_SGPIO_NUM            2
 #define AST1700_WDT_NUM              9
 
 #define TYPE_ASPEED_AST1700 "aspeed.ast1700"
@@ -41,6 +43,7 @@ struct AspeedAST1700SoCState {
     AspeedADCState adc;
     AspeedSCUState scu;
     AspeedGPIOState gpio;
+    AspeedSGPIOState sgpiom[AST1700_SGPIO_NUM];
     AspeedI2CState i2c;
     AspeedPWMState pwm;
     AspeedWDTState wdt[AST1700_WDT_NUM];
hw/arm/aspeed_ast1700.c +21 -0
index 108804f35b..06c35a3a36 100644
@@ -23,6 +23,8 @@ enum {
     ASPEED_AST1700_DEV_ADC,
     ASPEED_AST1700_DEV_SCU,
     ASPEED_AST1700_DEV_GPIO,
+    ASPEED_AST1700_DEV_SGPIOM0,
+    ASPEED_AST1700_DEV_SGPIOM1,
     ASPEED_AST1700_DEV_I2C,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
@@ -37,6 +39,8 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
     [ASPEED_AST1700_DEV_ADC]       =  0x00C00000,
     [ASPEED_AST1700_DEV_SCU]       =  0x00C02000,
     [ASPEED_AST1700_DEV_GPIO]      =  0x00C0B000,
+    [ASPEED_AST1700_DEV_SGPIOM0]   =  0x00C0C000,
+    [ASPEED_AST1700_DEV_SGPIOM1]   =  0x00C0D000,
     [ASPEED_AST1700_DEV_I2C]       =  0x00C0F000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
@@ -150,6 +154,17 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
     memory_region_add_subregion(&s->iomem,
                         aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_LTPI_CTRL],
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ltpi), 0));
+
+    /* SGPIOM */
+    for (int i = 0; i < AST1700_SGPIO_NUM; i++) {
+        if (!sysbus_realize(SYS_BUS_DEVICE(&s->sgpiom[i]), errp)) {
+            return;
+        }
+        memory_region_add_subregion(&s->iomem,
+                    aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SGPIOM0 + i],
+                    sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sgpiom[i]), 0));
+    }
+
     /* WDT */
     for (int i = 0; i < AST1700_WDT_NUM; i++) {
         AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
@@ -203,6 +218,12 @@ static void aspeed_ast1700_instance_init(Object *obj)
     object_initialize_child(obj, "ltpi-ctrl",
                             &s->ltpi, TYPE_ASPEED_LTPI);
 
+    /* SGPIOM */
+    for (int i = 0; i < AST1700_SGPIO_NUM; i++) {
+        object_initialize_child(obj, "ioexp-sgpiom[*]", &s->sgpiom[i],
+                                "aspeed.sgpio-ast2700");
+    }
+
     /* WDT */
     for (int i = 0; i < AST1700_WDT_NUM; i++) {
         object_initialize_child(obj, "ioexp-wdt[*]",
Signature · 1 line
2.43.0
#25 lore raw

PATCH v5 19/22 hw/arm/aspeed: Model AST1700 I3C block as unimplemented device

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

AST1700 exposes more I3C buses than the current dummy I3C model provides. When Linux probes the I3C devices on AST1700 this mismatch can trigger a kernel panic. Model the I3C block as an unimplemented device to make the missing functionality explicit and avoid unexpected side effects.

This wires up the I3C interrupt lines for the IO expanders and adds the corresponding device entries for the AST1700 model.

No functional I3C emulation is provided yet; this only prevents crashes and documents the missing piece.

---
 include/hw/arm/aspeed_ast1700.h |  3 +++
 include/hw/arm/aspeed_soc.h     |  2 ++
 hw/arm/aspeed_ast1700.c         | 15 +++++++++++++++
 hw/arm/aspeed_ast27x0.c         | 18 ++++++++++++++++--
 4 files changed, 36 insertions(+), 2 deletions(-)
include/hw/arm/aspeed_ast1700.h +3 -0
index c50987fc76..af2445f4cd 100644
@@ -19,6 +19,7 @@
 #include "hw/ssi/aspeed_smc.h"
 #include "hw/watchdog/wdt_aspeed.h"
 #include "hw/char/serial-mm.h"
+#include "hw/misc/unimp.h"
 
 #define AST1700_SGPIO_NUM            2
 #define AST1700_WDT_NUM              9
@@ -47,6 +48,8 @@ struct AspeedAST1700SoCState {
     AspeedI2CState i2c;
     AspeedPWMState pwm;
     AspeedWDTState wdt[AST1700_WDT_NUM];
+
+    UnimplementedDeviceState i3c;
 };
 
 #endif /* ASPEED_AST1700_H */
include/hw/arm/aspeed_soc.h +2 -0
index 4ea2521041..b185b04186 100644
@@ -294,6 +294,8 @@ enum {
     ASPEED_DEV_IOEXP1_I2C,
     ASPEED_DEV_IOEXP0_INTCIO,
     ASPEED_DEV_IOEXP1_INTCIO,
+    ASPEED_DEV_IOEXP0_I3C,
+    ASPEED_DEV_IOEXP1_I3C,
 };
 
 const char *aspeed_soc_cpu_type(const char * const *valid_cpu_types);
hw/arm/aspeed_ast1700.c +15 -0
index 06c35a3a36..0b6fdee208 100644
@@ -15,6 +15,7 @@
 
 #define AST2700_SOC_LTPI_SIZE        0x01000000
 #define AST1700_SOC_SRAM_SIZE        0x00040000
+#define AST1700_SOC_I3C_SIZE         0x00010000
 
 enum {
     ASPEED_AST1700_DEV_SPI0,
@@ -26,6 +27,7 @@ enum {
     ASPEED_AST1700_DEV_SGPIOM0,
     ASPEED_AST1700_DEV_SGPIOM1,
     ASPEED_AST1700_DEV_I2C,
+    ASPEED_AST1700_DEV_I3C,
     ASPEED_AST1700_DEV_UART12,
     ASPEED_AST1700_DEV_LTPI_CTRL,
     ASPEED_AST1700_DEV_WDT,
@@ -42,6 +44,7 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
     [ASPEED_AST1700_DEV_SGPIOM0]   =  0x00C0C000,
     [ASPEED_AST1700_DEV_SGPIOM1]   =  0x00C0D000,
     [ASPEED_AST1700_DEV_I2C]       =  0x00C0F000,
+    [ASPEED_AST1700_DEV_I3C]       =  0x00C20000,
     [ASPEED_AST1700_DEV_UART12]    =  0x00C33B00,
     [ASPEED_AST1700_DEV_LTPI_CTRL] =  0x00C34000,
     [ASPEED_AST1700_DEV_WDT]       =  0x00C37000,
@@ -181,6 +184,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                         sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->wdt[i]), 0));
     }
 
+    /* I3C */
+    qdev_prop_set_string(DEVICE(&s->i3c), "name", "ioexp-i3c");
+    qdev_prop_set_uint64(DEVICE(&s->i3c), "size", AST1700_SOC_I3C_SIZE);
+    sysbus_realize(SYS_BUS_DEVICE(&s->i3c), errp);
+    memory_region_add_subregion_overlap(&s->iomem,
+                        aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I3C],
+                        sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->i3c), 0),
+                        -1000);
 }
 
 static void aspeed_ast1700_instance_init(Object *obj)
@@ -230,6 +241,10 @@ static void aspeed_ast1700_instance_init(Object *obj)
                                 &s->wdt[i], "aspeed.wdt-ast2700");
     }
 
+    /* I3C */
+    object_initialize_child(obj, "ioexp-i3c[*]", &s->i3c,
+                            TYPE_UNIMPLEMENTED_DEVICE);
+
     return;
 }
 
hw/arm/aspeed_ast27x0.c +16 -2
index ca35a11291..bad2028bc9 100644
@@ -156,7 +156,9 @@ static const int aspeed_soc_ast2700a1_irqmap[] = {
     [ASPEED_DEV_PECI]      = 197,
     [ASPEED_DEV_SDHCI]     = 197,
     [ASPEED_DEV_IOEXP0_I2C] = 198,
+    [ASPEED_DEV_IOEXP0_I3C] = 199,
     [ASPEED_DEV_IOEXP1_I2C] = 200,
+    [ASPEED_DEV_IOEXP1_I3C] = 201,
 };
 
 /* GICINT 192 */
@@ -219,12 +221,24 @@ static const int ast2700_gic198_intcmap[] = {
     [ASPEED_DEV_IOEXP0_I2C]       = 0, /* 0 - 15 */
 };
 
+/* Primary AST1700 Interrupts */
+/* A1: GINTC 199 */
+static const int ast2700_gic199_intcmap[] = {
+    [ASPEED_DEV_IOEXP0_I3C]       = 0, /* 0 - 15 */
+};
+
 /* Secondary AST1700 Interrupts */
 /* A1: GINTC 200 */
 static const int ast2700_gic200_intcmap[] = {
     [ASPEED_DEV_IOEXP1_I2C]       = 0, /* 0 - 15 */
 };
 
+/* Secondary AST1700 Interrupts */
+/* A1: GINTC 201 */
+static const int ast2700_gic201_intcmap[] = {
+    [ASPEED_DEV_IOEXP1_I3C]       = 0, /* 0 - 15 */
+};
+
 /* GICINT 192 ~ 201 */
 struct gic_intc_irq_info {
     int irq;
@@ -241,9 +255,9 @@ static const struct gic_intc_irq_info ast2700_gic_intcmap[] = {
     {196, 1, 4, ast2700_gic196_intcmap},
     {197, 1, 5, ast2700_gic197_intcmap},
     {198, 2, 0, ast2700_gic198_intcmap},
-    {199, 1, 7, NULL},
+    {199, 2, 1, ast2700_gic199_intcmap},
     {200, 3, 0, ast2700_gic200_intcmap},
-    {201, 1, 9, NULL},
+    {201, 3, 1, ast2700_gic201_intcmap},
 };
 
 static qemu_irq aspeed_soc_ast2700_get_irq(AspeedSoCState *s, int dev)
Signature · 1 line
2.43.0
#26 lore raw

PATCH v5 20/22 hw/arm/aspeed: Enable AST1700 IO expander support

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Set ioexp_num to 2 to enable AST1700 IO expander support.

---
 hw/arm/aspeed_ast27x0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/aspeed_ast27x0.c +1 -1
index bad2028bc9..8118522d7e 100644
@@ -1161,7 +1161,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, const void *data)
     sc->macs_num     = 3;
     sc->uarts_num    = 13;
     sc->num_cpus     = 4;
-    sc->ioexp_num    = 0;
+    sc->ioexp_num    = 2;
     sc->uarts_base   = ASPEED_DEV_UART0;
     sc->irqmap       = aspeed_soc_ast2700a1_irqmap;
     sc->memmap       = aspeed_soc_ast2700_memmap;
Signature · 1 line
2.43.0
#27 lore raw

PATCH v5 21/22 test/functional/aarch64: Parameterize I2C bus ID in AST2700 test

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

The current Aspeed AST2700 functional test case strictly uses I2C bus 1 for its sensor tests. This hard-coded approach prevents the test logic from being reused for other machine types or configurations where I2C bus 1 might be disabled or where a different bus needs to be verified (e.g., I2C expanders).

This refactoring allows the same I2C verification logic to be shared across different test scenarios by simply passing the target bus number.

---
 .../functional/aarch64/test_aspeed_ast2700.py | 28 ++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)
tests/functional/aarch64/test_aspeed_ast2700.py +15 -13
index 0ced1a2502..438f7eb37c 100755
@@ -15,11 +15,12 @@
 
 class AST2x00MachineSDK(QemuSystemTest):
 
-    def do_test_aarch64_aspeed_sdk_start(self, image):
+    def do_test_aarch64_aspeed_sdk_start(self, image, bus_id):
+        bus_str = str(bus_id)
         self.require_netdev('user')
         self.vm.set_console()
         self.vm.add_args('-device',
-                         'tmp105,bus=aspeed.i2c.bus.1,address=0x4d,id=tmp-test')
+                         f'tmp105,bus=aspeed.i2c.bus.{bus_str},address=0x4d,id=tmp-test-{bus_str}')
         self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
                          '-net', 'nic', '-net', 'user', '-snapshot')
 
@@ -53,16 +54,17 @@ def verify_openbmc_boot_and_login(self, name):
             'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.08/ast2700-default-obmc.tar.gz',
             'eac3dc409b7ea3cd4b03d4792d3cebd469792ad893cb51e1d15f0fc20bd1e2cd')
 
-    def do_ast2700_i2c_test(self):
+    def do_ast2700_i2c_test(self, bus_id):
+        bus_str = str(bus_id)
         exec_command_and_wait_for_pattern(self,
-            'echo lm75 0x4d > /sys/class/i2c-dev/i2c-1/device/new_device ',
-            'i2c i2c-1: new_device: Instantiated device lm75 at 0x4d')
+            f'echo lm75 0x4d > /sys/class/i2c-dev/i2c-{bus_str}/device/new_device ',
+            f'i2c i2c-{bus_str}: new_device: Instantiated device lm75 at 0x4d')
         exec_command_and_wait_for_pattern(self,
-            'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '0')
-        self.vm.cmd('qom-set', path='/machine/peripheral/tmp-test',
+            f'cat /sys/bus/i2c/devices/{bus_str}-004d/hwmon/hwmon*/temp1_input', '0')
+        self.vm.cmd('qom-set', path=f'/machine/peripheral/tmp-test-{bus_str}',
                     property='temperature', value=18000)
         exec_command_and_wait_for_pattern(self,
-            'cat /sys/bus/i2c/devices/1-004d/hwmon/hwmon*/temp1_input', '18000')
+            f'cat /sys/bus/i2c/devices/{bus_str}-004d/hwmon/hwmon*/temp1_input', '18000')
 
     def do_ast2700_pcie_test(self):
         exec_command_and_wait_for_pattern(self,
@@ -116,12 +118,12 @@ def start_ast2700_test(self, name):
 
         self.vm.add_args('-smp', str(num_cpu))
         self.do_test_aarch64_aspeed_sdk_start(
-            self.scratch_file(name, 'image-bmc'))
+            self.scratch_file(name, 'image-bmc'), 1)
 
-    def start_ast2700_test_vbootrom(self, name):
+    def start_ast2700_test_vbootrom(self, name, bus_id):
         self.vm.add_args('-bios', 'ast27x0_bootrom.bin')
         self.do_test_aarch64_aspeed_sdk_start(
-                self.scratch_file(name, 'image-bmc'))
+                self.scratch_file(name, 'image-bmc'), bus_id)
 
     def test_aarch64_ast2700a1_evb_sdk_v09_08(self):
         self.set_machine('ast2700a1-evb')
@@ -132,7 +134,7 @@ def test_aarch64_ast2700a1_evb_sdk_v09_08(self):
         self.vm.add_args('-netdev', 'user,id=net1')
         self.start_ast2700_test('ast2700-default')
         self.verify_openbmc_boot_and_login('ast2700-default')
-        self.do_ast2700_i2c_test()
+        self.do_ast2700_i2c_test(1)
         self.do_ast2700_pcie_test()
 
     def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_08(self):
@@ -142,7 +144,7 @@ def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_08(self):
         self.archive_extract(self.ASSET_SDK_V908_AST2700A1)
         self.vm.add_args('-device', 'e1000e,netdev=net1,bus=pcie.2')
         self.vm.add_args('-netdev', 'user,id=net1')
-        self.start_ast2700_test_vbootrom('ast2700-default')
+        self.start_ast2700_test_vbootrom('ast2700-default', 1)
         self.verify_vbootrom_firmware_flow()
         self.verify_openbmc_boot_start()
 
Signature · 1 line
2.43.0
#28 lore raw

PATCH v5 22/22 test/functional/aarch64: Add I2C test for AST1700 IO expanders

In reply to Kane Chen via

From: Kane-Chen-AS <[email protected]>

Extend the AST2700 test suite to verify I2C connectivity on AST1700 IO expanders using the DCSCM image. This validates the new bus-label naming scheme by testing communication on both primary and expander-attached I2C buses.

---
 .../functional/aarch64/test_aspeed_ast2700.py | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
tests/functional/aarch64/test_aspeed_ast2700.py +24 -0
index 438f7eb37c..f2bdac5177 100755
@@ -50,10 +50,21 @@ def verify_openbmc_boot_and_login(self, name):
         exec_command_and_wait_for_pattern(self, 'root', 'Password:')
         exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#')
 
+    def bring_up_ast1700_and_login(self, name):
+        wait_for_console_pattern(self, 'Hit any key to stop autoboot')
+        exec_command_and_wait_for_pattern(self, '0', '=>')
+        exec_command_and_wait_for_pattern(self, 'cp.b 100420000 403000000 800000; bootm 403000000#conf-ast2700-dcscm_ast1700-evb.dtb', f'{name} login:')
+        exec_command_and_wait_for_pattern(self, 'root', 'Password:')
+        exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#')
+
     ASSET_SDK_V908_AST2700A1 = Asset(
             'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.08/ast2700-default-obmc.tar.gz',
             'eac3dc409b7ea3cd4b03d4792d3cebd469792ad893cb51e1d15f0fc20bd1e2cd')
 
+    ASSET_SDK_V908_AST2700A1_DCSCM = Asset(
+            'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.08/ast2700-dcscm-obmc.tar.gz',
+            '59dc1282db886087342419824edf91806bb4f83febf916ec5350238aa5613268')
+
     def do_ast2700_i2c_test(self, bus_id):
         bus_str = str(bus_id)
         exec_command_and_wait_for_pattern(self,
@@ -148,5 +159,18 @@ def test_aarch64_ast2700a1_evb_sdk_vbootrom_v09_08(self):
         self.verify_vbootrom_firmware_flow()
         self.verify_openbmc_boot_start()
 
+    def test_aarch64_ast2700a1_evb_ioexp_v09_08(self):
+        self.set_machine('ast2700a1-evb')
+        self.require_netdev('user')
+
+        self.archive_extract(self.ASSET_SDK_V908_AST2700A1_DCSCM)
+        self.vm.set_machine('ast2700a1-evb,fmc-model=w25q512jv')
+        self.vm.add_args('-device',
+                         'tmp105,bus=ioexp0.0,address=0x4d,id=tmp-test-16')
+        self.start_ast2700_test_vbootrom('ast2700-dcscm', 8)
+        self.bring_up_ast1700_and_login('ast2700-dcscm')
+        self.do_ast2700_i2c_test(8)
+        self.do_ast2700_i2c_test(16)
+
 if __name__ == '__main__':
     QemuSystemTest.main()
Signature · 1 line
2.43.0
#29 lore raw
In reply to Kane Chen via

Kane, Jamin,

For some reason, I don't receive your proposals anymore. My provider seems to drop silently these emails. Have you changed anything recently ?

Thanks,

C.

Quoted 130 lines · Kane Chen via qemu development

From: Kane-Chen-AS <[email protected]>

Hi all,

LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM 2.0 specification (see Figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdf

LTPI provides a protocol and physical interface for tunneling various low-speed signals between the Host Processor Module (HPM) and the Satellite Controller Module (SCM). In Figure 2 of the specification, the AST27x0 SoC (left) integrates two LTPI controllers, allowing it to connect to up to two AST1700 boards. On the other side, the AST1700 consolidates HPM FPGA functions and multiple peripheral interfaces (GPIO, UART, I2C, I3C, etc.) onto a single board.

Because the AST1700 exposes additional I/O interfaces (GPIO, I2C, I3C, and others), it acts as an I/O expander. Once connected over LTPI, the AST27x0 can control additional downstream devices through this link.

This patch series is based on the aspeed_next branch and incorporates
recent I2C bus label changes.
Ref: https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/

It introduces a basic LTPI controller model and wires it into the AST27x0 SoC. The series also adds the AST1700-specific LTPI expander device and incrementally connects common peripherals on the AST1700 model. For the I3C block, which may cause kernel crashes, its MMIO region is modeled as an unimplemented device to reserve address space and make the missing functionality explicit, ensuring stable guest probing.

In the official release images, the AST1700 functions are not included by default. To test the AST1700-related functionality, please include the following DTS files for probing:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi0.dtsi
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/arm64/boot/dts/aspeed/aspeed-ltpi1.dtsi

After including these DTS files in the BMC image, you can verify LTPI functionality using the following scenarios:

1. In U-Boot:
Run the ltpi command to trigger the LTPI connection and display the current connection status.
2. In BMC Linux:
Run i2cdetect -y <16-38> to scan and test the I2C buses exposed by the AST1700.

Any feedback or suggestions are appreciated!

Kane

---

ChangeLog
---------
v5:
- Add functional test case for AST1700 I2C
- Corrected the From attribution
- Fixed incorrect DRAM setting for SPI and I2C controllers
- Refine code structure

v4:
- Add missing Signed-off-by
- Fix checkpatch.pl warnings
- Refine code structure
- Enable AST1700 support only after all devices are ready

v3:
- Add PWM model
- Integrate the SGPIO model
- Fix I2C test case failure
- Refine code structure

v2:
- Separate the AST1700 model into a standalone implementation
- Refine the mechanism for assigning the AST1700 board number

v1:
- Initial version
---

Cédric Le Goater (1):
hw/misc: Add basic Aspeed PWM model

Kane-Chen-AS (21):
hw/misc: Add LTPI controller
hw/arm/aspeed: Attach LTPI controller to AST27X0 platform hw/arm/aspeed: Add AST1700 LTPI expander device model hw/arm/aspeed: Integrate AST1700 device into AST27X0 hw/arm/aspeed: Integrate interrupt controller for AST1700 hw/arm/aspeed: Attach LTPI controller to AST1700 model hw/arm/aspeed: Attach UART device to AST1700 model hw/arm/aspeed: Attach SRAM device to AST1700 model hw/arm/aspeed: Attach SPI device to AST1700 model hw/arm/aspeed: Attach ADC device to AST1700 model hw/arm/aspeed: Attach SCU device to AST1700 model hw/arm/aspeed: Attach GPIO device to AST1700 model hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC hw/arm/aspeed: attach I2C device to AST1700 model hw/arm/aspeed: Attach WDT device to AST1700 model hw/arm/aspeed: Attach PWM device to AST1700 model hw/arm/aspeed: Attach SGPIOM device to AST1700 model hw/arm/aspeed: Model AST1700 I3C block as unimplemented device hw/arm/aspeed: Enable AST1700 IO expander support test/functional/aarch64: Parameterize I2C bus ID in AST2700 test test/functional/aarch64: Add I2C test for AST1700 IO expanders

  include/hw/arm/aspeed_ast1700.h               |  55 ++++
  include/hw/arm/aspeed_soc.h                   |  25 +-
  include/hw/intc/aspeed_intc.h                 |   2 +
  include/hw/misc/aspeed_ltpi.h                 |  33 +++
  include/hw/misc/aspeed_pwm.h                  |  31 ++
  hw/arm/aspeed_ast1700.c                       | 280 ++++++++++++++++++
  hw/arm/aspeed_ast27x0.c                       | 170 ++++++++++-
  hw/intc/aspeed_intc.c                         |  60 ++++
  hw/misc/aspeed_ltpi.c                         | 193 ++++++++++++
  hw/misc/aspeed_pwm.c                          | 121 ++++++++
  hw/arm/meson.build                            |   1 +
  hw/misc/meson.build                           |   2 +
  hw/misc/trace-events                          |   4 +
  .../functional/aarch64/test_aspeed_ast2700.py |  52 +++-
  14 files changed, 999 insertions(+), 30 deletions(-)

create mode 100644 include/hw/arm/aspeed_ast1700.h create mode 100644 include/hw/misc/aspeed_ltpi.h create mode 100644 include/hw/misc/aspeed_pwm.h create mode 100644 hw/arm/aspeed_ast1700.c create mode 100644 hw/misc/aspeed_ltpi.c create mode 100644 hw/misc/aspeed_pwm.c

#30 lore raw

Hi Cédric

Quoted 12 lines

From: Cédric Le Goater <[email protected]>
Sent: Wednesday, January 21, 2026 12:09 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v5 00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups

Quoted 5 lines

Kane, Jamin,

For some reason, I don't receive your proposals anymore. My provider seems to drop silently these emails. Have you changed anything recently ?

The following patch series are ready for review.
[v1,00/11] Add SSP/TSP power control and DRAM remap support for AST2700
https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/
[v5,00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups
https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/
[PULL,SUBSYSTEM,vbootrom,v3,0/1] Update vbootrom image to commit 1c8e9510b22c
https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/
[PULL,1/1] pc-bios: Update vbootrom image to commit 1c8e9510b22c
https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/

Thanks-Jamin

Quoted 142 lines

Thanks,

C.

Quoted 113 lines · Kane Chen via qemu development

From: Kane-Chen-AS <[email protected]>

Hi all,

LTPI (LVDS Tunneling Protocol & Interface) is defined in the OCP DC-SCM
2.0 specification (see Figure 2):
https://www.opencompute.org/documents/ocp-dc-scm-2-0-ltpi-ver-1-0-pdf

LTPI provides a protocol and physical interface for tunneling various low-speed signals between the Host Processor Module (HPM) and the Satellite Controller Module (SCM). In Figure 2 of the specification, the AST27x0 SoC (left) integrates two LTPI controllers, allowing it to connect to up to two AST1700 boards. On the other side, the AST1700 consolidates HPM FPGA functions and multiple peripheral interfaces (GPIO, UART, I2C, I3C, etc.) onto a single board.

Because the AST1700 exposes additional I/O interfaces (GPIO, I2C, I3C, and others), it acts as an I/O expander. Once connected over LTPI, the AST27x0 can control additional downstream devices through this link.

This patch series is based on the aspeed_next branch and incorporates recent I2C bus label changes.
Ref:
https://patchwork.kernel.org/project/qemu-devel/patch/20260112083054.4
[email protected]/

It introduces a basic LTPI controller model and wires it into the AST27x0 SoC. The series also adds the AST1700-specific LTPI expander device and incrementally connects common peripherals on the AST1700 model. For the I3C block, which may cause kernel crashes, its MMIO region is modeled as an unimplemented device to reserve address space and make the missing functionality explicit, ensuring stable guest probing.

In the official release images, the AST1700 functions are not included by default. To test the AST1700-related functionality, please include the following DTS files for probing:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/a
rm64/boot/dts/aspeed/aspeed-ltpi0.dtsi
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v6.6/arch/a
rm64/boot/dts/aspeed/aspeed-ltpi1.dtsi

After including these DTS files in the BMC image, you can verify LTPI functionality using the following scenarios:

1. In U-Boot:
Run the ltpi command to trigger the LTPI connection and display the current connection status.
2. In BMC Linux:
Run i2cdetect -y <16-38> to scan and test the I2C buses exposed by the AST1700.

Any feedback or suggestions are appreciated!

Kane

---

ChangeLog
---------
v5:
- Add functional test case for AST1700 I2C
- Corrected the From attribution
- Fixed incorrect DRAM setting for SPI and I2C controllers
- Refine code structure

v4:
- Add missing Signed-off-by
- Fix checkpatch.pl warnings
- Refine code structure
- Enable AST1700 support only after all devices are ready

v3:
- Add PWM model
- Integrate the SGPIO model
- Fix I2C test case failure
- Refine code structure

v2:
- Separate the AST1700 model into a standalone implementation
- Refine the mechanism for assigning the AST1700 board number

v1:
- Initial version
---

Cédric Le Goater (1):
hw/misc: Add basic Aspeed PWM model

Kane-Chen-AS (21):
hw/misc: Add LTPI controller
hw/arm/aspeed: Attach LTPI controller to AST27X0 platform hw/arm/aspeed: Add AST1700 LTPI expander device model hw/arm/aspeed: Integrate AST1700 device into AST27X0 hw/arm/aspeed: Integrate interrupt controller for AST1700 hw/arm/aspeed: Attach LTPI controller to AST1700 model hw/arm/aspeed: Attach UART device to AST1700 model hw/arm/aspeed: Attach SRAM device to AST1700 model hw/arm/aspeed: Attach SPI device to AST1700 model hw/arm/aspeed: Attach ADC device to AST1700 model hw/arm/aspeed: Attach SCU device to AST1700 model hw/arm/aspeed: Attach GPIO device to AST1700 model hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC hw/arm/aspeed: attach I2C device to AST1700 model hw/arm/aspeed: Attach WDT device to AST1700 model hw/arm/aspeed: Attach PWM device to AST1700 model hw/arm/aspeed: Attach SGPIOM device to AST1700 model hw/arm/aspeed: Model AST1700 I3C block as unimplemented device hw/arm/aspeed: Enable AST1700 IO expander support test/functional/aarch64: Parameterize I2C bus ID in AST2700 test test/functional/aarch64: Add I2C test for AST1700 IO expanders

Quoted 6 lines
  include/hw/arm/aspeed_ast1700.h               |  55 ++++
  include/hw/arm/aspeed_soc.h                   |  25 +-
  include/hw/intc/aspeed_intc.h                 |   2 +
  include/hw/misc/aspeed_ltpi.h                 |  33 +++
  include/hw/misc/aspeed_pwm.h                  |  31 ++
  hw/arm/aspeed_ast1700.c                       | 280

++++++++++++++++++

Quoted 3 lines
  hw/arm/aspeed_ast27x0.c                       | 170 ++++++++++-
  hw/intc/aspeed_intc.c                         |  60 ++++
  hw/misc/aspeed_ltpi.c                         | 193

++++++++++++

Quoted 13 lines
  hw/misc/aspeed_pwm.c                          | 121 ++++++++
  hw/arm/meson.build                            |   1 +
  hw/misc/meson.build                           |   2 +
  hw/misc/trace-events                          |   4 +
  .../functional/aarch64/test_aspeed_ast2700.py |  52 +++-
  14 files changed, 999 insertions(+), 30 deletions(-)

create mode 100644 include/hw/arm/aspeed_ast1700.h create mode 100644 include/hw/misc/aspeed_ltpi.h create mode 100644 include/hw/misc/aspeed_pwm.h create mode 100644 hw/arm/aspeed_ast1700.c create mode 100644 hw/misc/aspeed_ltpi.c create mode 100644 hw/misc/aspeed_pwm.c

#31 lore raw

Hi Cédric,

I worked with our IT team to investigate the mail delivery issue. We identified that the mail server used for sending the patch series was missing DKIM (DomainKeys Identified Mail) signatures. We believe this is why the emails were being flagged as [SPAM].

We are currently enabling DKIM on the server and expect this to resolve the issue once the configuration is complete.

Best regards,
Kane

#32 lore raw
Quoted 9 lines · Kane Chen

Hi Cédric,

I worked with our IT team to investigate the mail delivery issue. We identified that the mail server used for sending the patch series was missing DKIM (DomainKeys Identified Mail) signatures. We believe this is why the emails were being flagged as [SPAM].

We are currently enabling DKIM on the server and expect this to resolve the issue once the configuration is complete.

Thanks for looking !

C.

#33 lore raw
In reply to Jamin Lin

Hello Jamin,

Quoted 19 lines · Jamin Lin

Hi Cédric

Quoted 17 lines

From: Cédric Le Goater <[email protected]>
Sent: Wednesday, January 21, 2026 12:09 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v5 00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups

Kane, Jamin,

For some reason, I don't receive your proposals anymore. My provider seems to drop silently these emails. Have you changed anything recently ?

Thanks for the info.

Quoted 3 lines

The following patch series are ready for review.
[v1,00/11] Add SSP/TSP power control and DRAM remap support for AST2700
https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/

I am seeing a 'make check' issue with this one. A 'dram' property link is missing.

Quoted 2 lines

[v5,00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups
https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/

There is a discussion in progress about the bus naming. Not a blocker but it's worth a bit of thinking.

Quoted 4 lines

[PULL,SUBSYSTEM,vbootrom,v3,0/1] Update vbootrom image to commit 1c8e9510b22c
https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/
[PULL,1/1] pc-bios: Update vbootrom image to commit 1c8e9510b22c
https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/

The above 3 series I plan to include in the next Aspeed PR.

What about the I3C series ? Could you take ownership ?

Thanks,

C.

#34 lore raw

+ Nabih, Joe

Hi Cédric,

Quoted 62 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, January 23, 2026 2:04 PM
To: Jamin Lin <[email protected]>; Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v5 00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups

Hello Jamin,

Quoted 19 lines · Jamin Lin

Hi Cédric

Quoted 17 lines

From: Cédric Le Goater <[email protected]>
Sent: Wednesday, January 21, 2026 12:09 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v5 00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups

Kane, Jamin,

For some reason, I don't receive your proposals anymore. My provider seems to drop silently these emails. Have you changed anything recently ?

Thanks for the info.

Quoted 5 lines

The following patch series are ready for review. [v1,00/11] Add SSP/TSP power control and DRAM remap support for AST2700
https://patchwork.kernel.org/project/qemu-devel/cover/20260120092939.2
[email protected]/

I am seeing a 'make check' issue with this one. A 'dram' property link is missing.

Quoted 3 lines

[v5,00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups
https://patchwork.kernel.org/project/qemu-devel/cover/20260120051859.1
[email protected]/

There is a discussion in progress about the bus naming. Not a blocker but it's worth a bit of thinking.

Quoted 7 lines

[PULL,SUBSYSTEM,vbootrom,v3,0/1] Update vbootrom image to commit 1c8e9510b22c
https://patchwork.kernel.org/project/qemu-devel/patch/20260116093249.4
[email protected]/ [PULL,1/1] pc-bios: Update vbootrom image to commit 1c8e9510b22c
https://patchwork.kernel.org/project/qemu-devel/patch/20260116093249.4
[email protected]/

Quoted 4 lines

The above 3 series I plan to include in the next Aspeed PR.

What about the I3C series ? Could you take ownership ?

I will discuss this with Joe and Nabih first.
If they agree, I am willing to take ownership of the I3C upstream work starting from v2.

Thanks,
Jamin

Quoted 3 lines

Thanks,

C.

#35 lore raw

Hi Cédric,

Quoted 74 lines

Subject: RE: [PATCH v5 00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups

+ Nabih, Joe

Hi Cédric,

Quoted 13 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Sent: Friday, January 23, 2026 2:04 PM
To: Jamin Lin <[email protected]>; Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>; open list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v5 00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups

Quoted 12 lines

Hello Jamin,

Quoted 9 lines · Jamin Lin

Hi Cédric

Quoted 7 lines

From: Cédric Le Goater <[email protected]>
Sent: Wednesday, January 21, 2026 12:09 AM
To: Kane Chen <[email protected]>; Peter Maydell <[email protected]>; Steven Lee <[email protected]>; Troy Lee <[email protected]>; Jamin Lin <[email protected]>; Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>; open list:ASPEED BMCs <[email protected]>;

open

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

list:All patches CC here <[email protected]>
Cc: Troy Lee <[email protected]>
Subject: Re: [PATCH v5 00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups

Kane, Jamin,

For some reason, I don't receive your proposals anymore. My provider seems to drop silently these emails. Have you changed anything

recently ?

Quoted 31 lines
Quoted 1 line
Quoted 1 line

Thanks for the info.

Quoted 6 lines

The following patch series are ready for review. [v1,00/11] Add SSP/TSP power control and DRAM remap support for AST2700
https://patchwork.kernel.org/project/qemu-devel/cover/20260120092939
.2
[email protected]/

I am seeing a 'make check' issue with this one. A 'dram' property link is missing.

Quoted 4 lines

[v5,00/22] hw/arm/aspeed: AST1700 LTPI support and device hookups
https://patchwork.kernel.org/project/qemu-devel/cover/20260120051859
.1
[email protected]/

There is a discussion in progress about the bus naming. Not a blocker but it's worth a bit of thinking.

Quoted 8 lines

[PULL,SUBSYSTEM,vbootrom,v3,0/1] Update vbootrom image to commit 1c8e9510b22c
https://patchwork.kernel.org/project/qemu-devel/patch/20260116093249
.4 [email protected]/ [PULL,1/1] pc-bios: Update vbootrom image to commit 1c8e9510b22c
https://patchwork.kernel.org/project/qemu-devel/patch/20260116093249
.4
[email protected]/

Quoted 8 lines
Quoted 4 lines

The above 3 series I plan to include in the next Aspeed PR.

What about the I3C series ? Could you take ownership ?

I will discuss this with Joe and Nabih first.
If they agree, I am willing to take ownership of the I3C upstream work starting from v2.

Joe and Nabih (GOOGLE) have agreed that I will take ownership of the I3C upstream work.

I am currently updating the function tests for AST2700 A1 to version 11.00, and will then proceed with upstream support for AST2700 A2. After completing these tasks, I plan to resend the I3C v2 series, with an estimated timeline around mid-February.

Thanks-Jamin

Quoted 7 lines

Thanks,
Jamin

Quoted 3 lines

Thanks,

C.

#36 lore raw

Hi Cédric, Joe, Nabih

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

What about the I3C series ? Could you take ownership ?

I will discuss this with Joe and Nabih first.
If they agree, I am willing to take ownership of the I3C upstream work starting from v2.

Joe and Nabih (GOOGLE) have agreed that I will take ownership of the I3C upstream work.

Quoted 7 lines

I am currently updating the function tests for AST2700 A1 to version 11.00, and will then proceed with upstream support for AST2700 A2.
After completing these tasks, I plan to resend the I3C v2 series, with an estimated timeline around mid-February.

Thanks-Jamin

I have sent the I3C v2 patch series here:
https://patchew.org/QEMU/[email protected]/

Thanks
Jamin

Quoted 7 lines
Quoted 7 lines

Thanks,
Jamin

Quoted 3 lines

Thanks,

C.