@@ -24,6 +24,7 @@
#include "exec/address-spaces.h"
#include "sysemu/kvm.h"
#include "kvm_arm.h"
+#include "qemu/qemu-clock.h"
#define GIC_NUM_SPI_INTR 160
@@ -182,6 +183,22 @@ static void xlnx_zynqmp_init(Object *obj)
qdev_set_parent_bus(DEVICE(s->crf), sysbus_get_default());
object_property_add_child(obj, "xlnx.zynqmp_crf", OBJECT(s->crf),
&error_abort);
+
+ s->pss_ref_clk = object_new(TYPE_FIXED_CLOCK);
+ object_property_add_child(obj, "pss_ref_clk", s->pss_ref_clk,
+ &error_abort);
+ object_property_set_int(s->pss_ref_clk, 50000000, "rate", &error_abort);
+ s->video_clk = object_new(TYPE_FIXED_CLOCK);
+ object_property_add_child(obj, "video_clk", s->video_clk, &error_abort);
+ object_property_set_int(s->video_clk, 27000000, "rate", &error_abort);
+ s->pss_alt_ref_clk = object_new(TYPE_FIXED_CLOCK);
+ object_property_add_child(obj, "pss_alt_ref_clk", s->pss_alt_ref_clk,
+ &error_abort);
+ s->aux_refclk = object_new(TYPE_FIXED_CLOCK);
+ object_property_add_child(obj, "aux_refclk", s->aux_refclk, &error_abort);
+ s->gt_crx_ref_clk = object_new(TYPE_FIXED_CLOCK);
+ object_property_add_child(obj, "gt_crx_ref_clk", s->gt_crx_ref_clk,
+ &error_abort);
}
static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
@@ -429,6 +446,31 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
sysbus_connect_irq(SYS_BUS_DEVICE(&s->dpdma), 0, gic_spi[DPDMA_IRQ]);
sysbus_mmio_map(SYS_BUS_DEVICE(s->crf), 0, 0xFD1A0000);
+
+ /* Bound the clock */
+ qemu_clk_bind_clock(qemu_clk_get_pin(DEVICE(s->pss_ref_clk), "clk_out"),
+ qemu_clk_get_pin(DEVICE(s->crf), "pss_ref_clk"));
+
+ qemu_clk_bind_clock(qemu_clk_get_pin(DEVICE(s->video_clk), "clk_out"),
+ qemu_clk_get_pin(DEVICE(s->crf), "video_clk"));
+
+ qemu_clk_bind_clock(qemu_clk_get_pin(DEVICE(s->pss_alt_ref_clk),
+ "clk_out"),
+ qemu_clk_get_pin(DEVICE(s->crf), "pss_alt_ref_clk"));
+
+ qemu_clk_bind_clock(qemu_clk_get_pin(DEVICE(s->aux_refclk), "clk_out"),
+ qemu_clk_get_pin(DEVICE(s->crf), "aux_refclk"));
+
+ qemu_clk_bind_clock(qemu_clk_get_pin(DEVICE(s->gt_crx_ref_clk),
+ "clk_out"),
+ qemu_clk_get_pin(DEVICE(s->crf), "gt_crx_ref_clk"));
+
+ object_property_set_bool(s->crf, true, "realized", &err);
+ object_property_set_bool(s->pss_ref_clk, true, "realized", &err);
+ object_property_set_bool(s->video_clk, true, "realized", &err);
+ object_property_set_bool(s->pss_alt_ref_clk, true, "realized", &err);
+ object_property_set_bool(s->aux_refclk, true, "realized", &err);
+ object_property_set_bool(s->gt_crx_ref_clk, true, "realized", &err);
}
static Property xlnx_zynqmp_props[] = {
@@ -28,6 +28,7 @@
#include "hw/ssi/xilinx_spips.h"
#include "hw/dma/xlnx_dpdma.h"
#include "hw/display/xlnx_dp.h"
+#include "hw/misc/fixed-clock.h"
#define TYPE_XLNX_ZYNQMP "xlnx,zynqmp"
#define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \
@@ -86,6 +87,11 @@ typedef struct XlnxZynqMPState {
XlnxDPState dp;
XlnxDPDMAState dpdma;
+ Object *pss_ref_clk;
+ Object *video_clk;
+ Object *pss_alt_ref_clk;
+ Object *aux_refclk;
+ Object *gt_crx_ref_clk;
Object *crf;
char *boot_cpu;