ramips: make rt3883 usb work properly
[openwrt.git] / target / linux / ramips / patches-3.9 / 0141-clocksource-make-clocksource_of_init-pass-a-device_n.patch
1 From ec2ed8cdbe8b3d24261f0d88eb039e9d71e5d588 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Thu, 23 May 2013 16:58:12 +0200
4 Subject: [PATCH 141/164] clocksource: make clocksource_of_init() pass a
5  device_node pointer
6
7 If we look at the clocksources that are OF enabled we will notice, that they
8 all do a of_find_matching_node() when being called. This patch changes
9 clocksource_of_init() to always pass the struct device_node pointer to the
10 init function.
11
12 Signed-off-by: John Crispin <blogic@openwrt.org>
13 ---
14  drivers/clocksource/bcm2835_timer.c |   12 +-----------
15  drivers/clocksource/clksrc-of.c     |    4 ++--
16  drivers/clocksource/tegra20_timer.c |   14 +-------------
17  drivers/clocksource/vt8500_timer.c  |   14 +-------------
18  4 files changed, 5 insertions(+), 39 deletions(-)
19
20 diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
21 index 50c68fe..766611d 100644
22 --- a/drivers/clocksource/bcm2835_timer.c
23 +++ b/drivers/clocksource/bcm2835_timer.c
24 @@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id)
25         }
26  }
27  
28 -static struct of_device_id bcm2835_time_match[] __initconst = {
29 -       { .compatible = "brcm,bcm2835-system-timer" },
30 -       {}
31 -};
32 -
33 -static void __init bcm2835_timer_init(void)
34 +static void __init bcm2835_timer_init(struct device_node *node)
35  {
36 -       struct device_node *node;
37         void __iomem *base;
38         u32 freq;
39         int irq;
40         struct bcm2835_timer *timer;
41  
42 -       node = of_find_matching_node(NULL, bcm2835_time_match);
43 -       if (!node)
44 -               panic("No bcm2835 timer node");
45 -
46         base = of_iomap(node, 0);
47         if (!base)
48                 panic("Can't remap registers");
49 diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c
50 index bdabdaa..3ef11fb 100644
51 --- a/drivers/clocksource/clksrc-of.c
52 +++ b/drivers/clocksource/clksrc-of.c
53 @@ -26,10 +26,10 @@ void __init clocksource_of_init(void)
54  {
55         struct device_node *np;
56         const struct of_device_id *match;
57 -       void (*init_func)(void);
58 +       void (*init_func)(struct device_node *);
59  
60         for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
61                 init_func = match->data;
62 -               init_func();
63 +               init_func(np);
64         }
65  }
66 diff --git a/drivers/clocksource/tegra20_timer.c b/drivers/clocksource/tegra20_timer.c
67 index 0bde03f..e698d8e 100644
68 --- a/drivers/clocksource/tegra20_timer.c
69 +++ b/drivers/clocksource/tegra20_timer.c
70 @@ -154,29 +154,17 @@ static struct irqaction tegra_timer_irq = {
71         .dev_id         = &tegra_clockevent,
72  };
73  
74 -static const struct of_device_id timer_match[] __initconst = {
75 -       { .compatible = "nvidia,tegra20-timer" },
76 -       {}
77 -};
78 -
79  static const struct of_device_id rtc_match[] __initconst = {
80         { .compatible = "nvidia,tegra20-rtc" },
81         {}
82  };
83  
84 -static void __init tegra20_init_timer(void)
85 +static void __init tegra20_init_timer(struct device_node *np)
86  {
87 -       struct device_node *np;
88         struct clk *clk;
89         unsigned long rate;
90         int ret;
91  
92 -       np = of_find_matching_node(NULL, timer_match);
93 -       if (!np) {
94 -               pr_err("Failed to find timer DT node\n");
95 -               BUG();
96 -       }
97 -
98         timer_reg_base = of_iomap(np, 0);
99         if (!timer_reg_base) {
100                 pr_err("Can't map timer registers\n");
101 diff --git a/drivers/clocksource/vt8500_timer.c b/drivers/clocksource/vt8500_timer.c
102 index 8efc86b..2422552 100644
103 --- a/drivers/clocksource/vt8500_timer.c
104 +++ b/drivers/clocksource/vt8500_timer.c
105 @@ -129,22 +129,10 @@ static struct irqaction irq = {
106         .dev_id  = &clockevent,
107  };
108  
109 -static struct of_device_id vt8500_timer_ids[] = {
110 -       { .compatible = "via,vt8500-timer" },
111 -       { }
112 -};
113 -
114 -static void __init vt8500_timer_init(void)
115 +static void __init vt8500_timer_init(struct device_node *np)
116  {
117 -       struct device_node *np;
118         int timer_irq;
119  
120 -       np = of_find_matching_node(NULL, vt8500_timer_ids);
121 -       if (!np) {
122 -               pr_err("%s: Timer description missing from Device Tree\n",
123 -                                                               __func__);
124 -               return;
125 -       }
126         regbase = of_iomap(np, 0);
127         if (!regbase) {
128                 pr_err("%s: Missing iobase description in Device Tree\n",
129 -- 
130 1.7.10.4
131