From nobody Mon Feb 9 02:28:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1590942352; cv=none; d=zohomail.com; s=zohoarc; b=ddSSIXiuQqJYjgvXf/txMklZj09lv2e3f0nm/jT3te38iPUYukfAQCUZ7kbAq/8X3aimewvrcpi+EbIvB4BFgBo95pIczQ0CZkIdsPmotOqlUhHp23yQ2fZkD1REckRlPL1OWmu3wdxYLTCsJXQKwW6oYk/bX1ArXBwOaDL5664= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590942352; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eB04VXZ6IUofti5f/z2LO/fT32gEeD+4fqOFd93BLQw=; b=j7998GLrOgCYwNGj0J5RZLAHm8efC3Rrp2m9qASFgy6d/KFcwHlQvPxBoyKqThhM/Neo6gwgvVrZAZ36jrynt9f3ItWRDO3Ic8oJV23fB5KoePTL1Brxg+f8G8QGiKk5I85Pjle/k0ncuCbKL12qBaCOcxxXWHBaXlA86y9T8ys= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590942352704730.2452089381288; Sun, 31 May 2020 09:25:52 -0700 (PDT) Received: from localhost ([::1]:46280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfQmV-0005fo-2p for importer@patchew.org; Sun, 31 May 2020 12:25:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfQlL-0004DM-Jb for qemu-devel@nongnu.org; Sun, 31 May 2020 12:24:39 -0400 Received: from mail03.asahi-net.or.jp ([202.224.55.15]:48260) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfQlJ-0004KS-Uh for qemu-devel@nongnu.org; Sun, 31 May 2020 12:24:39 -0400 Received: from sakura.ysato.name (ik1-413-38519.vs.sakura.ne.jp [153.127.30.23]) (Authenticated sender: PQ4Y-STU) by mail03.asahi-net.or.jp (Postfix) with ESMTPA id 0A2EDECD3D; Mon, 1 Jun 2020 01:24:35 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by sakura.ysato.name (Postfix) with ESMTPSA id B56F71C0DB3; Mon, 1 Jun 2020 01:24:34 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Subject: [PATCH 09/10] hw/sh4: Convert to renesas_timer.c Date: Mon, 1 Jun 2020 01:24:26 +0900 Message-Id: <20200531162427.57410-10-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200531162427.57410-1-ysato@users.sourceforge.jp> References: <20200531162427.57410-1-ysato@users.sourceforge.jp> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: softfail client-ip=202.224.55.15; envelope-from=ysato@users.sourceforge.jp; helo=mail03.asahi-net.or.jp X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/31 12:24:33 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yoshinori Sato Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Using unified TMU/CMT module. Signed-off-by: Yoshinori Sato --- include/hw/sh4/sh.h | 10 --------- hw/sh4/sh7750.c | 47 +++++++++++++++++++++++++++++++++--------- hw/sh4/Kconfig | 2 +- hw/timer/Makefile.objs | 1 - 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/include/hw/sh4/sh.h b/include/hw/sh4/sh.h index e184b4b300..248cc052e1 100644 --- a/include/hw/sh4/sh.h +++ b/include/hw/sh4/sh.h @@ -28,16 +28,6 @@ typedef struct { =20 int sh7750_register_io_device(struct SH7750State *s, sh7750_io_device * device); -/* sh_timer.c */ -#define TMU012_FEAT_TOCR (1 << 0) -#define TMU012_FEAT_3CHAN (1 << 1) -#define TMU012_FEAT_EXTCLK (1 << 2) -void tmu012_init(struct MemoryRegion *sysmem, hwaddr base, - int feat, uint32_t freq, - qemu_irq ch0_irq, qemu_irq ch1_irq, - qemu_irq ch2_irq0, qemu_irq ch2_irq1); - - /* sh7750.c */ qemu_irq sh7750_irl(struct SH7750State *s); =20 diff --git a/hw/sh4/sh7750.c b/hw/sh4/sh7750.c index 150d3029f7..733c4009e1 100644 --- a/hw/sh4/sh7750.c +++ b/hw/sh4/sh7750.c @@ -32,6 +32,7 @@ #include "sh7750_regnames.h" #include "hw/sh4/sh_intc.h" #include "hw/char/renesas_sci.h" +#include "hw/timer/renesas_timer.h" #include "hw/qdev-properties.h" #include "cpu.h" #include "exec/exec-all.h" @@ -756,13 +757,13 @@ static const MemoryRegionOps sh7750_mmct_ops =3D { }; =20 static void sh_serial_init(SH7750State *s, MemoryRegion *sysmem, - hwaddr base, int feat, - uint32_t freq, Chardev *chr, - qemu_irq eri_source, - qemu_irq rxi_source, - qemu_irq txi_source, - qemu_irq tei_source, - qemu_irq bri_source) + hwaddr base, int feat, + uint32_t freq, Chardev *chr, + qemu_irq eri_source, + qemu_irq rxi_source, + qemu_irq txi_source, + qemu_irq tei_source, + qemu_irq bri_source) { DeviceState *dev; SysBusDevice *sci; @@ -789,6 +790,31 @@ static void sh_serial_init(SH7750State *s, MemoryRegio= n *sysmem, } } =20 +static void tmu012_init(SH7750State *s, MemoryRegion *sysmem, hwaddr base, + int feat, uint32_t freq, + qemu_irq ch0_irq, qemu_irq ch1_irq, + qemu_irq ch2_irq0, qemu_irq ch2_irq1) +{ + DeviceState *dev; + SysBusDevice *tmu; + + dev =3D qdev_create(NULL, TYPE_RENESAS_TIMER); + + tmu =3D SYS_BUS_DEVICE(dev); + + qdev_prop_set_uint64(dev, "input-freq", freq); + qdev_prop_set_int32(dev, "feature", feat); + qdev_init_nofail(dev); + sysbus_mmio_map(tmu, 0, base); + sysbus_mmio_map(tmu, 1, P4ADDR(base)); + sysbus_mmio_map(tmu, 2, A7ADDR(base)); + sysbus_connect_irq(tmu, 0, ch0_irq); + sysbus_connect_irq(tmu, 1, ch1_irq); + if (ch2_irq0) { + sysbus_connect_irq(tmu, 2, ch2_irq0); + } +} + SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion *sysmem) { SH7750State *s; @@ -853,8 +879,8 @@ SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion *= sysmem) NULL, s->intc.irqs[SCIF_BRI]); =20 - tmu012_init(sysmem, 0x1fd80000, - TMU012_FEAT_TOCR | TMU012_FEAT_3CHAN | TMU012_FEAT_EXTCLK, + tmu012_init(s, sysmem, 0x1fd80000, + RTIMER_FEAT_TMU_LOW, s->periph_freq, s->intc.irqs[TMU0], s->intc.irqs[TMU1], @@ -877,7 +903,8 @@ SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion *= sysmem) sh_intc_register_sources(&s->intc, _INTC_ARRAY(vectors_tmu34), NULL, 0); - tmu012_init(sysmem, 0x1e100000, 0, s->periph_freq, + tmu012_init(s, sysmem, 0x1e100000, + RTIMER_FEAT_TMU_HIGH, s->periph_freq, s->intc.irqs[TMU3], s->intc.irqs[TMU4], NULL, NULL); diff --git a/hw/sh4/Kconfig b/hw/sh4/Kconfig index 38509b7e65..ac21830bb5 100644 --- a/hw/sh4/Kconfig +++ b/hw/sh4/Kconfig @@ -21,5 +21,5 @@ config SH7750 =20 config SH4 bool - select PTIMER + select RENESAS_TIMER select RENESAS_SCI diff --git a/hw/timer/Makefile.objs b/hw/timer/Makefile.objs index 289b6b03ab..f3918836e4 100644 --- a/hw/timer/Makefile.objs +++ b/hw/timer/Makefile.objs @@ -22,7 +22,6 @@ common-obj-$(CONFIG_EXYNOS4) +=3D exynos4210_pwm.o common-obj-$(CONFIG_OMAP) +=3D omap_gptimer.o common-obj-$(CONFIG_OMAP) +=3D omap_synctimer.o common-obj-$(CONFIG_PXA2XX) +=3D pxa2xx_timer.o -common-obj-$(CONFIG_SH4) +=3D sh_timer.o common-obj-$(CONFIG_DIGIC) +=3D digic-timer.o common-obj-$(CONFIG_MIPS_CPS) +=3D mips_gictimer.o =20 --=20 2.20.1