Connect the PWM device to AST1700 model.
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 | 2 ++
hw/arm/aspeed_ast1700.c | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
index ee0c47d173..8db513a38c 100644
--- a/include/hw/arm/aspeed_ast1700.h
+++ b/include/hw/arm/aspeed_ast1700.h
@@ -14,6 +14,7 @@
#include "hw/gpio/aspeed_gpio.h"
#include "hw/i2c/aspeed_i2c.h"
#include "hw/misc/aspeed_ltpi.h"
+#include "hw/misc/aspeed_pwm.h"
#include "hw/ssi/aspeed_smc.h"
#include "hw/watchdog/wdt_aspeed.h"
#include "hw/char/serial-mm.h"
@@ -40,6 +41,7 @@ struct AspeedAST1700SoCState {
AspeedSCUState scu;
AspeedGPIOState gpio;
AspeedI2CState i2c;
+ AspeedPWMState pwm;
AspeedWDTState wdt[AST1700_WDT_NUM];
};
diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
index 59954eca99..c0b288a0fc 100644
--- a/hw/arm/aspeed_ast1700.c
+++ b/hw/arm/aspeed_ast1700.c
@@ -18,6 +18,7 @@
enum {
ASPEED_AST1700_DEV_SPI0,
+ ASPEED_AST1700_DEV_PWM,
ASPEED_AST1700_DEV_SRAM,
ASPEED_AST1700_DEV_ADC,
ASPEED_AST1700_DEV_SCU,
@@ -31,6 +32,7 @@ enum {
static const hwaddr aspeed_ast1700_io_memmap[] = {
[ASPEED_AST1700_DEV_SPI0] = 0x00030000,
+ [ASPEED_AST1700_DEV_PWM] = 0x000C0000,
[ASPEED_AST1700_DEV_SRAM] = 0x00BC0000,
[ASPEED_AST1700_DEV_ADC] = 0x00C00000,
[ASPEED_AST1700_DEV_SCU] = 0x00C02000,
@@ -130,6 +132,14 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I2C],
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->i2c), 0));
+ /* PWM */
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->pwm), errp)) {
+ return;
+ }
+ memory_region_add_subregion(&s->iomem,
+ aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_PWM],
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->pwm), 0));
+
/* LTPI controller */
if (!sysbus_realize(SYS_BUS_DEVICE(&s->ltpi), errp)) {
return;
@@ -183,6 +193,9 @@ static void aspeed_ast1700_instance_init(Object *obj)
object_initialize_child(obj, "ioexp-i2c", &s->i2c,
"aspeed.i2c-ast2700");
+ /* PWM */
+ object_initialize_child(obj, "pwm", &s->pwm, TYPE_ASPEED_PWM);
+
/* LTPI controller */
object_initialize_child(obj, "ltpi-ctrl",
&s->ltpi, TYPE_ASPEED_LTPI);
--
2.43.0