Skip to contentSkip to conversation

ARM: clps711x: convert to clocksource/clockevents

PATCH New Linus Walleij 2 participants 4 messages Aug 30, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: clps711x: convert to clocksource/clockevents

This converts the ageing clps711x timer driver to the modern clocksource/clockevent API.

This was blind-coded using the datasheet, it'd be great if someone who has this machine could test it.

---
 arch/arm/Kconfig                |    3 +-
 arch/arm/mach-clps711x/common.c |   59 +++++++++++++++++++++++++++++---------
 2 files changed, 47 insertions(+), 15 deletions(-)
arch/arm/Kconfig +2 -1
index 181b697..8a3da9e 100644
@@ -383,8 +383,9 @@ config ARCH_HIGHBANK
 config ARCH_CLPS711X
 	bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
 	select CPU_ARM720T
-	select ARCH_USES_GETTIMEOFFSET
 	select NEED_MACH_MEMORY_H
+	select GENERIC_CLOCKEVENTS
+	select CLKSRC_MMIO
 	help
 	  Support for Cirrus Logic 711x/721x/731x based boards.
 
arch/arm/mach-clps711x/common.c +45 -14

93 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 1/1 ARM: clps711x: convert to clocksource/clockevents

Quoted 2 lines · On Thu, 30 Aug 2012 18:37:58 +0200 Linus Walleij <[email protected]>…

This converts the ageing clps711x timer driver to the modern clocksource/clockevent API.

The patch does not account for the changes that I sent to the mailing list recently, where I did support different clock frequencies for the processor.

Quoted 2 lines

This was blind-coded using the datasheet, it'd be great if someone who has this machine could test it.

...

arch/arm/mach-clps711x/common.c static void __init clps711x_timer_init(void) · line 216

Quoted 1 line
arch/arm/mach-clps711x/common.c +1 -0
+	/* Set both timers to 512 kHz */

The patch uses a second timer, which does not allow its use for other purposes, I can not test the functionality of the device in this case, unfortunately.

I have also tried to do something like this without using additional processor resources, but not yet brought to the finish line yet.

Signature · 1 line
Alexander Shiyan <[email protected]>
#2 lore raw

PATCH 1/1 ARM: clps711x: convert to clocksource/clockevents

Quoted 8 lines · Alexander Shiyan
Quoted 2 lines · On Thu, 30 Aug 2012 18:37:58 +0200 Linus Walleij <[email protected]>…

This converts the ageing clps711x timer driver to the modern clocksource/clockevent API.

The patch does not account for the changes that I sent to the mailing list recently, where I did support different clock frequencies for the processor.

No problem, I can rebase on top of your patches as soon as you submit them to ARM SoC so I can see them in linux-next.

Quoted 6 lines
Quoted 2 lines

This was blind-coded using the datasheet, it'd be great if someone who has this machine could test it.

...

Quoted 1 line

+ /* Set both timers to 512 kHz */

The patch uses a second timer, which does not allow its use for other purposes,

What does this mean? Reading the datasheet it didn't say anything about this timer being dedicated to something else.

I am using TC1D as clocksource and TC2D as clockevent, repurposing it from the previous use as singe time source.

Doing "git grep TC1D" I cannot see any code in the kernel making use of this timer?

I could think of things like the boot loader or firmware setting it up to run in free-running mode ... in that case we use
it as clocksource without initialization as long as we know what frequency it's running on.

As far as I could understand from the datasheet there is really no way to actually disable these timers, so they always run anyway?

Quoted 2 lines

I have also tried to do something like this without using additional processor resources, but not yet brought to the finish line yet.

OK do you think you can switch the clps71x over to generic time and clockevents inspired by this patch or so?

Yours,
Linus Walleij

#3 lore raw

PATCH 1/1 ARM: clps711x: convert to clocksource/clockevents

Quoted 6 lines · On Thu, 30 Aug 2012 10:21:44 -0700 Linus Walleij <[email protected]>…
Quoted 4 lines
Quoted 2 lines

This converts the ageing clps711x timer driver to the modern clocksource/clockevent API.

The patch does not account for the changes that I sent to the mailing list recently, where I did support different clock frequencies for the processor.

No problem, I can rebase on top of your patches as soon as you submit them to ARM SoC so I can see them in linux-next.

Patches have already been sent to the mailing list, and as far I understand, these patches are awaiting approval from Arnd.

...

Quoted 7 lines
Quoted 1 line

The patch uses a second timer, which does not allow its use for other purposes,

What does this mean? Reading the datasheet it didn't say anything about this timer being dedicated to something else.
I am using TC1D as clocksource and TC2D as clockevent, repurposing it from the previous use as singe time source.
Doing "git grep TC1D" I cannot see any code in the kernel making use of this timer?

These timers are only two in the processor and I just want to say that the second timer CAN be used for other purposes, such as I use. In the kernel of the second timer is really not used.

Quoted 4 lines

I could think of things like the boot loader or firmware setting it up to run in free-running mode ... in that case we use
it as clocksource without initialization as long as we know what frequency it's running on.

Not understand this...

Quoted 3 lines

As far as I could understand from the datasheet there is really no way to actually disable these timers, so they always run anyway?

Yes. We can only enable/disable IRQ for the timers, switch clock source and mode.

Quoted 4 lines
Quoted 2 lines

I have also tried to do something like this without using additional processor resources, but not yet brought to the finish line yet.

OK do you think you can switch the clps71x over to generic time and clockevents inspired by this patch or so?

Unfortunately, I'm leaving tomorrow for a little while so I can not check anything or try to do better, but the idea of ??switching to a new API I like. Upon arrival back, I'll try to make a similar using only one timer or use the CLOCKSOURCE/CLOCKEVENTS resources to generate intervals necessary for me.

Signature · 1 line
Alexander Shiyan <[email protected]>