diff options
author | Magnus Damm <damm@opensource.se> | 2013-06-28 07:27:04 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-07-17 01:26:49 -0400 |
commit | 99ade1a0f02e086248874d9908def3e8e4539418 (patch) | |
tree | a3e1dd561b672543ec3a5cabdc87904d676734dc /arch | |
parent | 29eb2ba89c63c6f57dc3a8b1a89241c7a877a3c8 (diff) |
ARM: shmobile: Add r8a7790 CMT00 clock event
Add clock event support for CMT0 timer channel 0
to the r8a7790 SoC code. On most ARM mach-shmobile
the CMT is hooked up to a 32KHz clock but on r8a7790
a 31.7KHz clock is instead used.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-shmobile/clock-r8a7790.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a7790.c | 23 |
2 files changed, 26 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c index 10d99b3fe8d2..62d8162c7e70 100644 --- a/arch/arm/mach-shmobile/clock-r8a7790.c +++ b/arch/arm/mach-shmobile/clock-r8a7790.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #define CPG_BASE 0xe6150000 | 47 | #define CPG_BASE 0xe6150000 |
48 | #define CPG_LEN 0x1000 | 48 | #define CPG_LEN 0x1000 |
49 | 49 | ||
50 | #define SMSTPCR1 0xe6150134 | ||
50 | #define SMSTPCR2 0xe6150138 | 51 | #define SMSTPCR2 0xe6150138 |
51 | #define SMSTPCR3 0xe615013c | 52 | #define SMSTPCR3 0xe615013c |
52 | #define SMSTPCR5 0xe6150144 | 53 | #define SMSTPCR5 0xe6150144 |
@@ -186,6 +187,7 @@ enum { | |||
186 | MSTP522, | 187 | MSTP522, |
187 | MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304, | 188 | MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304, |
188 | MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, | 189 | MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, |
190 | MSTP124, | ||
189 | MSTP_NR | 191 | MSTP_NR |
190 | }; | 192 | }; |
191 | 193 | ||
@@ -208,6 +210,7 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
208 | [MSTP204] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ | 210 | [MSTP204] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ |
209 | [MSTP203] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ | 211 | [MSTP203] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ |
210 | [MSTP202] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 2, 0), /* SCIFA2 */ | 212 | [MSTP202] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 2, 0), /* SCIFA2 */ |
213 | [MSTP124] = SH_CLK_MSTP32(&rclk_clk, SMSTPCR1, 24, 0), /* CMT0 */ | ||
211 | }; | 214 | }; |
212 | 215 | ||
213 | static struct clk_lookup lookups[] = { | 216 | static struct clk_lookup lookups[] = { |
@@ -270,6 +273,7 @@ static struct clk_lookup lookups[] = { | |||
270 | CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]), | 273 | CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]), |
271 | CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]), | 274 | CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]), |
272 | CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), | 275 | CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), |
276 | CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), | ||
273 | }; | 277 | }; |
274 | 278 | ||
275 | #define R8A7790_CLOCK_ROOT(e, m, p0, p1, p30, p31) \ | 279 | #define R8A7790_CLOCK_ROOT(e, m, p0, p1, p30, p31) \ |
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c index bc40a44de127..ece60c635de7 100644 --- a/arch/arm/mach-shmobile/setup-r8a7790.c +++ b/arch/arm/mach-shmobile/setup-r8a7790.c | |||
@@ -21,9 +21,10 @@ | |||
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/of_platform.h> | 23 | #include <linux/of_platform.h> |
24 | #include <linux/serial_sci.h> | ||
25 | #include <linux/platform_data/gpio-rcar.h> | 24 | #include <linux/platform_data/gpio-rcar.h> |
26 | #include <linux/platform_data/irq-renesas-irqc.h> | 25 | #include <linux/platform_data/irq-renesas-irqc.h> |
26 | #include <linux/serial_sci.h> | ||
27 | #include <linux/sh_timer.h> | ||
27 | #include <mach/common.h> | 28 | #include <mach/common.h> |
28 | #include <mach/irqs.h> | 29 | #include <mach/irqs.h> |
29 | #include <mach/r8a7790.h> | 30 | #include <mach/r8a7790.h> |
@@ -159,6 +160,25 @@ static struct resource thermal_resources[] __initdata = { | |||
159 | thermal_resources, \ | 160 | thermal_resources, \ |
160 | ARRAY_SIZE(thermal_resources)) | 161 | ARRAY_SIZE(thermal_resources)) |
161 | 162 | ||
163 | static struct sh_timer_config cmt00_platform_data = { | ||
164 | .name = "CMT00", | ||
165 | .timer_bit = 0, | ||
166 | .clockevent_rating = 80, | ||
167 | }; | ||
168 | |||
169 | static struct resource cmt00_resources[] = { | ||
170 | DEFINE_RES_MEM(0xffca0510, 0x0c), | ||
171 | DEFINE_RES_MEM(0xffca0500, 0x04), | ||
172 | DEFINE_RES_IRQ(gic_spi(142)), /* CMT0_0 */ | ||
173 | }; | ||
174 | |||
175 | #define r8a7790_register_cmt(idx) \ | ||
176 | platform_device_register_resndata(&platform_bus, "sh_cmt", \ | ||
177 | idx, cmt##idx##_resources, \ | ||
178 | ARRAY_SIZE(cmt##idx##_resources), \ | ||
179 | &cmt##idx##_platform_data, \ | ||
180 | sizeof(struct sh_timer_config)) | ||
181 | |||
162 | void __init r8a7790_add_standard_devices(void) | 182 | void __init r8a7790_add_standard_devices(void) |
163 | { | 183 | { |
164 | r8a7790_register_scif(SCIFA0); | 184 | r8a7790_register_scif(SCIFA0); |
@@ -173,6 +193,7 @@ void __init r8a7790_add_standard_devices(void) | |||
173 | r8a7790_register_scif(HSCIF1); | 193 | r8a7790_register_scif(HSCIF1); |
174 | r8a7790_register_irqc(0); | 194 | r8a7790_register_irqc(0); |
175 | r8a7790_register_thermal(); | 195 | r8a7790_register_thermal(); |
196 | r8a7790_register_cmt(00); | ||
176 | } | 197 | } |
177 | 198 | ||
178 | void __init r8a7790_timer_init(void) | 199 | void __init r8a7790_timer_init(void) |