Skip to contentSkip to conversation

C-SKY(csky) Timer Driver

PATCH In review Guo Ren 3 participants 9 messages Oct 31, 2018 – Nov 3, 2018

Subsystems (4)
lore
Share & tools
lore
author
#2 lore raw

PATCH v13 2/2 clocksource: add gx6605s SOC system timer

In reply to Guo Ren

The driver is for gx6605s SOC system timer and there are two same timers in gx6605s. We use one for clkevt and another one for clksrc.

The timer is mmio map to access, so we need give mmio address in dts.

The counter at 0x0 offset is clock event.
The counter at 0x40 offset is clock source.

Cc Daniel Lezcano <[email protected]>
Cc Thomas Gleixner <[email protected]>

---
Changelog:
- pass checkpatch.pl
- Add COMIPLE_TEST in Kconfig
- no cast is needed for "struct clock_event_device *ce = dev"
- remove: extra space after (u64)
- Add License and Copyright
- Use timer-of framework
- Change name with upstream feedback
- Use clksource_mmio framework
---

---
 drivers/clocksource/Kconfig         |   8 ++
 drivers/clocksource/Makefile        |   1 +
 drivers/clocksource/timer-gx6605s.c | 154 ++++++++++++++++++++++++++++++++++++
 3 files changed, 163 insertions(+)
 create mode 100644 drivers/clocksource/timer-gx6605s.c
drivers/clocksource/Kconfig +8 -0
index 591c9a8..55c77e4 100644
@@ -630,4 +630,12 @@ config CSKY_MP_TIMER
 	  csky,mptimer is not only used in SMP system, it also could be used
 	  single core system. It's not a mmio reg and it use mtcr/mfcr instruction.
 
+config GX6605S_TIMER
+	bool "Gx6605s SOC system timer driver" if COMPILE_TEST
+	depends on CSKY
+	select CLKSRC_MMIO
+	select TIMER_OF
+	help
+	  This option enables support for gx6605s SOC's timer.
+
 endmenu
drivers/clocksource/Makefile +1 -0
index 5ce82d3..9196331 100644
@@ -80,3 +80,4 @@ obj-$(CONFIG_X86_NUMACHIP)		+= numachip.o
 obj-$(CONFIG_ATCPIT100_TIMER)		+= timer-atcpit100.o
 obj-$(CONFIG_RISCV_TIMER)		+= riscv_timer.o
 obj-$(CONFIG_CSKY_MP_TIMER)		+= timer-mp-csky.o
+obj-$(CONFIG_GX6605S_TIMER)		+= timer-gx6605s.o
drivers/clocksource/timer-gx6605s.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.7.4

Guo Ren

author
#0 lore raw

v13 cover C-SKY(csky) Timer Driver

Hi Daniel & Thomas,

I sent you "PATCH V13" a few days ago, but no-reply:
https://lkml.org/lkml/2018/10/29/608
Now I send again.

Although csky subsystem has been merged into linux-4.20, but there is no timer drivers for csky. A lot of boards need these timer drivers.

Please help merge them into linux-4.20, wait for you reply.

Thx
Guo Ren

Changelog:
- Move changelog to end of patch.
- Remove the set_irq_createmapping call back in csky-mp-intc.c.
- Convert the cpumask to an interrupt-controller specific representation in driver's code, and not the SMP code's, and also modify the related codes in csky kernel patchset.
- Add COMPILE_TEST for csky_mp_timer.
- Fixup smp boot error, cpuhp_setup_state must after timer_of_init() for csky_mp_timer.

Guo Ren (2):
clocksource: add C-SKY SMP timer
clocksource: add gx6605s SOC system timer

 drivers/clocksource/Kconfig         |  18 ++++
 drivers/clocksource/Makefile        |   2 +
 drivers/clocksource/timer-gx6605s.c | 154 ++++++++++++++++++++++++++++++++
 drivers/clocksource/timer-mp-csky.c | 173 ++++++++++++++++++++++++++++++++++++
 include/linux/cpuhotplug.h          |   1 +
 5 files changed, 348 insertions(+)
 create mode 100644 drivers/clocksource/timer-gx6605s.c
 create mode 100644 drivers/clocksource/timer-mp-csky.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v13 1/2 clocksource: add C-SKY SMP timer

The driver is for C-SKY SMP timer. It only support oneshot event and 32bit overflow for clocksource. Per cpu core has one timer and all timers share one clock-counter-input the same clocksource.

This use mfcr&mtcr instructions to access the regs.

Cc Daniel Lezcano <[email protected]>
Cc Thomas Gleixner <[email protected]>

---
Changelog:
- Add COMPILE_TEST
- Fixup smp boot error, cpuhp_setup_state must after timer_of_init()
- Add rollback for timer_of_cleanup.
- Use request_percpu_irq separate from time_of.
- Remove #define CPUHP_AP_CSKY_TIMER_STARTING.
- Add CPUHP_AP_CSKY_TIMER_STARTING in cpuhotplug.h.
- Support csky mp timer alpha version.
- Just use low-counter with 32bit width as clocksource.
- Coding convention with upstream feed-back.
---

