From patchwork Fri Aug 19 19:08:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 660970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sGCMT2xF3z9sR9 for ; Sat, 20 Aug 2016 05:14:45 +1000 (AEST) Received: from localhost ([::1]:58666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bapFa-0002lj-Um for incoming@patchwork.ozlabs.org; Fri, 19 Aug 2016 15:14:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bapB9-0006sy-4o for qemu-devel@nongnu.org; Fri, 19 Aug 2016 15:10:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bapB4-0001uD-UE for qemu-devel@nongnu.org; Fri, 19 Aug 2016 15:10:06 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:50696) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bapB4-0001u9-OG for qemu-devel@nongnu.org; Fri, 19 Aug 2016 15:10:02 -0400 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id D89763D4A798F; Fri, 19 Aug 2016 20:09:47 +0100 (IST) Received: from localhost (10.100.200.35) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 19 Aug 2016 20:09:51 +0100 From: Paul Burton To: , Aurelien Jarno , Leon Alrae Date: Fri, 19 Aug 2016 20:08:58 +0100 Message-ID: <20160819190903.10974-3-paul.burton@imgtec.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160819190903.10974-1-paul.burton@imgtec.com> References: <20160819190903.10974-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.100.200.35] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.59.15.196 Subject: [Qemu-devel] [PATCH 2/7] hw/mips_gictimer: provide API for retrieving frequency 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: Paul Burton Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Provide a new function mips_gictimer_get_freq() which returns the frequency at which a GIC timer will count. This will be useful for boards which perform setup based upon this frequency. Signed-off-by: Paul Burton Reviewed-by: Leon Alrae --- hw/timer/mips_gictimer.c | 5 +++++ include/hw/timer/mips_gictimer.h | 1 + 2 files changed, 6 insertions(+) diff --git a/hw/timer/mips_gictimer.c b/hw/timer/mips_gictimer.c index 3698889..f5c5806 100644 --- a/hw/timer/mips_gictimer.c +++ b/hw/timer/mips_gictimer.c @@ -14,6 +14,11 @@ #define TIMER_PERIOD 10 /* 10 ns period for 100 Mhz frequency */ +uint32_t mips_gictimer_get_freq(MIPSGICTimerState *gic) +{ + return NANOSECONDS_PER_SECOND / TIMER_PERIOD; +} + static void gic_vptimer_update(MIPSGICTimerState *gictimer, uint32_t vp_index, uint64_t now) { diff --git a/include/hw/timer/mips_gictimer.h b/include/hw/timer/mips_gictimer.h index c8bc5d2..c7ca6c8 100644 --- a/include/hw/timer/mips_gictimer.h +++ b/include/hw/timer/mips_gictimer.h @@ -31,6 +31,7 @@ struct MIPSGICTimerState { MIPSGICTimerCB *cb; }; +uint32_t mips_gictimer_get_freq(MIPSGICTimerState *gic); uint32_t mips_gictimer_get_sh_count(MIPSGICTimerState *gic); void mips_gictimer_store_sh_count(MIPSGICTimerState *gic, uint64_t count); uint32_t mips_gictimer_get_vp_compare(MIPSGICTimerState *gictimer,