* [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly
@ 2013-12-11 9:25 Ben Dooks
2013-12-11 9:36 ` Magnus Damm
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ben Dooks @ 2013-12-11 9:25 UTC (permalink / raw)
To: linux-arm-kernel
If the system has been started in non-secure mode, then the ARM generic
timer is not configurable during the kernel initialisation. Currently
the only thing we can check for is if the timer has been correctly
configured during the boot process.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
---
arch/arm/mach-shmobile/setup-rcar-gen2.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 5734c24..6b7b7f1 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -78,12 +78,20 @@ void __init rcar_gen2_timer_init(void)
/* Remap "armgcnt address map" space */
base = ioremap(0xe6080000, PAGE_SIZE);
- /* Update registers with correct frequency */
- iowrite32(freq, base + CNTFID0);
- asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
+ /* Update the timer if it is either not running, or is not at the
+ * right frequency. The timer is only configurable in secure mode
+ * so this avoids an abort if the loader started the timer and
+ * started the kernel in non-secure mode. */
+ if ((ioread32(base + CNTCR) & 1) == 0 ||
+ ioread32(base + CNTFID0) != freq) {
+ /* Update registers with correct frequency */
+ iowrite32(freq, base + CNTFID0);
+ asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
+
+ /* make sure arch timer is started by setting bit 0 of CNTCR */
+ iowrite32(1, base + CNTCR);
+ }
- /* make sure arch timer is started by setting bit 0 of CNTCR */
- iowrite32(1, base + CNTCR);
iounmap(base);
#endif /* CONFIG_ARM_ARCH_TIMER */
--
1.8.5.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly
2013-12-11 9:25 [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly Ben Dooks
@ 2013-12-11 9:36 ` Magnus Damm
2013-12-11 10:06 ` Ben Dooks
2013-12-11 17:14 ` Sergei Shtylyov
2 siblings, 0 replies; 6+ messages in thread
From: Magnus Damm @ 2013-12-11 9:36 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Dec 11, 2013 at 6:25 PM, Ben Dooks <ben.dooks@codethink.co.uk> wrote:
> If the system has been started in non-secure mode, then the ARM generic
> timer is not configurable during the kernel initialisation. Currently
> the only thing we can check for is if the timer has been correctly
> configured during the boot process.
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
Looks fine, thanks!
Acked-by: Magnus Damm <damm@opensource.se>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly
2013-12-11 9:25 [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly Ben Dooks
2013-12-11 9:36 ` Magnus Damm
@ 2013-12-11 10:06 ` Ben Dooks
2013-12-11 17:14 ` Sergei Shtylyov
2 siblings, 0 replies; 6+ messages in thread
From: Ben Dooks @ 2013-12-11 10:06 UTC (permalink / raw)
To: linux-arm-kernel
On 11/12/13 09:25, Ben Dooks wrote:
> If the system has been started in non-secure mode, then the ARM generic
> timer is not configurable during the kernel initialisation. Currently
> the only thing we can check for is if the timer has been correctly
> configured during the boot process.
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
Sorry, I've gone and re-posted the same patch as yesterday.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly
2013-12-11 9:25 [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly Ben Dooks
2013-12-11 9:36 ` Magnus Damm
2013-12-11 10:06 ` Ben Dooks
@ 2013-12-11 17:14 ` Sergei Shtylyov
2013-12-11 17:15 ` Ben Dooks
2 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2013-12-11 17:14 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 11-12-2013 13:25, Ben Dooks wrote:
> If the system has been started in non-secure mode, then the ARM generic
> timer is not configurable during the kernel initialisation. Currently
> the only thing we can check for is if the timer has been correctly
> configured during the boot process.
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
> ---
> arch/arm/mach-shmobile/setup-rcar-gen2.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
> diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
> index 5734c24..6b7b7f1 100644
> --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
> +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
> @@ -78,12 +78,20 @@ void __init rcar_gen2_timer_init(void)
> /* Remap "armgcnt address map" space */
> base = ioremap(0xe6080000, PAGE_SIZE);
>
> - /* Update registers with correct frequency */
> - iowrite32(freq, base + CNTFID0);
> - asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
> + /* Update the timer if it is either not running, or is not at the
> + * right frequency. The timer is only configurable in secure mode
> + * so this avoids an abort if the loader started the timer and
> + * started the kernel in non-secure mode. */
You said you've fixed the comment style but you haven't as I see.
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly
2013-12-11 17:14 ` Sergei Shtylyov
@ 2013-12-11 17:15 ` Ben Dooks
2013-12-11 17:20 ` Sergei Shtylyov
0 siblings, 1 reply; 6+ messages in thread
From: Ben Dooks @ 2013-12-11 17:15 UTC (permalink / raw)
To: linux-arm-kernel
On 11/12/13 17:14, Sergei Shtylyov wrote:
> Hello.
>
> On 11-12-2013 13:25, Ben Dooks wrote:
>
>> If the system has been started in non-secure mode, then the ARM generic
>> timer is not configurable during the kernel initialisation. Currently
>> the only thing we can check for is if the timer has been correctly
>> configured during the boot process.
>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>> Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
>> ---
>> arch/arm/mach-shmobile/setup-rcar-gen2.c | 18 +++++++++++++-----
>> 1 file changed, 13 insertions(+), 5 deletions(-)
>
>> diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c
>> b/arch/arm/mach-shmobile/setup-rcar-gen2.c
>> index 5734c24..6b7b7f1 100644
>> --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
>> +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
>> @@ -78,12 +78,20 @@ void __init rcar_gen2_timer_init(void)
>> /* Remap "armgcnt address map" space */
>> base = ioremap(0xe6080000, PAGE_SIZE);
>>
>> - /* Update registers with correct frequency */
>> - iowrite32(freq, base + CNTFID0);
>> - asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
>> + /* Update the timer if it is either not running, or is not at the
>> + * right frequency. The timer is only configurable in secure mode
>> + * so this avoids an abort if the loader started the timer and
>> + * started the kernel in non-secure mode. */
>
> You said you've fixed the comment style but you haven't as I see.
I also said I reposted the previous patch by accident this morning
and posted the corrected one after it.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly
2013-12-11 17:15 ` Ben Dooks
@ 2013-12-11 17:20 ` Sergei Shtylyov
0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2013-12-11 17:20 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 11-12-2013 21:15, Ben Dooks wrote:
>>> If the system has been started in non-secure mode, then the ARM generic
>>> timer is not configurable during the kernel initialisation. Currently
>>> the only thing we can check for is if the timer has been correctly
>>> configured during the boot process.
>>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>>> Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
>>> ---
>>> arch/arm/mach-shmobile/setup-rcar-gen2.c | 18 +++++++++++++-----
>>> 1 file changed, 13 insertions(+), 5 deletions(-)
>>> diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c
>>> b/arch/arm/mach-shmobile/setup-rcar-gen2.c
>>> index 5734c24..6b7b7f1 100644
>>> --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
>>> +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
>>> @@ -78,12 +78,20 @@ void __init rcar_gen2_timer_init(void)
>>> /* Remap "armgcnt address map" space */
>>> base = ioremap(0xe6080000, PAGE_SIZE);
>>>
>>> - /* Update registers with correct frequency */
>>> - iowrite32(freq, base + CNTFID0);
>>> - asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
>>> + /* Update the timer if it is either not running, or is not at the
>>> + * right frequency. The timer is only configurable in secure mode
>>> + * so this avoids an abort if the loader started the timer and
>>> + * started the kernel in non-secure mode. */
>> You said you've fixed the comment style but you haven't as I see.
> I also said I reposted the previous patch by accident this morning
> and posted the corrected one after it.
Sorry, I've only read that after sending my comment. I thought that was an
intended repost with a slightly corrected subject.
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-12-11 17:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11 9:25 [PATCH] ARM: rcar-gen2: Do not attempt to re-setup timer if running correctly Ben Dooks
2013-12-11 9:36 ` Magnus Damm
2013-12-11 10:06 ` Ben Dooks
2013-12-11 17:14 ` Sergei Shtylyov
2013-12-11 17:15 ` Ben Dooks
2013-12-11 17:20 ` Sergei Shtylyov
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).