All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Jamin Lin" <jamin_lin@aspeedtech.com>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 06/34] hw/arm/aspeed_ast1040: Add FMC and SPI controllers
Date: Sat, 31 Oct 2026 07:57:55 +0100	[thread overview]
Message-ID: <20261031065823.191966-7-clg@redhat.com> (raw)
In-Reply-To: <20261031065823.191966-1-clg@redhat.com>

From: Jamin Lin <jamin_lin@aspeedtech.com>

Add the FMC, SPI0 and SPI1 controllers to the AST1040 SoC. Map their
register and flash memory regions, connect their interrupts, and link
the DMA DRAM region to internal Hyper RAM.

The AST1040 supports two SPI controllers, SPI0 and SPI1.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-7-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 hw/arm/aspeed_ast1040.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/hw/arm/aspeed_ast1040.c b/hw/arm/aspeed_ast1040.c
index 0b078f10c403..6e3b6900e0fb 100644
--- a/hw/arm/aspeed_ast1040.c
+++ b/hw/arm/aspeed_ast1040.c
@@ -103,7 +103,9 @@ static void aspeed_soc_ast1040_init(Object *obj)
     Aspeed10x0SoCState *a = ASPEED10X0_SOC(obj);
     AspeedSoCState *s = ASPEED_SOC(obj);
     AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
+    char typename[64];
     int i;
+
     object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
 
     s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
@@ -132,6 +134,13 @@ static void aspeed_soc_ast1040_init(Object *obj)
         object_initialize_child(obj, "wdt[*]", &s->wdt[i],
                                 "aspeed.wdt-ast2700");
     }
+
+    object_initialize_child(obj, "fmc", &s->fmc, "aspeed.fmc-ast1040");
+
+    for (i = 0; i < sc->spis_num; i++) {
+        snprintf(typename, sizeof(typename), "aspeed.spi%d-ast1040", i);
+        object_initialize_child(obj, "spi[*]", &s->spi[i], typename);
+    }
 }
 
 static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
@@ -268,6 +277,34 @@ static void aspeed_soc_ast1040_realize(DeviceState *dev_soc, Error **errp)
         aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset);
     }
 
+    /* FMC, The number of CS is set at the board level */
+    object_property_set_link(OBJECT(&s->fmc), "dram", OBJECT(&s->sram[1]),
+            &error_abort);
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->fmc), errp)) {
+        return;
+    }
+    aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->fmc), 0,
+                    sc->memmap[ASPEED_DEV_FMC]);
+    aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->fmc), 1,
+                    ASPEED_SMC_GET_CLASS(&s->fmc)->flash_window_base);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
+                       aspeed_soc_ast1040_get_irq(s, ASPEED_DEV_FMC));
+
+    /* SPI */
+    for (i = 0; i < sc->spis_num; i++) {
+        object_property_set_link(OBJECT(&s->spi[i]), "dram",
+                                 OBJECT(&s->sram[1]), &error_abort);
+        if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), errp)) {
+            return;
+        }
+        aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->spi[i]), 0,
+                        sc->memmap[ASPEED_DEV_SPI0 + i]);
+        aspeed_mmio_map(s->memory, SYS_BUS_DEVICE(&s->spi[i]), 1,
+                        ASPEED_SMC_GET_CLASS(&s->spi[i])->flash_window_base);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,
+                           aspeed_soc_ast1040_get_irq(s, ASPEED_DEV_SPI0 + i));
+    }
+
     /* Unimplemented devices */
     create_unimplemented_devices(OBJECT(s), s->memory, sc->unimp_devs);
 }
@@ -292,6 +329,7 @@ static void aspeed_soc_ast1040_class_init(ObjectClass *klass, const void *data)
     sc->uarts_num       = 13;
     sc->sgpio_num       = 2;
     sc->wdts_num        = 8;
+    sc->spis_num        = 2;
     sc->uarts_base      = ASPEED_DEV_UART0;
     sc->irqmap          = aspeed_soc_ast1040_irqmap;
     sc->memmap          = aspeed_soc_ast1040_memmap;
