Commit 4bcd943e authored by Michal Simek's avatar Michal Simek

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: default avatarMichal Simek <michal.simek@xilinx.com>
parent 144f5c19
...@@ -29,6 +29,7 @@ config MICROBLAZE ...@@ -29,6 +29,7 @@ config MICROBLAZE
select GENERIC_IDLE_POLL_SETUP select GENERIC_IDLE_POLL_SETUP
select MODULES_USE_ELF_RELA select MODULES_USE_ELF_RELA
select CLONE_BACKWARDS3 select CLONE_BACKWARDS3
select CLKSRC_OF
config SWAP config SWAP
def_bool n def_bool n
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/clocksource.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/cpu.h> #include <linux/cpu.h>
...@@ -192,6 +193,11 @@ void __init machine_early_init(const char *cmdline, unsigned int ram, ...@@ -192,6 +193,11 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
per_cpu(CURRENT_SAVE, 0) = (unsigned long)current; per_cpu(CURRENT_SAVE, 0) = (unsigned long)current;
} }
void __init time_init(void)
{
clocksource_of_init();
}
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *of_debugfs_root; struct dentry *of_debugfs_root;
......
...@@ -238,24 +238,12 @@ static int __init microblaze_clocksource_init(void) ...@@ -238,24 +238,12 @@ static int __init microblaze_clocksource_init(void)
*/ */
static int timer_initialized; static int timer_initialized;
void __init time_init(void) static void __init xilinx_timer_init(struct device_node *timer)
{ {
u32 irq; u32 irq;
u32 timer_num = 1; u32 timer_num = 1;
struct device_node *timer = NULL;
const void *prop; const void *prop;
prop = of_get_property(of_chosen, "system-timer", NULL);
if (prop)
timer = of_find_node_by_phandle(be32_to_cpup(prop));
else
pr_info("No chosen timer found, using default\n");
if (!timer)
timer = of_find_compatible_node(NULL, NULL,
"xlnx,xps-timer-1.00.a");
BUG_ON(!timer);
timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL)); timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL));
timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE); timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE);
irq = irq_of_parse_and_map(timer, 0); irq = irq_of_parse_and_map(timer, 0);
...@@ -297,3 +285,6 @@ unsigned long long notrace sched_clock(void) ...@@ -297,3 +285,6 @@ unsigned long long notrace sched_clock(void)
} }
return 0; return 0;
} }
CLOCKSOURCE_OF_DECLARE(xilinx_timer, "xlnx,xps-timer-1.00.a",
xilinx_timer_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment