ARM: shmobile: r8a7779: Correct TMU clock support again
v3 cover ARM: shmobile: r8a7779: Correct TMU clock support again
Hi,
This is a third pass at a two line fix for a regression in TMU clock configuration.
I have managed to track down a portion of the documentation which confirms the discussion on the mailing list: TMU01, TMU01 and TMU02 share a common clock.
I have also added a second patch to the series to exercise TMU02.
Simon Horman (2):
ARM: shmobile: r8a7779: Correct TMU clock support again [RFC] ARM: shmobile: r8a7779: Add TMU02 platform device
arch/arm/mach-shmobile/clock-r8a7779.c | 4 ++-- arch/arm/mach-shmobile/setup-r8a7779.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v3 1/2 ARM: shmobile: r8a7779: Correct TMU clock support again
After discussion on the linux-sh mailing list and reference to the hardware documentation it appears that 'TMU00', 'TMU01' and 'TMU02' use a common clock.
The sh_tmu.1 portion of this change resolves a regression introduced in 58079fa7d54a0929d304054ee759187a2ccd3cdf (ARM: shmobile: r8a7779: Correct TMU clock support) and fixes a regression introduced by that patch. That patch is queued up for v3.9.
...
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 2 ports detected
INFO: rcu_sched self-detected stall on CPUINFO: rcu_sched detected stalls on
+CPUs/tasks: { 1} (detected by 2, t=279640 jiffies, g=4294967052, c=4294967051, +q=38)
Task dump for CPU 1:
swapper/0 R running 0 1 0 0x00000002
[<c02b8f5c>] (__schedule+0x1b0/0x4c0) from [<c013c590>] (__loop_delay+0x4/0xc)
{ 1} (t=279640 jiffies g=4294967052 c=4294967052 q=37)
[<c000ef9c>] (unwind_backtrace+0x0/0xf8) from [<c0068488>] +(rcu_check_callbacks+0x218/0x6b8)
[<c0068488>] (rcu_check_callbacks+0x218/0x6b8) from [<c0026774>] +(update_process_times+0x38/0x4c)
[<c0026774>] (update_process_times+0x38/0x4c) from [<c00569e0>] +(tick_nohz_handler+0xb4/0x11c)
[<c00569e0>] (tick_nohz_handler+0xb4/0x11c) from [<c000e518>] +(twd_handler+0x34/0x44)
[<c000e518>] (twd_handler+0x34/0x44) from [<c0063484>] +(handle_percpu_devid_irq+0x68/0x80)
[<c0063484>] (handle_percpu_devid_irq+0x68/0x80) from [<c005febc>] +(generic_handle_irq+0x20/0x30)
[<c005febc>] (generic_handle_irq+0x20/0x30) from [<c000a5ec>] +(handle_IRQ+0x40/0x90)
[<c000a5ec>] (handle_IRQ+0x40/0x90) from [<c000934c>] (gic_handle_irq+0x2c/0x5c) [<c000934c>] (gic_handle_irq+0x2c/0x5c) from [<c0009a40>] (__irq_svc+0x40/0x50)
Exception stack(0xef03ddf8 to 0xef03de40)
dde0: 000001c1 ffffffff
de00: 000001d8 01bf01bf ef35ec40 ef35e800 ef35ec6c 0000002b ef35ec68 c013c560
de20: c0392994 60000113 00000000 ef03de40 c01a5d40 c013c590 20000113 ffffffff [<c0009a40>] (__irq_svc+0x40/0x50) from [<c013c590>] (__loop_delay+0x4/0xc)
--- arch/arm/mach-shmobile/clock-r8a7779.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/clock-r8a7779.c +2 -2
@@ -161,8 +161,8 @@ static struct clk_lookup lookups[] = {CLKDEV_DEV_ID ("ehci-platform.0" , &mstp_clks[MSTP100 ]),/* USB EHCI port0/1 */ CLKDEV_DEV_ID ("ohci-platform.0" , &mstp_clks[MSTP100 ]),/* USB OHCI port0/1 */ CLKDEV_DEV_ID ("sh_tmu.0" , &mstp_clks[MSTP016 ]),/* TMU00 */ -CLKDEV_DEV_ID ("sh_tmu.1" , &mstp_clks[MSTP015 ]),/* TMU01 */ -CLKDEV_DEV_ID ("sh_tmu.2" , &mstp_clks[MSTP014 ]),/* TMU02 */ +CLKDEV_DEV_ID ("sh_tmu.1" , &mstp_clks[MSTP016 ]),/* TMU01 */ +CLKDEV_DEV_ID ("sh_tmu.2" , &mstp_clks[MSTP016 ]),/* TMU02 */ CLKDEV_DEV_ID ("i2c-rcar.0" , &mstp_clks[MSTP030 ]),/* I2C0 */ CLKDEV_DEV_ID ("i2c-rcar.1" , &mstp_clks[MSTP029 ]),/* I2C1 */ CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
Signature · 1 line
1.7.10.4
RFC PATCH v3 2/2 ARM: shmobile: r8a7779: Add TMU02 platform device
In reply to Simon HormanThis 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.1sh_tmu sh_tmu.0: kept as earlytimersh_tmu sh_tmu.1: kept as earlytimersh_tmu sh_tmu.2: used as clock source
--- arch/arm/mach-shmobile/setup-r8a7779.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
arch/arm/mach-shmobile/setup-r8a7779.c +31 -0
@@ -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 = {
Signature · 1 line
1.7.10.4
RFC PATCH v3 2/2 ARM: shmobile: r8a7779: Add TMU02 platform device
Hi Simon
Quoted 22 lines
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.1sh_tmush_tmu.0: kept as earlytimersh_tmush_tmu.1: kept as earlytimersh_tmush_tmu.2: used as clock sourceCc Denis Oliver Kropp <[email protected]>Cc Magnus Damm <[email protected]>Cc Kuninori Morimoto <[email protected]>Cc Paul Mundt <[email protected]>Signed-off-by Simon Horman <[email protected]>---
(snip)
arch/arm/mach-shmobile/setup-r8a7779.c static struct platform_device tmu01_device = { · line 239
Quoted 6 lines
arch/arm/mach-shmobile/setup-r8a7779.c +6
-0+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
maintainerRFC PATCH v3 2/2 ARM: shmobile: r8a7779: Add TMU02 platform device
In reply to Simon HormanQuoted 3 lines · Simon Horman
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
RFC PATCH v3 2/2 ARM: shmobile: r8a7779: Add TMU02 platform device
Quoted 12 lines · Magnus Damm
Quoted 3 lines · Simon Horman
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.
Quoted 4 lines
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.