Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1i7xwR-0008Uu-Mv for mharc-qemu-riscv@gnu.org; Wed, 11 Sep 2019 04:25:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57766) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7xwN-0008Po-OR for qemu-riscv@nongnu.org; Wed, 11 Sep 2019 04:25:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7xwM-0006rG-3X for qemu-riscv@nongnu.org; Wed, 11 Sep 2019 04:25:27 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52177) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7xwL-0006qu-PD for qemu-riscv@nongnu.org; Wed, 11 Sep 2019 04:25:25 -0400 Received: by mail-wm1-f68.google.com with SMTP id 7so2333360wme.1 for ; Wed, 11 Sep 2019 01:25:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=zKS0Ptw6RqKS92hxW8V/YLR4EXZgqfiBzy8ZWgOdiHs=; b=L1m8qinzpprr+HkOGY98Vkzr2wvsLGi01+O/4yv89f3tGi3of5ZXuVmcTJ8hEjgxEu wSugfTD+jRXdUVBU+JDI8fTZPzgGQXT43a4VOvCXxSMPY1e/yfO87oWgkt1F4NelJMhu PUcGmGXjX43QPZDTR6+mZSiSSvf1fa5L3UO2g89sAEJdyXYd+1FpUtjmylcpRjlyM6sV IJJpj9lB+ABzLacN31zTceP6wY1IyN4T54/VLsK322FNYPZFKFOE8IL0rnovS4JTFsRT DiAZHC30DCDxg97RfrIFLs4jxgxWJ3iF0eJD57V32hy7S2D+voYA+HD6tpf+GGbcE1J6 /gQA== X-Gm-Message-State: APjAAAW1HnHIY0elOZ0eUHQepwp1Q58a5faGZuvOOexvGZsVW55ZRLTa OHfSyLJgaCCOclo/DV26ydZG4JKqN/6CiA== X-Google-Smtp-Source: APXvYqz1v/nztKnreMNb2jwoHVEdZoOFBccPo2VCZShzDyOTR4o4C6kz9lIf2gy0t/SPhBzfj7alCA== X-Received: by 2002:a1c:cbcc:: with SMTP id b195mr3115867wmg.80.1568190324356; Wed, 11 Sep 2019 01:25:24 -0700 (PDT) Received: from localhost ([148.69.85.38]) by smtp.gmail.com with ESMTPSA id y186sm3504573wmd.26.2019.09.11.01.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2019 01:25:23 -0700 (PDT) Date: Tue, 10 Sep 2019 12:05:02 -0700 Message-Id: <20190910190513.21160-37-palmer@sifive.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190910190513.21160-1-palmer@sifive.com> References: <20190910190513.21160-1-palmer@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Bin Meng , Alistair Francis , Palmer Dabbelt From: Palmer Dabbelt To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.68 Subject: [Qemu-riscv] [PULL 36/47] riscv: sifive_u: Reference PRCI clocks in UART and ethernet nodes X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2019 08:25:30 -0000 From: Bin Meng Now that we have added a PRCI node, update existing UART and ethernet nodes to reference PRCI as their clock sources, to keep in sync with the Linux kernel device tree. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Signed-off-by: Palmer Dabbelt --- hw/riscv/sifive_u.c | 7 ++++--- include/hw/riscv/sifive_u_prci.h | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index ff2e28e26c..ea21095513 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -78,7 +78,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, int cpu; uint32_t *cells; char *nodename; - char ethclk_names[] = "pclk\0hclk\0tx_clk"; + char ethclk_names[] = "pclk\0hclk"; uint32_t plic_phandle, prci_phandle, ethclk_phandle, phandle = 1; uint32_t uartclk_phandle; uint32_t hfclk_phandle, rtcclk_phandle; @@ -263,7 +263,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); qemu_fdt_setprop_cell(fdt, nodename, "interrupts", SIFIVE_U_GEM_IRQ); qemu_fdt_setprop_cells(fdt, nodename, "clocks", - ethclk_phandle, ethclk_phandle, ethclk_phandle); + prci_phandle, PRCI_CLK_GEMGXLPLL, prci_phandle, PRCI_CLK_GEMGXLPLL); qemu_fdt_setprop(fdt, nodename, "clock-names", ethclk_names, sizeof(ethclk_names)); qemu_fdt_setprop_cell(fdt, nodename, "#address-cells", 1); @@ -293,7 +293,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0, memmap[SIFIVE_U_UART0].base, 0x0, memmap[SIFIVE_U_UART0].size); - qemu_fdt_setprop_cell(fdt, nodename, "clocks", uartclk_phandle); + qemu_fdt_setprop_cells(fdt, nodename, "clocks", + prci_phandle, PRCI_CLK_TLCLK); qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); qemu_fdt_setprop_cell(fdt, nodename, "interrupts", SIFIVE_U_UART0_IRQ); diff --git a/include/hw/riscv/sifive_u_prci.h b/include/hw/riscv/sifive_u_prci.h index 60a2eab0e9..0a531fdadc 100644 --- a/include/hw/riscv/sifive_u_prci.h +++ b/include/hw/riscv/sifive_u_prci.h @@ -78,4 +78,14 @@ typedef struct SiFiveUPRCIState { uint32_t clkmuxstatus; } SiFiveUPRCIState; +/* + * Clock indexes for use by Device Tree data and the PRCI driver. + * + * These values are from sifive-fu540-prci.h in the Linux kernel. + */ +#define PRCI_CLK_COREPLL 0 +#define PRCI_CLK_DDRPLL 1 +#define PRCI_CLK_GEMGXLPLL 2 +#define PRCI_CLK_TLCLK 3 + #endif /* HW_SIFIVE_U_PRCI_H */ -- 2.21.0