qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Troy Lee" <troy_lee@aspeedtech.com>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 01/23] hw/arm: ast27x0: Wire up EHCI controllers
Date: Mon,  5 May 2025 11:06:13 +0200	[thread overview]
Message-ID: <20250505090635.778785-2-clg@redhat.com> (raw)
In-Reply-To: <20250505090635.778785-1-clg@redhat.com>

From: Troy Lee <troy_lee@aspeedtech.com>

AST27x0 has 4 EHCI controllers, where each CPU and I/O die has 2
instances. This patch use existing TYPE_PLATFORM_EHCI. After wiring up
the EHCI controller, the ast2700a1-evb can find up to 4 USB EHCI
interfaces.

ehci-platform 12061000.usb: EHCI Host Controller
ehci-platform 12061000.usb: new USB bus registered, assigned bus number 2
ehci-platform 12063000.usb: EHCI Host Controller
ehci-platform 12063000.usb: new USB bus registered, assigned bus number 3
ehci-platform 12061000.usb: irq 88, io mem 0x12061000
ehci-platform 12063000.usb: irq 90, io mem 0x12063000
ehci-platform 14121000.usb: EHCI Host Controller
ehci-platform 14123000.usb: EHCI Host Controller
ehci-platform 12061000.usb: USB 2.0 started, EHCI 1.00
ehci-platform 14121000.usb: new USB bus registered, assigned bus number 5
ehci-platform 14123000.usb: new USB bus registered, assigned bus number 6
ehci-platform 14121000.usb: irq 91, io mem 0x14121000
ehci-platform 14123000.usb: irq 92, io mem 0x14123000
ehci-platform 12063000.usb: USB 2.0 started, EHCI 1.00
usb usb2: Manufacturer: Linux 6.6.78-dirty-bafd2830c17c-gbafd2830c17c-dirty ehci_hcd
usb usb3: Manufacturer: Linux 6.6.78-dirty-bafd2830c17c-gbafd2830c17c-dirty ehci_hcd
ehci-platform 14121000.usb: USB 2.0 started, EHCI 1.00
usb usb5: Manufacturer: Linux 6.6.78-dirty-bafd2830c17c-gbafd2830c17c-dirty ehci_hcd
ehci-platform 14123000.usb: USB 2.0 started, EHCI 1.00
usb usb6: Manufacturer: Linux 6.6.78-dirty-bafd2830c17c-gbafd2830c17c-dirty ehci_hcd

Note that, AST27x0A0 only has 2 EHCI controllers due to hw issue.

Signed-off-by: Troy Lee <troy_lee@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250317065938.1902272-2-troy_lee@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 include/hw/arm/aspeed_soc.h |  4 +++-
 hw/arm/aspeed_ast27x0.c     | 28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index f069d17d1629..c1e80c8908b3 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -43,7 +43,7 @@
 #include "hw/intc/arm_gicv3.h"
 
 #define ASPEED_SPIS_NUM  3
-#define ASPEED_EHCIS_NUM 2
+#define ASPEED_EHCIS_NUM 4
 #define ASPEED_WDTS_NUM  8
 #define ASPEED_CPUS_NUM  4
 #define ASPEED_MACS_NUM  4
@@ -192,6 +192,8 @@ enum {
     ASPEED_DEV_SPI2,
     ASPEED_DEV_EHCI1,
     ASPEED_DEV_EHCI2,
+    ASPEED_DEV_EHCI3,
+    ASPEED_DEV_EHCI4,
     ASPEED_DEV_VIC,
     ASPEED_DEV_INTC,
     ASPEED_DEV_INTCIO,
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index 63a366f7e837..ea4a611b9068 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -25,6 +25,8 @@
 
 static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_SRAM]      =  0x10000000,
+    [ASPEED_DEV_EHCI1]     =  0x12061000,
+    [ASPEED_DEV_EHCI2]     =  0x12063000,
     [ASPEED_DEV_HACE]      =  0x12070000,
     [ASPEED_DEV_EMMC]      =  0x12090000,
     [ASPEED_DEV_INTC]      =  0x12100000,
