[PATCH v4 07/19] hw/arm/aspeed: Attach LTPI controller to AST1700 model

Kane Chen via posted 19 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH v4 07/19] hw/arm/aspeed: Attach LTPI controller to AST1700 model
Posted by Kane Chen via 1 month, 2 weeks ago
From: Kane-Chen-AS <kane_chen@aspeedtech.com>

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

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
 include/hw/arm/aspeed_ast1700.h |  3 +++
 hw/arm/aspeed_ast1700.c         | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
index 2a95ebfe89..b9ee4952d0 100644
--- a/include/hw/arm/aspeed_ast1700.h
+++ b/include/hw/arm/aspeed_ast1700.h
@@ -9,6 +9,7 @@
 #define ASPEED_AST1700_H
 
 #include "hw/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 */
diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
index bb6ca2ce9e..eeb586102f 100644
--- a/hw/arm/aspeed_ast1700.c
+++ b/hw/arm/aspeed_ast1700.c
@@ -14,6 +14,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);
@@ -23,8 +31,26 @@ 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)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -37,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)
-- 
2.43.0
Re: [PATCH v4 07/19] hw/arm/aspeed: Attach LTPI controller to AST1700 model
Posted by Cédric Le Goater 1 month, 2 weeks ago
On 12/24/25 02:41, Kane Chen via wrote:
> From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> 
> Connect the LTPI controller to the AST1700 model by mapping its MMIO
> region.
> 
> Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>

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


> ---
>   include/hw/arm/aspeed_ast1700.h |  3 +++
>   hw/arm/aspeed_ast1700.c         | 27 +++++++++++++++++++++++++++
>   2 files changed, 30 insertions(+)
> 
> diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
> index 2a95ebfe89..b9ee4952d0 100644
> --- a/include/hw/arm/aspeed_ast1700.h
> +++ b/include/hw/arm/aspeed_ast1700.h
> @@ -9,6 +9,7 @@
>   #define ASPEED_AST1700_H
>   
>   #include "hw/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 */
> diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
> index bb6ca2ce9e..eeb586102f 100644
> --- a/hw/arm/aspeed_ast1700.c
> +++ b/hw/arm/aspeed_ast1700.c
> @@ -14,6 +14,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);
> @@ -23,8 +31,26 @@ 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)
>   {
>       DeviceClass *dc = DEVICE_CLASS(klass);
> @@ -37,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)


Re: [PATCH v4 07/19] hw/arm/aspeed: Attach LTPI controller to AST1700 model
Posted by Nabih Estefan 1 month, 1 week ago
On Wed, Dec 24, 2025 at 2:41 AM Cédric Le Goater <clg@kaod.org> wrote:
>
> On 12/24/25 02:41, Kane Chen via wrote:
> > From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> >
> > Connect the LTPI controller to the AST1700 model by mapping its MMIO
> > region.
> >
> > Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
>
> Reviewed-by: Cédric Le Goater <clg@redhat.com>

Reviewed-by: Nabih Estefan <nabihestefan@google.com>
Tested-by: Nabih Estefan <nabihestefan@google.com>


>
>
> > ---
> >   include/hw/arm/aspeed_ast1700.h |  3 +++
> >   hw/arm/aspeed_ast1700.c         | 27 +++++++++++++++++++++++++++
> >   2 files changed, 30 insertions(+)
> >
> > diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
> > index 2a95ebfe89..b9ee4952d0 100644
> > --- a/include/hw/arm/aspeed_ast1700.h
> > +++ b/include/hw/arm/aspeed_ast1700.h
> > @@ -9,6 +9,7 @@
> >   #define ASPEED_AST1700_H
> >
> >   #include "hw/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 */
> > diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
> > index bb6ca2ce9e..eeb586102f 100644
> > --- a/hw/arm/aspeed_ast1700.c
> > +++ b/hw/arm/aspeed_ast1700.c
> > @@ -14,6 +14,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);
> > @@ -23,8 +31,26 @@ 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)
> >   {
> >       DeviceClass *dc = DEVICE_CLASS(klass);
> > @@ -37,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)
>