qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kane Chen via <qemu-devel@nongnu.org>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Steven Lee" <steven_lee@aspeedtech.com>,
	"Troy Lee" <leetroy@gmail.com>,
	"Jamin Lin" <jamin_lin@aspeedtech.com>,
	"Andrew Jeffery" <andrew@codeconstruct.com.au>,
	"Joel Stanley" <joel@jms.id.au>,
	"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: <troy_lee@aspeedtech.com>, Kane-Chen-AS <kane_chen@aspeedtech.com>
Subject: [PATCH v3 02/18] hw/arm/aspeed: Attach LTPI controller to AST27X0 platform
Date: Mon, 8 Dec 2025 15:44:14 +0800	[thread overview]
Message-ID: <20251208074436.1871180-3-kane_chen@aspeedtech.com> (raw)
In-Reply-To: <20251208074436.1871180-1-kane_chen@aspeedtech.com>

From: Kane-Chen-AS <kane_chen@aspeedtech.com>

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.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
 include/hw/arm/aspeed_soc.h |  5 +++++
 hw/arm/aspeed_ast27x0.c     | 21 +++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index 18ff961a38..bca10c387b 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -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);
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index 70be3871bb..341b53189b 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -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,
@@ -556,6 +558,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,
@@ -1047,6 +1054,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],
-- 
2.43.0



  parent reply	other threads:[~2025-12-08  7:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-08  7:44 [PATCH v3 00/18] hw/arm/aspeed: AST1700 LTPI support and device hookups Kane Chen via
2025-12-08  7:44 ` [PATCH v3 01/18] hw/misc: Add LTPI controller Kane Chen via
2025-12-10 23:00   ` Nabih Estefan
2025-12-08  7:44 ` Kane Chen via [this message]
2025-12-10 23:00   ` [PATCH v3 02/18] hw/arm/aspeed: Attach LTPI controller to AST27X0 platform Nabih Estefan
2025-12-08  7:44 ` [PATCH v3 03/18] hw/misc: Add basic Aspeed PWM model Kane Chen via
2025-12-10 23:00   ` Nabih Estefan
2025-12-08  7:44 ` [PATCH v3 04/18] hw/arm/aspeed: Add AST1700 LTPI expander device model Kane Chen via
2025-12-08  7:44 ` [PATCH v3 05/18] hw/arm/aspeed: Integrate AST1700 device into AST27X0 Kane Chen via
2025-12-08  7:44 ` [PATCH v3 06/18] hw/arm/aspeed: Integrate interrupt controller for AST1700 Kane Chen via
2025-12-08 21:03   ` Nabih Estefan
2025-12-09  2:08     ` Kane Chen
2025-12-09  8:47       ` Cédric Le Goater
2025-12-08  7:44 ` [PATCH v3 07/18] hw/arm/aspeed: Attach LTPI controller to AST1700 model Kane Chen via
2025-12-08  7:44 ` [PATCH v3 08/18] hw/arm/aspeed: Attach UART device " Kane Chen via
2025-12-08  7:44 ` [PATCH v3 09/18] hw/arm/aspeed: Attach SRAM " Kane Chen via
2025-12-08  7:44 ` [PATCH v3 10/18] hw/arm/aspeed: Attach SPI " Kane Chen via
2025-12-08  7:44 ` [PATCH v3 11/18] hw/arm/aspeed: Attach ADC " Kane Chen via
2025-12-08  7:44 ` [PATCH v3 12/18] hw/arm/aspeed: Attach SCU " Kane Chen via
2025-12-08  7:44 ` [PATCH v3 13/18] hw/arm/aspeed: Attach GPIO " Kane Chen via
2025-12-08  7:44 ` [PATCH v3 14/18] hw/arm/aspeed: attach I2C " Kane Chen via
2025-12-10 23:01   ` Nabih Estefan
2025-12-08  7:44 ` [PATCH v3 15/18] hw/arm/aspeed: Attach WDT " Kane Chen via
2025-12-08  7:44 ` [PATCH v3 16/18] hw/arm/aspeed: Attach PWM " Kane Chen via
2025-12-08  7:44 ` [PATCH v3 17/18] hw/arm/aspeed: Attach SGPIOM " Kane Chen via
2025-12-08 18:21   ` Nabih Estefan
2025-12-09  8:49     ` Cédric Le Goater
2025-12-09 10:17       ` Kane Chen
2025-12-10  2:41       ` Jamin Lin
2025-12-08  7:44 ` [PATCH v3 18/18] hw/arm/aspeed: Model AST1700 I3C block as unimplemented device Kane Chen via
2025-12-08 18:23   ` Nabih Estefan
2025-12-09  8:51     ` Cédric Le Goater
2025-12-10 23:01 ` [PATCH v3 00/18] hw/arm/aspeed: AST1700 LTPI support and device hookups Nabih Estefan
2025-12-11  6:42   ` Kane Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251208074436.1871180-3-kane_chen@aspeedtech.com \
    --to=qemu-devel@nongnu.org \
    --cc=andrew@codeconstruct.com.au \
    --cc=clg@kaod.org \
    --cc=jamin_lin@aspeedtech.com \
    --cc=joel@jms.id.au \
    --cc=kane_chen@aspeedtech.com \
    --cc=leetroy@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=steven_lee@aspeedtech.com \
    --cc=troy_lee@aspeedtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).