aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2013-02-06 15:40:22 -0500
committerRob Herring <rob.herring@calxeda.com>2013-03-11 09:42:07 -0400
commiteffbfdd7baf7babc73154b87a5ff940969cf6559 (patch)
tree7aab87a4f5be6ed1ab817cdd65dcd4d983094e37 /drivers
parente0c25362384f4be9c755c98560cd4b1cdb2ec79c (diff)
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: Rob Herring <rob.herring@calxeda.com> Cc: John Stultz <johnstul@us.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Tony Prisk <linux@prisktech.co.nz> Tested-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clocksource/bcm2835_timer.c12
-rw-r--r--drivers/clocksource/clksrc-of.c4
-rw-r--r--drivers/clocksource/tegra20_timer.c3
-rw-r--r--drivers/clocksource/vt8500_timer.c14
4 files changed, 5 insertions, 28 deletions
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index 50c68fef944b..766611d29945 100644
--- a/drivers/clocksource/bcm2835_timer.c
+++ b/drivers/clocksource/bcm2835_timer.c
@@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id)
95 } 95 }
96} 96}
97 97
98static struct of_device_id bcm2835_time_match[] __initconst = { 98static void __init bcm2835_timer_init(struct device_node *node)
99 { .compatible = "brcm,bcm2835-system-timer" },
100 {}
101};
102
103static void __init bcm2835_timer_init(void)
104{ 99{
105 struct device_node *node;
106 void __iomem *base; 100 void __iomem *base;
107 u32 freq; 101 u32 freq;
108 int irq; 102 int irq;
109 struct bcm2835_timer *timer; 103 struct bcm2835_timer *timer;
110 104
111 node = of_find_matching_node(NULL, bcm2835_time_match);
112 if (!node)
113 panic("No bcm2835 timer node");
114
115 base = of_iomap(node, 0); 105 base = of_iomap(node, 0);
116 if (!base) 106 if (!base)
117 panic("Can't remap registers"); 107 panic("Can't remap registers");
diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c
index bdabdaa8d00f..3ef11fba781c 100644
--- a/drivers/clocksource/clksrc-of.c
+++ b/drivers/clocksource/clksrc-of.c
@@ -26,10 +26,10 @@ void __init clocksource_of_init(void)
26{ 26{
27 struct device_node *np; 27 struct device_node *np;
28 const struct of_device_id *match; 28 const struct of_device_id *match;
29 void (*init_func)(void); 29 void (*init_func)(struct device_node *);
30 30
31 for_each_matching_node_and_match(np, __clksrc_of_table, &match) { 31 for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
32 init_func = match->data; 32 init_func = match->data;
33 init_func(); 33 init_func(np);
34 } 34 }
35} 35}
diff --git a/drivers/clocksource/tegra20_timer.c b/drivers/clocksource/tegra20_timer.c
index 0bde03feb095..b3396ab15f63 100644
--- a/drivers/clocksource/tegra20_timer.c
+++ b/drivers/clocksource/tegra20_timer.c
@@ -164,9 +164,8 @@ static const struct of_device_id rtc_match[] __initconst = {
164 {} 164 {}
165}; 165};
166 166
167static void __init tegra20_init_timer(void) 167static void __init tegra20_init_timer(struct device_node *np)
168{ 168{
169 struct device_node *np;
170 struct clk *clk; 169 struct clk *clk;
171 unsigned long rate; 170 unsigned long rate;
172 int ret; 171 int ret;
diff --git a/drivers/clocksource/vt8500_timer.c b/drivers/clocksource/vt8500_timer.c
index 8efc86b5b5dd..242255285597 100644
--- a/drivers/clocksource/vt8500_timer.c
+++ b/drivers/clocksource/vt8500_timer.c
@@ -129,22 +129,10 @@ static struct irqaction irq = {
129 .dev_id = &clockevent, 129 .dev_id = &clockevent,
130}; 130};
131 131
132static struct of_device_id vt8500_timer_ids[] = { 132static void __init vt8500_timer_init(struct device_node *np)
133 { .compatible = "via,vt8500-timer" },
134 { }
135};
136
137static void __init vt8500_timer_init(void)
138{ 133{
139 struct device_node *np;
140 int timer_irq; 134 int timer_irq;
141 135
142 np = of_find_matching_node(NULL, vt8500_timer_ids);
143 if (!np) {
144 pr_err("%s: Timer description missing from Device Tree\n",
145 __func__);
146 return;
147 }
148 regbase = of_iomap(np, 0); 136 regbase = of_iomap(np, 0);
149 if (!regbase) { 137 if (!regbase) {
150 pr_err("%s: Missing iobase description in Device Tree\n", 138 pr_err("%s: Missing iobase description in Device Tree\n",