[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180726143723.16585-7-hch@lst.de>
Date: Thu, 26 Jul 2018 16:37:20 +0200
From: Christoph Hellwig <hch@....de>
To: tglx@...utronix.de, palmer@...ive.com, jason@...edaemon.net,
marc.zyngier@....com, robh+dt@...nel.org, mark.rutland@....com
Cc: anup@...infault.org, atish.patra@....com,
devicetree@...r.kernel.org, aou@...s.berkeley.edu,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
shorne@...il.com, Palmer Dabbelt <palmer@...belt.com>
Subject: [PATCH 6/9] RISC-V: Support per-hart timebase-frequency
From: Palmer Dabbelt <palmer@...ive.com>
This isn't actually how I want to do it, I just needed something right
now.
Signed-off-by: Palmer Dabbelt <palmer@...belt.com>
---
arch/riscv/kernel/time.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/kernel/time.c b/arch/riscv/kernel/time.c
index 0df9b2cbd645..1bb01dc2d0f1 100644
--- a/arch/riscv/kernel/time.c
+++ b/arch/riscv/kernel/time.c
@@ -24,17 +24,24 @@ void __init init_clockevent(void)
csr_set(sie, SIE_STIE);
}
-void __init time_init(void)
+static long __init timebase_frequency(void)
{
struct device_node *cpu;
u32 prop;
cpu = of_find_node_by_path("/cpus");
- if (!cpu || of_property_read_u32(cpu, "timebase-frequency", &prop))
- panic(KERN_WARNING "RISC-V system with no 'timebase-frequency' in DTS\n");
- riscv_timebase = prop;
+ if (cpu && !of_property_read_u32(cpu, "timebase-frequency", &prop))
+ return prop;
+ cpu = of_find_node_by_path("/cpus/cpu@0");
+ if (cpu && !of_property_read_u32(cpu, "timebase-frequency", &prop))
+ return prop;
- lpj_fine = riscv_timebase / HZ;
+ panic(KERN_WARNING "RISC-V system with no 'timebase-frequency' in DTS\n");
+}
+void __init time_init(void)
+{
+ riscv_timebase = timebase_frequency();
+ lpj_fine = riscv_timebase / HZ;
init_clockevent();
}
--
2.18.0
Powered by blists - more mailing lists