From patchwork Thu Jan 26 09:47:40 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: 9538731 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 300F4601D7 for ; Thu, 26 Jan 2017 09:57:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 222212818E for ; Thu, 26 Jan 2017 09:57:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1579E281C3; Thu, 26 Jan 2017 09:57:44 +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 DD9F02818E for ; Thu, 26 Jan 2017 09:57:42 +0000 (UTC) Received: from localhost ([::1]:37149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWgoH-0005TP-U4 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 26 Jan 2017 04:57:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWgez-0005Np-IL for qemu-devel@nongnu.org; Thu, 26 Jan 2017 04:48:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWgex-0000wG-1h for qemu-devel@nongnu.org; Thu, 26 Jan 2017 04:48:05 -0500 Received: from greensocs.com ([193.104.36.180]:33180) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWgew-0000vv-MF for qemu-devel@nongnu.org; Thu, 26 Jan 2017 04:48:02 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id DC0B7389849; Thu, 26 Jan 2017 10:48:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1485424081; bh=WbcRL8e5VmuPDmz2YGjZQOObd+XUyz3Ponnp72f0xjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QM1JNNos5DI9+idvIw6TFX0WGu/fJfhwy8s/6VedNYY8znsGY35UkeIq3HHHu89Th fXZtZ1RO2yo1NQlg3LncvH4HR+h1XUu+Yzf0Qd57Xc+s/BxHFnifQPz1nr8WaXfYkP giDmVROD6AQfXFBroIzR0Ld1B5JYGlz+9TdUNzn8= 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=dIpSoqrS; dkim=pass (1024-bit key) header.d=greensocs.com header.b=dIpSoqrS 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 NxxFyWiHux11; Thu, 26 Jan 2017 10:47:59 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id B64EE38984C; Thu, 26 Jan 2017 10:47:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1485424076; bh=WbcRL8e5VmuPDmz2YGjZQOObd+XUyz3Ponnp72f0xjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dIpSoqrSWqRyONSnulokhsy03O/lYv03yxSkLHJeLG9qxg0FM0Mxe+Oedk8wvalDX 0RXsCktm1C28Nh12QV48KnTtEPsbHc9PN8n3+QoKO/1FNSYnYllU0HVZEtMx+tP517 xlIs6rlG8LH5IzXbcinwZ9uQmaYqD10lVQAqp96s= 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 F1504389849; Thu, 26 Jan 2017 10:47:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1485424076; bh=WbcRL8e5VmuPDmz2YGjZQOObd+XUyz3Ponnp72f0xjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dIpSoqrSWqRyONSnulokhsy03O/lYv03yxSkLHJeLG9qxg0FM0Mxe+Oedk8wvalDX 0RXsCktm1C28Nh12QV48KnTtEPsbHc9PN8n3+QoKO/1FNSYnYllU0HVZEtMx+tP517 xlIs6rlG8LH5IzXbcinwZ9uQmaYqD10lVQAqp96s= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Thu, 26 Jan 2017 10:47:40 +0100 Message-Id: <1485424060-12217-11-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1485424060-12217-1-git-send-email-fred.konrad@greensocs.com> References: <1485424060-12217-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 V2 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 | 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..1bef77d 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_clock(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_clock(qemu_clk_device_get_clock(DEVICE(s->video_clk), + "clk_out"), + qemu_clk_device_get_clock(DEVICE(s->crf), "video_clk")); + + qemu_clk_bind_clock(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_clock(qemu_clk_device_get_clock(DEVICE(s->aux_refclk), + "clk_out"), + qemu_clk_device_get_clock(DEVICE(s->crf), + "aux_refclk")); + + qemu_clk_bind_clock(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;