aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2016-10-31 16:02:31 -0400
committerVineet Gupta <vgupta@synopsys.com>2016-11-30 14:54:25 -0500
commitec7cb87bf998448471d1ff735abf156211da0874 (patch)
tree97b6d6960fb5b008a71bfd5a2f4cd46d75e9bf3e
parent2cd690ea6d6b345265f2de8c40e4a003ed802002 (diff)
ARC: timer: gfrc, rtc: Read BCR to detect whether hardware exists ...
... don't rely on cpuinfo populated in arc boot code. This paves way for moving this code in drivers/clocksource/ And while at it, convert the WARN() to pr_warn() as sugested by Daniel Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/kernel/time.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c
index 8d66bb446209..d3f3750a0d2d 100644
--- a/arch/arc/kernel/time.c
+++ b/arch/arc/kernel/time.c
@@ -111,11 +111,14 @@ static struct clocksource arc_counter_gfrc = {
111 111
112static int __init arc_cs_setup_gfrc(struct device_node *node) 112static int __init arc_cs_setup_gfrc(struct device_node *node)
113{ 113{
114 int exists = cpuinfo_arc700[0].extn.gfrc; 114 struct mcip_bcr mp;
115 int ret; 115 int ret;
116 116
117 if (WARN(!exists, "Global-64-bit-Ctr clocksource not detected")) 117 READ_BCR(ARC_REG_MCIP_BCR, mp);
118 if (!mp.gfrc) {
119 pr_warn("Global-64-bit-Ctr clocksource not detected");
118 return -ENXIO; 120 return -ENXIO;
121 }
119 122
120 ret = arc_get_timer_clk(node); 123 ret = arc_get_timer_clk(node);
121 if (ret) 124 if (ret)
@@ -163,15 +166,20 @@ static struct clocksource arc_counter_rtc = {
163 166
164static int __init arc_cs_setup_rtc(struct device_node *node) 167static int __init arc_cs_setup_rtc(struct device_node *node)
165{ 168{
166 int exists = cpuinfo_arc700[smp_processor_id()].extn.rtc; 169 struct bcr_timer timer;
167 int ret; 170 int ret;
168 171
169 if (WARN(!exists, "Local-64-bit-Ctr clocksource not detected")) 172 READ_BCR(ARC_REG_TIMERS_BCR, timer);
173 if (!timer.rtc) {
174 pr_warn("Local-64-bit-Ctr clocksource not detected");
170 return -ENXIO; 175 return -ENXIO;
176 }
171 177
172 /* Local to CPU hence not usable in SMP */ 178 /* Local to CPU hence not usable in SMP */
173 if (WARN(IS_ENABLED(CONFIG_SMP), "Local-64-bit-Ctr not usable in SMP")) 179 if (IS_ENABLED(CONFIG_SMP)) {
180 pr_warn("Local-64-bit-Ctr not usable in SMP");
174 return -EINVAL; 181 return -EINVAL;
182 }
175 183
176 ret = arc_get_timer_clk(node); 184 ret = arc_get_timer_clk(node);
177 if (ret) 185 if (ret)