---
 drivers/clocksource/Kconfig         |  10 +++
 drivers/clocksource/Makefile        |   1 +
 drivers/clocksource/timer-mp-csky.c | 173 ++++++++++++++++++++++++++++++++++++
 include/linux/cpuhotplug.h          |   1 +
 4 files changed, 185 insertions(+)
 create mode 100644 drivers/clocksource/timer-mp-csky.c
drivers/clocksource/Kconfig +10 -0
index a11f4ba..591c9a8 100644
@@ -620,4 +620,14 @@ config RISCV_TIMER
 	  is accessed via both the SBI and the rdcycle instruction.  This is
 	  required for all RISC-V systems.
 
+config CSKY_MP_TIMER
+	bool "SMP Timer for the C-SKY platform" if COMPILE_TEST
+	depends on CSKY
+	select TIMER_OF
+	help
+	  Say yes here to enable C-SKY SMP timer driver used for C-SKY SMP
+	  system.
+	  csky,mptimer is not only used in SMP system, it also could be used
+	  single core system. It's not a mmio reg and it use mtcr/mfcr instruction.
+
 endmenu
drivers/clocksource/Makefile +1 -0
index db51b24..5ce82d3 100644
@@ -79,3 +79,4 @@ obj-$(CONFIG_CLKSRC_ST_LPC)		+= clksrc_st_lpc.o
 obj-$(CONFIG_X86_NUMACHIP)		+= numachip.o
 obj-$(CONFIG_ATCPIT100_TIMER)		+= timer-atcpit100.o
 obj-$(CONFIG_RISCV_TIMER)		+= riscv_timer.o
+obj-$(CONFIG_CSKY_MP_TIMER)		+= timer-mp-csky.o
drivers/clocksource/timer-mp-csky.c new file +173 -0

173 lines not on this page · raw message

