Introduce clocksource driver for Keystone platform
Subsystems (3)
v3 cover Introduce clocksource driver for Keystone platform
Add a broadcast timer64 based clockevent driver for keystone arch. This driver uses timer in 64-bit general purpose mode as clock event device.
Documentation:
http://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdf
Based ongit://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
keystone/master
v2..v3:
- clocksource: timer-keystone: introduce clocksource driver for changed "u64" type to "unsigned long" for hz_period as more appropriate hz_period rounded up by DIV_ROUND_UP(rate, HZ)
corrected comments
v1..v2:
- clocksource: timer-keystone: introduce clocksource driver for renamed timer on "timer-keystone"
in keystone_timer_interrupt() evet pointer is passed via "dev_id" used __relaxed variants of writel/readl and added explicit barriers added "keystone_timer_disable()" for using in keystone_set_mode() keystone_timer_config() is not used for disabling the timer any more in case of an unsupported mode the keystone_timer_config() returns -1. used request_irq() instead of setup_irq()
assigned irq for event_device in event_dev->irq calculated timer.hz_period for CLOCK_EVT_MODE_PERIODIC at init deleted spare call of keystone_timer_config() in keystone_timer_init()
Ivan Khoronzhuk (3):
clocksource: timer-keystone: introduce clocksource driver for
Keystone
clocksource: keystone: add bindings for keystone timer
arm: dts: keystone: add keystone timer entry
.../bindings/timer/ti,keystone-timer.txt | 29 +++ arch/arm/boot/dts/keystone-clocks.dtsi | 10 + arch/arm/boot/dts/keystone.dtsi | 7 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-keystone.c | 233 ++++++++++++++++++++ 5 files changed, 280 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/ti,keystone-timer.txt create mode 100644 drivers/clocksource/timer-keystone.c
Signature · 1 line
1.7.9.5
PATCH v3 1/3 clocksource: timer-keystone: introduce clocksource driver for Keystone
Add broadcast clock-event device for the Keystone arch.
The timer can be configured as a general-purpose 64-bit timer, dual general-purpose 32-bit timers. When configured as dual 32-bit timers, each half can operate in conjunction (chain mode) or independently (unchained mode) of each other.
--- drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-keystone.c | 233 ++++++++++++++++++++++++++++++++++ 2 files changed, 234 insertions(+) create mode 100644 drivers/clocksource/timer-keystone.c
drivers/clocksource/Makefile +1 -0
@@ -36,3 +36,4 @@ obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o obj-$(CONFIG_ARM_GLOBAL_TIMER) += arm_global_timer.o obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o +obj-$(CONFIG_ARCH_KEYSTONE) += timer-keystone.o
drivers/clocksource/timer-keystone.c new file +233 -0
233 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 1/3 clocksource: timer-keystone: introduce clocksource driver for Keystone
Quoted 9 lines · Ivan Khoronzhuk
Add broadcast clock-event device for the Keystone arch.
The timer can be configured as a general-purpose 64-bit timer, dual general-purpose 32-bit timers. When configured as dual 32-bit timers, each half can operate in conjunction (chain mode) or independently (unchained mode) of each other.
Signed-off-by Ivan Khoronzhuk <[email protected]>---
Thanks for the update Ivan. This version looks good to me.
PATCH v3 1/3 clocksource: timer-keystone: introduce clocksource driver for Keystone
In reply to Ivan KhoronzhukQuoted 12 lines · Ivan Khoronzhuk
drivers/clocksource/timer-keystone.c new file +12
-0+ +/* enable timer interrupts */ +keystone_timer_writel (INTCTLSTAT_ENINT_MASK ,INTCTLSTAT ); + + error =request_irq (irq, keystone_timer_interrupt,IRQF_TIMER , +TIMER_NAME , event_dev); +if (error) { +pr_err ("%s: failed to setup irq\n" , __func__); + goto err; + } + +/* setup clockevent */
drivers/clocksource/timer-keystone.c line 224
Quoted 10 lines
drivers/clocksource/timer-keystone.c new file +10
-0+ event_dev->features =CLOCK_EVT_FEAT_PERIODIC |CLOCK_EVT_FEAT_ONESHOT ; + event_dev->set_next_event = keystone_set_next_event; + event_dev->set_mode = keystone_set_mode; + event_dev->cpumask = cpu_all_mask; + event_dev->owner =THIS_MODULE ; + event_dev->name =TIMER_NAME ; + event_dev->irq = irq; + +clockevents_config_and_register (event_dev, rate,1 ,ULONG_MAX ); +
I hope you don't get an interrupt before you register the clockevent. You might want to reorder the interrupt request and the clockevent registration so that it isn't a problem. Other than that you can have my
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 1/3 clocksource: timer-keystone: introduce clocksource driver for Keystone
Quoted 29 lines · Stephen Boyd
Quoted 12 lines · Ivan Khoronzhuk
drivers/clocksource/timer-keystone.c new file +12
-0+ +/* enable timer interrupts */ +keystone_timer_writel (INTCTLSTAT_ENINT_MASK ,INTCTLSTAT ); + + error =request_irq (irq, keystone_timer_interrupt,IRQF_TIMER , +TIMER_NAME , event_dev); +if (error) { +pr_err ("%s: failed to setup irq\n" , __func__); + goto err; + } + +/* setup clockevent */ drivers/clocksource/timer-keystone.c line 224
Quoted 10 lines
drivers/clocksource/timer-keystone.c new file +10
-0+ event_dev->features =CLOCK_EVT_FEAT_PERIODIC |CLOCK_EVT_FEAT_ONESHOT ; + event_dev->set_next_event = keystone_set_next_event; + event_dev->set_mode = keystone_set_mode; + event_dev->cpumask = cpu_all_mask; + event_dev->owner =THIS_MODULE ; + event_dev->name =TIMER_NAME ; + event_dev->irq = irq; + +clockevents_config_and_register (event_dev, rate,1 ,ULONG_MAX ); +I hope you don't get an interrupt before you register the clockevent. You might want to reorder the interrupt request and the clockevent registration so that it isn't a problem. Other than that you can have my
Quoted 2 lines
Reviewed-by Stephen Boyd <[email protected]>
Thanks.
While interrupt enabling the timer is disabled, so it cannot generate interrupt. The timer will be enabled when next event is set by clockevent core.
Signature · 2 lines
Regards, Ivan Khoronzhuk
PATCH v3 1/3 clocksource: timer-keystone: introduce clocksource driver for Keystone
Quoted 30 lines · ivan.khoronzhuk
Quoted 29 lines · Stephen Boyd
Quoted 12 lines · Ivan Khoronzhuk
drivers/clocksource/timer-keystone.c new file +12
-0+ +/* enable timer interrupts */ +keystone_timer_writel (INTCTLSTAT_ENINT_MASK ,INTCTLSTAT ); + + error =request_irq (irq, keystone_timer_interrupt,IRQF_TIMER , +TIMER_NAME , event_dev); +if (error) { +pr_err ("%s: failed to setup irq\n" , __func__); + goto err; + } + +/* setup clockevent */ drivers/clocksource/timer-keystone.c line 224
Quoted 10 lines
drivers/clocksource/timer-keystone.c new file +10
-0+ event_dev->features =CLOCK_EVT_FEAT_PERIODIC |CLOCK_EVT_FEAT_ONESHOT ; + event_dev->set_next_event = keystone_set_next_event; + event_dev->set_mode = keystone_set_mode; + event_dev->cpumask = cpu_all_mask; + event_dev->owner =THIS_MODULE ; + event_dev->name =TIMER_NAME ; + event_dev->irq = irq; + +clockevents_config_and_register (event_dev, rate,1 ,ULONG_MAX ); +I hope you don't get an interrupt before you register the clockevent. You might want to reorder the interrupt request and the clockevent registration so that it isn't a problem. Other than that you can have my
Quoted 8 lines
Quoted 2 lines
Reviewed-by Stephen Boyd <[email protected]>Thanks.
While interrupt enabling the timer is disabled, so it cannot generate interrupt. The timer will be enabled when next event is set by clockevent core.
Ok, I was thinking more like the interrupt is level triggered and the bootloader left it triggered. Sounds like that doesn't happen.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 2/3 clocksource: keystone: add bindings for keystone timer
In reply to Ivan KhoronzhukThis patch provides bindings for the 64-bit timer in the KeyStone architecture devices. The timer can be configured as a general-purpose 64-bit timer, dual general-purpose 32-bit timers. When configured as dual 32-bit timers, each half can operate in conjunction (chain mode) or independently (unchained mode) of each other.
It is global timer is a free running up-counter and can generate interrupt when the counter reaches preset counter values.
Documentation:
http://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdf
--- .../bindings/timer/ti,keystone-timer.txt | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/ti,keystone-timer.txt
Documentation/devicetree/bindings/timer/ti,keystone-timer.txt new file +29 -0
@@ -0,0 +1,29 @@ +* Device tree bindings for Texas instruments Keystone timer + +This document provides bindings for the 64-bit timer in the KeyStone +architecture devices. The timer can be configured as a general-purpose 64-bit +timer, dual general-purpose 32-bit timers. When configured as dual 32-bit +timers, each half can operate in conjunction (chain mode) or independently +(unchained mode) of each other. + +It is global timer is a free running up-counter and can generate interrupt +when the counter reaches preset counter values. + +Documentation: +http://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdf + +Required properties: + +- compatible : should be "ti,keystone-timer". +- reg : specifies base physical address and count of the registers. +- interrupts : interrupt generated by the timer. +- clocks : the clock feeding the timer clock. + +Example: + +timer at 22f0000 { + compatible = "ti,keystone-timer"; + reg = <0x022f0000 0x80>; + interrupts = <GIC_SPI 110 IRQ_TYPE_EDGE_RISING>; + clocks = <&clktimer15>; +};
Signature · 1 line
1.7.9.5
PATCH v3 2/3 clocksource: keystone: add bindings for keystone timer
Quoted 6 lines · Ivan Khoronzhuk
This patch provides bindings for the 64-bit timer in the KeyStone architecture devices. The timer can be configured as a general-purpose 64-bit timer, dual general-purpose 32-bit timers. When configured as dual 32-bit timers, each half can operate in conjunction (chain mode) or independently (unchained mode) of each other.
Quoted 8 lines
It is global timer is a free running up-counter and can generate interrupt when the counter reaches preset counter values.
Documentation:
http://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdfSigned-off-by Ivan Khoronzhuk <[email protected]>---
The binding is trivial but still needs to be blessed by DT folks. It looks good for me.
Quoted 40 lines
.../bindings/timer/ti,keystone-timer.txt | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/ti,keystone-timer.txtDocumentation/devicetree/bindings/timer/ti,keystone-timer.txt new file +29
-0@@ -0,0 +1,29 @@ +* Device tree bindings for Texas instruments Keystone timer + +This document provides bindings for the 64-bit timer in the KeyStone +architecture devices. The timer can be configured as a general-purpose 64-bit +timer, dual general-purpose 32-bit timers. When configured as dual 32-bit +timers, each half can operate in conjunction (chain mode) or independently +(unchained mode) of each other. + +It is global timer is a free running up-counter and can generate interrupt +when the counter reaches preset counter values. + +Documentation: +http://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdf + +Required properties: + +- compatible : should be "ti,keystone-timer". +- reg : specifies base physical address and count of the registers. +- interrupts : interrupt generated by the timer. +- clocks : the clock feeding the timer clock. + +Example: + +timer at 22f0000 { + compatible = "ti,keystone-timer"; + reg = <0x022f0000 0x80>; + interrupts = <GIC_SPI 110 IRQ_TYPE_EDGE_RISING>; + clocks = <&clktimer15>; +};
PATCH v3 3/3 arm: dts: keystone: add keystone timer entry
In reply to Ivan KhoronzhukAdd keystone timer entry to keystone device tree. This 64-bit timer is used as backup clock event device.
--- arch/arm/boot/dts/keystone-clocks.dtsi | 10 ++++++++++ arch/arm/boot/dts/keystone.dtsi | 7 +++++++ 2 files changed, 17 insertions(+)
arch/arm/boot/dts/keystone-clocks.dtsi +10 -0
@@ -737,6 +737,16 @@ clocks { domain-id = <0>; }; + clktimer15: clktimer15 { + #clock-cells = <0>; + compatible = "ti,keystone,psc-clock"; + clocks = <&clkmodrst0>; + clock-output-names = "timer15"; + reg = <0x02350000 0xb00>, <0x02350000 0x400>; + reg-names = "control", "domain"; + domain-id = <0>; + }; + clkuart0: clkuart0 { #clock-cells = <0>; compatible = "ti,keystone,psc-clock";
arch/arm/boot/dts/keystone.dtsi +7 -0
@@ -181,5 +181,12 @@ interrupts = <GIC_SPI 300 IRQ_TYPE_EDGE_RISING>; clocks = <&clkspi>; }; + + clock_event: timer at 22f0000 { + compatible = "ti,keystone-timer"; + reg = <0x022f0000 0x80>; + interrupts = <GIC_SPI 110 IRQ_TYPE_EDGE_RISING>; + clocks = <&clktimer15>; + }; }; };
Signature · 1 line
1.7.9.5
PATCH v3 3/3 arm: dts: keystone: add keystone timer entry
$subject
s/arm/ARM,
Quoted 5 lines · Ivan Khoronzhuk
Add keystone timer entry to keystone device tree. This 64-bit timer is used as backup clock event device.
Signed-off-by Ivan Khoronzhuk <[email protected]>---
No need to repost. I will fix it up while applying based on state of PATCH 1/3 and 2/3.
Regards,
Santosh
PATCH v3 3/3 arm: dts: keystone: add keystone timer entry
Quoted 11 lines · Santosh Shilimkar
$subject
s/arm/ARM,Quoted 5 lines · Ivan Khoronzhuk
Add keystone timer entry to keystone device tree. This 64-bit timer is used as backup clock event device.
Signed-off-by Ivan Khoronzhuk <[email protected]>---
No need to repost. I will fix it up while applying based on state of PATCH 1/3 and 2/3.
I assume you will take the patchset in your tree.
I am back from vacations, give me a couple of days to review the patchset before applying it please.
Thanks
-- Daniel
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
PATCH v3 3/3 arm: dts: keystone: add keystone timer entry
Quoted 8 lines · Daniel Lezcano
Quoted 7 lines · Santosh Shilimkar
$subject
s/arm/ARM,Quoted 3 lines · Ivan Khoronzhuk
Add keystone timer entry to keystone device tree. This 64-bit timer is used as backup clock event device.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Ivan Khoronzhuk <[email protected]>---
No need to repost. I will fix it up while applying based on state of PATCH 1/3 and 2/3.
I assume you will take the patchset in your tree.
I wasn't planning to take patch 1/3 and 2/3, assuming they will go via clocksource tree. Only the dts $subject patch is what I was planning to pick it up if the 1/3 and 2/3 gets lined up via thomas's tree.
Quoted 2 lines
I am back from vacations, give me a couple of days to review the patchset before applying it please.
Take your time. Am not applying them as mentioned above.
Regards,
Santosh
PATCH v3 3/3 arm: dts: keystone: add keystone timer entry
In reply to Daniel LezcanoQuoted 13 lines · Daniel Lezcano
Quoted 11 lines · Santosh Shilimkar
$subject
s/arm/ARM,Quoted 5 lines · Ivan Khoronzhuk
Add keystone timer entry to keystone device tree. This 64-bit timer is used as backup clock event device.
Signed-off-by Ivan Khoronzhuk <[email protected]>---
No need to repost. I will fix it up while applying based on state of PATCH 1/3 and 2/3.
Quoted 8 lines
I assume you will take the patchset in your tree.
I am back from vacations, give me a couple of days to review the patchset before applying it please.
Thanks
-- Daniel
Hi, Daniel
Do you have any comments on this patch series?
Can we expect it in k3.14
Signature · 2 lines
Regards, Ivan Khoronzhuk
PATCH v3 3/3 arm: dts: keystone: add keystone timer entry
Quoted 19 lines · ivan.khoronzhuk
Quoted 18 lines · Daniel Lezcano
Quoted 11 lines · Santosh Shilimkar
$subject
s/arm/ARM,Quoted 5 lines · Ivan Khoronzhuk
Add keystone timer entry to keystone device tree. This 64-bit timer is used as backup clock event device.
Signed-off-by Ivan Khoronzhuk <[email protected]>---
No need to repost. I will fix it up while applying based on state of PATCH 1/3 and 2/3.
I assume you will take the patchset in your tree.
I am back from vacations, give me a couple of days to review the patchset before applying it please.
Quoted 8 lines
Quoted 3 lines
Thanks
-- DanielHi, Daniel
Do you have any comments on this patch series?
Can we expect it in k3.14
I have applied the patch 1/3 and 2/3 in my tree but I was expecting the DT folks to give their acked-by for the patch 2/3.
It is a bit late for 3.14 but if the patch 3/3 is in Santosh's tree, the patch 2/3 gets its acked-by and you absolutely need the driver for this version, I may consider to send another PR to the upstream maintainers. That will be up to them to accept to pull it or not.
Signature · 5 lines
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
PATCH v3 3/3 arm: dts: keystone: add keystone timer entry
Quoted 24 lines · Daniel Lezcano
Quoted 23 lines · ivan.khoronzhuk
Quoted 21 lines · Daniel Lezcano
Quoted 11 lines · Santosh Shilimkar
$subject
s/arm/ARM,Quoted 5 lines · Ivan Khoronzhuk
Add keystone timer entry to keystone device tree. This 64-bit timer is used as backup clock event device.
Signed-off-by Ivan Khoronzhuk <[email protected]>---
No need to repost. I will fix it up while applying based on state of PATCH 1/3 and 2/3.
I assume you will take the patchset in your tree.
I am back from vacations, give me a couple of days to review the patchset before applying it please.
Thanks
-- Daniel
Quoted 9 lines
Quoted 4 lines
Hi, Daniel
Do you have any comments on this patch series?
Can we expect it in k3.14I have applied the patch 1/3 and 2/3 in my tree but I was expecting the DT folks to give their acked-by for the patch 2/3.
It is a bit late for 3.14 but if the patch 3/3 is in Santosh's tree, the patch 2/3 gets its acked-by and you absolutely need the driver for this version, I may consider to send another PR to the upstream maintainers. That will be up to them to accept to pull it or not.
They can wait for next merge window (3.15).
Regards,
Santosh