Skip to contentSkip to conversation

timer: npcm: Add driver for Nuvoton NPCM SoCs

PATCH In review Stanley Chu 2 participants 2 messages Feb 15, 2022 – Feb 26, 2022 Arm/nuvoton npcm architecture

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 timer: npcm: Add driver for Nuvoton NPCM SoCs

Enable a periodic timer on NPCM SoCs and implement the get_count timer ops.

---
v3:
- use driver data for clock setting on different chips
- remove unnecessary code of zeroing priv variables
- more help description in Kconfig
v2:
- calculate the prescale value, not hardcode

---
 drivers/timer/Kconfig      |   9 +++
 drivers/timer/Makefile     |   1 +
 drivers/timer/npcm-timer.c | 115 +++++++++++++++++++++++++++++++++++++
 3 files changed, 125 insertions(+)
 create mode 100644 drivers/timer/npcm-timer.c
drivers/timer/Kconfig +9 -0
index 8913142654..abcc736492 100644
@@ -143,6 +143,15 @@ config NOMADIK_MTU_TIMER
 	  The MTU provides 4 decrementing free-running timers.
 	  At the moment, only the first timer is used by the driver.
 
+config NPCM_TIMER
+	bool "Nuvoton NPCM timer support"
+	depends on TIMER
+	help
+	  Select this to enable a timer on Nuvoton NPCM SoCs.
+	  NPCM timer module has 5 down-counting timers, only the first timer
+	  is used to implement timer ops. No support for early timer and
+	  boot timer.
+
 config OMAP_TIMER
 	bool "Omap timer support"
 	depends on TIMER
drivers/timer/Makefile +1 -0
index e2bd530eb0..39bda1ea79 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_CADENCE_TTC_TIMER)	+= cadence-ttc.o
 obj-$(CONFIG_DESIGNWARE_APB_TIMER)	+= dw-apb-timer.o
 obj-$(CONFIG_MPC83XX_TIMER) += mpc83xx_timer.o
 obj-$(CONFIG_NOMADIK_MTU_TIMER)	+= nomadik-mtu-timer.o
+obj-$(CONFIG_NPCM_TIMER)	+= npcm-timer.o
 obj-$(CONFIG_OMAP_TIMER)	+= omap-timer.o
 obj-$(CONFIG_RENESAS_OSTM_TIMER) += ostm_timer.o
 obj-$(CONFIG_RISCV_TIMER) += riscv_timer.o
drivers/timer/npcm-timer.c new file +115 -0

115 lines not on this page · raw message

Signature · 1 line
2.17.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 12 lines · Stanley Chu

Enable a periodic timer on NPCM SoCs and implement the get_count timer ops.

---
v3:
- use driver data for clock setting on different chips
- remove unnecessary code of zeroing priv variables
- more help description in Kconfig
v2:
- calculate the prescale value, not hardcode

Quoted 6 lines
---
 drivers/timer/Kconfig      |   9 +++
 drivers/timer/Makefile     |   1 +
 drivers/timer/npcm-timer.c | 115 +++++++++++++++++++++++++++++++++++++
 3 files changed, 125 insertions(+)
 create mode 100644 drivers/timer/npcm-timer.c