Skip to content

Commit 4bcd943

Browse files
author
Michal Simek
committed
microblaze: timer: Use CLKSRC_OF initialization
Simplify timer initialization and prepare the driver for moving to drivers/clocksource folder. Also remove system-timer property from binding because the name is too generic. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
1 parent 144f5c1 commit 4bcd943

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

‎arch/microblaze/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ config MICROBLAZE
2929
select GENERIC_IDLE_POLL_SETUP
3030
select MODULES_USE_ELF_RELA
3131
select CLONE_BACKWARDS3
32+
select CLKSRC_OF
3233

3334
config SWAP
3435
def_bool n

‎arch/microblaze/kernel/setup.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
#include <linux/init.h>
12+
#include <linux/clocksource.h>
1213
#include <linux/string.h>
1314
#include <linux/seq_file.h>
1415
#include <linux/cpu.h>
@@ -192,6 +193,11 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
192193
per_cpu(CURRENT_SAVE, 0) = (unsigned long)current;
193194
}
194195

196+
void __init time_init(void)
197+
{
198+
clocksource_of_init();
199+
}
200+
195201
#ifdef CONFIG_DEBUG_FS
196202
struct dentry *of_debugfs_root;
197203

‎arch/microblaze/kernel/timer.c‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -238,24 +238,12 @@ static int __init microblaze_clocksource_init(void)
238238
*/
239239
static int timer_initialized;
240240

241-
void __init time_init(void)
241+
static void __init xilinx_timer_init(struct device_node *timer)
242242
{
243243
u32 irq;
244244
u32 timer_num = 1;
245-
struct device_node *timer = NULL;
246245
const void *prop;
247246

248-
prop = of_get_property(of_chosen, "system-timer", NULL);
249-
if (prop)
250-
timer = of_find_node_by_phandle(be32_to_cpup(prop));
251-
else
252-
pr_info("No chosen timer found, using default\n");
253-
254-
if (!timer)
255-
timer = of_find_compatible_node(NULL, NULL,
256-
"xlnx,xps-timer-1.00.a");
257-
BUG_ON(!timer);
258-
259247
timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL));
260248
timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE);
261249
irq = irq_of_parse_and_map(timer, 0);
@@ -297,3 +285,6 @@ unsigned long long notrace sched_clock(void)
297285
}
298286
return 0;
299287
}
288+
289+
CLOCKSOURCE_OF_DECLARE(xilinx_timer, "xlnx,xps-timer-1.00.a",
290+
xilinx_timer_init);

0 commit comments

Comments
 (0)