include/linux/cpuhotplug.h +1 -0
index caf40ad..e0cd2ba 100644
@@ -126,6 +126,7 @@ enum cpuhp_state {
 	CPUHP_AP_MIPS_GIC_TIMER_STARTING,
 	CPUHP_AP_ARC_TIMER_STARTING,
 	CPUHP_AP_RISCV_TIMER_STARTING,
+	CPUHP_AP_CSKY_TIMER_STARTING,
 	CPUHP_AP_KVM_STARTING,
 	CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,
 	CPUHP_AP_KVM_ARM_VGIC_STARTING,
Signature · 1 line
2.7.4
#3 lore raw
In reply to Guo Ren

Hi Guo,

Quoted 5 lines · Guo Ren

Hi Daniel & Thomas,

I sent you "PATCH V13" a few days ago, but no-reply:
https://lkml.org/lkml/2018/10/29/608
Now I send again.

Where are the DT bindings ?

please (cc lkml when sending patches)

Quoted 31 lines

Although csky subsystem has been merged into linux-4.20, but there is no timer drivers for csky. A lot of boards need these timer drivers.

Please help merge them into linux-4.20, wait for you reply.

Thx
Guo Ren

Changelog:
- Move changelog to end of patch.
- Remove the set_irq_createmapping call back in csky-mp-intc.c.
- Convert the cpumask to an interrupt-controller specific representation in driver's code, and not the SMP code's, and also modify the related codes in csky kernel patchset.
- Add COMPILE_TEST for csky_mp_timer.
- Fixup smp boot error, cpuhp_setup_state must after timer_of_init() for csky_mp_timer.

Guo Ren (2):
clocksource: add C-SKY SMP timer
clocksource: add gx6605s SOC system timer

 drivers/clocksource/Kconfig         |  18 ++++
 drivers/clocksource/Makefile        |   2 +
 drivers/clocksource/timer-gx6605s.c | 154 ++++++++++++++++++++++++++++++++
 drivers/clocksource/timer-mp-csky.c | 173 ++++++++++++++++++++++++++++++++++++
 include/linux/cpuhotplug.h          |   1 +
 5 files changed, 348 insertions(+)
 create mode 100644 drivers/clocksource/timer-gx6605s.c
 create mode 100644 drivers/clocksource/timer-mp-csky.c
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
In reply to Guo Ren
Quoted 10 lines · Guo Ren

Hi Daniel & Thomas,

I sent you "PATCH V13" a few days ago, but no-reply:
https://lkml.org/lkml/2018/10/29/608
Now I send again.

Although csky subsystem has been merged into linux-4.20, but there is no timer drivers for csky. A lot of boards need these timer drivers.

Please help merge them into linux-4.20, wait for you reply.

Thomas,

is it fine if I sent you a late PR based in tip/timers/urgent ?

These are new drivers.

Quoted 23 lines

Changelog:
- Move changelog to end of patch.
- Remove the set_irq_createmapping call back in csky-mp-intc.c.
- Convert the cpumask to an interrupt-controller specific representation in driver's code, and not the SMP code's, and also modify the related codes in csky kernel patchset.
- Add COMPILE_TEST for csky_mp_timer.
- Fixup smp boot error, cpuhp_setup_state must after timer_of_init() for csky_mp_timer.

Guo Ren (2):
clocksource: add C-SKY SMP timer
clocksource: add gx6605s SOC system timer

 drivers/clocksource/Kconfig         |  18 ++++
 drivers/clocksource/Makefile        |   2 +
 drivers/clocksource/timer-gx6605s.c | 154 ++++++++++++++++++++++++++++++++
 drivers/clocksource/timer-mp-csky.c | 173 ++++++++++++++++++++++++++++++++++++
 include/linux/cpuhotplug.h          |   1 +
 5 files changed, 348 insertions(+)
 create mode 100644 drivers/clocksource/timer-gx6605s.c
 create mode 100644 drivers/clocksource/timer-mp-csky.c
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
#8 lore raw
Quoted 10 lines · Daniel Lezcano
Quoted 9 lines · Guo Ren

Hi Daniel & Thomas,

I sent you "PATCH V13" a few days ago, but no-reply:
https://lkml.org/lkml/2018/10/29/608
Now I send again.

Although csky subsystem has been merged into linux-4.20, but there is no timer drivers for csky. A lot of boards need these timer drivers.

Quoted 7 lines
Quoted 1 line

Please help merge them into linux-4.20, wait for you reply.

Thomas,

is it fine if I sent you a late PR based in tip/timers/urgent ?

These are new drivers.

Sure

author
#4 lore raw
In reply to Daniel Lezcano

Hi Daniel,

Thx for reply.

Quoted 11 lines · Daniel Lezcano

Hi Guo,

Quoted 5 lines · Guo Ren

Hi Daniel & Thomas,

I sent you "PATCH V13" a few days ago, but no-reply:
https://lkml.org/lkml/2018/10/29/608
Now I send again.

Where are the DT bindings ?

I've sent you PATCH V13 before, see here:
https://lore.kernel.org/lkml/ad5c91023ae9bbb07aa0392882667a5a2b133fc5.1539579760.git.ren_guo@c-sky.com/
https://lore.kernel.org/lkml/0f7cbde6462150c6ddb058d89d59ce35c3d6da9f.1539579760.git.ren_guo@c-sky.com/
dt-bingdings docs have been reivewed-by Rob Herring.

If necessory, I could send PATCH V13 again with dt-bindings.

Quoted 2 lines

please (cc lkml when sending patches)

Ok, got it. I'll cc lkml next.

Best Regards
Guo Ren

#5 lore raw
Quoted 21 lines · Guo Ren

Hi Daniel,

Thx for reply.

Quoted 11 lines · Daniel Lezcano

Hi Guo,

Quoted 5 lines · Guo Ren

Hi Daniel & Thomas,

I sent you "PATCH V13" a few days ago, but no-reply:
https://lkml.org/lkml/2018/10/29/608
Now I send again.

Where are the DT bindings ?

I've sent you PATCH V13 before, see here:
https://lore.kernel.org/lkml/ad5c91023ae9bbb07aa0392882667a5a2b133fc5.1539579760.git.ren_guo@c-sky.com/
https://lore.kernel.org/lkml/0f7cbde6462150c6ddb058d89d59ce35c3d6da9f.1539579760.git.ren_guo@c-sky.com/
dt-bingdings docs have been reivewed-by Rob Herring.

Quoted 5 lines

If necessory, I could send PATCH V13 again with dt-bindings.

Quoted 2 lines

please (cc lkml when sending patches)

Ok, got it. I'll cc lkml next.

Yes, please resend the patches you want upstream with dt-bindings and prefix with resend in the subject. I will take them, fix some formatting and send the PR to Thomas.

Don't forget to Cc lkml@, so I can use my tools to retrieve the series.

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
#6 lore raw
In reply to Daniel Lezcano

Hi Daniel,

Thx for reply.

Quoted 12 lines · Daniel Lezcano

Hi Guo,

Quoted 5 lines · Guo Ren

Hi Daniel & Thomas,

I sent you "PATCH V13" a few days ago, but no-reply:
https://lkml.org/lkml/2018/10/29/608
Now I send again.

Where are the DT bindings ?

I've sent you PATCH V13 before, see here:
https://lore.kernel.org/lkml/ad5c91023ae9bbb07aa0392882667a5a2b133fc5.1539579760.git.ren_guo@c-sky.com/
https://lore.kernel.org/lkml/0f7cbde6462150c6ddb058d89d59ce35c3d6da9f.1539579760.git.ren_guo@c-sky.com/
dt-bingdings docs have been reivewed-by Rob Herring.

If necessory, I could send PATCH V13 again with dt-bindings.

Quoted 1 line

please (cc lkml when sending patches)

Ok, I'll cc lkml next.

Best Regards
Guo Ren