[PATCH v2 06/17] hw/arm/aspeed: Attach LTPI controller to AST1700 model

Kane Chen via posted 17 patches 1 week, 2 days ago
Maintainers: "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>
[PATCH v2 06/17] hw/arm/aspeed: Attach LTPI controller to AST1700 model
Posted by Kane Chen via 1 week, 2 days ago
From: Kane-Chen-AS <kane_chen@aspeedtech.com>

Connect the LTPI controller to the AST1700 model by mapping its MMIO
region and wiring its interrupt line.

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

diff --git a/include/hw/misc/aspeed_ast1700.h b/include/hw/misc/aspeed_ast1700.h
index 624ef61eda..c2bea11346 100644
--- a/include/hw/misc/aspeed_ast1700.h
+++ b/include/hw/misc/aspeed_ast1700.h
@@ -28,6 +28,8 @@ struct AspeedAST1700SoCState {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
+
+    AspeedLTPIState ltpi;
 };
 
 #endif /* ASPEED_AST1700_H */
diff --git a/hw/misc/aspeed_ast1700.c b/hw/misc/aspeed_ast1700.c
index 3125bec795..0ca2b90ff0 100644
--- a/hw/misc/aspeed_ast1700.c
+++ b/hw/misc/aspeed_ast1700.c
@@ -16,6 +16,14 @@
 #include "hw/misc/aspeed_ast1700.h"
 
 #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);
@@ -26,10 +34,23 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
                        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;
 }
 
-- 
2.43.0
Re: [PATCH v2 06/17] hw/arm/aspeed: Attach LTPI controller to AST1700 model
Posted by Cédric Le Goater 1 week ago
On 11/5/25 04:58, Kane Chen wrote:
> From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> 
> Connect the LTPI controller to the AST1700 model by mapping its MMIO
> region and wiring its interrupt line.
> 
> Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
> ---
>   include/hw/misc/aspeed_ast1700.h |  2 ++
>   hw/misc/aspeed_ast1700.c         | 21 +++++++++++++++++++++
>   2 files changed, 23 insertions(+)
> 
> diff --git a/include/hw/misc/aspeed_ast1700.h b/include/hw/misc/aspeed_ast1700.h
> index 624ef61eda..c2bea11346 100644
> --- a/include/hw/misc/aspeed_ast1700.h
> +++ b/include/hw/misc/aspeed_ast1700.h
> @@ -28,6 +28,8 @@ struct AspeedAST1700SoCState {
>       SysBusDevice parent_obj;
>   
>       MemoryRegion iomem;
> +
> +    AspeedLTPIState ltpi;
>   };
>   
>   #endif /* ASPEED_AST1700_H */
> diff --git a/hw/misc/aspeed_ast1700.c b/hw/misc/aspeed_ast1700.c
> index 3125bec795..0ca2b90ff0 100644
> --- a/hw/misc/aspeed_ast1700.c
> +++ b/hw/misc/aspeed_ast1700.c
> @@ -16,6 +16,14 @@
>   #include "hw/misc/aspeed_ast1700.h"
>   
>   #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);
> @@ -26,10 +34,23 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
>                          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;
>   }
>   


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

Thanks,

C.



RE: [PATCH v2 06/17] hw/arm/aspeed: Attach LTPI controller to AST1700 model
Posted by Kane Chen 4 days, 13 hours ago
Hi Cédric,

Thanks for reviewing.

Best Regards,
Kane
> -----Original Message-----
> From: Cédric Le Goater <clg@kaod.org>
> Sent: Friday, November 7, 2025 9:37 PM
> To: Kane Chen <kane_chen@aspeedtech.com>; 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 <troy_lee@aspeedtech.com>
> Subject: Re: [PATCH v2 06/17] hw/arm/aspeed: Attach LTPI controller to
> AST1700 model
> 
> On 11/5/25 04:58, Kane Chen wrote:
> > From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> >
> > Connect the LTPI controller to the AST1700 model by mapping its MMIO
> > region and wiring its interrupt line.
> >
> > Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
> > ---
> >   include/hw/misc/aspeed_ast1700.h |  2 ++
> >   hw/misc/aspeed_ast1700.c         | 21 +++++++++++++++++++++
> >   2 files changed, 23 insertions(+)
> >
> > diff --git a/include/hw/misc/aspeed_ast1700.h
> > b/include/hw/misc/aspeed_ast1700.h
> > index 624ef61eda..c2bea11346 100644
> > --- a/include/hw/misc/aspeed_ast1700.h
> > +++ b/include/hw/misc/aspeed_ast1700.h
> > @@ -28,6 +28,8 @@ struct AspeedAST1700SoCState {
> >       SysBusDevice parent_obj;
> >
> >       MemoryRegion iomem;
> > +
> > +    AspeedLTPIState ltpi;
> >   };
> >
> >   #endif /* ASPEED_AST1700_H */
> > diff --git a/hw/misc/aspeed_ast1700.c b/hw/misc/aspeed_ast1700.c index
> > 3125bec795..0ca2b90ff0 100644
> > --- a/hw/misc/aspeed_ast1700.c
> > +++ b/hw/misc/aspeed_ast1700.c
> > @@ -16,6 +16,14 @@
> >   #include "hw/misc/aspeed_ast1700.h"
> >
> >   #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); @@ -26,10
> +34,23
> > @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
> >                          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;
> >   }
> >
> 
> 
> Reviewed-by: Cédric Le Goater <clg@redhat.com>
> 
> Thanks,
> 
> C.
>