Skip to contentSkip to conversation

Introduce clocksource driver for Keystone platform

PATCH Applied Ivan Khoronzhuk 4 participants 12 messages Feb 10, 2014 – Feb 20, 2014

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

v6 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 on
git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
keystone/master

v5..v6:
added function to encapsulate __iowmb().

v4..v5:
used __iowmb() insted of wmb()

v3..v4:
rebased on latest of 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               | 244 +++++++++++++++++++++
 5 files changed, 291 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/ti,keystone-timer.txt
 create mode 100644 drivers/clocksource/timer-keystone.c
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v6 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 | 244 +++++++++++++++++++++++++++++++++++
 2 files changed, 245 insertions(+)
 create mode 100644 drivers/clocksource/timer-keystone.c
drivers/clocksource/Makefile +1 -0
index c7ca50a..4abe5aa 100644
@@ -37,3 +37,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 +244 -0

244 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#2 lore raw

Re: [PATCH v6 1/3] clocksource: timer-keystone: introduce clocksource driver for Keystone

Quoted 11 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.

---

Applied to my tree for 3.15

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
#3 lore raw

Re: [PATCH v6 1/3] clocksource: timer-keystone: introduce clocksource driver for Keystone

2014-02-11 13:58 GMT+01:00 Daniel Lezcano <[email protected]>:

Quoted 9 lines · Ivan Khoronzhuk
Quoted 8 lines

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.

Quoted 7 lines
Quoted 4 lines

---

Applied to my tree for 3.15

I wanted to send a trivial follow-up patch, but I can't find the tree to which you have applied this patch.
Would you mind to indicate me where I can find it.

Cheers,
Matthias

Quoted 14 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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 1 line
motzblog.wordpress.com
#4 lore raw

Re: [PATCH v6 1/3] clocksource: timer-keystone: introduce clocksource driver for Keystone

Quoted 16 lines · Matthias Brugger

2014-02-11 13:58 GMT+01:00 Daniel Lezcano <[email protected]>:

Quoted 15 lines · Ivan Khoronzhuk
Quoted 12 lines

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.

---

Quoted 5 lines
Quoted 1 line

Applied to my tree for 3.15

I wanted to send a trivial follow-up patch, but I can't find the tree to which you have applied this patch.
Would you mind to indicate me where I can find it.

Sure.

git://git.linaro.org/people/daniel.lezcano/linux.git #clockevents/3.15

Regards
-- Daniel

Quoted 21 lines

Cheers,
Matthias

Quoted 14 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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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
#5 lore raw

PATCH 1/1 clocksource: timer-keystone: Delete unnecessary variable

In reply to Daniel Lezcano

Commit 438e0bff5257 added the timer-keystone device driver but make use of an unnecessary variable in the init function.
This patch delets this variable.

---
 drivers/clocksource/timer-keystone.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clocksource/timer-keystone.c +1 -4
index 86b08cd..0250354 100644
@@ -164,7 +164,6 @@ static void __init keystone_timer_init(struct device_node *np)
 	unsigned long rate;
 	struct clk *clk;
 	int irq, error;
-	u32 tgcr;
 
 	irq  = irq_of_parse_and_map(np, 0);
 	if (irq == NO_IRQ) {
@@ -199,12 +198,10 @@ static void __init keystone_timer_init(struct device_node *np)
 	keystone_timer_barrier();
 
 	/* reset timer as 64-bit, no pre-scaler, plus features are disabled */
-	tgcr = 0;
 	keystone_timer_writel(0, TGCR);
 
 	/* unreset timer */
-	tgcr |= TGCR_TIM_UNRESET_MASK;
-	keystone_timer_writel(tgcr, TGCR);
+	keystone_timer_writel(TGCR_TIM_UNRESET_MASK, TGCR);
 
 	/* init counter to zero */
 	keystone_timer_writel(0, TIM12);
Signature · 1 line
1.8.1.2
#6 lore raw

Re: [PATCH] clocksource: timer-keystone: Delete unnecessary variable

Quoted 5 lines · Matthias Brugger

Commit 438e0bff5257 added the timer-keystone device driver but make use of an unnecessary variable in the init function.
This patch delets this variable.

Applied to my tree for 3.15.

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
#7 lore raw

PATCH v6 2/3 clocksource: keystone: add bindings for keystone timer

In reply to 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.

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
new file mode 100644
index 0000000..5fbe361
@@ -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.8.3.2
#8 lore raw

Re: [PATCH v6 2/3] clocksource: keystone: add bindings for keystone timer

Quoted 9 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.

It is global timer is a free running up-counter and can generate interrupt when the counter reaches preset counter values.

Quoted 7 lines

Documentation:
http://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdf

---

Applied to my tree for 3.15

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
#9 lore raw

PATCH v6 3/3 arm: dts: keystone: add keystone timer entry

In reply to Ivan Khoronzhuk

Add 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
index 2363593..16d2aba 100644
@@ -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
index b420290..cac9841 100644
@@ -208,5 +208,12 @@
 				usb-phy = <&usb_phy>, <&usb_phy>;
 			};
 		};
+
+		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.8.3.2
#10 lore raw
In reply to Ivan Khoronzhuk

Daniel,

Quoted 39 lines · Ivan Khoronzhuk

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 on
git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
keystone/master

v5..v6:
added function to encapsulate __iowmb().

v4..v5:
used __iowmb() insted of wmb()

v3..v4:
rebased on latest of 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()

Quoted 5 lines

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

Can you queue the first two patches from the series ? I will queue the dts patch via my tree.

Regards,
Santosh

#11 lore raw
Quoted 42 lines · Santosh Shilimkar

Daniel,

Quoted 39 lines · Ivan Khoronzhuk

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 on
git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
keystone/master

v5..v6:
added function to encapsulate __iowmb().

v4..v5:
used __iowmb() insted of wmb()

v3..v4:
rebased on latest of 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()

Quoted 7 lines
Quoted 5 lines

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

Can you queue the first two patches from the series ? I will queue the dts patch via my tree.

Sure.

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