Skip to contentSkip to conversation

J-Core timer support

PATCH In review Rich Felker 4 participants 13 messages Oct 13, 2016 – Oct 20, 2016

Subsystems (4)
lore
Share & tools
lore

Rich Felker

author maintainer
#0 lore raw

v9 cover J-Core timer support

This version of the patch makes the changes requested by Daniel Lezcano in review of v8.

Rich Felker (2):
of: add J-Core timer bindings
clocksource: add J-Core timer/clocksource driver

 .../devicetree/bindings/timer/jcore,pit.txt        |  24 ++
 drivers/clocksource/Kconfig                        |  10 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/jcore-pit.c                    | 249 +++++++++++++++++++++
 include/linux/cpuhotplug.h                         |   1 +
 5 files changed, 285 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt
 create mode 100644 drivers/clocksource/jcore-pit.c
Signature · 6 lines
2.10.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#1 lore raw

PATCH v9 1/2 of: add J-Core timer bindings

---
 .../devicetree/bindings/timer/jcore,pit.txt        | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt
Documentation/devicetree/bindings/timer/jcore,pit.txt new file +24 -0
new file mode 100644
index 0000000..af5dd35
@@ -0,0 +1,24 @@
+J-Core Programmable Interval Timer and Clocksource
+
+Required properties:
+
+- compatible: Must be "jcore,pit".
+
+- reg: Memory region(s) for timer/clocksource registers. For SMP,
+  there should be one region per cpu, indexed by the sequential,
+  zero-based hardware cpu number.
+
+- interrupts: An interrupt to assign for the timer. The actual pit
+  core is integrated with the aic and allows the timer interrupt
+  assignment to be programmed by software, but this property is
+  required in order to reserve an interrupt number that doesn't
+  conflict with other devices.
+
+
+Example:
+
+timer@200 {
+	compatible = "jcore,pit";
+	reg = < 0x200 0x30 0x500 0x30 >;
+	interrupts = < 0x48 >;
+};
Signature · 1 line
2.10.0
#2 lore raw

[tip:timers/urgent] of: Add J-Core timer bindings

of: Add J-Core timer bindings
Commit-ID:  a2ce092be34c4951e23104a0bfdec08f9577fada
Gitweb:     http://git.kernel.org/tip/a2ce092be34c4951e23104a0bfdec08f9577fada
Author:     Rich Felker <[email protected]>
AuthorDate: Thu, 13 Oct 2016 21:51:06 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 20 Oct 2016 20:10:17 +0200

of: Add J-Core timer bindings

---
 .../devicetree/bindings/timer/jcore,pit.txt        | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
Documentation/devicetree/bindings/timer/jcore,pit.txt new file +24 -0
new file mode 100644
index 0000000..af5dd35
@@ -0,0 +1,24 @@
+J-Core Programmable Interval Timer and Clocksource
+
+Required properties:
+
+- compatible: Must be "jcore,pit".
+
+- reg: Memory region(s) for timer/clocksource registers. For SMP,
+  there should be one region per cpu, indexed by the sequential,
+  zero-based hardware cpu number.
+
+- interrupts: An interrupt to assign for the timer. The actual pit
+  core is integrated with the aic and allows the timer interrupt
+  assignment to be programmed by software, but this property is
+  required in order to reserve an interrupt number that doesn't
+  conflict with other devices.
+
+
+Example:
+
+timer@200 {
+	compatible = "jcore,pit";
+	reg = < 0x200 0x30 0x500 0x30 >;
+	interrupts = < 0x48 >;
+};
author maintainer
#3 lore raw

PATCH v9 2/2 clocksource: add J-Core timer/clocksource driver

In reply to Rich Felker

At the hardware level, the J-Core PIT is integrated with the interrupt controller, but it is represented as its own device and has an independent programming interface. It provides a 12-bit countdown timer, which is not presently used, and a periodic timer. The interval length for the latter is programmable via a 32-bit throttle register whose units are determined by a bus-period register. The periodic timer is used to implement both periodic and oneshot clock event modes; in oneshot mode the interrupt handler simply disables the timer as soon as it fires.

