Skip to contentSkip to conversation

clocksource: Provide timekeeping for efm32 SoCs

PATCH Superseded Uwe Kleine-König 2 participants 5 messages Oct 3, 2013 – Oct 22, 2013

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

PATCH v2 1/1 clocksource: Provide timekeeping for efm32 SoCs

An efm32 features 4 16-bit timers with a 10-bit prescaler. This driver provides clocksource and clock event device using one timer instance each.

---
Changes since (implicit) v1, sent with Message-id:1379324644-20934-1-git-send-email-u.kleine-koenig at pengutronix.de:

- drop unused #defines
- add __init to efm32_clocksource_init
- fix indention
- add a comment describing the reason for the construct in efm32_timer_init
- add device tree binding document
I created a new directory "timer" below the binding directory.

 .../devicetree/bindings/timer/efm32,timer.txt      |  23 ++
 drivers/clocksource/Kconfig                        |   8 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/time-efm32.c                   | 275 +++++++++++++++++++++
 4 files changed, 307 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/efm32,timer.txt
 create mode 100644 drivers/clocksource/time-efm32.c
Documentation/devicetree/bindings/timer/efm32,timer.txt new file +23 -0
new file mode 100644
index 0000000..97a568f
@@ -0,0 +1,23 @@
+* EFM32 timer hardware
+
+The efm32 Giant Gecko SoCs come with four 16 bit timers. Two counters can be
+connected to form a 32 bit counter. Each timer has three Compare/Capture
+channels and can be used as PWM or Quadrature Decoder. Available clock sources
+are the cpu's HFPERCLK (with a 10-bit prescaler) or an external pin.
+
+Required properties:
+- compatible : Should be efm32,timer
+- reg : Address and length of the register set
+- clocks : Should contain a reference to the HFPERCLK
+
+Optional properties:
+- interrupts : Reference to the timer interrupt
+
+Example:
+
+timer at 40010c00 {
+	compatible = "efm32,timer";
+	reg = <0x40010c00 0x400>;
+	interrupts = <14>;
+	clocks = <&cmu clk_HFPERCLKTIMER3>;
+};
drivers/clocksource/Kconfig +8 -0
index 971d796..e634016 100644
@@ -71,6 +71,14 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK
 	help
 	  Use the always on PRCMU Timer as sched_clock
 
+config CLKSRC_EFM32
+	bool "Clocksource for Energy Micro's EFM32 SoCs" if !ARCH_EFM32
+	depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST)
+	default ARCH_EFM32
+	help
+	  Support to use the timers of EFM32 SoCs as clock source and clock
+	  event device.
+
 config ARM_ARCH_TIMER
 	bool
 	select CLKSRC_OF if OF
drivers/clocksource/Makefile +1 -0
index 704d6d3..33621ef 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_VT8500_TIMER)	+= vt8500_timer.o
 obj-$(CONFIG_ARCH_NSPIRE)	+= zevio-timer.o
 obj-$(CONFIG_ARCH_BCM)		+= bcm_kona_timer.o
 obj-$(CONFIG_CADENCE_TTC_TIMER)	+= cadence_ttc_timer.o
+obj-$(CONFIG_CLKSRC_EFM32)	+= time-efm32.o
 obj-$(CONFIG_CLKSRC_EXYNOS_MCT)	+= exynos_mct.o
 obj-$(CONFIG_CLKSRC_SAMSUNG_PWM)	+= samsung_pwm_timer.o
 obj-$(CONFIG_VF_PIT_TIMER)	+= vf_pit_timer.o
drivers/clocksource/time-efm32.c new file +275 -0

275 lines not on this page · raw message

Signature · 1 line
1.8.4.rc3
#1 lore raw

PATCH v2 1/1 clocksource: Provide timekeeping for efm32 SoCs

Quoted 6 lines · Uwe Kleine-K?nig

An efm32 features 4 16-bit timers with a 10-bit prescaler. This driver provides clocksource and clock event device using one timer instance each.

---

Applied to my tree for 3.13

Thanks !
-- Daniel

Quoted 9 lines

Changes since (implicit) v1, sent with Message-id:1379324644-20934-1-git-send-email-u.kleine-koenig at pengutronix.de:

- drop unused #defines
- add __init to efm32_clocksource_init
- fix indention
- add a comment describing the reason for the construct in efm32_timer_init
- add device tree binding document
I created a new directory "timer" below the binding directory.

Why do you say you created a new directory ?

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

PATCH v2 1/1 clocksource: Provide timekeeping for efm32 SoCs

Hello Daniel,

Quoted 9 lines · Daniel Lezcano
Quoted 6 lines · Uwe Kleine-K?nig

An efm32 features 4 16-bit timers with a 10-bit prescaler. This driver provides clocksource and clock event device using one timer instance each.

---

Applied to my tree for 3.13

Thanks

Quoted 4 lines
Quoted 2 lines

- add device tree binding document
I created a new directory "timer" below the binding directory.

Why do you say you created a new directory ?

That's because there was no directory for clockevent devices and clock sources before. So there is a new task to check where (if at all) the other drivers document their binding.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw

PATCH v2 1/1 clocksource: Provide timekeeping for efm32 SoCs

Quoted 8 lines · Uwe Kleine-K?nig

Hello Daniel,

Quoted 5 lines · Daniel Lezcano
Quoted 4 lines · Uwe Kleine-K?nig

An efm32 features 4 16-bit timers with a 10-bit prescaler. This driver provides clocksource and clock event device using one timer instance each.

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

---

Applied to my tree for 3.13

Thanks

Where is your tree to be found? This commit isn't in

git://git.linaro.org/people/dlezcano/linux.git clockevents/3.13

and also it's not included in next-20131021.

Best regards and thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw

PATCH v2 1/1 clocksource: Provide timekeeping for efm32 SoCs

Quoted 12 lines · Uwe Kleine-K?nig
Quoted 11 lines · Uwe Kleine-K?nig

Hello Daniel,

Quoted 8 lines · Daniel Lezcano
Quoted 6 lines · Uwe Kleine-K?nig

An efm32 features 4 16-bit timers with a 10-bit prescaler. This driver provides clocksource and clock event device using one timer instance each.

---

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

Applied to my tree for 3.13

Thanks

Where is your tree to be found? This commit isn't in

git://git.linaro.org/people/dlezcano/linux.git clockevents/3.13

and also it's not included in next-20131021.

Thanks for the heads up.

I synced my local tree with the tree:

git://git.linaro.org/people/dlezcano/linux.git

for the branch clockevents/3.13 and clockevents/3.12-fixes

I will send a PR as soon as I can.

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