From: Joseph Lo <josephl@nvidia.com>
To: Jon Hunter <jonathanh@nvidia.com>,
Thierry Reding <thierry.reding@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: <linux-tegra@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Thierry Reding <treding@nvidia.com>
Subject: Re: [PATCH V5 2/7] clocksource: tegra: add Tegra210 timer support
Date: Fri, 1 Feb 2019 22:39:46 +0800 [thread overview]
Message-ID: <3c9b86ba-32dd-76b2-9a51-6cd86782cadf@nvidia.com> (raw)
In-Reply-To: <5490ad66-7d20-7093-7025-1d0ec8da6dec@nvidia.com>
On 2/1/19 8:44 PM, Jon Hunter wrote:
>
> On 01/02/2019 03:36, Joseph Lo wrote:
>> Add support for the Tegra210 timer that runs at oscillator clock
>> (TMR10-TMR13). We need these timers to work as clock event device and to
>> replace the ARMv8 architected timer due to it can't survive across the
>> power cycle of the CPU core or CPUPORESET signal. So it can't be a wake-up
>> source when CPU suspends in power down state.
>>
>> Also convert the original driver to use timer-of API.
>
> It may have been nice to split this into 2 patches to make it easier to
> see what is going on but not a big deal.
>
>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Joseph Lo <josephl@nvidia.com>
>> Acked-by: Thierry Reding <treding@nvidia.com>
>> ---
>> v5:
>> * add ack tag from Thierry
>> v4:
>> * merge timer-tegra210.c in previous version into timer-tegra20.c
>> v3:
>> * use timer-of API
>> v2:
>> * add error clean-up code
>> ---
>> drivers/clocksource/Kconfig | 2 +-
>> drivers/clocksource/timer-tegra20.c | 369 ++++++++++++++++++++--------
>> include/linux/cpuhotplug.h | 1 +
>> 3 files changed, 272 insertions(+), 100 deletions(-)
>>
>> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
>> index a9e26f6a81a1..6af78534a285 100644
>> --- a/drivers/clocksource/Kconfig
>> +++ b/drivers/clocksource/Kconfig
>> @@ -131,7 +131,7 @@ config SUN5I_HSTIMER
>> config TEGRA_TIMER
>> bool "Tegra timer driver" if COMPILE_TEST
>> select CLKSRC_MMIO
>> - depends on ARM
>> + select TIMER_OF
>> help
>> Enables support for the Tegra driver.
>>
>> diff --git a/drivers/clocksource/timer-tegra20.c b/drivers/clocksource/timer-tegra20.c
>> index 4293943f4e2b..96a809341c9b 100644
>> --- a/drivers/clocksource/timer-tegra20.c
>> +++ b/drivers/clocksource/timer-tegra20.c
>> @@ -15,21 +15,24 @@
>> *
>> */
>>
>> -#include <linux/init.h>
>> +#include <linux/clk.h>
>> +#include <linux/clockchips.h>
>> +#include <linux/cpu.h>
>> +#include <linux/cpumask.h>
>> +#include <linux/delay.h>
>> #include <linux/err.h>
>> -#include <linux/time.h>
>> #include <linux/interrupt.h>
>> -#include <linux/irq.h>
>> -#include <linux/clockchips.h>
>> -#include <linux/clocksource.h>
>> -#include <linux/clk.h>
>> -#include <linux/io.h>
>> #include <linux/of_address.h>
>> #include <linux/of_irq.h>
>> -#include <linux/sched_clock.h>
>> -#include <linux/delay.h>
>> +#include <linux/percpu.h>
>> +#include <linux/syscore_ops.h>
>> +#include <linux/time.h>
>> +
>> +#include "timer-of.h"
>>
>> +#ifdef CONFIG_ARM
>> #include <asm/mach/time.h>
>> +#endif
>>
>> #define RTC_SECONDS 0x08
>> #define RTC_SHADOW_SECONDS 0x0c
>> @@ -43,70 +46,147 @@
>> #define TIMER2_BASE 0x8
>> #define TIMER3_BASE 0x50
>> #define TIMER4_BASE 0x58
>> -
>> -#define TIMER_PTV 0x0
>> -#define TIMER_PCR 0x4
>> -
>> +#define TIMER10_BASE 0x90
>> +
>> +#define TIMER_PTV 0x0
>> +#define TIMER_PTV_EN BIT(31)
>> +#define TIMER_PTV_PER BIT(30)
>> +#define TIMER_PCR 0x4
>> +#define TIMER_PCR_INTR_CLR BIT(30)
>> +
>> +#ifdef CONFIG_ARM
>> +#define TIMER_BASE TIMER3_BASE
>> +#else
>> +#define TIMER_BASE TIMER10_BASE
>> +#endif
>> +#define TIMER10_IRQ_IDX 10
>> +#define TIMER_FOR_CPU(cpu) (TIMER_BASE + (cpu) * 8)
>> +#define IRQ_IDX_FOR_CPU(cpu) (TIMER10_IRQ_IDX + cpu)
>
> TIMER10_IRQ_IDX and IRQ_IDX_FOR_CPU are only applicable to ARM64 and so
> we should probably not defined for ARM to avoid any confusion.
Okay, will do.
>
> Furthermore, a lot of these TIMERx_BASE definitions are unused AFAICT.
> Would be good to get rid of these.
Okay.
>
> Maybe we could just have ...
>
> +#ifdef CONFIG_ARM
> +#define TIMER_CPU0 3
> +#else
> +#define TIMER_CPU0 10
> +#endif
> +#define TIMER_BASE_FOR_CPU(cpu) ((TIMER_CPU0 + cpu) * 8)
> +#define TIMER_FOR_CPU(cpu) (TIMER_CPU0 + cpu)
>
This can't get the timer base address. I think you mean ...
+#ifdef CONFIG_ARM
+#define TIMER_CPU0 0x50 /* TIMER3 */
+#else
+#define TIMER_CPU0 0x90 /* TIMER10 */
+#endif
+#define TIMER_BASE_FOR_CPU(cpu) (TIMER_CPU0 + (cpu) * 8)
This doesn't need.
+#define TIMER_FOR_CPU(cpu) (TIMER_CPU0 + cpu)
Will fix above accordingly and adding your ack tag.
Thanks,
Joseph
> Otherwise looks good to me.
>
> Cheers
> Jon
>
next prev parent reply other threads:[~2019-02-01 14:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190201033621.16814-1-josephl@nvidia.com>
2019-02-01 3:36 ` [PATCH V5 1/7] dt-bindings: timer: add Tegra210 timer Joseph Lo
2019-02-01 3:36 ` [PATCH V5 2/7] clocksource: tegra: add Tegra210 timer support Joseph Lo
2019-02-01 12:44 ` Jon Hunter
2019-02-01 14:39 ` Joseph Lo [this message]
2019-02-01 15:43 ` Jon Hunter
2019-02-01 15:49 ` Joseph Lo
2019-02-01 13:06 ` Dmitry Osipenko
2019-02-01 13:11 ` Dmitry Osipenko
2019-02-01 13:54 ` Jon Hunter
2019-02-01 14:13 ` Joseph Lo
2019-02-01 15:13 ` Dmitry Osipenko
2019-02-01 15:37 ` Joseph Lo
2019-02-01 18:08 ` Dmitry Osipenko
2019-02-01 23:53 ` Joseph Lo
2019-02-02 13:38 ` Dmitry Osipenko
2019-02-02 16:07 ` Joseph Lo
2019-02-02 13:30 ` Dmitry Osipenko
2019-02-02 16:04 ` Joseph Lo
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=3c9b86ba-32dd-76b2-9a51-6cd86782cadf@nvidia.com \
--to=josephl@nvidia.com \
--cc=daniel.lezcano@linaro.org \
--cc=jonathanh@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=thierry.reding@gmail.com \
--cc=treding@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).