diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2013-03-23 19:01:48 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2013-04-08 15:41:54 -0400 |
commit | ea71d9a600e769ca669f4ba3e25ffdecdeede240 (patch) | |
tree | bb5bb6a4a2695a86f90d942e36e25f3cac6b6a80 | |
parent | 049817319a5cf2812ada74018ae9f5c5b739607b (diff) |
clocksource: sunxi: make use of CLKSRC_OF
Using CLKSRC_OF allows to remove the SoC specific sunxi_timer.h header,
and instead of using a custom init function in the machine definition
use the standard clocksource_of_init function.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-rw-r--r-- | arch/arm/mach-sunxi/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-sunxi/sunxi.c | 11 | ||||
-rw-r--r-- | drivers/clocksource/sunxi_timer.c | 18 | ||||
-rw-r--r-- | include/linux/sunxi_timer.h | 24 |
4 files changed, 13 insertions, 41 deletions
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 8709a39bd34c..06c28945357d 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config ARCH_SUNXI | 1 | config ARCH_SUNXI |
2 | bool "Allwinner A1X SOCs" if ARCH_MULTI_V7 | 2 | bool "Allwinner A1X SOCs" if ARCH_MULTI_V7 |
3 | select CLKSRC_MMIO | 3 | select CLKSRC_MMIO |
4 | select CLKSRC_OF | ||
4 | select COMMON_CLK | 5 | select COMMON_CLK |
5 | select GENERIC_CLOCKEVENTS | 6 | select GENERIC_CLOCKEVENTS |
6 | select GENERIC_IRQ_CHIP | 7 | select GENERIC_IRQ_CHIP |
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index 23afb732cb40..b26748d82045 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * warranty of any kind, whether express or implied. | 10 | * warranty of any kind, whether express or implied. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/clocksource.h> | ||
13 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
@@ -17,8 +18,8 @@ | |||
17 | #include <linux/of_irq.h> | 18 | #include <linux/of_irq.h> |
18 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
19 | #include <linux/io.h> | 20 | #include <linux/io.h> |
20 | #include <linux/sunxi_timer.h> | ||
21 | 21 | ||
22 | #include <linux/clk/sunxi.h> | ||
22 | #include <linux/irqchip/sunxi.h> | 23 | #include <linux/irqchip/sunxi.h> |
23 | 24 | ||
24 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
@@ -81,6 +82,12 @@ void __init sunxi_map_io(void) | |||
81 | iotable_init(sunxi_io_desc, ARRAY_SIZE(sunxi_io_desc)); | 82 | iotable_init(sunxi_io_desc, ARRAY_SIZE(sunxi_io_desc)); |
82 | } | 83 | } |
83 | 84 | ||
85 | static void __init sunxi_timer_init(void) | ||
86 | { | ||
87 | sunxi_init_clocks(); | ||
88 | clocksource_of_init(); | ||
89 | } | ||
90 | |||
84 | static void __init sunxi_dt_init(void) | 91 | static void __init sunxi_dt_init(void) |
85 | { | 92 | { |
86 | sunxi_setup_restart(); | 93 | sunxi_setup_restart(); |
@@ -100,6 +107,6 @@ DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") | |||
100 | .init_irq = sunxi_init_irq, | 107 | .init_irq = sunxi_init_irq, |
101 | .handle_irq = sunxi_handle_irq, | 108 | .handle_irq = sunxi_handle_irq, |
102 | .restart = sunxi_restart, | 109 | .restart = sunxi_restart, |
103 | .init_time = &sunxi_timer_init, | 110 | .init_time = sunxi_timer_init, |
104 | .dt_compat = sunxi_board_dt_compat, | 111 | .dt_compat = sunxi_board_dt_compat, |
105 | MACHINE_END | 112 | MACHINE_END |
diff --git a/drivers/clocksource/sunxi_timer.c b/drivers/clocksource/sunxi_timer.c index 7a3ea236be52..308bbe328318 100644 --- a/drivers/clocksource/sunxi_timer.c +++ b/drivers/clocksource/sunxi_timer.c | |||
@@ -22,8 +22,6 @@ | |||
22 | #include <linux/of.h> | 22 | #include <linux/of.h> |
23 | #include <linux/of_address.h> | 23 | #include <linux/of_address.h> |
24 | #include <linux/of_irq.h> | 24 | #include <linux/of_irq.h> |
25 | #include <linux/sunxi_timer.h> | ||
26 | #include <linux/clk/sunxi.h> | ||
27 | 25 | ||
28 | #define TIMER_IRQ_EN_REG 0x00 | 26 | #define TIMER_IRQ_EN_REG 0x00 |
29 | #define TIMER_IRQ_EN(val) (1 << val) | 27 | #define TIMER_IRQ_EN(val) (1 << val) |
@@ -98,23 +96,13 @@ static struct irqaction sunxi_timer_irq = { | |||
98 | .dev_id = &sunxi_clockevent, | 96 | .dev_id = &sunxi_clockevent, |
99 | }; | 97 | }; |
100 | 98 | ||
101 | static struct of_device_id sunxi_timer_dt_ids[] = { | 99 | static void __init sunxi_timer_init(struct device_node *node) |
102 | { .compatible = "allwinner,sunxi-timer" }, | ||
103 | { } | ||
104 | }; | ||
105 | |||
106 | void __init sunxi_timer_init(void) | ||
107 | { | 100 | { |
108 | struct device_node *node; | ||
109 | unsigned long rate = 0; | 101 | unsigned long rate = 0; |
110 | struct clk *clk; | 102 | struct clk *clk; |
111 | int ret, irq; | 103 | int ret, irq; |
112 | u32 val; | 104 | u32 val; |
113 | 105 | ||
114 | node = of_find_matching_node(NULL, sunxi_timer_dt_ids); | ||
115 | if (!node) | ||
116 | panic("No sunxi timer node"); | ||
117 | |||
118 | timer_base = of_iomap(node, 0); | 106 | timer_base = of_iomap(node, 0); |
119 | if (!timer_base) | 107 | if (!timer_base) |
120 | panic("Can't map registers"); | 108 | panic("Can't map registers"); |
@@ -123,8 +111,6 @@ void __init sunxi_timer_init(void) | |||
123 | if (irq <= 0) | 111 | if (irq <= 0) |
124 | panic("Can't parse IRQ"); | 112 | panic("Can't parse IRQ"); |
125 | 113 | ||
126 | sunxi_init_clocks(); | ||
127 | |||
128 | clk = of_clk_get(node, 0); | 114 | clk = of_clk_get(node, 0); |
129 | if (IS_ERR(clk)) | 115 | if (IS_ERR(clk)) |
130 | panic("Can't get timer clock"); | 116 | panic("Can't get timer clock"); |
@@ -158,3 +144,5 @@ void __init sunxi_timer_init(void) | |||
158 | clockevents_config_and_register(&sunxi_clockevent, rate / TIMER_SCAL, | 144 | clockevents_config_and_register(&sunxi_clockevent, rate / TIMER_SCAL, |
159 | 0x1, 0xff); | 145 | 0x1, 0xff); |
160 | } | 146 | } |
147 | CLOCKSOURCE_OF_DECLARE(sunxi, "allwinner,sunxi-timer", | ||
148 | sunxi_timer_init); | ||
diff --git a/include/linux/sunxi_timer.h b/include/linux/sunxi_timer.h deleted file mode 100644 index 18081787e5f3..000000000000 --- a/include/linux/sunxi_timer.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Maxime Ripard | ||
3 | * | ||
4 | * Maxime Ripard <maxime.ripard@free-electrons.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | */ | ||
16 | |||
17 | #ifndef __SUNXI_TIMER_H | ||
18 | #define __SUNXI_TIMER_H | ||
19 | |||
20 | #include <asm/mach/time.h> | ||
21 | |||
22 | void sunxi_timer_init(void); | ||
23 | |||
24 | #endif | ||