Despite its device tree node representing an interrupt for the PIT, the actual irq generated is programmable, not hard-wired. The driver is responsible for programming the PIT to generate the hardware irq number that the DT assigns to it.

On SMP configurations, J-Core provides cpu-local instances of the PIT; no broadcast timer is needed. This driver supports the creation of the necessary per-cpu clock_event_device instances.

A nanosecond-resolution clocksource is provided using the J-Core "RTC" registers, which give a 64-bit seconds count and 32-bit nanoseconds that wrap every second. The driver converts these to a full-range 32-bit nanoseconds count.

---
 drivers/clocksource/Kconfig     |  10 ++
 drivers/clocksource/Makefile    |   1 +
 drivers/clocksource/jcore-pit.c | 249 ++++++++++++++++++++++++++++++++++++++++
 include/linux/cpuhotplug.h      |   1 +
 4 files changed, 261 insertions(+)
 create mode 100644 drivers/clocksource/jcore-pit.c
drivers/clocksource/Kconfig +10 -0
index 5677886..eec5731 100644
@@ -407,6 +407,16 @@ config SYS_SUPPORTS_SH_TMU
 config SYS_SUPPORTS_EM_STI
         bool
 
+config CLKSRC_JCORE_PIT
+	bool "J-Core PIT timer driver" if COMPILE_TEST
+	depends on OF
+	depends on GENERIC_CLOCKEVENTS
+	depends on HAS_IOMEM
+	select CLKSRC_MMIO
+	help
+	  This enables build of clocksource and clockevent driver for
+	  the integrated PIT in the J-Core synthesizable, open source SoC.
+
 config SH_TIMER_CMT
 	bool "Renesas CMT timer driver" if COMPILE_TEST
 	depends on GENERIC_CLOCKEVENTS
drivers/clocksource/Makefile +1 -0
index fd9d6df..cf87f40 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_ATMEL_TCB_CLKSRC)	+= tcb_clksrc.o
 obj-$(CONFIG_X86_PM_TIMER)	+= acpi_pm.o
 obj-$(CONFIG_SCx200HR_TIMER)	+= scx200_hrt.o
 obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC)	+= cs5535-clockevt.o
+obj-$(CONFIG_CLKSRC_JCORE_PIT)		+= jcore-pit.o
 obj-$(CONFIG_SH_TIMER_CMT)	+= sh_cmt.o
 obj-$(CONFIG_SH_TIMER_MTU2)	+= sh_mtu2.o
 obj-$(CONFIG_SH_TIMER_TMU)	+= sh_tmu.o
drivers/clocksource/jcore-pit.c new file +249 -0

249 lines not on this page · raw message

