diff mbox

[2/2,v3,RFC] ARM: shmobile: r8a7779: Add TMU02 platform device

Message ID 1361147376-1228-3-git-send-email-horms+renesas@verge.net.au (mailing list archive)
State New, archived
Headers show

Commit Message

Simon Horman Feb. 18, 2013, 12:29 a.m. UTC
This is intended primarily to exercise the TMUO2 clock definition
in clock-r8a7779.c. I would appreciate review before I queue it up or
drop it.

With this patch and "ARM: shmobile: r8a7779: Correct TMU clock support
again" in place I see the following tmu related portions of the
bootlog on the Marzen board.

 sh_tmu.0: used for clock events
 sh_tmu.0: used for periodic clock events
 sh_tmu.1: used as clock source
Switching to clocksource sh_tmu.1
sh_tmu sh_tmu.0: kept as earlytimer
sh_tmu sh_tmu.1: kept as earlytimer
sh_tmu sh_tmu.2: used as clock source

Cc: Denis Oliver Kropp <dok@directfb.org>
Cc: Magnus Damm <damm@opensource.se>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/setup-r8a7779.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

Comments

Kuninori Morimoto Feb. 18, 2013, 1:33 a.m. UTC | #1
Hi Simon

> This is intended primarily to exercise the TMUO2 clock definition
> in clock-r8a7779.c. I would appreciate review before I queue it up or
> drop it.
> 
> With this patch and "ARM: shmobile: r8a7779: Correct TMU clock support
> again" in place I see the following tmu related portions of the
> bootlog on the Marzen board.
> 
>  sh_tmu.0: used for clock events
>  sh_tmu.0: used for periodic clock events
>  sh_tmu.1: used as clock source
> Switching to clocksource sh_tmu.1
> sh_tmu sh_tmu.0: kept as earlytimer
> sh_tmu sh_tmu.1: kept as earlytimer
> sh_tmu sh_tmu.2: used as clock source
> 
> Cc: Denis Oliver Kropp <dok@directfb.org>
> Cc: Magnus Damm <damm@opensource.se>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---

(snip)

> +static struct resource tmu02_resources[] = {
> +	[0] = {
> +		.name	= "TMU02",
> +		.start	= 0xffd80020,
> +		.end	= 0xffd81003,
> +		.flags	= IORESOURCE_MEM,

It seems not wrong, but
.end = 0xffd8002b seems very enough ?

Best regards
---
Kuninori Morimoto
Magnus Damm Feb. 18, 2013, 5:38 a.m. UTC | #2
On Mon, Feb 18, 2013 at 9:29 AM, Simon Horman
<horms+renesas@verge.net.au> wrote:
> This is intended primarily to exercise the TMUO2 clock definition
> in clock-r8a7779.c. I would appreciate review before I queue it up or
> drop it.

Why on earth would you want to queue this up? The TMU driver
interfaces to the Linux kernel as clock event or clock source. We
currently have one channel assigned as clock event, and another as
clock source. Adding more channels does not really improve anything
from a Linux kernel timer handling point of view.

However, say that you for some reason really enjoyed creating new
platform devices then I recommend you to go all the way and hook up
all 9 channels that are provided by the 3-channel TMU blocks TMU0,
TMU1 and TMU2. Usually we stick to two channels though.

Thanks,

/ magnus
Simon Horman Feb. 18, 2013, 6:58 a.m. UTC | #3
On Mon, Feb 18, 2013 at 02:38:32PM +0900, Magnus Damm wrote:
> On Mon, Feb 18, 2013 at 9:29 AM, Simon Horman
> <horms+renesas@verge.net.au> wrote:
> > This is intended primarily to exercise the TMUO2 clock definition
> > in clock-r8a7779.c. I would appreciate review before I queue it up or
> > drop it.
> 
> Why on earth would you want to queue this up? The TMU driver
> interfaces to the Linux kernel as clock event or clock source. We
> currently have one channel assigned as clock event, and another as
> clock source. Adding more channels does not really improve anything
> from a Linux kernel timer handling point of view.
> 
> However, say that you for some reason really enjoyed creating new
> platform devices then I recommend you to go all the way and hook up
> all 9 channels that are provided by the 3-channel TMU blocks TMU0,
> TMU1 and TMU2. Usually we stick to two channels though.

I will drop the change.
diff mbox

Patch

diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 7b4c1eb..3cdb738 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -224,6 +224,36 @@  static struct platform_device tmu01_device = {
 	.num_resources	= ARRAY_SIZE(tmu01_resources),
 };
 
+static struct sh_timer_config tmu02_platform_data = {
+	.name = "TMU02",
+	.channel_offset = 0x1c,
+	.timer_bit = 1,
+	.clocksource_rating = 200,
+};
+
+static struct resource tmu02_resources[] = {
+	[0] = {
+		.name	= "TMU02",
+		.start	= 0xffd80020,
+		.end	= 0xffd81003,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= gic_spi(34),
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device tmu02_device = {
+	.name		= "sh_tmu",
+	.id		= 2,
+	.dev = {
+		.platform_data	= &tmu02_platform_data,
+	},
+	.resource	= tmu02_resources,
+	.num_resources	= ARRAY_SIZE(tmu02_resources),
+};
+
 /* I2C */
 static struct resource rcar_i2c0_res[] = {
 	{
@@ -306,6 +336,7 @@  static struct platform_device *r8a7779_early_devices_dt[] __initdata = {
 	&scif5_device,
 	&tmu00_device,
 	&tmu01_device,
+	&tmu02_device,
 };
 
 static struct platform_device *r8a7779_early_devices[] __initdata = {