Skip to content

Commit 9cdca15

Browse files
jamin-aspeedlegoater
authored andcommitted
aspeed/soc: Support Timer for AST2700
Add Timer model for AST2700 Timer support. The Timer controller include 8 sets of 32-bit decrement counters. The base address of TIMER0 to TIMER7 as following. Base Address of Timer 0 = 0x12C1_0000 Base Address of Timer 1 = 0x12C1_0040 Base Address of Timer 2 = 0x12C1_0080 Base Address of Timer 3 = 0x12C1_00C0 Base Address of Timer 4 = 0x12C1_0100 Base Address of Timer 5 = 0x12C1_0140 Base Address of Timer 6 = 0x12C1_0180 Base Address of Timer 7 = 0x12C1_01C0 The interrupt of TIMER0 to TIMER7 as following. GICINT16 = TIMER 0 interrupt GICINT17 = TIMER 1 interrupt GICINT18 = TIMER 2 interrupt GICINT19 = TIMER 3 interrupt GICINT20 = TIMER 4 interrupt GICINT21 = TIMER 5 interrupt GICINT22 = TIMER 6 interrupt GICINT23 = TIMER 7 interrupt Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/r/20250113064455.1660564-4-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
1 parent 8bc691b commit 9cdca15

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

hw/arm/aspeed_ast27x0.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static const hwaddr aspeed_soc_ast2700_memmap[] = {
6666
[ASPEED_DEV_GPIO] = 0x14C0B000,
6767
[ASPEED_DEV_RTC] = 0x12C0F000,
6868
[ASPEED_DEV_SDHCI] = 0x14080000,
69+
[ASPEED_DEV_TIMER1] = 0x12C10000,
6970
};
7071

7172
#define AST2700_MAX_IRQ 256
@@ -397,6 +398,9 @@ static void aspeed_soc_ast2700_init(Object *obj)
397398

398399
object_initialize_child(obj, "emmc-controller.sdhci", &s->emmc.slots[0],
399400
TYPE_SYSBUS_SDHCI);
401+
402+
snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname);
403+
object_initialize_child(obj, "timerctrl", &s->timerctrl, typename);
400404
}
401405

402406
/*
@@ -716,6 +720,19 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
716720
sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc), 0,
717721
aspeed_soc_get_irq(s, ASPEED_DEV_EMMC));
718722

723+
/* Timer */
724+
object_property_set_link(OBJECT(&s->timerctrl), "scu", OBJECT(&s->scu),
725+
&error_abort);
726+
if (!sysbus_realize(SYS_BUS_DEVICE(&s->timerctrl), errp)) {
727+
return;
728+
}
729+
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->timerctrl), 0,
730+
sc->memmap[ASPEED_DEV_TIMER1]);
731+
for (i = 0; i < ASPEED_TIMER_NR_TIMERS; i++) {
732+
irq = aspeed_soc_get_irq(s, ASPEED_DEV_TIMER1 + i);
733+
sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq);
734+
}
735+
719736
create_unimplemented_device("ast2700.dpmcu", 0x11000000, 0x40000);
720737
create_unimplemented_device("ast2700.iomem0", 0x12000000, 0x01000000);
721738
create_unimplemented_device("ast2700.iomem1", 0x14000000, 0x01000000);

0 commit comments

Comments
 (0)