diff options
-rw-r--r-- | arch/arm/mach-picoxcell/common.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-socfpga/socfpga.c | 2 | ||||
-rw-r--r-- | drivers/clocksource/Kconfig | 1 | ||||
-rw-r--r-- | drivers/clocksource/dw_apb_timer_of.c | 41 | ||||
-rw-r--r-- | include/linux/dw_apb_timer.h | 1 |
5 files changed, 21 insertions, 26 deletions
diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c index 70b441ad1d18..7cde0424d33c 100644 --- a/arch/arm/mach-picoxcell/common.c +++ b/arch/arm/mach-picoxcell/common.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/of_address.h> | 15 | #include <linux/of_address.h> |
16 | #include <linux/of_irq.h> | 16 | #include <linux/of_irq.h> |
17 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
18 | #include <linux/dw_apb_timer.h> | ||
19 | 18 | ||
20 | #include <asm/mach/arch.h> | 19 | #include <asm/mach/arch.h> |
21 | #include <asm/mach/map.h> | 20 | #include <asm/mach/map.h> |
@@ -88,7 +87,6 @@ DT_MACHINE_START(PICOXCELL, "Picochip picoXcell") | |||
88 | .map_io = picoxcell_map_io, | 87 | .map_io = picoxcell_map_io, |
89 | .nr_irqs = NR_IRQS_LEGACY, | 88 | .nr_irqs = NR_IRQS_LEGACY, |
90 | .init_irq = irqchip_init, | 89 | .init_irq = irqchip_init, |
91 | .init_time = dw_apb_timer_init, | ||
92 | .init_machine = picoxcell_init_machine, | 90 | .init_machine = picoxcell_init_machine, |
93 | .dt_compat = picoxcell_dt_match, | 91 | .dt_compat = picoxcell_dt_match, |
94 | .restart = picoxcell_wdt_restart, | 92 | .restart = picoxcell_wdt_restart, |
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c index 46a051359f02..8ea11b472b91 100644 --- a/arch/arm/mach-socfpga/socfpga.c +++ b/arch/arm/mach-socfpga/socfpga.c | |||
@@ -14,7 +14,6 @@ | |||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | */ | 16 | */ |
17 | #include <linux/dw_apb_timer.h> | ||
18 | #include <linux/clk-provider.h> | 17 | #include <linux/clk-provider.h> |
19 | #include <linux/irqchip.h> | 18 | #include <linux/irqchip.h> |
20 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
@@ -120,7 +119,6 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA") | |||
120 | .smp = smp_ops(socfpga_smp_ops), | 119 | .smp = smp_ops(socfpga_smp_ops), |
121 | .map_io = socfpga_map_io, | 120 | .map_io = socfpga_map_io, |
122 | .init_irq = socfpga_init_irq, | 121 | .init_irq = socfpga_init_irq, |
123 | .init_time = dw_apb_timer_init, | ||
124 | .init_machine = socfpga_cyclone5_init, | 122 | .init_machine = socfpga_cyclone5_init, |
125 | .restart = socfpga_cyclone5_restart, | 123 | .restart = socfpga_cyclone5_restart, |
126 | .dt_compat = altera_dt_match, | 124 | .dt_compat = altera_dt_match, |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 48a0f2e1dd78..5871933c4e51 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
@@ -22,6 +22,7 @@ config DW_APB_TIMER | |||
22 | config DW_APB_TIMER_OF | 22 | config DW_APB_TIMER_OF |
23 | bool | 23 | bool |
24 | select DW_APB_TIMER | 24 | select DW_APB_TIMER |
25 | select CLKSRC_OF | ||
25 | 26 | ||
26 | config ARMADA_370_XP_TIMER | 27 | config ARMADA_370_XP_TIMER |
27 | bool | 28 | bool |
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c index 1964f8716966..cef554432a33 100644 --- a/drivers/clocksource/dw_apb_timer_of.c +++ b/drivers/clocksource/dw_apb_timer_of.c | |||
@@ -133,27 +133,26 @@ static void init_sched_clock(void) | |||
133 | setup_sched_clock(read_sched_clock, 32, sched_rate); | 133 | setup_sched_clock(read_sched_clock, 32, sched_rate); |
134 | } | 134 | } |
135 | 135 | ||
136 | static const struct of_device_id osctimer_ids[] __initconst = { | 136 | static int num_called; |
137 | { .compatible = "picochip,pc3x2-timer" }, | 137 | static void __init dw_apb_timer_init(struct device_node *timer) |
138 | { .compatible = "snps,dw-apb-timer-osc" }, | ||
139 | {}, | ||
140 | }; | ||
141 | |||
142 | void __init dw_apb_timer_init(void) | ||
143 | { | 138 | { |
144 | struct device_node *event_timer, *source_timer; | 139 | switch (num_called) { |
145 | 140 | case 0: | |
146 | event_timer = of_find_matching_node(NULL, osctimer_ids); | 141 | pr_debug("%s: found clockevent timer\n", __func__); |
147 | if (!event_timer) | 142 | add_clockevent(timer); |
148 | panic("No timer for clockevent"); | 143 | of_node_put(timer); |
149 | add_clockevent(event_timer); | 144 | break; |
150 | 145 | case 1: | |
151 | source_timer = of_find_matching_node(event_timer, osctimer_ids); | 146 | pr_debug("%s: found clocksource timer\n", __func__); |
152 | if (!source_timer) | 147 | add_clocksource(timer); |
153 | panic("No timer for clocksource"); | 148 | of_node_put(timer); |
154 | add_clocksource(source_timer); | 149 | init_sched_clock(); |
155 | 150 | break; | |
156 | of_node_put(source_timer); | 151 | default: |
152 | break; | ||
153 | } | ||
157 | 154 | ||
158 | init_sched_clock(); | 155 | num_called++; |
159 | } | 156 | } |
157 | CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init); | ||
158 | CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init); | ||
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h index dd755ce2a5eb..07261d52a6df 100644 --- a/include/linux/dw_apb_timer.h +++ b/include/linux/dw_apb_timer.h | |||
@@ -53,5 +53,4 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs); | |||
53 | cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); | 53 | cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); |
54 | void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs); | 54 | void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs); |
55 | 55 | ||
56 | extern void dw_apb_timer_init(void); | ||
57 | #endif /* __DW_APB_TIMER_H__ */ | 56 | #endif /* __DW_APB_TIMER_H__ */ |