Message ID | 20200427181649.26851-12-edgar.iglesias@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1,01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h | expand |
On Mon, Apr 27, 2020 at 11:28 AM Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote: > > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> > > Add support for the RTC. > > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c > index 0afee48672..7e749e1926 100644 > --- a/hw/arm/xlnx-versal-virt.c > +++ b/hw/arm/xlnx-versal-virt.c > @@ -283,6 +283,27 @@ static void fdt_add_sd_nodes(VersalVirt *s) > } > } > > +static void fdt_add_rtc_node(VersalVirt *s) > +{ > + const char compat[] = "xlnx,zynqmp-rtc"; > + const char interrupt_names[] = "alarm\0sec"; > + char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC); > + > + qemu_fdt_add_subnode(s->fdt, name); > + > + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", > + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ, > + GIC_FDT_IRQ_FLAGS_LEVEL_HI, > + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ, > + GIC_FDT_IRQ_FLAGS_LEVEL_HI); > + qemu_fdt_setprop(s->fdt, name, "interrupt-names", > + interrupt_names, sizeof(interrupt_names)); > + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", > + 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE); > + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); > + g_free(name); > +} > + > static void fdt_nop_memory_nodes(void *fdt, Error **errp) > { > Error *err = NULL; > @@ -496,6 +517,7 @@ static void versal_virt_init(MachineState *machine) > fdt_add_timer_nodes(s); > fdt_add_zdma_nodes(s); > fdt_add_sd_nodes(s); > + fdt_add_rtc_node(s); > fdt_add_cpu_nodes(s, psci_conduit); > fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); > fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); > -- > 2.20.1 > >
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote: > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> > > Add support for the RTC. > > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Luc Michel <luc.michel@greensocs.com> > --- > hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c > index 0afee48672..7e749e1926 100644 > --- a/hw/arm/xlnx-versal-virt.c > +++ b/hw/arm/xlnx-versal-virt.c > @@ -283,6 +283,27 @@ static void fdt_add_sd_nodes(VersalVirt *s) > } > } > > +static void fdt_add_rtc_node(VersalVirt *s) > +{ > + const char compat[] = "xlnx,zynqmp-rtc"; > + const char interrupt_names[] = "alarm\0sec"; > + char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC); > + > + qemu_fdt_add_subnode(s->fdt, name); > + > + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", > + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ, > + GIC_FDT_IRQ_FLAGS_LEVEL_HI, > + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ, > + GIC_FDT_IRQ_FLAGS_LEVEL_HI); > + qemu_fdt_setprop(s->fdt, name, "interrupt-names", > + interrupt_names, sizeof(interrupt_names)); > + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", > + 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE); > + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); > + g_free(name); > +} > + > static void fdt_nop_memory_nodes(void *fdt, Error **errp) > { > Error *err = NULL; > @@ -496,6 +517,7 @@ static void versal_virt_init(MachineState *machine) > fdt_add_timer_nodes(s); > fdt_add_zdma_nodes(s); > fdt_add_sd_nodes(s); > + fdt_add_rtc_node(s); > fdt_add_cpu_nodes(s, psci_conduit); > fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); > fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz); >
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 0afee48672..7e749e1926 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -283,6 +283,27 @@ static void fdt_add_sd_nodes(VersalVirt *s) } } +static void fdt_add_rtc_node(VersalVirt *s) +{ + const char compat[] = "xlnx,zynqmp-rtc"; + const char interrupt_names[] = "alarm\0sec"; + char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC); + + qemu_fdt_add_subnode(s->fdt, name); + + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ, + GIC_FDT_IRQ_FLAGS_LEVEL_HI, + GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ, + GIC_FDT_IRQ_FLAGS_LEVEL_HI); + qemu_fdt_setprop(s->fdt, name, "interrupt-names", + interrupt_names, sizeof(interrupt_names)); + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", + 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE); + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); + g_free(name); +} + static void fdt_nop_memory_nodes(void *fdt, Error **errp) { Error *err = NULL; @@ -496,6 +517,7 @@ static void versal_virt_init(MachineState *machine) fdt_add_timer_nodes(s); fdt_add_zdma_nodes(s); fdt_add_sd_nodes(s); + fdt_add_rtc_node(s); fdt_add_cpu_nodes(s, psci_conduit); fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);