include/linux/cpuhotplug.h +1 -0
index 34bd805..e2e6c8c 100644
@@ -52,6 +52,7 @@ enum cpuhp_state {
 	CPUHP_AP_ARM_ARCH_TIMER_STARTING,
 	CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
 	CPUHP_AP_DUMMY_TIMER_STARTING,
+	CPUHP_AP_JCORE_TIMER_STARTING,
 	CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING,
 	CPUHP_AP_ARM_TWD_STARTING,
 	CPUHP_AP_METAG_TIMER_STARTING,
Signature · 1 line
2.10.0
#4 lore raw

[tip:timers/urgent] clocksource: Add J-Core timer/clocksource driver

clocksource: Add J-Core timer/clocksource driver
Commit-ID:  9995f4f184613fb02ee73092b03545520a72b104
Gitweb:     http://git.kernel.org/tip/9995f4f184613fb02ee73092b03545520a72b104
Author:     Rich Felker <[email protected]>
AuthorDate: Thu, 13 Oct 2016 21:51:06 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 20 Oct 2016 20:10:17 +0200

clocksource: Add J-Core timer/clocksource driver

At the hardware level, the J-Core PIT is integrated with the interrupt controller, but it is represented as its own device and has an independent programming interface. It provides a 12-bit countdown timer, which is not presently used, and a periodic timer. The interval length for the latter is programmable via a 32-bit throttle register whose units are determined by a bus-period register. The periodic timer is used to implement both periodic and oneshot clock event modes; in oneshot mode the interrupt handler simply disables the timer as soon as it fires.

Despite its device tree node representing an interrupt for the PIT, the actual irq generated is programmable, not hard-wired. The driver is responsible for programming the PIT to generate the hardware irq number that the DT assigns to it.

On SMP configurations, J-Core provides cpu-local instances of the PIT; no broadcast timer is needed. This driver supports the creation of the necessary per-cpu clock_event_device instances.

A nanosecond-resolution clocksource is provided using the J-Core "RTC" registers, which give a 64-bit seconds count and 32-bit nanoseconds that wrap every second. The driver converts these to a full-range 32-bit nanoseconds count.

---
 drivers/clocksource/Kconfig     |  10 ++
 drivers/clocksource/Makefile    |   1 +
 drivers/clocksource/jcore-pit.c | 249 ++++++++++++++++++++++++++++++++++++++++
 include/linux/cpuhotplug.h      |   1 +
 4 files changed, 261 insertions(+)
drivers/clocksource/Kconfig +10 -0
index 2451908..e2c6e43 100644
@@ -417,6 +417,16 @@ config SYS_SUPPORTS_SH_TMU
 config SYS_SUPPORTS_EM_STI
         bool
 
+config CLKSRC_JCORE_PIT
+	bool "J-Core PIT timer driver" if COMPILE_TEST
+	depends on OF
+	depends on GENERIC_CLOCKEVENTS
+	depends on HAS_IOMEM
+	select CLKSRC_MMIO
+	help
+	  This enables build of clocksource and clockevent driver for
+	  the integrated PIT in the J-Core synthesizable, open source SoC.
+
 config SH_TIMER_CMT
 	bool "Renesas CMT timer driver" if COMPILE_TEST
 	depends on GENERIC_CLOCKEVENTS
drivers/clocksource/Makefile +1 -0
index fd9d6df..cf87f40 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_ATMEL_TCB_CLKSRC)	+= tcb_clksrc.o
 obj-$(CONFIG_X86_PM_TIMER)	+= acpi_pm.o
 obj-$(CONFIG_SCx200HR_TIMER)	+= scx200_hrt.o
 obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC)	+= cs5535-clockevt.o
+obj-$(CONFIG_CLKSRC_JCORE_PIT)		+= jcore-pit.o
 obj-$(CONFIG_SH_TIMER_CMT)	+= sh_cmt.o
 obj-$(CONFIG_SH_TIMER_MTU2)	+= sh_mtu2.o
 obj-$(CONFIG_SH_TIMER_TMU)	+= sh_tmu.o
drivers/clocksource/jcore-pit.c new file +249 -0

249 lines not on this page · raw message

include/linux/cpuhotplug.h +1 -0
index 9b207a8..afe641c 100644
@@ -81,6 +81,7 @@ enum cpuhp_state {
 	CPUHP_AP_ARM_ARCH_TIMER_STARTING,
 	CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
 	CPUHP_AP_DUMMY_TIMER_STARTING,
+	CPUHP_AP_JCORE_TIMER_STARTING,
 	CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING,
 	CPUHP_AP_ARM_TWD_STARTING,
 	CPUHP_AP_METAG_TIMER_STARTING,
#5 lore raw
In reply to Rich Felker
Quoted 7 lines · Rich Felker

This version of the patch makes the changes requested by Daniel Lezcano in review of v8.

Rich Felker (2):
of: add J-Core timer bindings
clocksource: add J-Core timer/clocksource driver

Quoted 8 lines
 .../devicetree/bindings/timer/jcore,pit.txt        |  24 ++
 drivers/clocksource/Kconfig                        |  10 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/jcore-pit.c                    | 249 +++++++++++++++++++++
 include/linux/cpuhotplug.h                         |   1 +
 5 files changed, 285 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt
 create mode 100644 drivers/clocksource/jcore-pit.c

Hi Rich,

I applied your patches on my tree.

Thanks !

-- Daniel

author maintainer
#6 lore raw
Quoted 17 lines · Daniel Lezcano
Quoted 7 lines · Rich Felker

This version of the patch makes the changes requested by Daniel Lezcano in review of v8.

Rich Felker (2):
of: add J-Core timer bindings
clocksource: add J-Core timer/clocksource driver

Quoted 8 lines
 .../devicetree/bindings/timer/jcore,pit.txt        |  24 ++
 drivers/clocksource/Kconfig                        |  10 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/jcore-pit.c                    | 249 +++++++++++++++++++++
 include/linux/cpuhotplug.h                         |   1 +
 5 files changed, 285 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt
 create mode 100644 drivers/clocksource/jcore-pit.c
Quoted 5 lines

Hi Rich,

I applied your patches on my tree.

Thanks !

Thanks! Which is your current tree? I was looking and couldn't find it. This is the one thing (and it's a boot blocker) keeping Linux on J2 from working out of the box and I'd really love to see it go in 4.9.

