From: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] clocksource: SuperH TMU Timer driver
Date: Sat, 30 May 2009 13:27:16 +0000 [thread overview]
Message-ID: <4A213434.4030800@juno.dti.ne.jp> (raw)
In-Reply-To: <20090501065100.8800.99808.sendpatchset@rx1.opensource.se>
Hi Magnus, could you provide an answer to my question on SH-TMU?
Magnus Damm wrote:
> From: Magnus Damm <damm@igel.co.jp>
>
> This patch adds a TMU driver for the SuperH architecture.
>
> The TMU driver is a platform driver with early platform
> support to allow using a TMU channel as clockevent or
> clocksource during system bootup or later.
>
> Clocksource or clockevent can be selected.
> Both periodic and oneshot clockevents are supported.
>
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> ---
>
> Tested on a Migo-R board with sh7722.
> Applies on top of the MTU2 patches.
> Clocksource operation requires the following patch:
> "clocksource: setup mult_orig in clocksource_enable()"
>
> arch/sh/Kconfig | 12 +
> drivers/clocksource/Makefile | 1
> drivers/clocksource/sh_tmu.c | 461 ++++++++++++++++++++++++++++++++++++++++++
> include/linux/sh_tmu.h | 13 +
> 4 files changed, 487 insertions(+)
>
> --- 0006/arch/sh/Kconfig
> +++ work/arch/sh/Kconfig 2009-05-01 13:18:03.000000000 +0900
> @@ -116,6 +116,9 @@ config SYS_SUPPORTS_CMT
> config SYS_SUPPORTS_MTU2
> bool
>
> +config SYS_SUPPORTS_TMU
> + bool
> +
> config STACKTRACE_SUPPORT
> def_bool y
>
> @@ -470,6 +473,15 @@ config SH_TMU
> help
> This enables the use of the TMU as the system timer.
>
> +config SH_TIMER_TMU
> + bool "TMU timer driver"
> + depends on !SH_TMU && SYS_SUPPORTS_TMU
> + default y
> + select GENERIC_TIME
> + select GENERIC_CLOCKEVENTS
> + help
> + This enables the build of the TMU timer driver.
> +
> config SH_TIMER_CMT
> bool "CMT timer driver"
> depends on SYS_SUPPORTS_CMT
> --- 0004/drivers/clocksource/Makefile
> +++ work/drivers/clocksource/Makefile 2009-05-01 13:17:38.000000000 +0900
> @@ -4,3 +4,4 @@ obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o
> obj-$(CONFIG_SCx200HR_TIMER) += scx200_hrt.o
> obj-$(CONFIG_SH_TIMER_CMT) += sh_cmt.o
> obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o
> +obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o
> --- /dev/null
> +++ work/drivers/clocksource/sh_tmu.c 2009-05-01 13:20:00.000000000 +0900
> @@ -0,0 +1,461 @@
(snip...)
> +static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta,
> + int periodic)
> +{
> + /* stop timer */
> + sh_tmu_start_stop_ch(p, 0);
> +
> + /* acknowledge interrupt */
> + sh_tmu_read(p, TCR);
> +
> + /* enable interrupt */
> + sh_tmu_write(p, TCR, 0x0020);
> +
> + /* reload delta value in case of periodic timer */
> + if (periodic)
> + sh_tmu_write(p, TCOR, delta);
> + else
> + sh_tmu_write(p, TCOR, 0);
> +
> + sh_tmu_write(p, TCNT, delta);
> +
> + /* start timer */
> + sh_tmu_start_stop_ch(p, 1);
> +}
In some occasions, qemu-sh prints out a lot of warnings on timer
with this message : 'Timer with period zero. disabling.'
I made some investigation, and found that the warnings are printed
after zero value is set to TCOR. I checked SH7785 hardware manual,
but could not find any description what happens when zero value set
to TCOR.
According to the code above, I guess that TMU works as a non-periodic
one-shot timer when the TCOR value is zero. Is it right?
Regards,
Shin-ichiro KAWASAKI
next prev parent reply other threads:[~2009-05-30 13:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-01 6:51 [PATCH] clocksource: SuperH TMU Timer driver Magnus Damm
2009-05-30 13:27 ` Shin-ichiro KAWASAKI [this message]
2009-06-01 10:50 ` Magnus Damm
2009-06-01 10:57 ` Paul Mundt
2009-06-01 22:37 ` Shin-ichiro KAWASAKI
2009-06-11 15:51 ` Shin-ichiro KAWASAKI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A213434.4030800@juno.dti.ne.jp \
--to=kawasaki@juno.dti.ne.jp \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.