[RFC PATCH 8/8] aspeed: Add uhci support for ast2400 and ast2500

Guenter Roeck posted 8 patches 2 months, 2 weeks ago
There is a newer version of this series
[RFC PATCH 8/8] aspeed: Add uhci support for ast2400 and ast2500
Posted by Guenter Roeck 2 months, 2 weeks ago
Enable UHCI support for ast2400 and ast2500 SoCs. With this patch,
the UHCI port is successfully instantiated on the ast2500-evb machine.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 hw/arm/aspeed_ast2400.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c
index d125886207..93bfe3e3dd 100644
--- a/hw/arm/aspeed_ast2400.c
+++ b/hw/arm/aspeed_ast2400.c
@@ -31,6 +31,7 @@ static const hwaddr aspeed_soc_ast2400_memmap[] = {
     [ASPEED_DEV_FMC]    = 0x1E620000,
     [ASPEED_DEV_SPI1]   = 0x1E630000,
     [ASPEED_DEV_EHCI1]  = 0x1E6A1000,
+    [ASPEED_DEV_UHCI]   = 0x1E6B0000,
     [ASPEED_DEV_VIC]    = 0x1E6C0000,
     [ASPEED_DEV_SDMC]   = 0x1E6E0000,
     [ASPEED_DEV_SCU]    = 0x1E6E2000,
@@ -68,6 +69,7 @@ static const hwaddr aspeed_soc_ast2500_memmap[] = {
     [ASPEED_DEV_SPI2]   = 0x1E631000,
     [ASPEED_DEV_EHCI1]  = 0x1E6A1000,
     [ASPEED_DEV_EHCI2]  = 0x1E6A3000,
+    [ASPEED_DEV_UHCI]   = 0x1E6B0000,
     [ASPEED_DEV_VIC]    = 0x1E6C0000,
     [ASPEED_DEV_SDMC]   = 0x1E6E0000,
     [ASPEED_DEV_SCU]    = 0x1E6E2000,
@@ -107,6 +109,7 @@ static const int aspeed_soc_ast2400_irqmap[] = {
     [ASPEED_DEV_FMC]    = 19,
     [ASPEED_DEV_EHCI1]  = 5,
     [ASPEED_DEV_EHCI2]  = 13,
+    [ASPEED_DEV_UHCI]   = 14,
     [ASPEED_DEV_SDMC]   = 0,
     [ASPEED_DEV_SCU]    = 21,
     [ASPEED_DEV_ADC]    = 31,
@@ -199,6 +202,8 @@ static void aspeed_ast2400_soc_init(Object *obj)
                                 TYPE_PLATFORM_EHCI);
     }
 
+    object_initialize_child(obj, "uhci", &s->uhci, TYPE_ASPEED_UHCI);
+
     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),
@@ -393,6 +398,15 @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
                            aspeed_soc_get_irq(s, ASPEED_DEV_EHCI1 + i));
     }
 
+    /* UHCI */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->uhci), errp)) {
+        return;
+    }
+    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->uhci), 0,
+                    sc->memmap[ASPEED_DEV_UHCI]);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->uhci), 0,
+                       aspeed_soc_get_irq(s, ASPEED_DEV_UHCI));
+
     /* SDMC - SDRAM Memory Controller */
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdmc), errp)) {
         return;
-- 
2.45.2
Re: [RFC PATCH 8/8] aspeed: Add uhci support for ast2400 and ast2500
Posted by Cédric Le Goater 2 months, 2 weeks ago
On 9/6/24 14:25, Guenter Roeck wrote:
> Enable UHCI support for ast2400 and ast2500 SoCs. With this patch,
> the UHCI port is successfully instantiated on the ast2500-evb machine.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/arm/aspeed_ast2400.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c
> index d125886207..93bfe3e3dd 100644
> --- a/hw/arm/aspeed_ast2400.c
> +++ b/hw/arm/aspeed_ast2400.c
> @@ -31,6 +31,7 @@ static const hwaddr aspeed_soc_ast2400_memmap[] = {
>       [ASPEED_DEV_FMC]    = 0x1E620000,
>       [ASPEED_DEV_SPI1]   = 0x1E630000,
>       [ASPEED_DEV_EHCI1]  = 0x1E6A1000,
> +    [ASPEED_DEV_UHCI]   = 0x1E6B0000,
>       [ASPEED_DEV_VIC]    = 0x1E6C0000,
>       [ASPEED_DEV_SDMC]   = 0x1E6E0000,
>       [ASPEED_DEV_SCU]    = 0x1E6E2000,
> @@ -68,6 +69,7 @@ static const hwaddr aspeed_soc_ast2500_memmap[] = {
>       [ASPEED_DEV_SPI2]   = 0x1E631000,
>       [ASPEED_DEV_EHCI1]  = 0x1E6A1000,
>       [ASPEED_DEV_EHCI2]  = 0x1E6A3000,
> +    [ASPEED_DEV_UHCI]   = 0x1E6B0000,
>       [ASPEED_DEV_VIC]    = 0x1E6C0000,
>       [ASPEED_DEV_SDMC]   = 0x1E6E0000,
>       [ASPEED_DEV_SCU]    = 0x1E6E2000,
> @@ -107,6 +109,7 @@ static const int aspeed_soc_ast2400_irqmap[] = {
>       [ASPEED_DEV_FMC]    = 19,
>       [ASPEED_DEV_EHCI1]  = 5,
>       [ASPEED_DEV_EHCI2]  = 13,
> +    [ASPEED_DEV_UHCI]   = 14,
>       [ASPEED_DEV_SDMC]   = 0,
>       [ASPEED_DEV_SCU]    = 21,
>       [ASPEED_DEV_ADC]    = 31,
> @@ -199,6 +202,8 @@ static void aspeed_ast2400_soc_init(Object *obj)
>                                   TYPE_PLATFORM_EHCI);
>       }
>   
> +    object_initialize_child(obj, "uhci", &s->uhci, TYPE_ASPEED_UHCI);
> +
>       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),
> @@ -393,6 +398,15 @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
>                              aspeed_soc_get_irq(s, ASPEED_DEV_EHCI1 + i));
>       }
>   
> +    /* UHCI */
> +    if (!sysbus_realize(SYS_BUS_DEVICE(&s->uhci), errp)) {
> +        return;
> +    }
> +    aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->uhci), 0,
> +                    sc->memmap[ASPEED_DEV_UHCI]);
> +    sysbus_connect_irq(SYS_BUS_DEVICE(&s->uhci), 0,
> +                       aspeed_soc_get_irq(s, ASPEED_DEV_UHCI));
> +
>       /* SDMC - SDRAM Memory Controller */
>       if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdmc), errp)) {
>           return;