From patchwork Wed Oct 5 22:11:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S09OUkFEIEZyw6lkw6lyaWM=?= X-Patchwork-Id: 9363535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A4041607D6 for ; Wed, 5 Oct 2016 22:23:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9905F2862B for ; Wed, 5 Oct 2016 22:23:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D1DC28D10; Wed, 5 Oct 2016 22:23:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 043E72862B for ; Wed, 5 Oct 2016 22:23:39 +0000 (UTC) Received: from localhost ([::1]:51654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brubB-00045E-TY for patchwork-qemu-devel@patchwork.kernel.org; Wed, 05 Oct 2016 18:23:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bruOQ-0001fC-Ba for qemu-devel@nongnu.org; Wed, 05 Oct 2016 18:10:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bruOO-0007X7-1K for qemu-devel@nongnu.org; Wed, 05 Oct 2016 18:10:25 -0400 Received: from greensocs.com ([193.104.36.180]:33071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bruON-0007Wt-Md for qemu-devel@nongnu.org; Wed, 05 Oct 2016 18:10:23 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 351DC37BD23; Thu, 6 Oct 2016 00:10:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1475705423; bh=P+S/MKuZe4JMEwo8UapuLCB9sBjWAM4uMPeBbQrIjs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KOzGd6wSXdpVQ5tELOrGwzclxnzXAuVIG+s71SPJUYjluLWkH5ZYPk42nxebfrTwL HacfF8jt7eM5WclypS1oN+CrfRFjiZTid3APbd0Ckn11VdwV86nEmTUvwipaIOCIhA tlRyGyp9FmfN002HfwJsR5FRF+ks6+QzlCDmL2tM= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com header.b=MPG+XRFL; dkim=pass (1024-bit key) header.d=greensocs.com header.b=MPG+XRFL Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YCAZUdIa9b9w; Thu, 6 Oct 2016 00:10:22 +0200 (CEST) Received: by greensocs.com (Postfix, from userid 998) id 3B9DA37BD5D; Thu, 6 Oct 2016 00:10:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1475705422; bh=P+S/MKuZe4JMEwo8UapuLCB9sBjWAM4uMPeBbQrIjs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MPG+XRFLlg7nYA1HgrNT+l7gnlgXOxGLf1UYRluzcIP0gY8e/ZU3zAPupzmw/qT7U 4VEDotpPAHAK8KJYPazTKd8BDXAgyGsLhiKrCZgnWWV+Bkc/rlZMUPwg51hXKtQEH2 wX0sCqoTpWXalwyVHPqsX/QjFQBiMwMxqeJj7txs= Received: from asus.localdomain (localhost [IPv6:::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: fred.konrad@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id 922AE37BD23; Thu, 6 Oct 2016 00:10:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1475705422; bh=P+S/MKuZe4JMEwo8UapuLCB9sBjWAM4uMPeBbQrIjs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MPG+XRFLlg7nYA1HgrNT+l7gnlgXOxGLf1UYRluzcIP0gY8e/ZU3zAPupzmw/qT7U 4VEDotpPAHAK8KJYPazTKd8BDXAgyGsLhiKrCZgnWWV+Bkc/rlZMUPwg51hXKtQEH2 wX0sCqoTpWXalwyVHPqsX/QjFQBiMwMxqeJj7txs= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Thu, 6 Oct 2016 00:11:04 +0200 Message-Id: <1475705464-27130-11-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1475705464-27130-1-git-send-email-fred.konrad@greensocs.com> References: <1475705464-27130-1-git-send-email-fred.konrad@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH V1 10/10] zynqmp: add reference clock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, fred.konrad@greensocs.com, mark.burton@greensocs.com, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: KONRAD Frederic This adds some fixed reference clock to the zynqmp platform. They will feed the zynqmp_crf block. Signed-off-by: KONRAD Frederic --- hw/arm/xlnx-zynqmp.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/hw/arm/xlnx-zynqmp.h | 6 ++++++ 2 files changed, 48 insertions(+) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 05cf99b..1096dc4 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -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[] = { diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h index 379a17a..d0cc57f 100644 --- a/include/hw/arm/xlnx-zynqmp.h +++ b/include/hw/arm/xlnx-zynqmp.h @@ -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;