From patchwork Fri Aug 23 05:11:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110609 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B56A1709 for ; Fri, 23 Aug 2019 05:41:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D627821019 for ; Fri, 23 Aug 2019 05:41:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X03nJwsu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D627821019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12Jt-0001Ty-1L for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:41:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45282) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11ra-0004Wp-Q7 for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rZ-0002pa-7o for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:50 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:34843) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rZ-0002pK-2B; Fri, 23 Aug 2019 01:11:49 -0400 Received: by mail-pg1-x543.google.com with SMTP id n4so5102322pgv.2; Thu, 22 Aug 2019 22:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=mZL9h/bKRMuQuWVv7NByPM2xYVHQluXKxIATUm/Qd2A=; b=X03nJwsuGqdj94XZ6o0+9gsl8S7rzLgTFxRowykpQUWnGAcs5yaURRYTcA1GkopHYm 51DbPFFPuN29xJK6gMarvYkH7caBpIEzaxG+Pgj6sVRakDCzqp1rNBaujamtWBjZMBVE Wd2vrx3Erq5TBjTCXmuOXd5jZeREdMko52czADDJOEhjXuJpaBEymUz6VGijXtF/hNMn s7j5vpE0+FvoRaN3VWmcOIz02RPqDa6OJU7KIYUA/cOOF9V32kDFZhmk9ybuC+xwzwmY 7dIftJOyaif9RXdkc/0rLS7By/aXlU7+f/6Fixs0Ohg6jdDM9xNs005ulihDov0X+cf+ GADg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=mZL9h/bKRMuQuWVv7NByPM2xYVHQluXKxIATUm/Qd2A=; b=KKD7en127XMXOMV94PeTH691xgYfZ0xuFnS+dpS52FtCKQgCiGHw48CGZCngAJ9YwI /JV2hXP3jd7eirytU+gIgG6ptLWlSSM0kp9ToiT0CTrCPAQHwQQNLDh/SqwgMj8lH5Cq byuVvt9wf7FZlDGVvI1Uuz/cknpOvpdjOaljprJlSfpxXZElqjcNSxWuemTYaR4RXFll TR0/pT2ZDnl5cpnjdWZ47Fv98bSPQtlsqrW3O4FjFkvPOEfhoiUTr+nV3/UWAsg3NKcG okEP23B/S5RLXpmmUXNFFy1RfA9vE2rLHDeSgag2w1FSse+HgBEZfyEb7BMbODGtCP3X dELQ== X-Gm-Message-State: APjAAAW7h+RjptXAB0PO+FWjGlN/s2yckaUmzJYqftWCgG+bpqMUS7TK nLI1VFm/2pvXtlaPca6jB70= X-Google-Smtp-Source: APXvYqwWyIdaJD1wdH3bRPE8sGvUug+vUiKjbvj43QAL6B03SujZ8CMbwkFywYtquPWictlIAzmd/A== X-Received: by 2002:a63:e602:: with SMTP id g2mr2350219pgh.224.1566537108292; Thu, 22 Aug 2019 22:11:48 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:47 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:08 -0700 Message-Id: <1566537069-22741-30-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH v5 29/30] riscv: sifive_u: Remove handcrafted clock nodes for UART and ethernet 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" In the past we did not have a model for PRCI, hence two handcrafted clock nodes ("/soc/ethclk" and "/soc/uartclk") were created for the purpose of supplying hard-coded clock frequencies. But now since we have added the PRCI support in QEMU, we don't need them any more. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: - new patch to remove handcrafted clock nodes for UART and ethernet Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 24 +----------------------- include/hw/riscv/sifive_u.h | 3 +-- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 503db4b..1140c38 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -88,8 +88,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, uint32_t *cells; char *nodename; char ethclk_names[] = "pclk\0hclk"; - uint32_t plic_phandle, prci_phandle, ethclk_phandle, phandle = 1; - uint32_t uartclk_phandle; + uint32_t plic_phandle, prci_phandle, phandle = 1; uint32_t hfclk_phandle, rtcclk_phandle, phy_phandle; fdt = s->fdt = create_device_tree(&s->fdt_size); @@ -249,17 +248,6 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, g_free(cells); g_free(nodename); - ethclk_phandle = phandle++; - nodename = g_strdup_printf("/soc/ethclk"); - qemu_fdt_add_subnode(fdt, nodename); - qemu_fdt_setprop_string(fdt, nodename, "compatible", "fixed-clock"); - qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x0); - qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", - SIFIVE_U_GEM_CLOCK_FREQ); - qemu_fdt_setprop_cell(fdt, nodename, "phandle", ethclk_phandle); - ethclk_phandle = qemu_fdt_get_phandle(fdt, nodename); - g_free(nodename); - phy_phandle = phandle++; nodename = g_strdup_printf("/soc/ethernet@%lx", (long)memmap[SIFIVE_U_GEM].base); @@ -293,16 +281,6 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "reg", 0x0); g_free(nodename); - uartclk_phandle = phandle++; - nodename = g_strdup_printf("/soc/uartclk"); - qemu_fdt_add_subnode(fdt, nodename); - qemu_fdt_setprop_string(fdt, nodename, "compatible", "fixed-clock"); - qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x0); - qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", 3686400); - qemu_fdt_setprop_cell(fdt, nodename, "phandle", uartclk_phandle); - uartclk_phandle = qemu_fdt_get_phandle(fdt, nodename); - g_free(nodename); - nodename = g_strdup_printf("/soc/serial@%lx", (long)memmap[SIFIVE_U_UART0].base); qemu_fdt_add_subnode(fdt, nodename); diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index d2b9d99..3bb87cb 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -76,8 +76,7 @@ enum { enum { SIFIVE_U_CLOCK_FREQ = 1000000000, SIFIVE_U_HFCLK_FREQ = 33333333, - SIFIVE_U_RTCCLK_FREQ = 1000000, - SIFIVE_U_GEM_CLOCK_FREQ = 125000000 + SIFIVE_U_RTCCLK_FREQ = 1000000 }; #define SIFIVE_U_MANAGEMENT_CPU_COUNT 1