Commit effbfdd7 authored by Rob Herring's avatar Rob Herring

clocksource: pass DT node pointer to init functions

In cases where we have multiple nodes of the same type, we may need the
node pointer to know which node was matched. Passing the node pointer
also keeps the init function from having to match the node a 2nd time.

Update bcm2835, vt8500, and tegra20 init functions for the new function
prototype. Further tegra20 clean-ups are in follow-up commit.
Signed-off-by: default avatarRob Herring <rob.herring@calxeda.com>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarStephen Warren <swarren@nvidia.com>
Tested-by: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarTony Prisk <linux@prisktech.co.nz>
Tested-by: default avatarMichal Simek <michal.simek@xilinx.com>
parent e0c25362
...@@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id) ...@@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id)
} }
} }
static struct of_device_id bcm2835_time_match[] __initconst = { static void __init bcm2835_timer_init(struct device_node *node)
{ .compatible = "brcm,bcm2835-system-timer" },
{}
};
static void __init bcm2835_timer_init(void)
{ {
struct device_node *node;
void __iomem *base; void __iomem *base;
u32 freq; u32 freq;
int irq; int irq;
struct bcm2835_timer *timer; struct bcm2835_timer *timer;
node = of_find_matching_node(NULL, bcm2835_time_match);
if (!node)
panic("No bcm2835 timer node");
base = of_iomap(node, 0); base = of_iomap(node, 0);
if (!base) if (!base)
panic("Can't remap registers"); panic("Can't remap registers");
......
...@@ -26,10 +26,10 @@ void __init clocksource_of_init(void) ...@@ -26,10 +26,10 @@ void __init clocksource_of_init(void)
{ {
struct device_node *np; struct device_node *np;
const struct of_device_id *match; const struct of_device_id *match;
void (*init_func)(void); void (*init_func)(struct device_node *);
for_each_matching_node_and_match(np, __clksrc_of_table, &match) { for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
init_func = match->data; init_func = match->data;
init_func(); init_func(np);
} }
} }
...@@ -164,9 +164,8 @@ static const struct of_device_id rtc_match[] __initconst = { ...@@ -164,9 +164,8 @@ static const struct of_device_id rtc_match[] __initconst = {
{} {}
}; };
static void __init tegra20_init_timer(void) static void __init tegra20_init_timer(struct device_node *np)
{ {
struct device_node *np;
struct clk *clk; struct clk *clk;
unsigned long rate; unsigned long rate;
int ret; int ret;
......
...@@ -129,22 +129,10 @@ static struct irqaction irq = { ...@@ -129,22 +129,10 @@ static struct irqaction irq = {
.dev_id = &clockevent, .dev_id = &clockevent,
}; };
static struct of_device_id vt8500_timer_ids[] = { static void __init vt8500_timer_init(struct device_node *np)
{ .compatible = "via,vt8500-timer" },
{ }
};
static void __init vt8500_timer_init(void)
{ {
struct device_node *np;
int timer_irq; int timer_irq;
np = of_find_matching_node(NULL, vt8500_timer_ids);
if (!np) {
pr_err("%s: Timer description missing from Device Tree\n",
__func__);
return;
}
regbase = of_iomap(np, 0); regbase = of_iomap(np, 0);
if (!regbase) { if (!regbase) {
pr_err("%s: Missing iobase description in Device Tree\n", pr_err("%s: Missing iobase description in Device Tree\n",
......
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