linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] clocksource/drivers/timer-microchip-pit64b: add delay timer support
@ 2023-01-12 11:42 Claudiu Beznea
  2023-01-12 11:42 ` [PATCH 1/3] clocksource/drivers/timer-microchip-pit64b: move COMPILE_TEST on type definition Claudiu Beznea
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Claudiu Beznea @ 2023-01-12 11:42 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Claudiu Beznea

Hi,

This series adds delay timer support for Microchip PIT64B driver.

Thank you,
Claudiu Beznea

Claudiu Beznea (3):
  clocksource/drivers/timer-microchip-pit64b: move COMPILE_TEST on type
    definition
  clocksource/drivers/timer-microchip-pit64b: select driver only on ARM
  clocksource/drivers/timer-microchip-pit64b: add delay timer

 drivers/clocksource/Kconfig                  |  4 ++--
 drivers/clocksource/timer-microchip-pit64b.c | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] clocksource/drivers/timer-microchip-pit64b: move COMPILE_TEST on type definition
  2023-01-12 11:42 [PATCH 0/3] clocksource/drivers/timer-microchip-pit64b: add delay timer support Claudiu Beznea
@ 2023-01-12 11:42 ` Claudiu Beznea
  2023-01-12 11:42 ` [PATCH 2/3] clocksource/drivers/timer-microchip-pit64b: select driver only on ARM Claudiu Beznea
  2023-01-12 11:42 ` [PATCH 3/3] clocksource/drivers/timer-microchip-pit64b: add delay timer Claudiu Beznea
  2 siblings, 0 replies; 4+ messages in thread
From: Claudiu Beznea @ 2023-01-12 11:42 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Claudiu Beznea

Move COMPILE_TEST to menu type definition. This, along with commit
f611af4c3bfa ("ARM: at91: Kconfig: implement PIT64B selection") and the
next one in this series allows simply for driver to compile only on ARM
based platforms which allows further implementing delay timer on top of
PIT64B.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clocksource/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 4469e7f555e9..0e87d478a2fa 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -705,8 +705,8 @@ config INGENIC_OST
 	  Support for the Operating System Timer of the Ingenic JZ SoCs.
 
 config MICROCHIP_PIT64B
-	bool "Microchip PIT64B support"
-	depends on OF || COMPILE_TEST
+	bool "Microchip PIT64B support" if COMPILE_TEST
+	depends on OF
 	select TIMER_OF
 	help
 	  This option enables Microchip PIT64B timer for Atmel
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] clocksource/drivers/timer-microchip-pit64b: select driver only on ARM
  2023-01-12 11:42 [PATCH 0/3] clocksource/drivers/timer-microchip-pit64b: add delay timer support Claudiu Beznea
  2023-01-12 11:42 ` [PATCH 1/3] clocksource/drivers/timer-microchip-pit64b: move COMPILE_TEST on type definition Claudiu Beznea
@ 2023-01-12 11:42 ` Claudiu Beznea
  2023-01-12 11:42 ` [PATCH 3/3] clocksource/drivers/timer-microchip-pit64b: add delay timer Claudiu Beznea
  2 siblings, 0 replies; 4+ messages in thread
From: Claudiu Beznea @ 2023-01-12 11:42 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Claudiu Beznea

Microchip PIT64B is currently available on ARM based devices. Thus
select it only for ARM. This allows implementing delay timer.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clocksource/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 0e87d478a2fa..d47825e72dc2 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -706,7 +706,7 @@ config INGENIC_OST
 
 config MICROCHIP_PIT64B
 	bool "Microchip PIT64B support" if COMPILE_TEST
-	depends on OF
+	depends on OF && ARM
 	select TIMER_OF
 	help
 	  This option enables Microchip PIT64B timer for Atmel
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] clocksource/drivers/timer-microchip-pit64b: add delay timer
  2023-01-12 11:42 [PATCH 0/3] clocksource/drivers/timer-microchip-pit64b: add delay timer support Claudiu Beznea
  2023-01-12 11:42 ` [PATCH 1/3] clocksource/drivers/timer-microchip-pit64b: move COMPILE_TEST on type definition Claudiu Beznea
  2023-01-12 11:42 ` [PATCH 2/3] clocksource/drivers/timer-microchip-pit64b: select driver only on ARM Claudiu Beznea
@ 2023-01-12 11:42 ` Claudiu Beznea
  2 siblings, 0 replies; 4+ messages in thread
From: Claudiu Beznea @ 2023-01-12 11:42 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, Claudiu Beznea

Add delay timer.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/clocksource/timer-microchip-pit64b.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c
index d5f1436f33d9..57209bb38c70 100644
--- a/drivers/clocksource/timer-microchip-pit64b.c
+++ b/drivers/clocksource/timer-microchip-pit64b.c
@@ -9,6 +9,7 @@
 
 #include <linux/clk.h>
 #include <linux/clockchips.h>
+#include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -92,6 +93,8 @@ struct mchp_pit64b_clksrc {
 static void __iomem *mchp_pit64b_cs_base;
 /* Default cycles for clockevent timer. */
 static u64 mchp_pit64b_ce_cycles;
+/* Delay timer. */
+static struct delay_timer mchp_pit64b_dt;
 
 static inline u64 mchp_pit64b_cnt_read(void __iomem *base)
 {
@@ -169,6 +172,11 @@ static u64 notrace mchp_pit64b_sched_read_clk(void)
 	return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
 }
 
+static unsigned long notrace mchp_pit64b_dt_read(void)
+{
+	return mchp_pit64b_cnt_read(mchp_pit64b_cs_base);
+}
+
 static int mchp_pit64b_clkevt_shutdown(struct clock_event_device *cedev)
 {
 	struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
@@ -376,6 +384,10 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
 
 	sched_clock_register(mchp_pit64b_sched_read_clk, 64, clk_rate);
 
+	mchp_pit64b_dt.read_current_timer = mchp_pit64b_dt_read;
+	mchp_pit64b_dt.freq = clk_rate;
+	register_current_timer_delay(&mchp_pit64b_dt);
+
 	return 0;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-12 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 11:42 [PATCH 0/3] clocksource/drivers/timer-microchip-pit64b: add delay timer support Claudiu Beznea
2023-01-12 11:42 ` [PATCH 1/3] clocksource/drivers/timer-microchip-pit64b: move COMPILE_TEST on type definition Claudiu Beznea
2023-01-12 11:42 ` [PATCH 2/3] clocksource/drivers/timer-microchip-pit64b: select driver only on ARM Claudiu Beznea
2023-01-12 11:42 ` [PATCH 3/3] clocksource/drivers/timer-microchip-pit64b: add delay timer Claudiu Beznea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).