Skip to content

Commit a7b99f2

Browse files
Magnus Dammhorms
authored andcommitted
ARM: shmobile: Add r8a73a4 CMT10 clock event
Add clock event support for CMT1 timer channel 0 to the r8a73a4 SoC code. The CMT is used together with a 32KHz clock in this case. Signed-off-by: Magnus Damm <[email protected]> Signed-off-by: Simon Horman <[email protected]>
1 parent 8333d8c commit a7b99f2

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

arch/arm/mach-shmobile/clock-r8a73a4.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ static struct clk div6_clks[DIV6_NR] = {
505505
/* MSTP */
506506
enum {
507507
MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203,
508-
MSTP323, MSTP318, MSTP317, MSTP316,
508+
MSTP329, MSTP323, MSTP318, MSTP317, MSTP316,
509509
MSTP315, MSTP314, MSTP313, MSTP312, MSTP305, MSTP300,
510510
MSTP411, MSTP410, MSTP409,
511511
MSTP522, MSTP515,
@@ -529,6 +529,7 @@ static struct clk mstp_clks[MSTP_NR] = {
529529
[MSTP317] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 17, 0), /* IIC7 */
530530
[MSTP318] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 18, 0), /* IIC0 */
531531
[MSTP323] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */
532+
[MSTP329] = SH_CLK_MSTP32(&extalr_clk, SMSTPCR3, 29, 0), /* CMT10 */
532533
[MSTP409] = SH_CLK_MSTP32(&main_div2_clk, SMSTPCR4, 9, 0), /* IIC5 */
533534
[MSTP410] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */
534535
[MSTP411] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */
@@ -593,6 +594,7 @@ static struct clk_lookup lookups[] = {
593594
CLKDEV_DEV_ID("e6560000.i2c", &mstp_clks[MSTP317]),
594595
CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]),
595596
CLKDEV_DEV_ID("e6510000.i2c", &mstp_clks[MSTP323]),
597+
CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]),
596598
CLKDEV_DEV_ID("e60b0000.i2c", &mstp_clks[MSTP409]),
597599
CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP410]),
598600
CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP411]),

arch/arm/mach-shmobile/setup-r8a73a4.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/of_platform.h>
2323
#include <linux/platform_data/irq-renesas-irqc.h>
2424
#include <linux/serial_sci.h>
25+
#include <linux/sh_timer.h>
2526
#include <mach/common.h>
2627
#include <mach/irqs.h>
2728
#include <mach/r8a73a4.h>
@@ -168,6 +169,25 @@ static const struct resource thermal0_resources[] = {
168169
thermal0_resources, \
169170
ARRAY_SIZE(thermal0_resources))
170171

172+
static struct sh_timer_config cmt10_platform_data = {
173+
.name = "CMT10",
174+
.timer_bit = 0,
175+
.clockevent_rating = 80,
176+
};
177+
178+
static struct resource cmt10_resources[] = {
179+
DEFINE_RES_MEM(0xe6130010, 0x0c),
180+
DEFINE_RES_MEM(0xe6130000, 0x04),
181+
DEFINE_RES_IRQ(gic_spi(120)), /* CMT1_0 */
182+
};
183+
184+
#define r8a7790_register_cmt(idx) \
185+
platform_device_register_resndata(&platform_bus, "sh_cmt", \
186+
idx, cmt##idx##_resources, \
187+
ARRAY_SIZE(cmt##idx##_resources), \
188+
&cmt##idx##_platform_data, \
189+
sizeof(struct sh_timer_config))
190+
171191
void __init r8a73a4_add_standard_devices(void)
172192
{
173193
r8a73a4_register_scif(SCIFA0);
@@ -179,6 +199,7 @@ void __init r8a73a4_add_standard_devices(void)
179199
r8a73a4_register_irqc(0);
180200
r8a73a4_register_irqc(1);
181201
r8a73a4_register_thermal();
202+
r8a7790_register_cmt(10);
182203
}
183204

184205
#ifdef CONFIG_USE_OF

0 commit comments

Comments
 (0)