All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org
Cc: figlesia@xilinx.com, peter.maydell@linaro.org,
	sstabellini@kernel.org, edgar.iglesias@xilinx.com,
	sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com,
	alistair@alistair23.me, richard.henderson@linaro.org,
	frederic.konrad@adacore.com, qemu-arm@nongnu.org,
	philmd@redhat.com, luc.michel@greensocs.com
Subject: [PATCH v1 09/11] hw/arm: versal: Add support for the RTC
Date: Mon, 27 Apr 2020 20:16:47 +0200	[thread overview]
Message-ID: <20200427181649.26851-10-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <20200427181649.26851-1-edgar.iglesias@gmail.com>

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

hw/arm: versal: Add support for the RTC.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal.c         | 21 +++++++++++++++++++++
 include/hw/arm/xlnx-versal.h |  8 ++++++++
 2 files changed, 29 insertions(+)

diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index e263bdf77a..321171bcce 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -240,6 +240,26 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
     }
 }
 
+static void versal_create_rtc(Versal *s, qemu_irq *pic)
+{
+    SysBusDevice *sbd;
+    MemoryRegion *mr;
+
+    sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc),
+                          TYPE_XLNX_ZYNQMP_RTC);
+    sbd = SYS_BUS_DEVICE(&s->pmc.rtc);
+    qdev_init_nofail(DEVICE(sbd));
+
+    mr = sysbus_mmio_get_region(sbd, 0);
+    memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr);
+
+    /*
+     * TODO: Connect the ALARM and SECONDS interrupts once our RTC model
+     * supports them.
+     */
+    sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]);
+}
+
 /* This takes the board allocated linear DDR memory and creates aliases
  * for each split DDR range/aperture on the Versal address map.
  */
@@ -323,6 +343,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
     versal_create_gems(s, pic);
     versal_create_admas(s, pic);
     versal_create_sds(s, pic);
+    versal_create_rtc(s, pic);
     versal_map_ddr(s);
     versal_unimp(s);
 
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index e11693e29d..9c9f47ba9d 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -19,6 +19,7 @@
 #include "hw/char/pl011.h"
 #include "hw/dma/xlnx-zdma.h"
 #include "hw/net/cadence_gem.h"
+#include "hw/rtc/xlnx-zynqmp-rtc.h"
 
 #define TYPE_XLNX_VERSAL "xlnx-versal"
 #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
@@ -65,6 +66,8 @@ typedef struct Versal {
         struct {
             SDHCIState sd[XLNX_VERSAL_NR_SDS];
         } iou;
+
+        XlnxZynqMPRTC rtc;
     } pmc;
 
     struct {
@@ -89,7 +92,10 @@ typedef struct Versal {
 #define VERSAL_GEM1_IRQ_0          58
 #define VERSAL_GEM1_WAKE_IRQ_0     59
 #define VERSAL_ADMA_IRQ_0          60
+#define VERSAL_RTC_APB_ERR_IRQ     121
 #define VERSAL_SD0_IRQ_0           126
+#define VERSAL_RTC_ALARM_IRQ       142
+#define VERSAL_RTC_SECONDS_IRQ     143
 
 /* Architecturally reserved IRQs suitable for virtualization.  */
 #define VERSAL_RSVD_IRQ_FIRST 111
@@ -143,4 +149,6 @@ typedef struct Versal {
 #define MM_PMC_SD0_SIZE             0x10000
 #define MM_PMC_CRP                  0xf1260000U
 #define MM_PMC_CRP_SIZE             0x10000
+#define MM_PMC_RTC                  0xf12a0000
+#define MM_PMC_RTC_SIZE             0x10000
 #endif
-- 
2.20.1



  parent reply	other threads:[~2020-04-27 18:24 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
2020-04-27 18:16 ` [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h Edgar E. Iglesias
2020-04-27 20:08   ` Alistair Francis
2020-04-29  7:23   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 02/11] hw/arm: versal: Move misplaced comment Edgar E. Iglesias
2020-04-27 20:08   ` Alistair Francis
2020-04-28  7:46   ` Philippe Mathieu-Daudé
2020-04-29  7:23   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal Edgar E. Iglesias
2020-04-27 22:18   ` Alistair Francis
2020-04-28  7:46   ` Philippe Mathieu-Daudé
2020-04-29  7:24   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type Edgar E. Iglesias
2020-04-27 22:16   ` Alistair Francis
2020-04-28  7:47   ` Philippe Mathieu-Daudé
2020-04-29  7:27   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs " Edgar E. Iglesias
2020-04-27 22:17   ` Alistair Francis
2020-04-28  7:48   ` Philippe Mathieu-Daudé
2020-04-29  7:27   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs " Edgar E. Iglesias
2020-04-27 22:18   ` Alistair Francis
2020-04-28  7:49   ` Philippe Mathieu-Daudé
2020-04-29  7:28   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 07/11] hw/arm: versal: Embedd the APUs " Edgar E. Iglesias
2020-04-27 22:20   ` Alistair Francis
2020-04-28  7:50   ` Philippe Mathieu-Daudé
2020-04-29  7:28   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 08/11] hw/arm: versal: Add support for SD Edgar E. Iglesias
2020-04-27 22:24   ` Alistair Francis
2020-04-28  7:51   ` Philippe Mathieu-Daudé
2020-04-29  7:28   ` Luc Michel
2020-04-27 18:16 ` Edgar E. Iglesias [this message]
2020-04-28  8:01   ` [PATCH v1 09/11] hw/arm: versal: Add support for the RTC Philippe Mathieu-Daudé
2020-04-28 17:51   ` Alistair Francis
2020-04-29  7:28   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD Edgar E. Iglesias
2020-04-28 17:54   ` Alistair Francis
2020-04-29  7:36   ` Luc Michel
2020-04-27 18:16 ` [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC Edgar E. Iglesias
2020-04-28 17:55   ` Alistair Francis
2020-04-29  7:57   ` Luc Michel
2020-05-04 10:13 ` [PATCH v1 00/11] hw/arm: versal: Add SD and " Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200427181649.26851-10-edgar.iglesias@gmail.com \
    --to=edgar.iglesias@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=edgar.iglesias@xilinx.com \
    --cc=figlesia@xilinx.com \
    --cc=frasse.iglesias@gmail.com \
    --cc=frederic.konrad@adacore.com \
    --cc=luc.michel@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sai.pavan.boddu@xilinx.com \
    --cc=sstabellini@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.