-- 
2.56.0



  parent reply	other threads:[~2026-10-31  7:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31  6:57 [PULL 00/34] aspeed queue Cédric Le Goater
2026-10-31  6:57 ` [PULL 01/34] hw/ssi/aspeed_smc: Fix AST2700 segment end address decoding Cédric Le Goater
2026-10-31  6:57 ` [PULL 02/34] hw/ssi/aspeed_smc: Fix AST2700 DMA flash address mask Cédric Le Goater
2026-10-31  6:57 ` [PULL 03/34] hw/block/m25p80: Add Winbond W25Q33PW flash Cédric Le Goater
2026-10-31  6:57 ` [PULL 04/34] hw/misc/aspeed_scu: Correct AST1040 A0 revision ID Cédric Le Goater
2026-10-31  6:57 ` [PULL 05/34] hw/ssi/aspeed_smc: Add AST1040 FMC and SPI controllers Cédric Le Goater
2026-10-31  6:57 ` Cédric Le Goater [this message]
2026-10-31  6:57 ` [PULL 07/34] hw/arm/aspeed_ast1040: Add FMC and SPI filters as unimplemented devices Cédric Le Goater
2026-10-31  6:57 ` [PULL 08/34] hw/arm/aspeed_ast1040: Add OTP as an unimplemented device Cédric Le Goater
2026-10-31  6:57 ` [PULL 09/34] hw/arm/aspeed_ast1040: Add Anti-Tamper Controller (ATC) " Cédric Le Goater
2026-10-31  6:57 ` [PULL 10/34] hw/arm/aspeed_ast1040: Add I3C " Cédric Le Goater
2026-10-31  6:58 ` [PULL 11/34] hw/arm/aspeed_ast1040: Add Caliptra " Cédric Le Goater
2026-10-31  6:58 ` [PULL 12/34] tests/qtest/aspeed_smc: Add AST1040 SMC tests Cédric Le Goater
2026-10-31  6:58 ` [PULL 13/34] tests/functional/arm/test_aspeed_ast1040: Update AST1040 image to aspeed-mcu-fw-hub v01.00 Cédric Le Goater
2026-10-31  6:58 ` [PULL 14/34] hw/arm/aspeed_ast1040: Add common init function for AST1040/AST1080 SoCs Cédric Le Goater
2026-10-31  6:58 ` [PULL 15/34] hw/arm/aspeed_ast1040: Add common realize " Cédric Le Goater
2026-10-31  6:58 ` [PULL 16/34] hw/misc/aspeed_scu: Add AST1080 A0 silicon revision definition Cédric Le Goater
2026-10-31  6:58 ` [PULL 17/34] hw/arm/aspeed_ast1040: Add AST1080 SoC support Cédric Le Goater
2026-10-31  6:58 ` [PULL 18/34] hw/arm/aspeed_ast1040: Add AST1080 QSPI filters as unimplemented device Cédric Le Goater
2026-10-31  6:58 ` [PULL 19/34] hw/arm/aspeed_ast1040: Add AST1080 I2C filter as an " Cédric Le Goater
2026-10-31  6:58 ` [PULL 20/34] hw/arm/aspeed_ast1040_evb: Add AST1080 EVB machine support Cédric Le Goater
2026-10-31  6:58 ` [PULL 21/34] tests/functional/arm/aspeed: Add AST1080 test with ASPEED MCU FW Hub v01.00 Cédric Le Goater
2026-10-31  6:58 ` [PULL 22/34] docs/system/arm/aspeed: Add AST1080 Platform Root of Trust evaluation board Cédric Le Goater
2026-10-31  6:58 ` [PULL 23/34] docs/system/arm/aspeed: add the catalina-bmc machine Cédric Le Goater
2026-10-31  6:58 ` [PULL 24/34] docs/system/arm/aspeed: add the sanmiguel-bmc machine Cédric Le Goater
2026-10-31  6:58 ` [PULL 25/34] hw/arm: sanmiguel: remove the second SPI flash controller Cédric Le Goater
2026-10-31  6:58 ` [PULL 26/34] hw/i2c: pca954x: drop unused header inclusions Cédric Le Goater
2026-10-31  6:58 ` [PULL 27/34] hw/i2c: pca954x: add PCA9545 4-channel mux model Cédric Le Goater
2026-10-31  6:58 ` [PULL 28/34] hw/i2c: pca954x: migrate mux state Cédric Le Goater
2026-10-31  6:58 ` [PULL 29/34] tests/qtest: pca9545: add mux test Cédric Le Goater
2026-10-31  6:58 ` [PULL 30/34] hw/rtc: ds1338: move TYPE_DS1338 to a public header Cédric Le Goater
2026-10-31  6:58 ` [PULL 31/34] hw: ds1338: use the TYPE_DS1338 constant instead of the "ds1338" string Cédric Le Goater
2026-10-31  6:58 ` [PULL 32/34] hw/rtc: ds1338: implement Resettable reset Cédric Le Goater
2026-10-31  6:58 ` [PULL 33/34] hw/rtc: ds1338: prefix the file-local helpers with ds1338_ Cédric Le Goater
2026-10-31  6:58 ` [PULL 34/34] hw/rtc: ds1338: parameterise the register map via a device class Cédric Le Goater

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=20261031065823.191966-7-clg@redhat.com \
    --to=clg@redhat.com \
    --cc=jamin_lin@aspeedtech.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.