From patchwork Sat Oct 31 10:28:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 37359 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 257D8B7067 for ; Sat, 31 Oct 2009 21:28:58 +1100 (EST) Received: from localhost ([127.0.0.1]:49783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4BCZ-0001zn-FE for incoming@patchwork.ozlabs.org; Sat, 31 Oct 2009 06:28:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N4BC0-0001yR-Rr for qemu-devel@nongnu.org; Sat, 31 Oct 2009 06:28:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N4BBv-0001vy-Ko for qemu-devel@nongnu.org; Sat, 31 Oct 2009 06:28:20 -0400 Received: from [199.232.76.173] (port=51493 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4BBv-0001vv-Gb for qemu-devel@nongnu.org; Sat, 31 Oct 2009 06:28:15 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:54589) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N4BBu-0005lP-Kv for qemu-devel@nongnu.org; Sat, 31 Oct 2009 06:28:15 -0400 Received: from flocke.weilnetz.de (p54ADFF14.dip.t-dialin.net [84.173.255.20]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MBqAp-1Mv9231MO7-00AJAo; Sat, 31 Oct 2009 11:28:12 +0100 Received: from stefan by flocke.weilnetz.de with local (Exim 4.69) (envelope-from ) id 1N4BBr-0005TU-G0; Sat, 31 Oct 2009 11:28:11 +0100 From: Stefan Weil To: QEMU Developers Date: Sat, 31 Oct 2009 11:28:11 +0100 Message-Id: <1256984891-21014-1-git-send-email-weil@mail.berlios.de> X-Mailer: git-send-email 1.5.6.5 X-Provags-ID: V01U2FsdGVkX19A4F6rabAjR6B7GjKqTORlHAfr9Cbl1Ma8n69 TIH4Z7qRnXk44GJq7e8/pxaIkHI22mRY3KOMRk+GOsESkQ4Y6K rEziQbl3K8YGiW4xg3Ma+TaT/iE6KJ41MPzInIYZknPCwCpaWq 0fw== X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] [PATCH] serial: Add interface to set reference oscillator frequency X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Many (most?) serial interfaces have a programmable clock which provides the reference frequency ("baudbase"). So a fixed baudbase which is only set once can be wrong. omap1.c is an example which could use the new interface to change baudbase when the programmable clock changes. ar7 system emulation (still not part of standard QEMU) is similar to omap and already uses serial_set_frequency. Signed-off-by: Stefan Weil --- hw/pc.h | 1 + hw/serial.c | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/hw/pc.h b/hw/pc.h index 15fff8d..03ffc91 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -13,6 +13,7 @@ SerialState *serial_mm_init (target_phys_addr_t base, int it_shift, qemu_irq irq, int baudbase, CharDriverState *chr, int ioregister); SerialState *serial_isa_init(int index, CharDriverState *chr); +void serial_set_frequency(SerialState *s, uint32_t frequency); /* parallel.c */ diff --git a/hw/serial.c b/hw/serial.c index 9353201..754727f 100644 --- a/hw/serial.c +++ b/hw/serial.c @@ -731,6 +731,13 @@ static void serial_init_core(SerialState *s) serial_event, s); } +/* Change the main reference oscillator frequency. */ +void serial_set_frequency(SerialState *s, uint32_t frequency) +{ + s->baudbase = frequency; + serial_update_parameters(s); +} + static const int isa_serial_io[MAX_SERIAL_PORTS] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; static const int isa_serial_irq[MAX_SERIAL_PORTS] = { 4, 3, 4, 3 };