Rich

#7 lore raw
Quoted 18 lines · Rich Felker
Quoted 17 lines · Daniel Lezcano
Quoted 15 lines · Rich Felker

This version of the patch makes the changes requested by Daniel Lezcano in review of v8.

Rich Felker (2):
of: add J-Core timer bindings
clocksource: add J-Core timer/clocksource driver

 .../devicetree/bindings/timer/jcore,pit.txt        |  24 ++
 drivers/clocksource/Kconfig                        |  10 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/jcore-pit.c                    | 249 +++++++++++++++++++++
 include/linux/cpuhotplug.h                         |   1 +
 5 files changed, 285 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt
 create mode 100644 drivers/clocksource/jcore-pit.c
Quoted 7 lines
Quoted 5 lines

Hi Rich,

I applied your patches on my tree.

Thanks !

Thanks! Which is your current tree?

http://git.linaro.org/people/daniel.lezcano/linux.git clockevents/4.10

Quoted 4 lines

I was looking and couldn't find
it. This is the one thing (and it's a boot blocker) keeping Linux on J2 from working out of the box and I'd really love to see it go in 4.9.

Unfortunately it won't happen. v4.9-rc1 is already out. The driver will be in v4.10.

If you wanted patches merged for v4.9, they should have been merged in the downstream tree before v4.8-rc5, so they hit the upstream tree for v4.9's merge window.

-- Daniel

author maintainer
#8 lore raw
Quoted 34 lines · Daniel Lezcano
Quoted 18 lines · Rich Felker
Quoted 17 lines · Daniel Lezcano
Quoted 15 lines · Rich Felker

This version of the patch makes the changes requested by Daniel Lezcano in review of v8.

Rich Felker (2):
of: add J-Core timer bindings
clocksource: add J-Core timer/clocksource driver

 .../devicetree/bindings/timer/jcore,pit.txt        |  24 ++
 drivers/clocksource/Kconfig                        |  10 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/jcore-pit.c                    | 249 +++++++++++++++++++++
 include/linux/cpuhotplug.h                         |   1 +
 5 files changed, 285 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt
 create mode 100644 drivers/clocksource/jcore-pit.c
Quoted 7 lines
Quoted 5 lines

Hi Rich,

I applied your patches on my tree.

Thanks !

Thanks! Which is your current tree?

http://git.linaro.org/people/daniel.lezcano/linux.git clockevents/4.10

Quoted 4 lines

I was looking and couldn't find
it. This is the one thing (and it's a boot blocker) keeping Linux on J2 from working out of the box and I'd really love to see it go in 4.9.

Quoted 6 lines

Unfortunately it won't happen. v4.9-rc1 is already out. The driver will be in v4.10.

If you wanted patches merged for v4.9, they should have been merged in the downstream tree before v4.8-rc5, so they hit the upstream tree for v4.9's merge window.

I've been trying to get what's essentially the same patch merged since before the 4.8 merge window. I would be more understanding if this were something new that's not upstream, but broken support for the hardware (that, from a user perspective, is a bug, since they can select the target but then it doesn't boot) has already been in one release due to missing core drivers, and the irq patches have already been merged in this release (post-rc1 even).

Rich

#9 lore raw

Daniel,

Quoted 8 lines · Rich Felker
Quoted 6 lines · Daniel Lezcano

Unfortunately it won't happen. v4.9-rc1 is already out. The driver will be in v4.10.

If you wanted patches merged for v4.9, they should have been merged in the downstream tree before v4.8-rc5, so they hit the upstream tree for v4.9's merge window.

Quoted 7 lines

I've been trying to get what's essentially the same patch merged since before the 4.8 merge window. I would be more understanding if this were something new that's not upstream, but broken support for the hardware (that, from a user perspective, is a bug, since they can select the target but then it doesn't boot) has already been in one release due to missing core drivers, and the irq patches have already been merged in this release (post-rc1 even).

