All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <Anup.Patel@wdc.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v9 12/15] cpu: Bind timer driver for boot hart
Date: Thu, 21 Feb 2019 04:31:24 +0000	[thread overview]
Message-ID: <20190221042936.13441-13-anup.patel@wdc.com> (raw)
In-Reply-To: <20190221042936.13441-1-anup.patel@wdc.com>

From: Atish Patra <atish.patra@wdc.com>

Currently, timer driver is bound only for hart0.

There is no mandatory requirement that hart0 should always
come up. In fact, HiFive Unleashed SoC hart0 doesn't boot
in S-mode because it only has M-mode.

The timer driver should be bound for boot hart.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
 drivers/cpu/riscv_cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c
index 5e15df590e..f77c126499 100644
--- a/drivers/cpu/riscv_cpu.c
+++ b/drivers/cpu/riscv_cpu.c
@@ -10,6 +10,8 @@
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static int riscv_cpu_get_desc(struct udevice *dev, char *buf, int size)
 {
 	const char *isa;
@@ -62,7 +64,6 @@ static int riscv_cpu_bind(struct udevice *dev)
 
 	/* save the hart id */
 	plat->cpu_id = dev_read_addr(dev);
-
 	/* first examine the property in current cpu node */
 	ret = dev_read_u32(dev, "timebase-frequency", &plat->timebase_freq);
 	/* if not found, then look at the parent /cpus node */
@@ -71,7 +72,7 @@ static int riscv_cpu_bind(struct udevice *dev)
 			     &plat->timebase_freq);
 
 	/*
-	 * Bind riscv-timer driver on hart 0
+	 * Bind riscv-timer driver on boot hart.
 	 *
 	 * We only instantiate one timer device which is enough for U-Boot.
 	 * Pass the "timebase-frequency" value as the driver data for the
@@ -80,7 +81,7 @@ static int riscv_cpu_bind(struct udevice *dev)
 	 * Return value is not checked since it's possible that the timer
 	 * driver is not included.
 	 */
-	if (!plat->cpu_id && plat->timebase_freq) {
+	if (plat->cpu_id == gd->arch.boot_hart && plat->timebase_freq) {
 		drv = lists_driver_lookup_name("riscv_timer");
 		if (!drv) {
 			debug("Cannot find the timer driver, not included?\n");
-- 
2.17.1

  parent reply	other threads:[~2019-02-21  4:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21  4:30 [U-Boot] [PATCH v9 00/15] SiFive FU540 Support Anup Patel
2019-02-21  4:30 ` [U-Boot] [PATCH v9 01/15] riscv: Enable create symlink using kconfig Anup Patel
2019-02-21  4:30 ` [U-Boot] [PATCH v9 02/15] riscv: Rename cpu/qemu to cpu/generic Anup Patel
2019-02-21  4:30 ` [U-Boot] [PATCH v9 03/15] riscv: Add asm/dma-mapping.h for DMA mappings Anup Patel
2019-02-21  4:30 ` [U-Boot] [PATCH v9 04/15] riscv: Add place-holder asm/arch/clk.h for driver compilation Anup Patel
2019-02-21  4:30 ` [U-Boot] [PATCH v9 05/15] riscv: generic: Ensure that U-Boot runs within 4GB for 64bit systems Anup Patel
2019-02-21  4:30 ` [U-Boot] [PATCH v9 06/15] net: macb: Fix clk API usage for RISC-V systems Anup Patel
2019-02-21 18:35   ` Joe Hershberger
2019-02-21  4:30 ` [U-Boot] [PATCH v9 07/15] net: macb: Fix GEM hardware detection Anup Patel
2019-02-21  4:31 ` [U-Boot] [PATCH v9 08/15] clk: Add SiFive FU540 PRCI clock driver Anup Patel
2019-02-21  4:31 ` [U-Boot] [PATCH v9 09/15] clk: Add fixed-factor " Anup Patel
2019-02-21  4:31 ` [U-Boot] [PATCH v9 10/15] drivers: serial_sifive: Fix baud rate calculation Anup Patel
2019-02-21  4:31 ` [U-Boot] [PATCH v9 11/15] drivers: serial_sifive: Skip baudrate config if no input clock Anup Patel
2019-02-21  4:31 ` Anup Patel [this message]
2019-02-21  4:31 ` [U-Boot] [PATCH v9 13/15] riscv: Add SiFive FU540 board support Anup Patel
2019-02-21  4:31 ` [U-Boot] [PATCH v9 14/15] doc: Add a readme guide for SiFive FU540 Anup Patel
2019-02-21  4:31 ` [U-Boot] [PATCH v9 15/15] riscv: Enable CONFIG_SYS_BOOT_RAMDISK_HIGH for using initrd Anup Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190221042936.13441-13-anup.patel@wdc.com \
    --to=anup.patel@wdc.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.