@@ -47,6 +49,8 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {
     [ASPEED_DEV_ETH2]      =  0x14060000,
     [ASPEED_DEV_ETH3]      =  0x14070000,
     [ASPEED_DEV_SDHCI]     =  0x14080000,
+    [ASPEED_DEV_EHCI3]     =  0x14121000,
+    [ASPEED_DEV_EHCI4]     =  0x14123000,
     [ASPEED_DEV_ADC]       =  0x14C00000,
     [ASPEED_DEV_SCUIO]     =  0x14C02000,
     [ASPEED_DEV_GPIO]      =  0x14C0B000,
@@ -91,6 +95,8 @@ static const int aspeed_soc_ast2700a0_irqmap[] = {
     [ASPEED_DEV_TIMER7]    = 22,
     [ASPEED_DEV_TIMER8]    = 23,
     [ASPEED_DEV_DP]        = 28,
+    [ASPEED_DEV_EHCI1]     = 33,
+    [ASPEED_DEV_EHCI2]     = 37,
     [ASPEED_DEV_LPC]       = 128,
     [ASPEED_DEV_IBT]       = 128,
     [ASPEED_DEV_KCS]       = 128,
@@ -137,6 +143,8 @@ static const int aspeed_soc_ast2700a1_irqmap[] = {
     [ASPEED_DEV_TIMER7]    = 22,
     [ASPEED_DEV_TIMER8]    = 23,
     [ASPEED_DEV_DP]        = 28,
+    [ASPEED_DEV_EHCI1]     = 33,
+    [ASPEED_DEV_EHCI2]     = 37,
     [ASPEED_DEV_LPC]       = 192,
     [ASPEED_DEV_IBT]       = 192,
     [ASPEED_DEV_KCS]       = 192,
@@ -212,6 +220,8 @@ static const int ast2700_gic132_gic196_intcmap[] = {
     [ASPEED_DEV_UART10]    = 16,
     [ASPEED_DEV_UART11]    = 17,
     [ASPEED_DEV_UART12]    = 18,
+    [ASPEED_DEV_EHCI3]     = 28,
+    [ASPEED_DEV_EHCI4]     = 29,
 };
 
 /* GICINT 133 */
@@ -434,6 +444,11 @@ static void aspeed_soc_ast2700_init(Object *obj)
         object_initialize_child(obj, "spi[*]", &s->spi[i], typename);
     }
 
+    for (i = 0; i < sc->ehcis_num; i++) {
+        object_initialize_child(obj, "ehci[*]", &s->ehci[i],
+                                TYPE_PLATFORM_EHCI);
+    }
+
     snprintf(typename, sizeof(typename), "aspeed.sdmc-%s", socname);
     object_initialize_child(obj, "sdmc", &s->sdmc, typename);
     object_property_add_alias(obj, "ram-size", OBJECT(&s->sdmc),
@@ -709,6 +724,17 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
                         ASPEED_SMC_GET_CLASS(&s->spi[i])->flash_window_base);
     }
 
+    /* EHCI */
+    for (i = 0; i < sc->ehcis_num; i++) {
+        if (!sysbus_realize(SYS_BUS_DEVICE(&s->ehci[i]), errp)) {
+            return;
+        }
+        aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->ehci[i]), 0,
+                        sc->memmap[ASPEED_DEV_EHCI1 + i]);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0,
+                           aspeed_soc_get_irq(s, ASPEED_DEV_EHCI1 + i));
+    }
+
     /*
      * SDMC - SDRAM Memory Controller
      * The SDMC controller is unlocked at SPL stage.
@@ -900,6 +926,7 @@ static void aspeed_soc_ast2700a0_class_init(ObjectClass *oc, const void *data)
     sc->silicon_rev  = AST2700_A0_SILICON_REV;
     sc->sram_size    = 0x20000;
     sc->spis_num     = 3;
+    sc->ehcis_num    = 2;
     sc->wdts_num     = 8;
     sc->macs_num     = 1;
     sc->uarts_num    = 13;
@@ -927,6 +954,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, const void *data)
     sc->silicon_rev  = AST2700_A1_SILICON_REV;
     sc->sram_size    = 0x20000;
     sc->spis_num     = 3;
+    sc->ehcis_num    = 4;
     sc->wdts_num     = 8;
     sc->macs_num     = 3;
     sc->uarts_num    = 13;
-- 
2.49.0



  reply	other threads:[~2025-05-05  9:12 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05  9:06 [PULL 00/23] aspeed queue Cédric Le Goater
2025-05-05  9:06 ` Cédric Le Goater [this message]
2025-05-05  9:06 ` [PULL 02/23] hw/ssi/aspeed_smc: Allow 64-bit wide flash accesses Cédric Le Goater
2025-05-05  9:06 ` [PULL 03/23] tests/functional/aspeed: Update test ASPEED SDK v09.06 for AST2500 Cédric Le Goater
2025-05-05  9:06 ` [PULL 04/23] tests/functional/aspeed: Update test ASPEED SDK v09.06 for AST2600 Cédric Le Goater
2025-05-05  9:06 ` [PULL 05/23] tests/functional/aspeed: Update test ASPEED SDK v03.00 for AST1030 Cédric Le Goater
2025-05-05  9:06 ` [PULL 06/23] hw/arm/aspeed_ast27x0: Rename variable sram_name to name in ast2700 realize Cédric Le Goater
2025-05-05  9:06 ` [PULL 07/23] tests/functional/aspeed: Move I2C test into shared helper for AST2700 reuse Cédric Le Goater
2025-05-05  9:06 ` [PULL 08/23] tests/functional/aspeed: Update test ASPEED SDK v09.06 Cédric Le Goater
2025-05-05  9:06 ` [PULL 09/23] tests/functional/aspeed: extract boot and login sequence into helper function Cédric Le Goater
2025-05-05  9:06 ` [PULL 10/23] hw/arm/aspeed_ast27x0 Introduce vbootrom memory region Cédric Le Goater
2025-05-05  9:06 ` [PULL 11/23] hw/arm/aspeed: Add support for loading vbootrom image via "-bios" Cédric Le Goater
2025-05-05  9:06 ` [PULL 12/23] tests/functional/aspeed: Add to test vbootrom for AST2700 Cédric Le Goater
2025-05-05  9:06 ` [PULL 13/23] docs/system/arm/aspeed: move AST2700 content to new section Cédric Le Goater
2025-05-05  9:06 ` [PULL 14/23] docs/system/arm/aspeed: Support vbootrom for AST2700 Cédric Le Goater
2025-05-05  9:06 ` [PULL 15/23] aspeed: ast27x0: Map unimplemented devices in SoC memory Cédric Le Goater
2025-05-05  9:06 ` [PULL 16/23] aspeed: ast27x0: Correct hex notation for device addresses Cédric Le Goater
2025-05-05  9:06 ` [PULL 17/23] hw/intc/aspeed: Add support for AST2700 SSP INTC Cédric Le Goater
2025-05-05  9:06 ` [PULL 18/23] hw/intc/aspeed: Add support for AST2700 TSP INTC Cédric Le Goater
2025-05-05  9:06 ` [PULL 19/23] hw/arm/aspeed_ast27x0-ssp: Introduce AST27x0 A1 SSP SoC Cédric Le Goater
2025-05-05  9:06 ` [PULL 20/23] hw/arm/aspeed_ast27x0-tsp: Introduce AST27x0 A1 TSP SoC Cédric Le Goater
2025-05-05  9:06 ` [PULL 21/23] hw/arm: Introduce ASPEED AST2700 A1 full core machine Cédric Le Goater
2025-05-05  9:06 ` [PULL 22/23] tests/function/aspeed: Add functional test for ast2700fc Cédric Le Goater
2025-05-06 14:22   ` Peter Maydell
2025-05-06 15:14     ` Cédric Le Goater
2025-05-07  3:27       ` Steven Lee
2025-05-07  6:39         ` Cédric Le Goater
2025-05-06 21:09     ` Pierrick Bouvier
2025-05-07  6:46       ` Cédric Le Goater
2025-05-09 14:32     ` Cédric Le Goater
2025-05-09 15:27       ` Peter Maydell
2025-05-12  1:50         ` Steven Lee
2025-05-12  8:21         ` Cédric Le Goater
2025-05-05  9:06 ` [PULL 23/23] docs: Add support for ast2700fc machine Cédric Le Goater
2025-05-05  9:35 ` [PULL 00/23] aspeed queue Philippe Mathieu-Daudé
2025-05-05  9:43   ` Cédric Le Goater
2025-05-06 13:58 ` Stefan Hajnoczi

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=20250505090635.778785-2-clg@redhat.com \
    --to=clg@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --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).