It's hardware enablement and not a new feature, so it's fine to merge it now. I'll pick it up later tonight.

Thanks,

tglx

#10 lore raw
Quoted 19 lines · Thomas Gleixner

Daniel,

Quoted 8 lines · Rich Felker
Quoted 6 lines · Daniel Lezcano

Unfortunately it won't happen. v4.9-rc1 is already out. The driver will be in v4.10.

If you wanted patches merged for v4.9, they should have been merged in the downstream tree before v4.8-rc5, so they hit the upstream tree for v4.9's merge window.

Quoted 7 lines

I've been trying to get what's essentially the same patch merged since before the 4.8 merge window. I would be more understanding if this were something new that's not upstream, but broken support for the hardware (that, from a user perspective, is a bug, since they can select the target but then it doesn't boot) has already been in one release due to missing core drivers, and the irq patches have already been merged in this release (post-rc1 even).

Quoted 2 lines

It's hardware enablement and not a new feature, so it's fine to merge it now. I'll pick it up later tonight.

Daniel, it's the top two commits in your 4.10 branch. So it's not a big deal to zap them.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
Quoted 20 lines · Thomas Gleixner
Quoted 19 lines · Thomas Gleixner

Daniel,

Quoted 15 lines · Rich Felker
Quoted 6 lines · Daniel Lezcano

Unfortunately it won't happen. v4.9-rc1 is already out. The driver will be in v4.10.

If you wanted patches merged for v4.9, they should have been merged in the downstream tree before v4.8-rc5, so they hit the upstream tree for v4.9's merge window.

I've been trying to get what's essentially the same patch merged since before the 4.8 merge window. I would be more understanding if this were something new that's not upstream, but broken support for the hardware (that, from a user perspective, is a bug, since they can select the target but then it doesn't boot) has already been in one release due to missing core drivers, and the irq patches have already been merged in this release (post-rc1 even).

Quoted 5 lines
Quoted 2 lines

It's hardware enablement and not a new feature, so it's fine to merge it now. I'll pick it up later tonight.

Daniel, it's the top two commits in your 4.10 branch. So it's not a big deal to zap them.

Yes, sure. No problem.

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
author maintainer
#12 lore raw
In reply to Thomas Gleixner
Quoted 19 lines · Thomas Gleixner

Daniel,

Quoted 8 lines · Rich Felker
Quoted 6 lines · Daniel Lezcano

Unfortunately it won't happen. v4.9-rc1 is already out. The driver will be in v4.10.

If you wanted patches merged for v4.9, they should have been merged in the downstream tree before v4.8-rc5, so they hit the upstream tree for v4.9's merge window.

Quoted 7 lines

I've been trying to get what's essentially the same patch merged since before the 4.8 merge window. I would be more understanding if this were something new that's not upstream, but broken support for the hardware (that, from a user perspective, is a bug, since they can select the target but then it doesn't boot) has already been in one release due to missing core drivers, and the irq patches have already been merged in this release (post-rc1 even).

Quoted 2 lines

It's hardware enablement and not a new feature, so it's fine to merge it now. I'll pick it up later tonight.

Thanks Thomas. Daniel, sorry if my above reply was harsh and thanks again for all your help reviewing and getting this upstream.

Rich