From: Kane-Chen-AS <kane_chen@aspeedtech.com>
Connect the ADC device to AST1700 model.
Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
include/hw/misc/aspeed_ast1700.h | 1 +
hw/arm/aspeed_ast27x0.c | 4 ++++
hw/misc/aspeed_ast1700.c | 15 +++++++++++++++
3 files changed, 20 insertions(+)
diff --git a/include/hw/misc/aspeed_ast1700.h b/include/hw/misc/aspeed_ast1700.h
index e55deea67a..dc9aa08c24 100644
--- a/include/hw/misc/aspeed_ast1700.h
+++ b/include/hw/misc/aspeed_ast1700.h
@@ -34,6 +34,7 @@ struct AspeedAST1700SoCState {
SerialMM uart;
MemoryRegion sram;
AspeedSMCState spi;
+ AspeedADCState adc;
};
#endif /* ASPEED_AST1700_H */
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index 7151feb35d..75bb18b9c1 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -1092,6 +1092,10 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
sysbus_connect_irq(SYS_BUS_DEVICE(&a->intc[2 + i]), j,
irq);
}
+
+ /* ADC */
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->ioexp[i].adc), 0,
+ aspeed_soc_ast2700_get_irq(s, ASPEED_DEV_ADC));
}
aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
diff --git a/hw/misc/aspeed_ast1700.c b/hw/misc/aspeed_ast1700.c
index ba44e484e8..d06603a048 100644
--- a/hw/misc/aspeed_ast1700.c
+++ b/hw/misc/aspeed_ast1700.c
@@ -22,6 +22,7 @@
enum {
ASPEED_AST1700_DEV_SPI0,
ASPEED_AST1700_DEV_SRAM,
+ ASPEED_AST1700_DEV_ADC,
ASPEED_AST1700_DEV_UART12,
ASPEED_AST1700_DEV_LTPI_CTRL,
ASPEED_AST1700_DEV_SPI0_MEM,
@@ -30,6 +31,7 @@ enum {
static const hwaddr aspeed_ast1700_io_memmap[] = {
[ASPEED_AST1700_DEV_SPI0] = 0x00030000,
[ASPEED_AST1700_DEV_SRAM] = 0x00BC0000,
+ [ASPEED_AST1700_DEV_ADC] = 0x00C00000,
[ASPEED_AST1700_DEV_UART12] = 0x00C33B00,
[ASPEED_AST1700_DEV_LTPI_CTRL] = 0x00C34000,
[ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000,
@@ -94,6 +96,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_SPI0_MEM],
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->spi), 1));
+ /* ADC */
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->adc), errp)) {
+ return;
+ }
+ memory_region_add_subregion(&s->iomem,
+ aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_ADC],
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->adc), 0));
+
/* LTPI controller */
if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
return;
@@ -121,6 +131,11 @@ static void aspeed_ast1700_instance_init(Object *obj)
snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", 0, socname);
object_initialize_child(obj, "ioexp-spi[*]", &s->spi,
typename);
+
+ /* ADC */
+ snprintf(typename, sizeof(typename), "aspeed.adc-%s", socname);
+ object_initialize_child(obj, "ioexp-adc[*]", &s->adc,
+ typename);
/* LTPI controller */
object_initialize_child(obj, "ltpi-ctrl",
&s->ltpi, TYPE_ASPEED_LTPI);
--
2.43.0