From patchwork Tue Feb 28 10:03:05 2017 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: 9595091 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 0A42C601D7 for ; Tue, 28 Feb 2017 10:13:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED44B27165 for ; Tue, 28 Feb 2017 10:13:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1AFA2851E; Tue, 28 Feb 2017 10:13:01 +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 623F027165 for ; Tue, 28 Feb 2017 10:13:01 +0000 (UTC) Received: from localhost ([::1]:59896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciemC-0006CT-DJ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 28 Feb 2017 05:13:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciedC-0006tW-IN for qemu-devel@nongnu.org; Tue, 28 Feb 2017 05:03:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cied7-0004Al-PP for qemu-devel@nongnu.org; Tue, 28 Feb 2017 05:03:42 -0500 Received: from greensocs.com ([193.104.36.180]:38463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cied7-0004AD-FI for qemu-devel@nongnu.org; Tue, 28 Feb 2017 05:03:37 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id CCD6F4251B0; Tue, 28 Feb 2017 11:03:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1488276216; bh=EoFkxZEF+JVKSGUhI0esH/4DD6Nzf+TjtYyFtNJTs3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Nd8noSRbv/FxBC+InQKE2CJf7ZThkuv3wj3/vEMdC1qoId75mykF4tyQ4NyBIM9PA 6MoQsbmx4lHztb4FlDYuqu2M+PQN3aWc6ko6YGjEJCgn9muAKl7Ly/oEzKckjh1PiA vEZoG6rYFf0xpHSq5NHObsSW5HKb9Okp41vQn5X4= 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 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 DzsWtVCqdd2v; Tue, 28 Feb 2017 11:03:36 +0100 (CET) Received: from corsair.home (bd231-7-88-127-3-24.fbx.proxad.net [88.127.3.24]) (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 5F0A21A5656; Tue, 28 Feb 2017 11:03:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1488276215; bh=EoFkxZEF+JVKSGUhI0esH/4DD6Nzf+TjtYyFtNJTs3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2ZDx8XukNoI4s3NQ6c8VkKMHAK/ud4zBq6oNcOnwSaFUar2kInWlkRhTfN/cJw3f1 UPTZtFqDHaCrcevaedErgo0s3cb0aYZ8S58LcAzLofQLG6WgZnv7jcmXx70Qj445Hf ALME6mMhRQnzFKgtLd0sGJvQoO+rY2k7DWWFie7M= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Tue, 28 Feb 2017 11:03:05 +0100 Message-Id: <1488276185-31168-11-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488276185-31168-1-git-send-email-fred.konrad@greensocs.com> References: <1488276185-31168-1-git-send-email-fred.konrad@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v3 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, mark.burton@greensocs.com, alistair.francis@xilinx.com, clg@kaod.org, fred.konrad@greensocs.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 | 49 ++++++++++++++++++++++++++++++++++++++++++++ include/hw/arm/xlnx-zynqmp.h | 6 ++++++ 2 files changed, 55 insertions(+) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 27dccdb..b9cd856 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) @@ -431,6 +448,38 @@ 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); + + /* Bind the clock */ + qemu_clk_bind(qemu_clk_device_get_clock(DEVICE(s->pss_ref_clk), + "clk_out"), + qemu_clk_device_get_clock(DEVICE(s->crf), + "pss_ref_clk")); + + qemu_clk_bind(qemu_clk_device_get_clock(DEVICE(s->video_clk), + "clk_out"), + qemu_clk_device_get_clock(DEVICE(s->crf), "video_clk")); + + qemu_clk_bind(qemu_clk_device_get_clock(DEVICE(s->pss_alt_ref_clk), + "clk_out"), + qemu_clk_device_get_clock(DEVICE(s->crf), + "pss_alt_ref_clk")); + + qemu_clk_bind(qemu_clk_device_get_clock(DEVICE(s->aux_refclk), + "clk_out"), + qemu_clk_device_get_clock(DEVICE(s->crf), + "aux_refclk")); + + qemu_clk_bind(qemu_clk_device_get_clock(DEVICE(s->gt_crx_ref_clk), + "clk_out"), + qemu_clk_device_get_clock(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;